From 45d985aab21955892ca85fb27cc33512dcf3474e Mon Sep 17 00:00:00 2001 From: "jihwan.seo" Date: Thu, 21 Jan 2016 09:17:08 +0900 Subject: [PATCH] replaced OC_LOG with OIC_LOG in service layer Change-Id: I892b23e6087368addb63a418fac7f95794aae04d Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/4835 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka Reviewed-by: Uze Choi --- .../sampleapp/enrollee/arduino/enrollee_wifi.cpp | 26 ++--- .../sdk/enrollee/arduino/wifi/networkHandler.cpp | 24 ++--- service/easy-setup/sdk/enrollee/src/easysetup.cpp | 34 +++---- .../sdk/enrollee/src/resourceHandler.cpp | 36 +++---- service/resource-container/src/BundleResource.cpp | 6 +- service/resource-container/src/Configuration.cpp | 20 ++-- .../resource-container/src/JavaBundleResource.cpp | 8 +- .../src/ResourceContainerImpl.cpp | 110 ++++++++++----------- .../resource-directory/src/internal/rd_storage.c | 22 ++--- service/resource-directory/src/rd_client.c | 48 ++++----- service/resource-directory/src/rd_server.c | 28 +++--- .../src/common/utils/include/ScopeLogger.h | 6 +- .../src/resourceBroker/src/DeviceAssociation.cpp | 14 +-- .../src/resourceBroker/src/DevicePresence.cpp | 38 +++---- .../src/resourceBroker/src/ResourceBroker.cpp | 42 ++++---- .../src/resourceBroker/src/ResourcePresence.cpp | 52 +++++----- .../src/resourceClient/RCSRemoteResourceObject.cpp | 10 +- .../src/serverBuilder/src/RCSResourceObject.cpp | 14 +-- .../simulator/src/client/auto_request_gen_mngr.cpp | 4 +- .../simulator/src/client/get_request_generator.cpp | 12 +-- .../src/client/post_request_generator.cpp | 16 +-- .../simulator/src/client/put_request_generator.cpp | 16 +-- service/simulator/src/client/request_sender.cpp | 2 +- .../src/client/simulator_remote_resource_impl.cpp | 18 ++-- .../simulator/src/common/request_model_builder.cpp | 4 +- .../src/common/simulator_resource_model.cpp | 2 +- .../src/server/resource_update_automation.cpp | 6 +- .../src/server/resource_update_automation_mngr.cpp | 10 +- .../src/server/simulator_resource_factory.cpp | 12 +-- 29 files changed, 320 insertions(+), 320 deletions(-) diff --git a/service/easy-setup/sampleapp/enrollee/arduino/enrollee_wifi.cpp b/service/easy-setup/sampleapp/enrollee/arduino/enrollee_wifi.cpp index dd3c58c..fc5aa3e 100644 --- a/service/easy-setup/sampleapp/enrollee/arduino/enrollee_wifi.cpp +++ b/service/easy-setup/sampleapp/enrollee/arduino/enrollee_wifi.cpp @@ -136,13 +136,13 @@ void EventCallbackInApp(ESResult esResult, EnrolleeState enrolleeState) { if(g_OnBoardingSucceeded) { - OC_LOG_V(ERROR, TAG, "Failure in Provisioning. \ + OIC_LOG_V(ERROR, TAG, "Failure in Provisioning. \ Current Enrollee State: %d",enrolleeState); g_OnBoardingSucceeded = false; } else if(g_ProvisioningSucceeded) { - OC_LOG_V(ERROR, TAG, "Failure in connect to target network. \ + OIC_LOG_V(ERROR, TAG, "Failure in connect to target network. \ Current Enrollee State: %d",enrolleeState); g_ProvisioningSucceeded = false; } @@ -163,47 +163,47 @@ void PrintArduinoMemoryStats() extern char *__brkval; //address of tmp gives us the current stack boundry int tmp; - OC_LOG_V(INFO, TAG, "Stack: %u Heap: %u", (unsigned int)&tmp, (unsigned int)__brkval); - OC_LOG_V(INFO, TAG, "Unallocated Memory between heap and stack: %u", + OIC_LOG_V(INFO, TAG, "Stack: %u Heap: %u", (unsigned int)&tmp, (unsigned int)__brkval); + OIC_LOG_V(INFO, TAG, "Unallocated Memory between heap and stack: %u", ((unsigned int)&tmp - (unsigned int)__brkval)); #endif } void StartEasySetup() { - OC_LOG(DEBUG, TAG, "OCServer is starting..."); + OIC_LOG(DEBUG, TAG, "OCServer is starting..."); if(InitEasySetup(CT_ADAPTER_IP, ssid, passwd, EventCallbackInApp) == ES_ERROR) { - OC_LOG(ERROR, TAG, "OnBoarding Failed"); + OIC_LOG(ERROR, TAG, "OnBoarding Failed"); return; } g_isInitialized = true; - OC_LOG_V(ERROR, TAG, "OnBoarding succeeded. Successfully connected to ssid : %s",ssid); + OIC_LOG_V(ERROR, TAG, "OnBoarding succeeded. Successfully connected to ssid : %s",ssid); } void StartProvisioning() { - OC_LOG(DEBUG, TAG, "StartProvisioning is invoked..."); + OIC_LOG(DEBUG, TAG, "StartProvisioning is invoked..."); if(InitProvisioning()== ES_ERROR) { - OC_LOG(ERROR, TAG, "Init Provisioning Failed"); + OIC_LOG(ERROR, TAG, "Init Provisioning Failed"); return; } } void StopEasySetup() { - OC_LOG(DEBUG, TAG, "Stopping EasySetup is invoked..."); + OIC_LOG(DEBUG, TAG, "Stopping EasySetup is invoked..."); g_isInitialized = false; if(TerminateEasySetup()== ES_ERROR) { - OC_LOG(ERROR, TAG, "TerminateEasySetup Failed"); + OIC_LOG(ERROR, TAG, "TerminateEasySetup Failed"); return; } } @@ -214,7 +214,7 @@ void setup() { // Add your initialization code here // Note : This will initialize Serial port on Arduino at 115200 bauds - OC_LOG_INIT(); + OIC_LOG_INIT(); Serial.println("#########################"); Serial.println("EasySetup Enrollee SAMPLE"); @@ -276,7 +276,7 @@ void loop() // Give CPU cycles to OCStack to perform send/recv and other OCStack stuff if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); return; } } diff --git a/service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.cpp b/service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.cpp index d4b3327..d591e5b 100644 --- a/service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.cpp +++ b/service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.cpp @@ -77,24 +77,24 @@ ESResult ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCa // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { - OC_LOG(ERROR, ES_NH_TAG, "WiFi shield not present"); + OIC_LOG(ERROR, ES_NH_TAG, "WiFi shield not present"); return ES_ERROR; } // Verify that WiFi Shield is running the firmware with all UDP fixes fwVersion = WiFi.firmwareVersion(); - OC_LOG_V(INFO, ES_NH_TAG, "WiFi Shield Firmware version %s", fwVersion); + OIC_LOG_V(INFO, ES_NH_TAG, "WiFi Shield Firmware version %s", fwVersion); if (strncmp(fwVersion, ARDUINO_WIFI_SHIELD_UDP_FW_VER, sizeof(ARDUINO_WIFI_SHIELD_UDP_FW_VER)) != 0) { - OC_LOG(DEBUG, ES_NH_TAG, "!!!!! Upgrade WiFi Shield Firmware version !!!!!!"); + OIC_LOG(DEBUG, ES_NH_TAG, "!!!!! Upgrade WiFi Shield Firmware version !!!!!!"); return ES_ERROR; } //Retry counter is reset everytime the ConnectToWiFiNetwork is invoked g_retryCounter = 0; - OC_LOG_V(INFO, ES_NH_TAG, "Finding SSID: %s", ssid); + OIC_LOG_V(INFO, ES_NH_TAG, "Finding SSID: %s", ssid); while ((findNetwork(ssid) == 0) && g_retryCounter < ES_MAX_NETWORK_RETRY) // found { @@ -103,8 +103,8 @@ ESResult ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCa } if(g_retryCounter == ES_MAX_NETWORK_RETRY){ - OC_LOG_V(ERROR, ES_NH_TAG, "Connection to network failed after %d attempts", - g_retryCounter); + OIC_LOG_V(ERROR, ES_NH_TAG, "Connection to network failed after %d attempts", + g_retryCounter); return ES_ERROR; } @@ -173,7 +173,7 @@ int ConnectToNetwork(const char *ssid, const char *pass) // attempt to connect to Wifi network: while (status != WL_CONNECTED && g_retryCounter < ES_MAX_NETWORK_RETRY) { - OC_LOG_V(INFO, ES_NH_TAG, "Attempting to connect to SSID: %s", ssid); + OIC_LOG_V(INFO, ES_NH_TAG, "Attempting to connect to SSID: %s", ssid); status = WiFi.begin((char *) ssid, (char *) pass); @@ -184,16 +184,16 @@ int ConnectToNetwork(const char *ssid, const char *pass) } if(g_retryCounter == ES_MAX_NETWORK_RETRY){ - OC_LOG_V(ERROR, ES_NH_TAG, "Connection to network failed after %d attempts", - g_retryCounter); + OIC_LOG_V(ERROR, ES_NH_TAG, "Connection to network failed after %d attempts", + g_retryCounter); return ES_ERROR; } - OC_LOG(DEBUG, ES_NH_TAG, "Connected to wifi"); + OIC_LOG(DEBUG, ES_NH_TAG, "Connected to wifi"); enrolleeIP = WiFi.localIP(); - OC_LOG_V(INFO, ES_NH_TAG, "IP Address: %d.%d.%d.%d", enrolleeIP[0], enrolleeIP[1], - enrolleeIP[2], enrolleeIP[3]); + OIC_LOG_V(INFO, ES_NH_TAG, "IP Address: %d.%d.%d.%d", enrolleeIP[0], enrolleeIP[1], + enrolleeIP[2], enrolleeIP[3]); char buf[50]; sprintf(buf, "IP Address: %d.%d.%d.%d", enrolleeIP[0], enrolleeIP[1], diff --git a/service/easy-setup/sdk/enrollee/src/easysetup.cpp b/service/easy-setup/sdk/enrollee/src/easysetup.cpp index 9855710..36a75a3 100644 --- a/service/easy-setup/sdk/enrollee/src/easysetup.cpp +++ b/service/easy-setup/sdk/enrollee/src/easysetup.cpp @@ -68,20 +68,20 @@ void EventCallbackAfterProvisioning(ESResult esResult); void EventCallbackInOnboarding(ESResult esResult) { if (g_cbForEnrolleeStatus != NULL){ - OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with esResult = %d", esResult); + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with esResult = %d", esResult); if(esResult == ES_OK){ - OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", ES_ON_BOARDED_STATE); g_cbForEnrolleeStatus(esResult, ES_ON_BOARDED_STATE); } else{ - OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", ES_INIT_STATE); g_cbForEnrolleeStatus(esResult, ES_INIT_STATE); } } else{ - OC_LOG(ERROR, ES_ENROLLEE_TAG, "g_cbForEnrolleeStatus is NULL"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "g_cbForEnrolleeStatus is NULL"); } } @@ -96,7 +96,7 @@ void EventCallbackInProvisioning(ESResult esResult) if(TerminateEasySetup() != OC_STACK_OK) { - OC_LOG(ERROR, ES_ENROLLEE_TAG, "Terminating stack failed"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Terminating stack failed"); return; } @@ -107,12 +107,12 @@ void EventCallbackInProvisioning(ESResult esResult) if (g_cbForEnrolleeStatus != NULL) { if(res == ES_NETWORKCONNECTED){ - OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", ES_PROVISIONED_STATE); g_cbForEnrolleeStatus(ES_OK, ES_PROVISIONED_STATE); } else{ - OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", ES_PROVISIONING_STATE); g_cbForEnrolleeStatus(ES_OK, ES_PROVISIONING_STATE); } @@ -125,18 +125,18 @@ void EventCallbackAfterProvisioning(ESResult esResult) { if (g_cbForEnrolleeStatus != NULL){ if(esResult == ES_OK){ - OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", ES_PROVISIONED_STATE); g_cbForEnrolleeStatus(esResult, ES_PROVISIONED_STATE); } else{ - OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "Calling the application with enrolleestate = %d", ES_PROVISIONING_STATE); g_cbForEnrolleeStatus(esResult, ES_PROVISIONING_STATE); } } else{ - OC_LOG(ERROR, ES_ENROLLEE_TAG, "g_cbForEnrolleeStatus is NULL"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "g_cbForEnrolleeStatus is NULL"); } } @@ -159,12 +159,12 @@ ESResult FindNetworkForOnboarding(OCConnectivityType networkType, if(ConnectToWiFiNetwork(ssid, passwd, EventCallbackInOnboarding) != ES_NETWORKCONNECTED) { - OC_LOG(ERROR, ES_ENROLLEE_TAG, "ConnectToWiFiNetwork Failed"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "ConnectToWiFiNetwork Failed"); cb(ES_ERROR, ES_ON_BOARDING_STATE); return ES_ERROR; } else{ - OC_LOG(INFO, ES_ENROLLEE_TAG, "ConnectToWiFiNetwork Success"); + OIC_LOG(INFO, ES_ENROLLEE_TAG, "ConnectToWiFiNetwork Success"); cb(ES_OK, ES_ON_BOARDED_STATE); return ES_OK; } @@ -178,19 +178,19 @@ ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid, const c { if(FindNetworkForOnboarding(networkType, ssid, passwd, cb) != ES_OK) { - OC_LOG(ERROR, ES_ENROLLEE_TAG, "OnBoarding Failed"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "OnBoarding Failed"); return ES_ERROR; } // Initialize the OC Stack in Server mode if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack init error"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack init error"); return ES_ERROR; } else { - OC_LOG(DEBUG, ES_ENROLLEE_TAG, "OCStack init success"); + OIC_LOG(DEBUG, ES_ENROLLEE_TAG, "OCStack init success"); return ES_OK; } } @@ -199,12 +199,12 @@ ESResult TerminateEasySetup() { if(OCStop() != OC_STACK_OK) { - OC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack stop failed"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack stop failed"); return ES_ERROR; } else { - OC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack stop success"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack stop success"); return ES_OK; } } diff --git a/service/easy-setup/sdk/enrollee/src/resourceHandler.cpp b/service/easy-setup/sdk/enrollee/src/resourceHandler.cpp index 6c0fec2..e556cfd 100644 --- a/service/easy-setup/sdk/enrollee/src/resourceHandler.cpp +++ b/service/easy-setup/sdk/enrollee/src/resourceHandler.cpp @@ -86,7 +86,7 @@ OCStackResult CreateProvisioningResource() OCStackResult res = OCCreateResource(&g_prov.handle, "oic.r.prov", OC_RSRVD_INTERFACE_DEFAULT, OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb, NULL, OC_DISCOVERABLE | OC_OBSERVABLE); - OC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res)); return res; } @@ -111,12 +111,12 @@ OCStackResult CreateNetworkResource() netInfo.ipaddr[3]); sprintf(g_net.cnn, "%s", netInfo.ssid); - OC_LOG_V(INFO, ES_RH_TAG, "SSID: %s", g_net.cnn); - OC_LOG_V(INFO, ES_RH_TAG, "IP Address: %s", g_net.ipaddr); + OIC_LOG_V(INFO, ES_RH_TAG, "SSID: %s", g_net.cnn); + OIC_LOG_V(INFO, ES_RH_TAG, "IP Address: %s", g_net.ipaddr); OCStackResult res = OCCreateResource(&g_net.handle, "oic.r.net", OC_RSRVD_INTERFACE_DEFAULT, OC_RSRVD_ES_URI_NET, OCEntityHandlerCb,NULL, OC_DISCOVERABLE | OC_OBSERVABLE); - OC_LOG_V(INFO, ES_RH_TAG, "Created Net resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, ES_RH_TAG, "Created Net resource with result: %s", getResult(res)); return res; } @@ -127,19 +127,19 @@ OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCEntityHandlerResult ehResult = OC_EH_ERROR; if (!ehRequest) { - OC_LOG(ERROR, ES_RH_TAG, "Request is Null"); + OIC_LOG(ERROR, ES_RH_TAG, "Request is Null"); return ehResult; } if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation"); + OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation"); return ehResult; } OCRepPayload *getResp = constructResponse(ehRequest); if (!getResp) { - OC_LOG(ERROR, ES_RH_TAG, "constructResponse failed"); + OIC_LOG(ERROR, ES_RH_TAG, "constructResponse failed"); return OC_EH_ERROR; } @@ -156,14 +156,14 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest, OCEntityHandlerResult ehResult = OC_EH_ERROR; if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation"); + OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation"); return ehResult; } OCRepPayload* input = (OCRepPayload*) (ehRequest->payload); if (!input) { - OC_LOG(ERROR, ES_RH_TAG, "Failed to parse"); + OIC_LOG(ERROR, ES_RH_TAG, "Failed to parse"); return ehResult; } @@ -184,7 +184,7 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload *getResp = constructResponse(ehRequest); if (!getResp) { - OC_LOG(ERROR, ES_RH_TAG, "constructResponse failed"); + OIC_LOG(ERROR, ES_RH_TAG, "constructResponse failed"); return OC_EH_ERROR; } @@ -200,19 +200,19 @@ OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCEntityHandlerResult ehResult = OC_EH_ERROR; if (!ehRequest) { - OC_LOG(ERROR, ES_RH_TAG, "Request is Null"); + OIC_LOG(ERROR, ES_RH_TAG, "Request is Null"); return ehResult; } if (ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation"); + OIC_LOG(ERROR, ES_RH_TAG, "Incoming payload not a representation"); return ehResult; } OCRepPayload* input = (OCRepPayload*) (ehRequest->payload); if (!input) { - OC_LOG(ERROR, ES_RH_TAG, "Failed to parse"); + OIC_LOG(ERROR, ES_RH_TAG, "Failed to parse"); return ehResult; } char* tr; @@ -233,7 +233,7 @@ OCRepPayload* constructResponse(OCEntityHandlerRequest *ehRequest) OCRepPayload* payload = OCRepPayloadCreate(); if (!payload) { - OC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload"); + OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload"); return NULL; } @@ -268,12 +268,12 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, { if (OC_REST_GET == entityHandlerRequest->method) { - OC_LOG(INFO, ES_RH_TAG, "Received GET request"); + OIC_LOG(INFO, ES_RH_TAG, "Received GET request"); ehRet = ProcessGetRequest(entityHandlerRequest, &payload); } else if (OC_REST_PUT == entityHandlerRequest->method) { - OC_LOG(INFO, ES_RH_TAG, "Received PUT request"); + OIC_LOG(INFO, ES_RH_TAG, "Received PUT request"); if (g_prov.handle != NULL && entityHandlerRequest->resource == g_prov.handle) { @@ -287,7 +287,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, else if (OC_REST_POST == entityHandlerRequest->method) { // TODO: As of now, POST request will be not received. - OC_LOG(INFO, ES_RH_TAG, "Received OC_REST_POST from client"); + OIC_LOG(INFO, ES_RH_TAG, "Received OC_REST_POST from client"); //ehRet = ProcessPostRequest (entityHandlerRequest, payload, sizeof(payload) - 1); } @@ -309,7 +309,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, // Send the response if (OCDoResponse(&response) != OC_STACK_OK) { - OC_LOG(ERROR, ES_RH_TAG, "Error sending response"); + OIC_LOG(ERROR, ES_RH_TAG, "Error sending response"); ehRet = OC_EH_ERROR; } } diff --git a/service/resource-container/src/BundleResource.cpp b/service/resource-container/src/BundleResource.cpp index cb8d437..4bd10a7 100644 --- a/service/resource-container/src/BundleResource.cpp +++ b/service/resource-container/src/BundleResource.cpp @@ -64,7 +64,7 @@ namespace OIC { for (RCSResourceAttributes::iterator it = attrs.begin(); it != attrs.end(); ++it) { - OC_LOG_V(INFO, CONTAINER_TAG, "set attribute \(%s)'", + OIC_LOG_V(INFO, CONTAINER_TAG, "set attribute \(%s)'", std::string(it->key() + "\', with " + it->value().toString()).c_str()); m_resourceAttributes[it->key()] = it->value(); @@ -74,7 +74,7 @@ namespace OIC void BundleResource::setAttribute(const std::string &key, RCSResourceAttributes::Value &&value, bool notify) { - OC_LOG_V(INFO, CONTAINER_TAG, "set attribute \(%s)'", std::string(key + "\', with " + + OIC_LOG_V(INFO, CONTAINER_TAG, "set attribute \(%s)'", std::string(key + "\', with " + value.toString()).c_str()); m_resourceAttributes[key] = value; @@ -89,7 +89,7 @@ namespace OIC RCSResourceAttributes::Value BundleResource::getAttribute(const std::string &key) { - OC_LOG_V(INFO, CONTAINER_TAG, "get attribute \'(%s)" , std::string(key + "\'").c_str()); + OIC_LOG_V(INFO, CONTAINER_TAG, "get attribute \'(%s)" , std::string(key + "\'").c_str()); return m_resourceAttributes.at(key); } diff --git a/service/resource-container/src/Configuration.cpp b/service/resource-container/src/Configuration.cpp index e545c25..df0db00 100644 --- a/service/resource-container/src/Configuration.cpp +++ b/service/resource-container/src/Configuration.cpp @@ -113,8 +113,8 @@ namespace OIC } catch (rapidxml::parse_error &e) { - OC_LOG(ERROR, CONTAINER_TAG, "xml parsing failed !!"); - OC_LOG_V(ERROR, CONTAINER_TAG, "Exception : (%s)", e.what()); + OIC_LOG(ERROR, CONTAINER_TAG, "xml parsing failed !!"); + OIC_LOG_V(ERROR, CONTAINER_TAG, "Exception : (%s)", e.what()); } } } @@ -159,8 +159,8 @@ namespace OIC } catch (rapidxml::parse_error &e) { - OC_LOG(ERROR, CONTAINER_TAG, "xml parsing failed !!"); - OC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what()); + OIC_LOG(ERROR, CONTAINER_TAG, "xml parsing failed !!"); + OIC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what()); } } } @@ -248,8 +248,8 @@ namespace OIC } catch (rapidxml::parse_error &e) { - OC_LOG(ERROR, CONTAINER_TAG, "xml parsing failed !!"); - OC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what()); + OIC_LOG(ERROR, CONTAINER_TAG, "xml parsing failed !!"); + OIC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what()); } } } @@ -278,14 +278,14 @@ namespace OIC } catch (rapidxml::parse_error &e) { - OC_LOG(ERROR, CONTAINER_TAG, "xml parsing failed !!"); - OC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what()); + OIC_LOG(ERROR, CONTAINER_TAG, "xml parsing failed !!"); + OIC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what()); } } else { - OC_LOG(ERROR, CONTAINER_TAG, "Configuration File load failed !!"); + OIC_LOG(ERROR, CONTAINER_TAG, "Configuration File load failed !!"); } } } -} \ No newline at end of file +} diff --git a/service/resource-container/src/JavaBundleResource.cpp b/service/resource-container/src/JavaBundleResource.cpp index 67e71b1..bf9b59b 100644 --- a/service/resource-container/src/JavaBundleResource.cpp +++ b/service/resource-container/src/JavaBundleResource.cpp @@ -86,13 +86,13 @@ RCSResourceAttributes::Value JavaBundleResource::handleGetAttributeRequest( { if (vm->AttachCurrentThread((void **) &env, NULL) != 0) { - OC_LOG_V(ERROR, CONTAINER_TAG, + OIC_LOG_V(ERROR, CONTAINER_TAG, "[JavaBundleResource::handleGetAttributeRequest] Failed to attach "); } } else if (envStat == JNI_EVERSION) { - OC_LOG_V(ERROR, CONTAINER_TAG, + OIC_LOG_V(ERROR, CONTAINER_TAG, "[JavaBundleResource::handleGetAttributeRequest] Env: version not supported"); } @@ -121,13 +121,13 @@ void JavaBundleResource::handleSetAttributeRequest(const std::string &attributeN { if (vm->AttachCurrentThread((void **) &env, NULL) != 0) { - OC_LOG_V(ERROR, CONTAINER_TAG, + OIC_LOG_V(ERROR, CONTAINER_TAG, "[JavaBundleResource::handleSetAttributeRequest] Failed to attach "); } } else if (envStat == JNI_EVERSION) { - OC_LOG_V(ERROR, CONTAINER_TAG, + OIC_LOG_V(ERROR, CONTAINER_TAG, "[JavaBundleResource::handleSetAttributeRequest] Env: version not supported "); } diff --git a/service/resource-container/src/ResourceContainerImpl.cpp b/service/resource-container/src/ResourceContainerImpl.cpp index 542fb7a..e2abbb4 100644 --- a/service/resource-container/src/ResourceContainerImpl.cpp +++ b/service/resource-container/src/ResourceContainerImpl.cpp @@ -59,11 +59,11 @@ namespace OIC void ResourceContainerImpl::startContainer(const std::string &configFile) { - OC_LOG(INFO, CONTAINER_TAG, "Starting resource container."); + OIC_LOG(INFO, CONTAINER_TAG, "Starting resource container."); #if (JAVA_SUPPORT) - OC_LOG(INFO, CONTAINER_TAG, "Resource container has Java support."); + OIC_LOG(INFO, CONTAINER_TAG, "Resource container has Java support."); #else - OC_LOG(INFO, CONTAINER_TAG, "Resource container without Java support."); + OIC_LOG(INFO, CONTAINER_TAG, "Resource container without Java support."); #endif @@ -92,7 +92,7 @@ namespace OIC bundles[i][BUNDLE_LIBRARY_PATH]); } - OC_LOG_V(INFO, CONTAINER_TAG, "Init Bundle:(%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Init Bundle:(%s)", std::string(bundles[i][BUNDLE_ID] + ";" + bundles[i][BUNDLE_PATH]).c_str()); @@ -102,12 +102,12 @@ namespace OIC } else { - OC_LOG_V(ERROR, CONTAINER_TAG, "Container started with invalid configfile path."); + OIC_LOG_V(ERROR, CONTAINER_TAG, "Container started with invalid configfile path."); } } else { - OC_LOG_V(INFO, CONTAINER_TAG, "No configuration file for the container provided."); + OIC_LOG_V(INFO, CONTAINER_TAG, "No configuration file for the container provided."); } map::iterator activatorIterator; @@ -124,7 +124,7 @@ namespace OIC void ResourceContainerImpl::stopContainer() { - OC_LOG(INFO, CONTAINER_TAG, "Stopping resource container."); + OIC_LOG(INFO, CONTAINER_TAG, "Stopping resource container."); for (std::map< std::string, BundleInfoInternal * >::iterator it = m_bundles.begin(); it != m_bundles.end(); ++it) @@ -173,7 +173,7 @@ namespace OIC void ResourceContainerImpl::activateBundle(const std::string &id) { - OC_LOG_V(INFO, CONTAINER_TAG, "Activating bundle: (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Activating bundle: (%s)", std::string(m_bundles[id]->getID()).c_str()); activationLock.lock(); auto f = std::bind(&ResourceContainerImpl::activateBundleThread, this, @@ -181,7 +181,7 @@ namespace OIC boost::thread activator(f); activator.timed_join(boost::posix_time::seconds(BUNDLE_SET_GET_WAIT_SEC)); activationLock.unlock(); - OC_LOG_V(INFO, CONTAINER_TAG, "Bundle activated: (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Bundle activated: (%s)", std::string(m_bundles[id]->getID()).c_str()); } @@ -202,7 +202,7 @@ namespace OIC // loads the bundle void ResourceContainerImpl::registerBundle(RCSBundleInfo *bundleInfo) { - OC_LOG_V(INFO, CONTAINER_TAG, "Registering bundle: (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Registering bundle: (%s)", std::string(bundleInfo->getPath()).c_str()); if (has_suffix(bundleInfo->getPath(), ".jar")) @@ -241,7 +241,7 @@ namespace OIC { void *bundleHandle = m_bundles[id]->getBundleHandle(); - OC_LOG_V(INFO, CONTAINER_TAG, "Unregister bundle: (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Unregister bundle: (%s)", std::string(m_bundles[id]->getID()).c_str()); const char *error; @@ -249,7 +249,7 @@ namespace OIC if ((error = dlerror()) != NULL) { - OC_LOG_V(ERROR, CONTAINER_TAG, "Error (%s)", error); + OIC_LOG_V(ERROR, CONTAINER_TAG, "Error (%s)", error); } else { @@ -266,7 +266,7 @@ namespace OIC RCSResourceObject::Ptr server = nullptr; int ret = EINVAL; - OC_LOG_V(INFO, CONTAINER_TAG, "Registration of resource (%s)" , + OIC_LOG_V(INFO, CONTAINER_TAG, "Registration of resource (%s)" , std::string(strUri + ", " + strResourceType).c_str()); registrationLock.lock(); @@ -292,7 +292,7 @@ namespace OIC std::bind(&ResourceContainerImpl::setRequestHandler, this, std::placeholders::_1, std::placeholders::_2)); - OC_LOG_V(INFO, CONTAINER_TAG, "Registration finished (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Registration finished (%s)", std::string(strUri + ", " + strResourceType).c_str()); @@ -308,7 +308,7 @@ namespace OIC } else { - OC_LOG_V(ERROR, CONTAINER_TAG, "resource with (%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "resource with (%s)", std::string(strUri + " already exists.").c_str()); ret = -EEXIST; } @@ -322,7 +322,7 @@ namespace OIC string strUri = resource->m_uri; string strResourceType = resource->m_resourceType; - OC_LOG_V(INFO, CONTAINER_TAG, "Unregistration of resource (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Unregistration of resource (%s)", std::string(resource->m_uri + ", " + resource->m_resourceType).c_str()); @@ -420,7 +420,7 @@ namespace OIC void ResourceContainerImpl::onNotificationReceived(const std::string &strResourceUri) { - OC_LOG_V(INFO, CONTAINER_TAG, + OIC_LOG_V(INFO, CONTAINER_TAG, "notification from (%s)", std::string(strResourceUri + ".").c_str()); if (m_mapServers.find(strResourceUri) != m_mapServers.end()) @@ -451,12 +451,12 @@ namespace OIC activateBundle(m_bundles[bundleId]); else { - OC_LOG(ERROR, CONTAINER_TAG, "Bundle already started"); + OIC_LOG(ERROR, CONTAINER_TAG, "Bundle already started"); } } else { - OC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", std::string(bundleId + "\' is not registered.").c_str()); } } @@ -469,12 +469,12 @@ namespace OIC deactivateBundle(m_bundles[bundleId]); else { - OC_LOG(ERROR, CONTAINER_TAG, "Bundle not activated"); + OIC_LOG(ERROR, CONTAINER_TAG, "Bundle not activated"); } } else { - OC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", std::string(bundleId + "\' is not registered.").c_str()); } } @@ -486,7 +486,7 @@ namespace OIC (void) bundleUri; if (m_bundles.find(bundleId) != m_bundles.end()) - OC_LOG(ERROR, CONTAINER_TAG, "BundleId already exist"); + OIC_LOG(ERROR, CONTAINER_TAG, "BundleId already exist"); else { @@ -502,7 +502,7 @@ namespace OIC ((BundleInfoInternal *)bundleInfo)->setLibraryPath(params[BUNDLE_LIBRARY_PATH]); } - OC_LOG_V(INFO, CONTAINER_TAG, "Add Bundle: (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Add Bundle: (%s)", std::string(bundleInfo->getID() + "; " + bundleInfo->getPath()).c_str()); @@ -523,7 +523,7 @@ namespace OIC } else { - OC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", std::string(bundleId + "\' is not registered.").c_str()); } } @@ -565,7 +565,7 @@ namespace OIC } else { - OC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", std::string(bundleId + "\' is not registered.").c_str()); } } @@ -582,7 +582,7 @@ namespace OIC } else { - OC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Bundle with ID \'(%s)", std::string(bundleId + "\' is not registered.").c_str()); } } @@ -634,7 +634,7 @@ namespace OIC if ((error = dlerror()) != NULL) { - OC_LOG_V(ERROR, CONTAINER_TAG, "Error : (%s)", error); + OIC_LOG_V(ERROR, CONTAINER_TAG, "Error : (%s)", error); } else { @@ -652,7 +652,7 @@ namespace OIC { if ((error = dlerror()) != NULL) { - OC_LOG_V(ERROR, CONTAINER_TAG, "Error : (%s)", error); + OIC_LOG_V(ERROR, CONTAINER_TAG, "Error : (%s)", error); } } } @@ -669,7 +669,7 @@ namespace OIC else { //Unload module and return error - OC_LOG(ERROR, CONTAINER_TAG, "Activation unsuccessful."); + OIC_LOG(ERROR, CONTAINER_TAG, "Activation unsuccessful."); } BundleInfoInternal *bundleInfoInternal = (BundleInfoInternal *) m_bundles[bundleId]; @@ -754,7 +754,7 @@ namespace OIC { deactivator_t *bundleDeactivator = m_bundles[id]->getBundleDeactivator(); - OC_LOG_V(INFO, CONTAINER_TAG, "De-activating bundle: (%s)", std::string( + OIC_LOG_V(INFO, CONTAINER_TAG, "De-activating bundle: (%s)", std::string( m_bundles[id]->getID()).c_str()); if (bundleDeactivator != NULL) @@ -765,7 +765,7 @@ namespace OIC else { //Unload module and return error - OC_LOG(ERROR, CONTAINER_TAG, "De-activation unsuccessful."); + OIC_LOG(ERROR, CONTAINER_TAG, "De-activation unsuccessful."); } } @@ -782,7 +782,7 @@ namespace OIC } else { - OC_LOG(ERROR, CONTAINER_TAG, "addResource unsuccessful."); + OIC_LOG(ERROR, CONTAINER_TAG, "addResource unsuccessful."); } } @@ -800,14 +800,14 @@ namespace OIC } else { - OC_LOG(ERROR, CONTAINER_TAG, "removeResource unsuccessful."); + OIC_LOG(ERROR, CONTAINER_TAG, "removeResource unsuccessful."); } } } void ResourceContainerImpl::activateBundleThread(const std::string &id) { - OC_LOG_V(INFO, CONTAINER_TAG, "Activating bundle: (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Activating bundle: (%s)", std::string(m_bundles[id]->getID()).c_str()); if (m_bundles[id]->getJavaBundle()) @@ -821,7 +821,7 @@ namespace OIC activateSoBundle (id); } - OC_LOG_V(INFO, CONTAINER_TAG, "Bundle activated: (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Bundle activated: (%s)", std::string(m_bundles[id]->getID()).c_str()); } @@ -833,7 +833,7 @@ namespace OIC void ResourceContainerImpl::registerJavaBundle(RCSBundleInfo *bundleInfo) { - OC_LOG_V(INFO, CONTAINER_TAG, "Registering Java bundle (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Registering Java bundle (%s)", std::string(bundleInfo->getID()).c_str()); JavaVM *jvm; JNIEnv *env; @@ -846,13 +846,13 @@ namespace OIC { fclose(file); - OC_LOG_V(INFO, CONTAINER_TAG, "Resource bundle (%s)", + OIC_LOG_V(INFO, CONTAINER_TAG, "Resource bundle (%s)", std::string(bundleInfo->getPath() + " available.").c_str()); } else { - OC_LOG_V(ERROR, CONTAINER_TAG, "Resource bundle (%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Resource bundle (%s)", std::string(bundleInfo->getPath() + " not available.").c_str()); return; @@ -864,7 +864,7 @@ namespace OIC strcpy(classpath, "-Djava.class.path="); strcat(classpath, bundleInfo->getPath().c_str()); - OC_LOG(INFO, CONTAINER_TAG, + OIC_LOG(INFO, CONTAINER_TAG, std::string("Configured classpath: ").append(classpath).c_str()); options[1].optionString = classpath; @@ -874,7 +874,7 @@ namespace OIC strcat(libraryPath, bundleInfo->getLibraryPath().c_str()); options[2].optionString = libraryPath; - OC_LOG(INFO, CONTAINER_TAG, + OIC_LOG(INFO, CONTAINER_TAG, std::string("Configured library path: ").append(libraryPath).c_str()); vm_args.version = JNI_VERSION_1_4; @@ -887,26 +887,26 @@ namespace OIC if (res < 0) { - OC_LOG(ERROR, CONTAINER_TAG, "cannot create JavaVM."); + OIC_LOG(ERROR, CONTAINER_TAG, "cannot create JavaVM."); return; } else { - OC_LOG(INFO, CONTAINER_TAG, "JVM successfully created."); + OIC_LOG(INFO, CONTAINER_TAG, "JVM successfully created."); } m_bundleVM.insert(std::pair< string, JavaVM * >(bundleInfo->getID(), jvm)); const char *className = bundleInfoInternal->getActivatorName().c_str(); - OC_LOG_V(INFO, CONTAINER_TAG, "Looking up class: (%s)", std::string( + OIC_LOG_V(INFO, CONTAINER_TAG, "Looking up class: (%s)", std::string( bundleInfoInternal->getActivatorName() + "|").c_str()); jclass bundleActivatorClass = env->FindClass(className); if (bundleActivatorClass == NULL) { - OC_LOG_V(ERROR, CONTAINER_TAG, "Cannot register bundle (%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Cannot register bundle (%s)", std::string( bundleInfoInternal->getID() + " bundle activator(" + bundleInfoInternal->getActivatorName() + ") not found ").c_str()); @@ -918,7 +918,7 @@ namespace OIC if (activateMethod == NULL) { - OC_LOG_V(ERROR, CONTAINER_TAG, "Cannot register bundle (%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Cannot register bundle (%s)", std::string( bundleInfoInternal->getID() + " activate bundle method not found ").c_str()); return; @@ -930,7 +930,7 @@ namespace OIC if (deactivateMethod == NULL) { - OC_LOG_V(ERROR, CONTAINER_TAG, "Cannot register bundle (%s)", + OIC_LOG_V(ERROR, CONTAINER_TAG, "Cannot register bundle (%s)", std::string( bundleInfoInternal->getID() + " deactivate bundle method not found ").c_str()); return; @@ -953,12 +953,12 @@ namespace OIC m_bundles[bundleInfo->getID()] = ((BundleInfoInternal *)bundleInfo); - OC_LOG(INFO, CONTAINER_TAG, "Bundle registered"); + OIC_LOG(INFO, CONTAINER_TAG, "Bundle registered"); } void ResourceContainerImpl::activateJavaBundle(string bundleId) { - OC_LOG(INFO, CONTAINER_TAG, "Activating java bundle"); + OIC_LOG(INFO, CONTAINER_TAG, "Activating java bundle"); JavaVM *vm = getJavaVM(bundleId); BundleInfoInternal *bundleInfoInternal = (BundleInfoInternal *) m_bundles[bundleId]; @@ -969,12 +969,12 @@ namespace OIC { if (vm->AttachCurrentThread((void **) &env, NULL) != 0) { - OC_LOG(ERROR, CONTAINER_TAG, "Failed to attach "); + OIC_LOG(ERROR, CONTAINER_TAG, "Failed to attach "); } } else if (envStat == JNI_EVERSION) { - OC_LOG(ERROR, CONTAINER_TAG, "Env: version not supported "); + OIC_LOG(ERROR, CONTAINER_TAG, "Env: version not supported "); } env->CallVoidMethod(bundleInfoInternal->getJavaBundleActivatorObject(), @@ -985,7 +985,7 @@ namespace OIC void ResourceContainerImpl::deactivateJavaBundle(string bundleId) { - OC_LOG(INFO, CONTAINER_TAG, "Deactivating java bundle"); + OIC_LOG(INFO, CONTAINER_TAG, "Deactivating java bundle"); JavaVM *vm = getJavaVM(bundleId); BundleInfoInternal *bundleInfoInternal = (BundleInfoInternal *) m_bundles[bundleId]; @@ -996,12 +996,12 @@ namespace OIC { if (vm->AttachCurrentThread((void **) &env, NULL) != 0) { - OC_LOG(ERROR, CONTAINER_TAG, "Failed to attach "); + OIC_LOG(ERROR, CONTAINER_TAG, "Failed to attach "); } } else if (envStat == JNI_EVERSION) { - OC_LOG(ERROR, CONTAINER_TAG, "Env: version not supported "); + OIC_LOG(ERROR, CONTAINER_TAG, "Env: version not supported "); } env->CallVoidMethod(bundleInfoInternal->getJavaBundleActivatorObject(), @@ -1012,10 +1012,10 @@ namespace OIC void ResourceContainerImpl::unregisterBundleJava(string id) { - OC_LOG_V(INFO, CONTAINER_TAG, "Unregister Java bundle: (%s)", std::string( + OIC_LOG_V(INFO, CONTAINER_TAG, "Unregister Java bundle: (%s)", std::string( m_bundles[id]->getID()).c_str()); - OC_LOG(INFO, CONTAINER_TAG, "Destroying JVM"); + OIC_LOG(INFO, CONTAINER_TAG, "Destroying JVM"); m_bundleVM[id]->DestroyJavaVM(); diff --git a/service/resource-directory/src/internal/rd_storage.c b/service/resource-directory/src/internal/rd_storage.c index 45515ad..2f6c922 100644 --- a/service/resource-directory/src/internal/rd_storage.c +++ b/service/resource-directory/src/internal/rd_storage.c @@ -36,7 +36,7 @@ static OCRDStorePublishResources *g_rdStorage = NULL; static void printStoragedResources(OCRDStorePublishResources *payload) { - OC_LOG(DEBUG, TAG, "Print Storage Resources ... "); + OIC_LOG(DEBUG, TAG, "Print Storage Resources ... "); for (OCRDStorePublishResources *temp = payload; temp; temp = temp->next) { if (temp->publishedResource) @@ -52,18 +52,18 @@ OCStackResult OCRDStorePublishedResources(const OCResourceCollectionPayload *pay OCResourceCollectionPayload *storeResource = (OCResourceCollectionPayload *)OICCalloc(1, sizeof(OCResourceCollectionPayload)); if (!storeResource) { - OC_LOG(ERROR, TAG, "Failed allocating memory for OCRDStorePublishResources."); + OIC_LOG(ERROR, TAG, "Failed allocating memory for OCRDStorePublishResources."); return OC_STACK_NO_MEMORY; } - OC_LOG_V(DEBUG, TAG, "Storing Resources for %s:%u", address->addr, address->port); + OIC_LOG_V(DEBUG, TAG, "Storing Resources for %s:%u", address->addr, address->port); OCTagsPayload *tags = payload->tags; storeResource->tags = OCCopyTagsResources(tags->n.deviceName, tags->di.id, tags->baseURI, tags->bitmap, address->port, tags->ins, tags->rts, tags->drel, tags->ttl); if (!storeResource->tags) { - OC_LOG(ERROR, TAG, "Failed allocating memory for tags."); + OIC_LOG(ERROR, TAG, "Failed allocating memory for tags."); OCFreeCollectionResource(storeResource); return OC_STACK_NO_MEMORY; } @@ -76,7 +76,7 @@ OCStackResult OCRDStorePublishedResources(const OCResourceCollectionPayload *pay links->rel, links->obs, links->title, links->uri, links->ins, links->mt); if (!storeResource->setLinks) { - OC_LOG(ERROR, TAG, "Failed allocating memory for links."); + OIC_LOG(ERROR, TAG, "Failed allocating memory for links."); OCFreeCollectionResource(storeResource); return OC_STACK_NO_MEMORY; } @@ -92,7 +92,7 @@ OCStackResult OCRDStorePublishedResources(const OCResourceCollectionPayload *pay links->obs, links->title, links->uri, links->ins, links->mt); if (!temp->next) { - OC_LOG(ERROR, TAG, "Failed allocating memory for links."); + OIC_LOG(ERROR, TAG, "Failed allocating memory for links."); OCFreeCollectionResource(storeResource); return OC_STACK_NO_MEMORY; } @@ -136,11 +136,11 @@ OCStackResult OCRDCheckPublishedResource(const char *interfaceType, const char * // not null it will continue execution. if (!resourceType && !interfaceType) { - OC_LOG(DEBUG, TAG, "Missing resource type or interace type."); + OIC_LOG(DEBUG, TAG, "Missing resource type or interace type."); return OC_STACK_INVALID_PARAM; } - OC_LOG(DEBUG, TAG, "Check Resource in RD"); + OIC_LOG(DEBUG, TAG, "Check Resource in RD"); if (g_rdStorage && g_rdStorage->publishedResource) { for (OCRDStorePublishResources *pResource = g_rdStorage; @@ -153,7 +153,7 @@ OCStackResult OCRDCheckPublishedResource(const char *interfaceType, const char * // If either rt or itf are NULL, it should skip remaining code execution. if (!tLinks->rt || !tLinks->itf) { - OC_LOG(DEBUG, TAG, "Either resource type or interface type is missing."); + OIC_LOG(DEBUG, TAG, "Either resource type or interface type is missing."); continue; } if (resourceType) @@ -161,7 +161,7 @@ OCStackResult OCRDCheckPublishedResource(const char *interfaceType, const char * OCStringLL *temp = tLinks->rt; while(temp) { - OC_LOG_V(DEBUG, TAG, "Resource Type: %s %s", resourceType, temp->value); + OIC_LOG_V(DEBUG, TAG, "Resource Type: %s %s", resourceType, temp->value); if (strcmp(resourceType, temp->value) == 0) { OCTagsPayload *tag = pResource->publishedResource->tags; @@ -196,7 +196,7 @@ OCStackResult OCRDCheckPublishedResource(const char *interfaceType, const char * OCStringLL *temp = tLinks->itf; while (temp) { - OC_LOG_V(DEBUG, TAG, "Interface Type: %s %s", interfaceType, temp->value); + OIC_LOG_V(DEBUG, TAG, "Interface Type: %s %s", interfaceType, temp->value); if (strcmp(interfaceType, temp->value) == 0) { OCTagsPayload *tag = pResource->publishedResource->tags; diff --git a/service/resource-directory/src/rd_client.c b/service/resource-directory/src/rd_client.c index e351b6c..a50bf2c 100644 --- a/service/resource-directory/src/rd_client.c +++ b/service/resource-directory/src/rd_client.c @@ -52,11 +52,11 @@ static OCStackResult sendRequest(OCMethod method, char *uri, OCDevAddr *addr, if (result == OC_STACK_OK) { - OC_LOG(DEBUG, TAG, "Resource Directory send successful..."); + OIC_LOG(DEBUG, TAG, "Resource Directory send successful..."); } else { - OC_LOG(ERROR, TAG, "Resource Directory send failed..."); + OIC_LOG(ERROR, TAG, "Resource Directory send failed..."); } return result; @@ -67,15 +67,15 @@ static OCStackApplicationResult handlePublishCB(__attribute__((unused))void *ctx __attribute__((unused)) OCClientResponse *clientResponse) { OCStackApplicationResult ret = OC_STACK_DELETE_TRANSACTION; - OC_LOG(DEBUG, TAG, "Successfully published resources."); + OIC_LOG(DEBUG, TAG, "Successfully published resources."); if (OC_STACK_OK == OCStopMulticastServer()) { - OC_LOG_V(DEBUG, TAG, "Stopped receiving the multicast traffic."); + OIC_LOG_V(DEBUG, TAG, "Stopped receiving the multicast traffic."); } else { - OC_LOG_V(DEBUG, TAG, "Failed stopping the multicast traffic."); + OIC_LOG_V(DEBUG, TAG, "Failed stopping the multicast traffic."); } return ret; @@ -83,10 +83,10 @@ static OCStackApplicationResult handlePublishCB(__attribute__((unused))void *ctx static void retreiveRDDetails(OCClientResponse *clientResponse, OCRDBiasFactorCB clientCB) { - OC_LOG_V(DEBUG, TAG, "\tAddress of the RD: %s:%d", clientResponse->devAddr.addr, + OIC_LOG_V(DEBUG, TAG, "\tAddress of the RD: %s:%d", clientResponse->devAddr.addr, clientResponse->devAddr.port); - OC_LOG_PAYLOAD(DEBUG, clientResponse->payload); + OIC_LOG_PAYLOAD(DEBUG, clientResponse->payload); // TODO: Multiple Resource Directory will have different biasFactor, // needs to cache here detail @@ -101,37 +101,37 @@ static void retreiveRDDetails(OCClientResponse *clientResponse, OCRDBiasFactorCB static OCStackApplicationResult handleDiscoverCB(void *ctx, __attribute__((unused)) OCDoHandle handle, OCClientResponse *clientResponse) { - OC_LOG(DEBUG, TAG, "Found Resource Directory"); + OIC_LOG(DEBUG, TAG, "Found Resource Directory"); OCStackApplicationResult ret = OC_STACK_DELETE_TRANSACTION; OCRDClientContextCB *cb = (OCRDClientContextCB *)ctx; if (!cb) { - OC_LOG(ERROR, TAG, "RD Context Invalid Parameters."); + OIC_LOG(ERROR, TAG, "RD Context Invalid Parameters."); return ret; } if (cb->context != (void *) DEFAULT_CONTEXT_VALUE) { - OC_LOG(ERROR, TAG, "RD Context Invalid Context Value Parameters."); + OIC_LOG(ERROR, TAG, "RD Context Invalid Context Value Parameters."); return ret; } if (clientResponse) { - OC_LOG_V(DEBUG, TAG, "Callback Context for DISCOVER query received successfully :%d.", clientResponse->result); + OIC_LOG_V(DEBUG, TAG, "Callback Context for DISCOVER query received successfully :%d.", clientResponse->result); if (clientResponse->result == OC_STACK_OK) { retreiveRDDetails(clientResponse, cb->cbFunc); } else { - OC_LOG(ERROR, TAG, "Discovery of RD Failed"); + OIC_LOG(ERROR, TAG, "Discovery of RD Failed"); } } else { - OC_LOG(ERROR, TAG, "No client response."); + OIC_LOG(ERROR, TAG, "No client response."); } OICFree(cb); @@ -143,7 +143,7 @@ OCStackResult OCRDDiscover(OCRDBiasFactorCB cbBiasFactor) { if (!cbBiasFactor) { - OC_LOG(DEBUG, TAG, "No callback function specified."); + OIC_LOG(DEBUG, TAG, "No callback function specified."); return OC_STACK_INVALID_CALLBACK; } @@ -151,12 +151,12 @@ OCStackResult OCRDDiscover(OCRDBiasFactorCB cbBiasFactor) char queryUri[MAX_URI_LENGTH] = { '\0' }; snprintf(queryUri, MAX_URI_LENGTH, "coap://%s%s", OC_MULTICAST_PREFIX, OC_RSRVD_RD_URI); - OC_LOG_V(DEBUG, TAG, "Querying RD: %s\n", queryUri); + OIC_LOG_V(DEBUG, TAG, "Querying RD: %s\n", queryUri); OCRDClientContextCB *cbContext = (OCRDClientContextCB *)OICCalloc(1, sizeof(OCRDClientContextCB)); if (!cbContext) { - OC_LOG(ERROR, TAG, "Failed allocating memory."); + OIC_LOG(ERROR, TAG, "Failed allocating memory."); return OC_STACK_NO_MEMORY; } @@ -182,13 +182,13 @@ static OCStackResult createStringLL(uint8_t numElements, OCResourceHandle handle *stringLL = (OCStringLL *)OICCalloc(1, sizeof(OCStringLL)); if (!*stringLL) { - OC_LOG(ERROR, TAG, "Failed allocating memory."); + OIC_LOG(ERROR, TAG, "Failed allocating memory."); return OC_STACK_NO_MEMORY; } (*stringLL)->value = OICStrdup(value); if (!(*stringLL)->value) { - OC_LOG(ERROR, TAG, "Failed copying to OCStringLL."); + OIC_LOG(ERROR, TAG, "Failed copying to OCStringLL."); return OC_STACK_NO_MEMORY; } } @@ -202,13 +202,13 @@ static OCStackResult createStringLL(uint8_t numElements, OCResourceHandle handle cur->next = (OCStringLL *)OICCalloc(1, sizeof(OCStringLL)); if (!cur->next) { - OC_LOG(ERROR, TAG, "Failed allocating memory."); + OIC_LOG(ERROR, TAG, "Failed allocating memory."); return OC_STACK_NO_MEMORY; } cur->next->value = OICStrdup(value); if (!cur->next->value) { - OC_LOG(ERROR, TAG, "Failed copying to OCStringLL."); + OIC_LOG(ERROR, TAG, "Failed copying to OCStringLL."); return OC_STACK_NO_MEMORY; } } @@ -220,14 +220,14 @@ OCStackResult OCRDPublish(char *addr, uint16_t port, int numArg, ... ) { if (!addr) { - OC_LOG(ERROR, TAG, "RD address not specified."); + OIC_LOG(ERROR, TAG, "RD address not specified."); return OC_STACK_INVALID_PARAM; } char targetUri[MAX_URI_LENGTH]; snprintf(targetUri, MAX_URI_LENGTH, "coap://%s:%d%s?rt=%s", addr, port, OC_RSRVD_RD_URI, OC_RSRVD_RESOURCE_TYPE_RDPUBLISH); - OC_LOG_V(DEBUG, TAG, "Target URI : %s", targetUri); + OIC_LOG_V(DEBUG, TAG, "Target URI : %s", targetUri); // Gather all resources locally and do publish OCCallbackData cbData = { 0 }; @@ -338,12 +338,12 @@ OCStackResult OCRDPublish(char *addr, uint16_t port, int numArg, ... ) OICStrcpy(rdAddr.addr, MAX_ADDR_STR_SIZE, addr); rdAddr.port = port; - OC_LOG_PAYLOAD(DEBUG, (OCPayload *) rdPayload); + OIC_LOG_PAYLOAD(DEBUG, (OCPayload *) rdPayload); return sendRequest(OC_REST_POST, targetUri, &rdAddr, (OCPayload *)rdPayload, cbData); no_memory: - OC_LOG(ERROR, TAG, "Failed allocating memory."); + OIC_LOG(ERROR, TAG, "Failed allocating memory."); va_end(arguments); if (rt) { diff --git a/service/resource-directory/src/rd_server.c b/service/resource-directory/src/rd_server.c index 7713679..e97fedf 100644 --- a/service/resource-directory/src/rd_server.c +++ b/service/resource-directory/src/rd_server.c @@ -47,12 +47,12 @@ static OCEntityHandlerResult handleGetRequest(const OCEntityHandlerRequest *ehRe { if (!ehRequest) { - OC_LOG(DEBUG, TAG, "Invalid request pointer."); + OIC_LOG(DEBUG, TAG, "Invalid request pointer."); return OC_EH_ERROR; } OCEntityHandlerResult ehResult = OC_EH_OK; - OC_LOG_V(DEBUG, TAG, "Received OC_REST_GET from client with query: %s.", ehRequest->query); + OIC_LOG_V(DEBUG, TAG, "Received OC_REST_GET from client with query: %s.", ehRequest->query); OCRDPayload *rdPayload = OCRDPayloadCreate(); if (!rdPayload) @@ -67,11 +67,11 @@ static OCEntityHandlerResult handleGetRequest(const OCEntityHandlerRequest *ehRe return OC_STACK_NO_MEMORY; } - OC_LOG_PAYLOAD(DEBUG, (OCPayload *) rdPayload); + OIC_LOG_PAYLOAD(DEBUG, (OCPayload *) rdPayload); if (sendResponse(ehRequest, rdPayload) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Sending response failed."); + OIC_LOG(ERROR, TAG, "Sending response failed."); ehResult = OC_EH_ERROR; } @@ -88,11 +88,11 @@ static OCEntityHandlerResult handlePublishRequest(const OCEntityHandlerRequest * if (!ehRequest) { - OC_LOG(DEBUG, TAG, "Invalid request pointer"); + OIC_LOG(DEBUG, TAG, "Invalid request pointer"); return OC_EH_ERROR; } - OC_LOG_V(DEBUG, TAG, "Received OC_REST_PUT from client with query: %s.", ehRequest->query); + OIC_LOG_V(DEBUG, TAG, "Received OC_REST_PUT from client with query: %s.", ehRequest->query); OCRDPayload *payload = (OCRDPayload *)ehRequest->payload; if (payload && payload->rdPublish) @@ -103,15 +103,15 @@ static OCEntityHandlerResult handlePublishRequest(const OCEntityHandlerRequest * OCRDPayload *rdPayload = OCRDPayloadCreate(); if (!rdPayload) { - OC_LOG(ERROR, TAG, "Failed allocating memory."); + OIC_LOG(ERROR, TAG, "Failed allocating memory."); return OC_STACK_NO_MEMORY; } - OC_LOG_PAYLOAD(DEBUG, (OCPayload *) rdPayload); + OIC_LOG_PAYLOAD(DEBUG, (OCPayload *) rdPayload); if (sendResponse(ehRequest, rdPayload) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Sending response failed."); + OIC_LOG(ERROR, TAG, "Sending response failed."); ehResult = OC_EH_ERROR; } @@ -134,7 +134,7 @@ static OCEntityHandlerResult rdEntityHandler(OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG(DEBUG, TAG, "Flag includes OC_REQUEST_FLAG."); + OIC_LOG(DEBUG, TAG, "Flag includes OC_REQUEST_FLAG."); switch (ehRequest->method) { case OC_REST_GET: @@ -175,11 +175,11 @@ OCStackResult OCRDStart() if (result == OC_STACK_OK) { - OC_LOG(DEBUG, TAG, "Resource Directory Started."); + OIC_LOG(DEBUG, TAG, "Resource Directory Started."); } else { - OC_LOG(ERROR, TAG, "Failed starting Resource Directory."); + OIC_LOG(ERROR, TAG, "Failed starting Resource Directory."); } return result; @@ -194,11 +194,11 @@ OCStackResult OCRDStop() if (result == OC_STACK_OK) { - OC_LOG(DEBUG, TAG, "Resource Directory Stopped."); + OIC_LOG(DEBUG, TAG, "Resource Directory Stopped."); } else { - OC_LOG(ERROR, TAG, "Failed stopping Resource Directory."); + OIC_LOG(ERROR, TAG, "Failed stopping Resource Directory."); } return result; } diff --git a/service/resource-encapsulation/src/common/utils/include/ScopeLogger.h b/service/resource-encapsulation/src/common/utils/include/ScopeLogger.h index 018e538..b34d5ad 100644 --- a/service/resource-encapsulation/src/common/utils/include/ScopeLogger.h +++ b/service/resource-encapsulation/src/common/utils/include/ScopeLogger.h @@ -43,7 +43,7 @@ namespace OIC { static constexpr char DEFAULT_ENTER_STR[]{ "IN" }; - OC_LOG_V(m_level, m_tag, "%s %s", m_scopeName, DEFAULT_ENTER_STR); + OIC_LOG_V(m_level, m_tag, "%s %s", m_scopeName, DEFAULT_ENTER_STR); } ~ScopeLogger() @@ -52,12 +52,12 @@ namespace OIC if (std::uncaught_exception()) { - OC_LOG_V(m_level, m_tag, "%s %s by stack unwinding (uncaught exception)", + OIC_LOG_V(m_level, m_tag, "%s %s by stack unwinding (uncaught exception)", m_scopeName, DEFAULT_EXIT_STR); } else { - OC_LOG_V(m_level, m_tag, "%s %s", m_scopeName, DEFAULT_EXIT_STR); + OIC_LOG_V(m_level, m_tag, "%s %s", m_scopeName, DEFAULT_EXIT_STR); } } diff --git a/service/resource-encapsulation/src/resourceBroker/src/DeviceAssociation.cpp b/service/resource-encapsulation/src/resourceBroker/src/DeviceAssociation.cpp index 0176c7b..6cc97b7 100644 --- a/service/resource-encapsulation/src/resourceBroker/src/DeviceAssociation.cpp +++ b/service/resource-encapsulation/src/resourceBroker/src/DeviceAssociation.cpp @@ -56,13 +56,13 @@ namespace OIC DevicePresencePtr DeviceAssociation::findDevice(const std::string & address) { - OC_LOG_V(DEBUG,BROKER_TAG,"findDevice()"); + OIC_LOG_V(DEBUG,BROKER_TAG,"findDevice()"); DevicePresencePtr retDevice = nullptr; for(auto it : s_deviceList) { if(address == it->getAddress()) { - OC_LOG_V(DEBUG,BROKER_TAG,"find device in deviceList"); + OIC_LOG_V(DEBUG,BROKER_TAG,"find device in deviceList"); retDevice = it; break; } @@ -73,22 +73,22 @@ namespace OIC void DeviceAssociation::addDevice(DevicePresencePtr dPresence) { - OC_LOG_V(DEBUG,BROKER_TAG,"addDevice()"); + OIC_LOG_V(DEBUG,BROKER_TAG,"addDevice()"); DevicePresencePtr foundDevice = findDevice(dPresence->getAddress()); if(foundDevice == nullptr) { - OC_LOG_V(DEBUG,BROKER_TAG,"add device in deviceList"); + OIC_LOG_V(DEBUG,BROKER_TAG,"add device in deviceList"); s_deviceList.push_back(dPresence); } } void DeviceAssociation::removeDevice(DevicePresencePtr dPresence) { - OC_LOG_V(DEBUG,BROKER_TAG,"removeDevice()"); + OIC_LOG_V(DEBUG,BROKER_TAG,"removeDevice()"); DevicePresencePtr foundDevice = findDevice(dPresence->getAddress()); if(foundDevice != nullptr) { - OC_LOG_V(DEBUG,BROKER_TAG,"remove device in deviceList"); + OIC_LOG_V(DEBUG,BROKER_TAG,"remove device in deviceList"); s_deviceList.remove(foundDevice); foundDevice.reset(); } @@ -96,7 +96,7 @@ namespace OIC bool DeviceAssociation::isEmptyDeviceList() { - OC_LOG_V(DEBUG,BROKER_TAG,"isEmptyDeviceList()"); + OIC_LOG_V(DEBUG,BROKER_TAG,"isEmptyDeviceList()"); return s_deviceList.empty(); } } // namespace Service diff --git a/service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp b/service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp index b3ada66..33baf31 100644 --- a/service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp +++ b/service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp @@ -41,28 +41,28 @@ namespace OIC { if(presenceSubscriber.isSubscribing()) { - OC_LOG_V(DEBUG,BROKER_TAG,"unsubscribed presence."); + OIC_LOG_V(DEBUG,BROKER_TAG,"unsubscribed presence."); presenceSubscriber.unsubscribe(); } resourcePresenceList.clear(); - OC_LOG_V(DEBUG,BROKER_TAG,"destroy Timer."); + OIC_LOG_V(DEBUG,BROKER_TAG,"destroy Timer."); } void DevicePresence::initializeDevicePresence(PrimitiveResourcePtr pResource) { - OC_LOG_V(DEBUG, BROKER_TAG, "initializeDevicePresence()"); + OIC_LOG_V(DEBUG, BROKER_TAG, "initializeDevicePresence()"); address = pResource->getHost(); - OC_LOG_V(DEBUG, BROKER_TAG, "%s",address.c_str()); + OIC_LOG_V(DEBUG, BROKER_TAG, "%s",address.c_str()); try { - OC_LOG_V(DEBUG, BROKER_TAG, "subscribe Presence"); + OIC_LOG_V(DEBUG, BROKER_TAG, "subscribe Presence"); presenceSubscriber = PresenceSubscriber(address, BROKER_TRANSPORT, pSubscribeRequestCB); } catch(RCSPlatformException &e) { - OC_LOG_V(DEBUG, BROKER_TAG, + OIC_LOG_V(DEBUG, BROKER_TAG, "exception in subscribe Presence %s", e.getReason().c_str()); throw; } @@ -82,25 +82,25 @@ namespace OIC const std::string DevicePresence::getAddress() const { - OC_LOG_V(DEBUG, BROKER_TAG, "getAddress()"); + OIC_LOG_V(DEBUG, BROKER_TAG, "getAddress()"); return address; } void DevicePresence::addPresenceResource(ResourcePresence * rPresence) { - OC_LOG_V(DEBUG, BROKER_TAG, "addPresenceResource()"); + OIC_LOG_V(DEBUG, BROKER_TAG, "addPresenceResource()"); resourcePresenceList.push_back(rPresence); } void DevicePresence::removePresenceResource(ResourcePresence * rPresence) { - OC_LOG_V(DEBUG, BROKER_TAG, "removePresenceResource()"); + OIC_LOG_V(DEBUG, BROKER_TAG, "removePresenceResource()"); resourcePresenceList.remove(rPresence); } void DevicePresence::changeAllPresenceMode(BROKER_MODE mode) { - OC_LOG_V(DEBUG, BROKER_TAG, "changeAllPresenceMode()"); + OIC_LOG_V(DEBUG, BROKER_TAG, "changeAllPresenceMode()"); if(!resourcePresenceList.empty()) { for(auto it : resourcePresenceList) @@ -112,16 +112,16 @@ namespace OIC bool DevicePresence::isEmptyResourcePresence() const { - OC_LOG_V(DEBUG, BROKER_TAG, "isEmptyResourcePresence()"); + OIC_LOG_V(DEBUG, BROKER_TAG, "isEmptyResourcePresence()"); return resourcePresenceList.empty(); } void DevicePresence::subscribeCB(OCStackResult ret, const unsigned int seq, const std::string & hostAddress) { - OC_LOG_V(DEBUG, BROKER_TAG, "subscribeCB()"); - OC_LOG_V(DEBUG, BROKER_TAG, "Received presence CB from: %s",hostAddress.c_str()); - OC_LOG_V(DEBUG, BROKER_TAG, "In subscribeCB: %d",ret); + OIC_LOG_V(DEBUG, BROKER_TAG, "subscribeCB()"); + OIC_LOG_V(DEBUG, BROKER_TAG, "Received presence CB from: %s",hostAddress.c_str()); + OIC_LOG_V(DEBUG, BROKER_TAG, "In subscribeCB: %d",ret); if(isRunningTimeOut) { @@ -136,9 +136,9 @@ namespace OIC case OC_STACK_RESOURCE_CREATED: case OC_STACK_CONTINUE: { - OC_LOG_V(DEBUG, BROKER_TAG, "SEQ# %d",seq); + OIC_LOG_V(DEBUG, BROKER_TAG, "SEQ# %d",seq); setDeviceState(DEVICE_STATE::ALIVE); - OC_LOG_V(DEBUG, BROKER_TAG, "device state : %d", + OIC_LOG_V(DEBUG, BROKER_TAG, "device state : %d", (int)getDeviceState()); changeAllPresenceMode(BROKER_MODE::DEVICE_PRESENCE_MODE); presenceTimerHandle @@ -159,7 +159,7 @@ namespace OIC } default: { - OC_LOG_V(DEBUG, BROKER_TAG, "Presence Lost Signal because unknown type"); + OIC_LOG_V(DEBUG, BROKER_TAG, "Presence Lost Signal because unknown type"); setDeviceState(DEVICE_STATE::LOST_SIGNAL); changeAllPresenceMode(BROKER_MODE::NON_PRESENCE_MODE); break; @@ -169,11 +169,11 @@ namespace OIC void DevicePresence::timeOutCB(TimerID /*id*/) { - OC_LOG_V(DEBUG,BROKER_TAG,"timeOutCB()"); + OIC_LOG_V(DEBUG,BROKER_TAG,"timeOutCB()"); std::unique_lock lock(timeoutMutex); isRunningTimeOut = true; - OC_LOG_V(DEBUG, BROKER_TAG, + OIC_LOG_V(DEBUG, BROKER_TAG, "Timeout execution. will be discard after receiving cb message"); setDeviceState(DEVICE_STATE::LOST_SIGNAL); changeAllPresenceMode(BROKER_MODE::NON_PRESENCE_MODE); diff --git a/service/resource-encapsulation/src/resourceBroker/src/ResourceBroker.cpp b/service/resource-encapsulation/src/resourceBroker/src/ResourceBroker.cpp index fe1c852..559b932 100644 --- a/service/resource-encapsulation/src/resourceBroker/src/ResourceBroker.cpp +++ b/service/resource-encapsulation/src/resourceBroker/src/ResourceBroker.cpp @@ -36,13 +36,13 @@ namespace OIC { if(s_presenceList != nullptr) { - OC_LOG_V(DEBUG, BROKER_TAG, "clear the ResourcePresenceList."); + OIC_LOG_V(DEBUG, BROKER_TAG, "clear the ResourcePresenceList."); s_presenceList->erase(s_presenceList->begin(), s_presenceList->end()); s_presenceList->clear(); } if(s_brokerIDMap != nullptr) { - OC_LOG_V(DEBUG, BROKER_TAG, "clear the brokerIDMap."); + OIC_LOG_V(DEBUG, BROKER_TAG, "clear the brokerIDMap."); s_brokerIDMap->erase(s_brokerIDMap->begin(), s_brokerIDMap->end()); s_brokerIDMap->clear(); } @@ -65,7 +65,7 @@ namespace OIC BrokerID ResourceBroker::hostResource(PrimitiveResourcePtr pResource, BrokerCB cb) { - OC_LOG_V(DEBUG, BROKER_TAG, "hostResource()."); + OIC_LOG_V(DEBUG, BROKER_TAG, "hostResource()."); if(pResource == nullptr || cb == nullptr || cb == NULL) { throw InvalidParameterException("[hostResource] input parameter(PrimitiveResource or BrokerCB) is Invalid"); @@ -76,12 +76,12 @@ namespace OIC ResourcePresencePtr presenceItem = findResourcePresence(pResource); if(presenceItem == nullptr) { - OC_LOG_V(DEBUG, BROKER_TAG, "Not found any Handled Resource."); - OC_LOG_V(DEBUG, BROKER_TAG, "Create New Resource Presence Handler."); + OIC_LOG_V(DEBUG, BROKER_TAG, "Not found any Handled Resource."); + OIC_LOG_V(DEBUG, BROKER_TAG, "Create New Resource Presence Handler."); try { - OC_LOG_V(DEBUG, BROKER_TAG, "create the ResourcePresence."); + OIC_LOG_V(DEBUG, BROKER_TAG, "create the ResourcePresence."); presenceItem.reset(new ResourcePresence()); presenceItem->initializeResourcePresence(pResource); }catch(RCSPlatformException &e) @@ -90,11 +90,11 @@ namespace OIC } if(s_presenceList != nullptr) { - OC_LOG_V(DEBUG, BROKER_TAG, "push the ResourcePresence in presenceList."); + OIC_LOG_V(DEBUG, BROKER_TAG, "push the ResourcePresence in presenceList."); s_presenceList->push_back(presenceItem); } } - OC_LOG_V(DEBUG, BROKER_TAG, "add the BrokerRequester in ResourcePresence."); + OIC_LOG_V(DEBUG, BROKER_TAG, "add the BrokerRequester in ResourcePresence."); presenceItem->addBrokerRequester(retID, cb); BrokerCBResourcePair pair(presenceItem, cb); @@ -106,12 +106,12 @@ namespace OIC void ResourceBroker::cancelHostResource(BrokerID brokerId) { - OC_LOG_V(DEBUG,BROKER_TAG,"cancelHostResource()."); + OIC_LOG_V(DEBUG,BROKER_TAG,"cancelHostResource()."); if(brokerId == 0) { // input parameter is wrong. // hostResource never return value 0; - OC_LOG_V(DEBUG,BROKER_TAG,"brokerId is zero."); + OIC_LOG_V(DEBUG,BROKER_TAG,"brokerId is zero."); throw InvalidParameterException("[cancelHostResource] brokerId is invalid."); } @@ -119,7 +119,7 @@ namespace OIC if(it == s_brokerIDMap->end()) { // not found requested brokerId in BrokerMap; - OC_LOG_V(DEBUG,BROKER_TAG,"brokerId is not found in brokerIDMap."); + OIC_LOG_V(DEBUG,BROKER_TAG,"brokerId is not found in brokerIDMap."); throw InvalidParameterException("[cancelHostResource] brokerId is not found in brokerIDMap."); } else @@ -130,7 +130,7 @@ namespace OIC if(presenceItem->isEmptyRequester()) { - OC_LOG_V(DEBUG,BROKER_TAG,"remove resourcePresence in presenceList because it is not including any requester info."); + OIC_LOG_V(DEBUG,BROKER_TAG,"remove resourcePresence in presenceList because it is not including any requester info."); s_presenceList->remove(presenceItem); } } @@ -138,10 +138,10 @@ namespace OIC BROKER_STATE ResourceBroker::getResourceState(BrokerID brokerId) { - OC_LOG_V(DEBUG,BROKER_TAG,"getResourceState()."); + OIC_LOG_V(DEBUG,BROKER_TAG,"getResourceState()."); if(brokerId == 0) { - OC_LOG_V(DEBUG,BROKER_TAG,"brokerId is zero."); + OIC_LOG_V(DEBUG,BROKER_TAG,"brokerId is zero."); throw InvalidParameterException("[getResourceState] input BrokerID is Invalid"); } @@ -151,7 +151,7 @@ namespace OIC if(it == s_brokerIDMap->end()) { // not found requested brokerId in BrokerMap; - OC_LOG_V(DEBUG,BROKER_TAG,"brokerId is not found in brokerIDMap."); + OIC_LOG_V(DEBUG,BROKER_TAG,"brokerId is not found in brokerIDMap."); throw InvalidParameterException("[getResourceState] input BrokerID is unknown ID"); } else @@ -165,7 +165,7 @@ namespace OIC BROKER_STATE ResourceBroker::getResourceState(PrimitiveResourcePtr pResource) { - OC_LOG_V(DEBUG,BROKER_TAG,"getResourceState()."); + OIC_LOG_V(DEBUG,BROKER_TAG,"getResourceState()."); if(pResource == nullptr) { throw InvalidParameterException("[getResourceState] input PrimitiveResource is Invalid"); @@ -184,22 +184,22 @@ namespace OIC void ResourceBroker::initializeResourceBroker() { - OC_LOG_V(DEBUG,BROKER_TAG,"initializeResourceBroker()."); + OIC_LOG_V(DEBUG,BROKER_TAG,"initializeResourceBroker()."); if(s_presenceList == nullptr) { - OC_LOG_V(DEBUG,BROKER_TAG,"create the presenceList."); + OIC_LOG_V(DEBUG,BROKER_TAG,"create the presenceList."); s_presenceList = std::unique_ptr(new PresenceList); } if(s_brokerIDMap == nullptr) { - OC_LOG_V(DEBUG,BROKER_TAG,"create the brokerIDMap."); + OIC_LOG_V(DEBUG,BROKER_TAG,"create the brokerIDMap."); s_brokerIDMap = std::unique_ptr(new BrokerIDMap); } } ResourcePresencePtr ResourceBroker::findResourcePresence(PrimitiveResourcePtr pResource) { - OC_LOG_V(DEBUG,BROKER_TAG,"findResourcePresence()."); + OIC_LOG_V(DEBUG,BROKER_TAG,"findResourcePresence()."); ResourcePresencePtr retResource(nullptr); if(s_presenceList->empty() != true) @@ -220,7 +220,7 @@ namespace OIC BrokerID ResourceBroker::generateBrokerID() { - OC_LOG_V(DEBUG,BROKER_TAG,"generateBrokerID()."); + OIC_LOG_V(DEBUG,BROKER_TAG,"generateBrokerID()."); BrokerID retID = 0; srand(time(NULL)); diff --git a/service/resource-encapsulation/src/resourceBroker/src/ResourcePresence.cpp b/service/resource-encapsulation/src/resourceBroker/src/ResourcePresence.cpp index bb80de3..7174ba6 100644 --- a/service/resource-encapsulation/src/resourceBroker/src/ResourcePresence.cpp +++ b/service/resource-encapsulation/src/resourceBroker/src/ResourcePresence.cpp @@ -40,7 +40,7 @@ using namespace OIC::Service; void getCallback(const HeaderOptions &hos, const ResponseStatement& rep, int eCode, std::weak_ptr this_ptr) { - OC_LOG_V(DEBUG,BROKER_TAG,"getCallback().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"getCallback().\n"); std::shared_ptr Ptr = this_ptr.lock(); if(Ptr) { @@ -49,7 +49,7 @@ using namespace OIC::Service; } void timeOutCallback(unsigned int msg, std::weak_ptr this_ptr) { - OC_LOG_V(DEBUG,BROKER_TAG,"timeOutCallback().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"timeOutCallback().\n"); std::shared_ptr Ptr = this_ptr.lock(); if(Ptr) { @@ -71,7 +71,7 @@ namespace OIC void ResourcePresence::initializeResourcePresence(PrimitiveResourcePtr pResource) { - OC_LOG_V(DEBUG,BROKER_TAG,"initializeResourcePresence().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"initializeResourcePresence().\n"); pGetCB = std::bind(getCallback, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::weak_ptr(shared_from_this())); pTimeoutCB = std::bind(timeOutCallback, std::placeholders::_1, @@ -84,7 +84,7 @@ namespace OIC (new std::list); timeoutHandle = expiryTimer.post(BROKER_SAFE_MILLISECOND, pTimeoutCB); - OC_LOG_V(DEBUG,BROKER_TAG,"initializeResourcePresence::requestGet.\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"initializeResourcePresence::requestGet.\n"); primitiveResource->requestGet(pGetCB); registerDevicePresence(); @@ -115,14 +115,14 @@ namespace OIC void ResourcePresence::addBrokerRequester(BrokerID _id, BrokerCB _cb) { - OC_LOG_V(DEBUG,BROKER_TAG,"addBrokerRequester().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"addBrokerRequester().\n"); requesterList->push_back( std::make_shared(BrokerRequesterInfo(_id, _cb))); } void ResourcePresence::removeAllBrokerRequester() { - OC_LOG_V(DEBUG,BROKER_TAG,"removeAllBrokerRequester().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"removeAllBrokerRequester().\n"); if(requesterList != nullptr) { requesterList->erase(requesterList->begin(), requesterList->end()); @@ -131,13 +131,13 @@ namespace OIC void ResourcePresence::removeBrokerRequester(BrokerID _id) { - OC_LOG_V(DEBUG,BROKER_TAG,"removeBrokerRequester().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"removeBrokerRequester().\n"); std::list::iterator iter = requesterList->begin(); for(; iter != requesterList->end(); ++iter) { if(iter->get()->brokerId == _id) { - OC_LOG_V(DEBUG,BROKER_TAG,"find broker-id in requesterList.\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"find broker-id in requesterList.\n"); requesterList->erase(iter); break; } @@ -146,25 +146,25 @@ namespace OIC bool ResourcePresence::isEmptyRequester() const { - OC_LOG_V(DEBUG,BROKER_TAG,"isEmptyRequester().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"isEmptyRequester().\n"); return (requesterList!=nullptr)?requesterList->empty():true; } int ResourcePresence::requesterListSize() const { - OC_LOG_V(DEBUG,BROKER_TAG,"requesterListSize().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"requesterListSize().\n"); return (requesterList!=nullptr)?requesterList->size():0; } void ResourcePresence::requestResourceState() const { - OC_LOG_V(DEBUG,BROKER_TAG,"requestResourceState().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"requestResourceState().\n"); primitiveResource->requestGet(pGetCB); - OC_LOG_V(DEBUG, BROKER_TAG, "Request Get\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "Request Get\n"); } void ResourcePresence::registerDevicePresence() { - OC_LOG_V(DEBUG,BROKER_TAG,"registerDevicePresence().\n"); + OIC_LOG_V(DEBUG,BROKER_TAG,"registerDevicePresence().\n"); std::string deviceAddress = primitiveResource->getHost(); DevicePresencePtr foundDevice @@ -187,7 +187,7 @@ namespace OIC void ResourcePresence::executeAllBrokerCB(BROKER_STATE changedState) { - OC_LOG_V(DEBUG, BROKER_TAG, "executeAllBrokerCB().\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "executeAllBrokerCB().\n"); if(state != changedState) { setResourcestate(changedState); @@ -204,14 +204,14 @@ namespace OIC void ResourcePresence::setResourcestate(BROKER_STATE _state) { - OC_LOG_V(DEBUG, BROKER_TAG, "setResourcestate().\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "setResourcestate().\n"); this->state = _state; } void ResourcePresence::timeOutCB(unsigned int /*msg*/) { - OC_LOG_V(DEBUG, BROKER_TAG, "timeOutCB()"); - OC_LOG_V(DEBUG, BROKER_TAG, "waiting for terminate getCB\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "timeOutCB()"); + OIC_LOG_V(DEBUG, BROKER_TAG, "waiting for terminate getCB\n"); std::unique_lock lock(cbMutex); time_t currentTime; @@ -224,7 +224,7 @@ namespace OIC return; } this->isWithinTime = false; - OC_LOG_V(DEBUG, BROKER_TAG, + OIC_LOG_V(DEBUG, BROKER_TAG, "Timeout execution. will be discard after receiving cb message.\n"); executeAllBrokerCB(BROKER_STATE::LOST_SIGNAL); @@ -233,7 +233,7 @@ namespace OIC void ResourcePresence::pollingCB(unsigned int /*msg*/) { - OC_LOG_V(DEBUG, BROKER_TAG, "pollingCB().\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "pollingCB().\n"); if(this->requesterList->size() != 0) { this->requestResourceState(); @@ -244,8 +244,8 @@ namespace OIC void ResourcePresence::getCB(const HeaderOptions & /*hos*/, const ResponseStatement & /*rep*/, int eCode) { - OC_LOG_V(DEBUG, BROKER_TAG, "getCB().\n"); - OC_LOG_V(DEBUG, BROKER_TAG, "waiting for terminate TimeoutCB.\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "getCB().\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "waiting for terminate TimeoutCB.\n"); std::unique_lock lock(cbMutex); time_t currentTime; @@ -269,7 +269,7 @@ namespace OIC void ResourcePresence::verifiedGetResponse(int eCode) { - OC_LOG_V(DEBUG, BROKER_TAG, "verifiedGetResponse().\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "verifiedGetResponse().\n"); BROKER_STATE verifiedState = BROKER_STATE::NONE; switch(eCode) { @@ -293,24 +293,24 @@ namespace OIC } executeAllBrokerCB(verifiedState); - OC_LOG_V(DEBUG, BROKER_TAG, "resource state : %d",(int)state); + OIC_LOG_V(DEBUG, BROKER_TAG, "resource state : %d",(int)state); } const PrimitiveResourcePtr ResourcePresence::getPrimitiveResource() const { - OC_LOG_V(DEBUG, BROKER_TAG, "getPrimitiveResource()\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "getPrimitiveResource()\n"); return primitiveResource; } BROKER_STATE ResourcePresence::getResourceState() const { - OC_LOG_V(DEBUG, BROKER_TAG, "getResourceState()\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "getResourceState()\n"); return state; } void ResourcePresence::changePresenceMode(BROKER_MODE newMode) { - OC_LOG_V(DEBUG, BROKER_TAG, "changePresenceMode()\n"); + OIC_LOG_V(DEBUG, BROKER_TAG, "changePresenceMode()\n"); if(newMode != mode) { expiryTimer.cancel(timeoutHandle); diff --git a/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp b/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp index 388ac21..33bf8bd 100644 --- a/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp +++ b/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp @@ -162,7 +162,7 @@ namespace OIC if (isMonitoring()) { - OC_LOG(DEBUG, TAG, "startMonitoring : already started"); + OIC_LOG(DEBUG, TAG, "startMonitoring : already started"); throw RCSBadRequestException{ "Monitoring already started." }; } @@ -176,7 +176,7 @@ namespace OIC if (!isMonitoring()) { - OC_LOG(DEBUG, TAG, "stopMonitoring : Not started"); + OIC_LOG(DEBUG, TAG, "stopMonitoring : Not started"); return; } @@ -208,7 +208,7 @@ namespace OIC if (isCaching()) { - OC_LOG(DEBUG, TAG, "startCaching : already Started"); + OIC_LOG(DEBUG, TAG, "startCaching : already Started"); throw RCSBadRequestException{ "Caching already started." }; } @@ -225,7 +225,7 @@ namespace OIC m_primitiveResource, { }, REPORT_FREQUENCY::NONE, 0); } - OC_LOG_V(DEBUG, TAG, "startCaching CACHE ID %d", m_cacheId); + OIC_LOG_V(DEBUG, TAG, "startCaching CACHE ID %d", m_cacheId); } void RCSRemoteResourceObject::stopCaching() @@ -234,7 +234,7 @@ namespace OIC if (!isCaching()) { - OC_LOG(DEBUG, TAG, "Caching already terminated"); + OIC_LOG(DEBUG, TAG, "Caching already terminated"); return; } diff --git a/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp b/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp index c68b357..0566fb1 100644 --- a/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp +++ b/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp @@ -72,7 +72,7 @@ namespace } catch (const OC::OCException& e) { - OC_LOG_V(WARNING, LOG_TAG, "Error (%s)", e.what()); + OIC_LOG_V(WARNING, LOG_TAG, "Error (%s)", e.what()); } return OC_EH_ERROR; @@ -222,7 +222,7 @@ namespace OIC } catch (...) { - OC_LOG(WARNING, LOG_TAG, "Failed to unregister resource."); + OIC_LOG(WARNING, LOG_TAG, "Failed to unregister resource."); } } } @@ -432,7 +432,7 @@ namespace OIC OCEntityHandlerResult RCSResourceObject::entityHandler( const std::shared_ptr< OC::OCResourceRequest >& request) { - OC_LOG(WARNING, LOG_TAG, "entityHandler"); + OIC_LOG(WARNING, LOG_TAG, "entityHandler"); if (!request) { return OC_EH_ERROR; @@ -452,12 +452,12 @@ namespace OIC } catch (const std::exception& e) { - OC_LOG_V(WARNING, LOG_TAG, "Failed to handle request : %s", e.what()); + OIC_LOG_V(WARNING, LOG_TAG, "Failed to handle request : %s", e.what()); throw; } catch (...) { - OC_LOG(WARNING, LOG_TAG, "Failed to handle request."); + OIC_LOG(WARNING, LOG_TAG, "Failed to handle request."); throw; } @@ -502,7 +502,7 @@ namespace OIC auto replaced = requestHandler->applyAcceptanceMethod(response.getAcceptanceMethod(), *this, requstAttrs); - OC_LOG_V(WARNING, LOG_TAG, "replaced num %zu", replaced.size()); + OIC_LOG_V(WARNING, LOG_TAG, "replaced num %zu", replaced.size()); for (const auto& attrKeyValPair : replaced) { std::shared_ptr< AttributeUpdatedListener > foundListener; @@ -540,7 +540,7 @@ namespace OIC autoNotify(attrsChanged, m_autoNotifyPolicy); return sendResponse(*this, request, response); } catch (const RCSPlatformException& e) { - OC_LOG_V(ERROR, LOG_TAG, "Error : %s ", e.what()); + OIC_LOG_V(ERROR, LOG_TAG, "Error : %s ", e.what()); return OC_EH_ERROR; } } diff --git a/service/simulator/src/client/auto_request_gen_mngr.cpp b/service/simulator/src/client/auto_request_gen_mngr.cpp index 10aaf14..d01f67e 100644 --- a/service/simulator/src/client/auto_request_gen_mngr.cpp +++ b/service/simulator/src/client/auto_request_gen_mngr.cpp @@ -169,11 +169,11 @@ void AutoRequestGenMngr::stop(int id) if (m_requestGenList.end() != m_requestGenList.find(id)) { m_requestGenList[id]->stop(); - OC_LOG_V(INFO, TAG, "Auto request generation session stopped [%d]", id); + OIC_LOG_V(INFO, TAG, "Auto request generation session stopped [%d]", id); return; } - OC_LOG_V(ERROR, TAG, "Invalid verification id : %d", id); + OIC_LOG_V(ERROR, TAG, "Invalid verification id : %d", id); } void AutoRequestGenMngr::onProgressChange(int sessionId, OperationState state, diff --git a/service/simulator/src/client/get_request_generator.cpp b/service/simulator/src/client/get_request_generator.cpp index 1a6aa17..0b3020a 100644 --- a/service/simulator/src/client/get_request_generator.cpp +++ b/service/simulator/src/client/get_request_generator.cpp @@ -44,7 +44,7 @@ void GETRequestGenerator::startSending() std::lock_guard lock(m_statusLock); if (m_status) { - OC_LOG(ERROR, TAG, "Operation already in progress !"); + OIC_LOG(ERROR, TAG, "Operation already in progress !"); throw OperationInProgressException("Another GET request generation session is already in progress!"); } @@ -62,7 +62,7 @@ void GETRequestGenerator::stopSending() void GETRequestGenerator::SendAllRequests() { // Notify the progress status - OC_LOG(DEBUG, TAG, "Sending OP_START event"); + OIC_LOG(DEBUG, TAG, "Sending OP_START event"); m_callback(m_id, OP_START); do @@ -95,7 +95,7 @@ void GETRequestGenerator::SendAllRequests() void GETRequestGenerator::onResponseReceived(SimulatorResult result, SimulatorResourceModelSP repModel) { - OC_LOG_V(INFO, TAG, "Response recieved result:%d", result); + OIC_LOG_V(INFO, TAG, "Response recieved result:%d", result); m_responseCnt++; completed(); } @@ -106,13 +106,13 @@ void GETRequestGenerator::completed() { if (m_stopRequested) { - OC_LOG(DEBUG, TAG, "Sending OP_ABORT event"); + OIC_LOG(DEBUG, TAG, "Sending OP_ABORT event"); m_callback(m_id, OP_ABORT); } else { - OC_LOG(DEBUG, TAG, "Sending OP_COMPLETE event"); + OIC_LOG(DEBUG, TAG, "Sending OP_COMPLETE event"); m_callback(m_id, OP_COMPLETE); } } -} \ No newline at end of file +} diff --git a/service/simulator/src/client/post_request_generator.cpp b/service/simulator/src/client/post_request_generator.cpp index a8c397d..547fb6a 100644 --- a/service/simulator/src/client/post_request_generator.cpp +++ b/service/simulator/src/client/post_request_generator.cpp @@ -47,7 +47,7 @@ void POSTRequestGenerator::startSending() // Check the representation if (!m_rep) { - OC_LOG(ERROR, TAG, "Invalid Representation given!"); + OIC_LOG(ERROR, TAG, "Invalid Representation given!"); throw SimulatorException(SIMULATOR_ERROR, "Invalid representation detected!"); } @@ -55,7 +55,7 @@ void POSTRequestGenerator::startSending() std::lock_guard lock(m_statusLock); if (m_status) { - OC_LOG(ERROR, TAG, "Operation already in progress !"); + OIC_LOG(ERROR, TAG, "Operation already in progress !"); throw OperationInProgressException("Another POST request generation session is already in progress!"); } @@ -73,7 +73,7 @@ void POSTRequestGenerator::stopSending() void POSTRequestGenerator::SendAllRequests() { // Notify the progress status - OC_LOG(DEBUG, TAG, "Sending OP_START event"); + OIC_LOG(DEBUG, TAG, "Sending OP_START event"); m_callback(m_id, OP_START); // Create attribute generator for value manipulation @@ -83,7 +83,7 @@ void POSTRequestGenerator::SendAllRequests() if (!attributeGenList.size()) { - OC_LOG(ERROR, TAG, "Zero attribute found from resource model!"); + OIC_LOG(ERROR, TAG, "Zero attribute found from resource model!"); return; } @@ -122,7 +122,7 @@ void POSTRequestGenerator::SendAllRequests() void POSTRequestGenerator::onResponseReceived(SimulatorResult result, SimulatorResourceModelSP repModel) { - OC_LOG_V(INFO, TAG, "Response recieved result:%d", result); + OIC_LOG_V(INFO, TAG, "Response recieved result:%d", result); m_responseCnt++; completed(); } @@ -133,13 +133,13 @@ void POSTRequestGenerator::completed() { if (m_stopRequested) { - OC_LOG(DEBUG, TAG, "Sending OP_ABORT event"); + OIC_LOG(DEBUG, TAG, "Sending OP_ABORT event"); m_callback(m_id, OP_ABORT); } else { - OC_LOG(DEBUG, TAG, "Sending OP_COMPLETE event"); + OIC_LOG(DEBUG, TAG, "Sending OP_COMPLETE event"); m_callback(m_id, OP_COMPLETE); } } -} \ No newline at end of file +} diff --git a/service/simulator/src/client/put_request_generator.cpp b/service/simulator/src/client/put_request_generator.cpp index d54a52d..b712957 100644 --- a/service/simulator/src/client/put_request_generator.cpp +++ b/service/simulator/src/client/put_request_generator.cpp @@ -47,7 +47,7 @@ void PUTRequestGenerator::startSending() // Check the representation if (!m_rep) { - OC_LOG(ERROR, TAG, "Invalid Representation given!"); + OIC_LOG(ERROR, TAG, "Invalid Representation given!"); throw SimulatorException(SIMULATOR_ERROR, "Invalid representation detected!"); } @@ -55,7 +55,7 @@ void PUTRequestGenerator::startSending() std::lock_guard lock(m_statusLock); if (m_status) { - OC_LOG(ERROR, TAG, "Operation already in progress !"); + OIC_LOG(ERROR, TAG, "Operation already in progress !"); throw OperationInProgressException("Another PUT request generation session is already in progress!"); } @@ -72,7 +72,7 @@ void PUTRequestGenerator::stopSending() void PUTRequestGenerator::SendAllRequests() { - OC_LOG(DEBUG, TAG, "Sending OP_START event"); + OIC_LOG(DEBUG, TAG, "Sending OP_START event"); m_callback(m_id, OP_START); // Create attribute combination generator for generating resource model @@ -85,7 +85,7 @@ void PUTRequestGenerator::SendAllRequests() if (!attributes.size()) { - OC_LOG(ERROR, TAG, "Zero attribute found from resource model!"); + OIC_LOG(ERROR, TAG, "Zero attribute found from resource model!"); return; } @@ -124,7 +124,7 @@ void PUTRequestGenerator::SendAllRequests() void PUTRequestGenerator::onResponseReceived(SimulatorResult result, SimulatorResourceModelSP repModel) { - OC_LOG_V(INFO, TAG, "Response recieved result:%d", result); + OIC_LOG_V(INFO, TAG, "Response recieved result:%d", result); m_responseCnt++; completed(); } @@ -135,13 +135,13 @@ void PUTRequestGenerator::completed() { if (m_stopRequested) { - OC_LOG(DEBUG, TAG, "Sending OP_ABORT event"); + OIC_LOG(DEBUG, TAG, "Sending OP_ABORT event"); m_callback(m_id, OP_ABORT); } else { - OC_LOG(DEBUG, TAG, "Sending OP_COMPLETE event"); + OIC_LOG(DEBUG, TAG, "Sending OP_COMPLETE event"); m_callback(m_id, OP_COMPLETE); } } -} \ No newline at end of file +} diff --git a/service/simulator/src/client/request_sender.cpp b/service/simulator/src/client/request_sender.cpp index b577a00..3ce89ef 100644 --- a/service/simulator/src/client/request_sender.cpp +++ b/service/simulator/src/client/request_sender.cpp @@ -73,7 +73,7 @@ void RequestSender::sendRequest(const std::string &interfaceType, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, requestId)); if (OC_STACK_OK != ocResult) { - OC_LOG_V(ERROR, TAG, "Sending request failed [errorcode: %d]", ocResult); + OIC_LOG_V(ERROR, TAG, "Sending request failed [errorcode: %d]", ocResult); m_requestList.remove(requestId); throw SimulatorException(static_cast(ocResult), "Failed to send request!"); } diff --git a/service/simulator/src/client/simulator_remote_resource_impl.cpp b/service/simulator/src/client/simulator_remote_resource_impl.cpp index 336c3ba..f40055d 100644 --- a/service/simulator/src/client/simulator_remote_resource_impl.cpp +++ b/service/simulator/src/client/simulator_remote_resource_impl.cpp @@ -144,7 +144,7 @@ void SimulatorRemoteResourceImpl::get(const std::string &interfaceType, if (!m_getRequestSender) { - OC_LOG(ERROR, TAG, "Invalid GET request sender!"); + OIC_LOG(ERROR, TAG, "Invalid GET request sender!"); throw NoSupportException("Can not send GET request on this resource!"); } @@ -161,7 +161,7 @@ void SimulatorRemoteResourceImpl::get(const std::map & if (!m_getRequestSender) { - OC_LOG(ERROR, TAG, "Invalid GET request sender !"); + OIC_LOG(ERROR, TAG, "Invalid GET request sender !"); throw NoSupportException("Can not send GET request on this resource!"); } @@ -180,7 +180,7 @@ void SimulatorRemoteResourceImpl::put(const std::string &interfaceType, if (!m_putRequestSender) { - OC_LOG(ERROR, TAG, "Invalid PUT request sender !"); + OIC_LOG(ERROR, TAG, "Invalid PUT request sender !"); throw NoSupportException("Can not send PUT request on this resource!"); } @@ -198,7 +198,7 @@ void SimulatorRemoteResourceImpl::put(const std::map & if (!m_putRequestSender) { - OC_LOG(ERROR, TAG, "Invalid PUT request sender !"); + OIC_LOG(ERROR, TAG, "Invalid PUT request sender !"); throw NoSupportException("Can not send PUT request on this resource!"); } @@ -217,7 +217,7 @@ void SimulatorRemoteResourceImpl::post(const std::string &interfaceType, if (!m_postRequestSender) { - OC_LOG(ERROR, TAG, "Invalid POST request sender !"); + OIC_LOG(ERROR, TAG, "Invalid POST request sender !"); throw NoSupportException("Can not send POST request on this resource!"); } @@ -235,7 +235,7 @@ void SimulatorRemoteResourceImpl::post(const std::map if (!m_postRequestSender) { - OC_LOG(ERROR, TAG, "Invalid POST request sender !"); + OIC_LOG(ERROR, TAG, "Invalid POST request sender !"); throw NoSupportException("Can not send POST request on this resource!"); } @@ -252,7 +252,7 @@ int SimulatorRemoteResourceImpl::startVerification(RequestType type, if (!m_autoRequestGenMngr) { - OC_LOG(ERROR, TAG, "Invalid auto request generation manager !"); + OIC_LOG(ERROR, TAG, "Invalid auto request generation manager !"); throw NoSupportException("Resource is not configured with RAML!"); } @@ -309,13 +309,13 @@ void SimulatorRemoteResourceImpl::stopVerification(int id) { if (id < 0) { - OC_LOG(ERROR, TAG, "Invalid session id!"); + OIC_LOG(ERROR, TAG, "Invalid session id!"); throw InvalidArgsException(SIMULATOR_INVALID_PARAM, "Invalid ID!"); } if (!m_autoRequestGenMngr) { - OC_LOG(ERROR, TAG, "Invalid auto request generation manager !"); + OIC_LOG(ERROR, TAG, "Invalid auto request generation manager !"); throw NoSupportException("Resource is not configured with RAML!"); } diff --git a/service/simulator/src/common/request_model_builder.cpp b/service/simulator/src/common/request_model_builder.cpp index b181433..79319b3 100755 --- a/service/simulator/src/common/request_model_builder.cpp +++ b/service/simulator/src/common/request_model_builder.cpp @@ -54,7 +54,7 @@ std::map RequestModelBuilder::build(const std::stri RequestModelSP RequestModelBuilder::createRequestModel(const RAML::ActionPtr &action) { - OC_LOG(DEBUG, TAG, "Creating request model"); + OIC_LOG(DEBUG, TAG, "Creating request model"); // Validate the action type. Only GET, PUT, POST and DELETE are supported. RAML::ActionType actionType = action->getType(); @@ -63,7 +63,7 @@ RequestModelSP RequestModelBuilder::createRequestModel(const RAML::ActionPtr &ac && actionType != RAML::ActionType::POST && actionType != RAML::ActionType::DELETE) { - OC_LOG(ERROR, TAG, "Failed to create request model as it is of unknown type!"); + OIC_LOG(ERROR, TAG, "Failed to create request model as it is of unknown type!"); return nullptr; } diff --git a/service/simulator/src/common/simulator_resource_model.cpp b/service/simulator/src/common/simulator_resource_model.cpp index bb44646..0c02374 100644 --- a/service/simulator/src/common/simulator_resource_model.cpp +++ b/service/simulator/src/common/simulator_resource_model.cpp @@ -1011,7 +1011,7 @@ bool SimulatorResourceModel::setAttributeValue(const std::string &key, { if (key.empty()) { - OC_LOG(ERROR, TAG, "key is empty!"); + OIC_LOG(ERROR, TAG, "key is empty!"); return false; } diff --git a/service/simulator/src/server/resource_update_automation.cpp b/service/simulator/src/server/resource_update_automation.cpp index 6c6f863..42e3fed 100644 --- a/service/simulator/src/server/resource_update_automation.cpp +++ b/service/simulator/src/server/resource_update_automation.cpp @@ -78,7 +78,7 @@ void AttributeUpdateAutomation::updateAttribute() { if (false == m_resource->updateAttributeValue(attribute)) { - OC_LOG_V(ERROR, ATAG, "Failed to update the attribute![%s]", attribute.getName().c_str()); + OIC_LOG_V(ERROR, ATAG, "Failed to update the attribute![%s]", attribute.getName().c_str()); continue; } resourceImpl->notifyApp(); @@ -97,7 +97,7 @@ void AttributeUpdateAutomation::updateAttribute() if (!m_stopRequested) { - OC_LOG_V(DEBUG, ATAG, "Attribute:%s automation is completed!", m_attrName.c_str()); + OIC_LOG_V(DEBUG, ATAG, "Attribute:%s automation is completed!", m_attrName.c_str()); SIM_LOG(ILogger::INFO, "Automation of " << m_attrName << " attribute is completed."); } @@ -131,7 +131,7 @@ void ResourceUpdateAutomation::start() if (0 == attributes.size()) { - OC_LOG(ERROR, RTAG, "Resource has zero attributes!"); + OIC_LOG(ERROR, RTAG, "Resource has zero attributes!"); throw SimulatorException(SIMULATOR_ERROR, "Resource has zero attributes!"); } diff --git a/service/simulator/src/server/resource_update_automation_mngr.cpp b/service/simulator/src/server/resource_update_automation_mngr.cpp index 1b52c70..d332abc 100644 --- a/service/simulator/src/server/resource_update_automation_mngr.cpp +++ b/service/simulator/src/server/resource_update_automation_mngr.cpp @@ -33,7 +33,7 @@ int UpdateAutomationMngr::startResourceAutomation(SimulatorSingleResource *resou { if (!callback) { - OC_LOG(ERROR, TAG, "Invalid callback!"); + OIC_LOG(ERROR, TAG, "Invalid callback!"); throw InvalidArgsException(SIMULATOR_INVALID_CALLBACK, "Invalid callback!"); } @@ -44,7 +44,7 @@ int UpdateAutomationMngr::startResourceAutomation(SimulatorSingleResource *resou std::lock_guard lock(m_lock); resourceAutomation->start(); - OC_LOG_V(DEBUG, TAG, "Resource automation successfully started [id: %d]", m_id); + OIC_LOG_V(DEBUG, TAG, "Resource automation successfully started [id: %d]", m_id); SIM_LOG(ILogger::INFO, "Resource automation successfully started [ id: " << m_id << " ]"); m_resourceUpdationList[m_id] = resourceAutomation; @@ -57,7 +57,7 @@ int UpdateAutomationMngr::startAttributeAutomation(SimulatorSingleResource *reso { if (!callback) { - OC_LOG(ERROR, TAG, "Invalid callback!"); + OIC_LOG(ERROR, TAG, "Invalid callback!"); throw InvalidArgsException(SIMULATOR_INVALID_CALLBACK, "Invalid callback!"); } @@ -65,7 +65,7 @@ int UpdateAutomationMngr::startAttributeAutomation(SimulatorSingleResource *reso SimulatorResourceModel::Attribute attribute; if (false == resource->getAttribute(attrName, attribute)) { - OC_LOG_V(ERROR, TAG, "Attribute:%s not present in resource!", attrName.c_str()); + OIC_LOG_V(ERROR, TAG, "Attribute:%s not present in resource!", attrName.c_str()); throw SimulatorException(SIMULATOR_ERROR, "Attribute is not present in resource!"); } @@ -76,7 +76,7 @@ int UpdateAutomationMngr::startAttributeAutomation(SimulatorSingleResource *reso std::lock_guard lock(m_lock); attributeAutomation->start(); - OC_LOG_V(DEBUG, TAG, "Attribute automation successfully started [name: %s, id: %d]", + OIC_LOG_V(DEBUG, TAG, "Attribute automation successfully started [name: %s, id: %d]", attrName.c_str(), m_id); SIM_LOG(ILogger::INFO, "Automation for " << attrName << " attribute has successfully started [ id: " << diff --git a/service/simulator/src/server/simulator_resource_factory.cpp b/service/simulator/src/server/simulator_resource_factory.cpp index 321d425..cc932c0 100644 --- a/service/simulator/src/server/simulator_resource_factory.cpp +++ b/service/simulator/src/server/simulator_resource_factory.cpp @@ -44,7 +44,7 @@ std::shared_ptr SimulatorResourceFactory::createResource( if (0 == raml->getResources().size() || nullptr == (ramlResource = raml->getResources().begin()->second)) { - OC_LOG(ERROR, TAG, "Zero resources detected from RAML!"); + OIC_LOG(ERROR, TAG, "Zero resources detected from RAML!"); return nullptr; } @@ -65,7 +65,7 @@ std::vector > SimulatorResourceFactory::creat if (0 == raml->getResources().size() || nullptr == (ramlResource = raml->getResources().begin()->second)) { - OC_LOG(ERROR, TAG, "Zero resources detected from RAML!"); + OIC_LOG(ERROR, TAG, "Zero resources detected from RAML!"); return resources; } @@ -74,7 +74,7 @@ std::vector > SimulatorResourceFactory::creat std::shared_ptr resource = buildResource(ramlResource); if (!resource) { - OC_LOG(ERROR, TAG, "Failed to create resource!"); + OIC_LOG(ERROR, TAG, "Failed to create resource!"); return resources; } @@ -217,21 +217,21 @@ RAML::RequestResponseBodyPtr SimulatorResourceFactory::getRAMLResponseBody( RAML::ActionPtr action = ramlResource->getAction(type); if (!action) { - OC_LOG(ERROR, TAG, "Resource does not possess the request!"); + OIC_LOG(ERROR, TAG, "Resource does not possess the request!"); return nullptr; } RAML::ResponsePtr response = action->getResponse(responseCode); if (!response) { - OC_LOG(ERROR, TAG, "Resource does not provide valid GET response!"); + OIC_LOG(ERROR, TAG, "Resource does not provide valid GET response!"); return nullptr; } RAML::RequestResponseBodyPtr responseBody = response->getResponseBody("application/json"); if (!responseBody) { - OC_LOG(ERROR, TAG, "GET response is not of type \"application/json\" "); + OIC_LOG(ERROR, TAG, "GET response is not of type \"application/json\" "); return nullptr; } -- 2.7.4