Fix spacing, tag debug with ONVIF

pull/3750/head
Isaac Connor 2023-07-25 13:24:37 -04:00
parent 30c8052e60
commit c54a20ba70
1 changed files with 62 additions and 67 deletions

View File

@ -1049,13 +1049,11 @@ bool Monitor::connect() {
proxyEvent.soap_endpoint = full_url.c_str(); proxyEvent.soap_endpoint = full_url.c_str();
set_credentials(soap); set_credentials(soap);
const char *RequestMessageID = soap_wsa_rand_uuid(soap); const char *RequestMessageID = soap_wsa_rand_uuid(soap);
if (soap_wsa_request(soap, RequestMessageID, proxyEvent.soap_endpoint , "CreatePullPointSubscriptionRequest") == SOAP_OK) if (soap_wsa_request(soap, RequestMessageID, proxyEvent.soap_endpoint , "CreatePullPointSubscriptionRequest") == SOAP_OK) {
{
Debug(1, ":soap_wsa_request OK ");
Debug(1, "ONVIF Endpoint: %s", proxyEvent.soap_endpoint); Debug(1, "ONVIF Endpoint: %s", proxyEvent.soap_endpoint);
if (proxyEvent.CreatePullPointSubscription(&request, response) != SOAP_OK) { if (proxyEvent.CreatePullPointSubscription(&request, response) != SOAP_OK) {
const char *detail = soap_fault_detail(soap); const char *detail = soap_fault_detail(soap);
Error("Couldn't create subscription! %s, %s", soap_fault_string(soap), detail ? detail : "null"); Error("ONVIF Couldn't create subscription! %s, %s", soap_fault_string(soap), detail ? detail : "null");
_wsnt__Unsubscribe wsnt__Unsubscribe; _wsnt__Unsubscribe wsnt__Unsubscribe;
_wsnt__UnsubscribeResponse wsnt__UnsubscribeResponse; _wsnt__UnsubscribeResponse wsnt__UnsubscribeResponse;
proxyEvent.Unsubscribe(response.SubscriptionReference.Address, NULL, &wsnt__Unsubscribe, wsnt__UnsubscribeResponse); proxyEvent.Unsubscribe(response.SubscriptionReference.Address, NULL, &wsnt__Unsubscribe, wsnt__UnsubscribeResponse);
@ -1067,11 +1065,11 @@ bool Monitor::connect() {
//Empty the stored messages //Empty the stored messages
set_credentials(soap); set_credentials(soap);
RequestMessageID = soap_wsa_rand_uuid(soap); RequestMessageID = soap_wsa_rand_uuid(soap);
if (soap_wsa_request(soap, RequestMessageID, response.SubscriptionReference.Address , "PullMessageRequest") == SOAP_OK) if (soap_wsa_request(soap, RequestMessageID, response.SubscriptionReference.Address , "PullMessageRequest") == SOAP_OK) {
{ Debug(1, "ONVIF :soap_wsa_request OK ");
Debug(1, ":soap_wsa_request OK ");
if ((proxyEvent.PullMessages(response.SubscriptionReference.Address, NULL, &tev__PullMessages, tev__PullMessagesResponse) != SOAP_OK) && if ((proxyEvent.PullMessages(response.SubscriptionReference.Address, NULL, &tev__PullMessages, tev__PullMessagesResponse) != SOAP_OK) &&
( soap->error != SOAP_EOF)) { //SOAP_EOF could indicate no messages to pull. (soap->error != SOAP_EOF)
) { //SOAP_EOF could indicate no messages to pull.
Error("Couldn't do initial event pull! Error %i %s, %s", soap->error, soap_fault_string(soap), soap_fault_detail(soap)); Error("Couldn't do initial event pull! Error %i %s, %s", soap->error, soap_fault_string(soap), soap_fault_detail(soap));
Event_Poller_Healthy = FALSE; Event_Poller_Healthy = FALSE;
} else { } else {
@ -1079,48 +1077,45 @@ bool Monitor::connect() {
Event_Poller_Healthy = TRUE; Event_Poller_Healthy = TRUE;
} }
} else { } else {
Error("Couldn't set wsa headers RequestMessageID= %s ; TO= %s ; Request= PullMessageRequest .... ! Error %i %s, %s",RequestMessageID , response.SubscriptionReference.Address , soap->error, soap_fault_string(soap), soap_fault_detail(soap)); Error("ONVIF Couldn't set wsa headers RequestMessageID= %s ; TO= %s ; Request= PullMessageRequest .... ! Error %i %s, %s",RequestMessageID , response.SubscriptionReference.Address , soap->error, soap_fault_string(soap), soap_fault_detail(soap));
Event_Poller_Healthy = FALSE; Event_Poller_Healthy = FALSE;
} }
////////////////////////////////////////////////////
// we renew the current subscription ......... // we renew the current subscription .........
set_credentials(soap); set_credentials(soap);
RequestMessageID = soap_wsa_rand_uuid(soap); RequestMessageID = soap_wsa_rand_uuid(soap);
if (soap_wsa_request(soap, RequestMessageID, response.SubscriptionReference.Address , "RenewRequest") == SOAP_OK) if (soap_wsa_request(soap, RequestMessageID, response.SubscriptionReference.Address, "RenewRequest") == SOAP_OK) {
{ Debug(1, "ONVIF :soap_wsa_request OK");
Debug(1, ":soap_wsa_request OK ");
if (proxyEvent.Renew(response.SubscriptionReference.Address, NULL, &wsnt__Renew, wsnt__RenewResponse) != SOAP_OK) { if (proxyEvent.Renew(response.SubscriptionReference.Address, NULL, &wsnt__Renew, wsnt__RenewResponse) != SOAP_OK) {
Error("Couldn't do initial Renew ! Error %i %s, %s", soap->error, soap_fault_string(soap), soap_fault_detail(soap)); Error("ONVIF Couldn't do initial Renew ! Error %i %s, %s", soap->error, soap_fault_string(soap), soap_fault_detail(soap));
Event_Poller_Healthy = FALSE; Event_Poller_Healthy = FALSE;
} else { } else {
Debug(1, "Good Initial ONVIF Renew %i %s, %s", soap->error, soap_fault_string(soap), soap_fault_detail(soap)); Debug(1, "Good Initial ONVIF Renew %i %s, %s", soap->error, soap_fault_string(soap), soap_fault_detail(soap));
Event_Poller_Healthy = TRUE; Event_Poller_Healthy = TRUE;
} }
} else { } else {
Error("Couldn't set wsa headers RequestMessageID= %s ; TO= %s ; Request= RenewRequest .... ! Error %i %s, %s",RequestMessageID , response.SubscriptionReference.Address , soap->error, soap_fault_string(soap), soap_fault_detail(soap)); Error("ONVIF Couldn't set wsa headers RequestMessageID= %s ; TO= %s ; Request= RenewRequest .... ! Error %i %s, %s",
RequestMessageID,
response.SubscriptionReference.Address,
soap->error,
soap_fault_string(soap),
soap_fault_detail(soap));
Event_Poller_Healthy = FALSE; Event_Poller_Healthy = FALSE;
} }
//////////////////////////////////////////////////////
}
} else {
Error("Couldn't set wsa headers RequestMessageID= %s ; TO= %s ; Request= CreatePullPointSubscriptionRequest .... ! Error %i %s, %s",RequestMessageID , proxyEvent.soap_endpoint , soap->error, soap_fault_string(soap), soap_fault_detail(soap));
} }
} else { } else {
Warning("You must specify the url to the onvif endpoint"); Error("ONVIF Couldn't set wsa headers RequestMessageID= %s ; TO= %s ; Request= CreatePullPointSubscriptionRequest .... ! Error %i %s, %s",RequestMessageID , proxyEvent.soap_endpoint , soap->error, soap_fault_string(soap), soap_fault_detail(soap));
}
} else {
Warning("You must specify the url to the ONVIF endpoint");
} }
#else #else
Error("zmc not compiled with GSOAP. ONVIF support not built in!"); Error("zmc not compiled with GSOAP. ONVIF support not built in!");
#endif #endif
} // end if Armcrest of GSOAP } // end if Armcrest or GSOAP
} else { } else {
Debug(1, "Not Starting ONVIF"); Debug(1, "Not Starting ONVIF");
} } //End ONVIF Setup
//End ONVIF Setup
#if MOSQUITTOPP_FOUND #if MOSQUITTOPP_FOUND
if (mqtt_enabled) { if (mqtt_enabled) {