Search code examples
c++soapgsoaponvif

OnvifClientPTZ onvif c++ unable to get configuration options


tt__Profile *t = profiles.Profiles.at(0);

OnvifClientPTZ PTZ(onvifDevice);

_tptz__GetConfigurationOptions tptz__GetConfigurationOptions;
_tptz__GetConfigurationOptionsResponse  tptz__GetConfigurationOptionsResponse;
tt__PTZConfigurationOptions *options; 

int response = PTZ.GetConfigurationOptions(tptz__GetConfigurationOptionsResponse, t->token);

Problem is that PTZ#GetConfigurationOptions returns value of 1 (#response). Object #onvifDevice seems to be fine (onvifDevice.hasPTZ returns true). I've tried debugging and onvifDevice.GetPTZUrl(strUrl) returns true and sets strUrl to 192.168.1.88:2000/device/services which is soap_endpoint of PtzProxy object (ptzProxy.soap_endpoint = strUrl.c_str();) and it seems to be fine. Also soap_action is "www.onvif.org/ver20/ptz/wsdl/GetConfigurationOptions" which also seems to be fine. I'm using https://github.com/xsmart/onvifcpplib.

In PTZ proxy returns here:

tptz__GetConfigurationOptionsResponse->soap_get(soap, "tptz:GetConfigurationOptionsResponse", "");
if (soap->error)
    return soap_recv_fault(soap, 0);

Any help would be appreciated.


Solution

  • I've found the solution. Problem was in this line:

    int response = PTZ.GetConfigurationOptions(tptz__GetConfigurationOptionsResponse, t->token);
    

    OnvifPTZClient#GetConfigurationOptions requests PTZConfiguration token, not profile token. So correct line would be:

    response = PTZ.GetConfigurationOptions(tptz__GetConfigurationOptionsResponse, tr->PTZConfiguration->token);