From 2be79ca3a44a57ae8808c7b7d6d1764c216bd347 Mon Sep 17 00:00:00 2001 From: "koushik.girijala" Date: Thu, 3 Sep 2015 16:31:42 +0530 Subject: [PATCH] [RI] Fix for out of memory issue in Arduino Mega OC log and OC log V used almost 3500bytes of RAM in Mega board because of improper log usage. Updated code using PCF properly in OC logging to save almost 3500 bytes of RAM memory. Verfied changes on both Arduino Due and Mega boards and found Working fine. Change-Id: I9ca134d5cff9c8a91707a18bd9279089533a9b99 Signed-off-by: koushik.girijala Reviewed-on: https://gerrit.iotivity.org/gerrit/2363 Tested-by: jenkins-iotivity Reviewed-by: Ashok Babu Channa Reviewed-by: Abhishek Pandey Reviewed-by: Jon A. Cruz --- resource/c_common/oic_malloc/src/oic_malloc.c | 11 +- resource/csdk/logger/include/logger.h | 12 +- resource/csdk/logger/src/logger.c | 52 +--- .../logger/test/arduino/ArduinoLoggerTest.cpp | 16 +- resource/csdk/security/include/srmutility.h | 4 +- .../sample/sampleserver_justworks.cpp | 4 +- .../sample/sampleserver_randompin.cpp | 4 +- .../provisioning/src/credentialgenerator.c | 4 +- resource/csdk/security/src/aclresource.c | 20 +- resource/csdk/security/src/amaclresource.c | 10 +- resource/csdk/security/src/credresource.c | 10 +- resource/csdk/security/src/doxmresource.c | 32 +- resource/csdk/security/src/oxmpincommon.c | 2 +- resource/csdk/security/src/policyengine.c | 38 +-- resource/csdk/security/src/psinterface.c | 12 +- resource/csdk/security/src/pstatresource.c | 14 +- resource/csdk/security/src/resourcemanager.c | 4 +- .../csdk/security/src/secureresourcemanager.c | 22 +- resource/csdk/security/src/srmutility.c | 6 +- resource/csdk/security/src/svcresource.c | 12 +- .../security/unittest/aclresourcetest.cpp | 2 +- .../security/unittest/credentialresource.cpp | 18 +- .../csdk/security/unittest/doxmresource.cpp | 4 +- .../security/unittest/iotvticalendartest.cpp | 54 ++-- resource/csdk/stack/include/payload_logging.h | 163 +++++----- .../SimpleClientServer/ocserver/ocserver.cpp | 24 +- .../linux/SimpleClientServer/occlient.cpp | 34 +-- .../SimpleClientServer/occlientbasicops.cpp | 14 +- .../linux/SimpleClientServer/occlientcoll.cpp | 14 +- .../linux/SimpleClientServer/occlientslow.cpp | 4 +- .../ocremoteaccessclient.cpp | 12 +- .../linux/SimpleClientServer/ocserverslow.cpp | 4 +- .../samples/linux/secure/occlientbasicops.cpp | 14 +- .../tizen/SimpleClientServer/occlient.cpp | 10 +- resource/csdk/stack/src/occlientcb.c | 16 +- resource/csdk/stack/src/occollection.c | 22 +- resource/csdk/stack/src/ocobserve.c | 30 +- resource/csdk/stack/src/ocpayload.c | 4 +- resource/csdk/stack/src/ocpayloadconvert.c | 12 +- resource/csdk/stack/src/ocpayloadparse.c | 32 +- resource/csdk/stack/src/ocresource.c | 62 ++-- resource/csdk/stack/src/ocserverrequest.c | 40 +-- resource/csdk/stack/src/ocstack.c | 278 +++++++++--------- resource/csdk/stack/src/oicgroup.c | 62 ++-- .../stack/test/arduino/ArduinoStackTest.cpp | 30 +- resource/csdk/stack/test/arduino/ocserver.cpp | 4 +- resource/csdk/stack/test/linux/occlient.c | 2 +- resource/csdk/stack/test/linux/ocserver.c | 2 +- .../oc_logger/samples/linux/test_logging.c | 2 +- .../NotificationManager/include/hosting.h | 2 +- .../NotificationManager/src/HostingObject.cpp | 2 +- .../src/resourceBroker/include/BrokerTypes.h | 2 +- .../src/resourceCache/include/CacheTypes.h | 2 +- .../resourceClient/RCSDiscoveryManager.cpp | 2 +- .../RCSRemoteResourceObject.cpp | 2 +- .../Reference_Thing/src/oic_lanLib.cpp | 6 +- .../arduino/Reference_Thing/src/reference.cpp | 12 +- .../arduino/Reference_Thing/src/trackee.cpp | 14 +- .../arduino/THSensorApp/src/thserver.cpp | 18 +- .../arduino/THSensorApp1/src/thserver.cpp | 18 +- .../arduino/Trackee_Thing/src/oic_lanLib.cpp | 6 +- .../arduino/Trackee_Thing/src/trackee.cpp | 12 +- 62 files changed, 663 insertions(+), 693 deletions(-) diff --git a/resource/c_common/oic_malloc/src/oic_malloc.c b/resource/c_common/oic_malloc/src/oic_malloc.c index 01717e78c..2c830596f 100644 --- a/resource/c_common/oic_malloc/src/oic_malloc.c +++ b/resource/c_common/oic_malloc/src/oic_malloc.c @@ -66,7 +66,10 @@ void *OICMalloc(size_t size) #ifdef ENABLE_MALLOC_DEBUG void *ptr = malloc(size); - count++; + if (ptr) + { + count++; + } OIC_LOG_V(INFO, TAG, "malloc: ptr=%p, size=%u, count=%u", ptr, size, count); return ptr; #else @@ -83,7 +86,11 @@ void *OICCalloc(size_t num, size_t size) #ifdef ENABLE_MALLOC_DEBUG void *ptr = calloc(num, size); - OIC_LOG_V(INFO, TAG, "calloc: ptr=%p, num=%u, size=%u", ptr, num, size); + if (ptr) + { + count++; + } + OIC_LOG_V(INFO, TAG, "calloc: ptr=%p, num=%u, size=%u, count=%u", ptr, num, size, count); return ptr; #else return calloc(num, size); diff --git a/resource/csdk/logger/include/logger.h b/resource/csdk/logger/include/logger.h index 8ee3ec3ce..81d962d1f 100644 --- a/resource/csdk/logger/include/logger.h +++ b/resource/csdk/logger/include/logger.h @@ -43,7 +43,12 @@ extern "C" { // Use the PCF macro to wrap strings stored in FLASH on the Arduino // Example: OC_LOG(INFO, TAG, PCF("Entering function")); #ifdef ARDUINO + +#ifdef __cplusplus #define PCF(str) ((PROGMEM const char *)(F(str))) +#else + #define PCF(str) ((PROGMEM const char *)(PSTR(str))) +#endif //__cplusplus #else #define PCF(str) str #endif @@ -162,18 +167,19 @@ int OCGetTizenLogLevel(LogLevel level); #define OC_LOG_BUFFER(level, tag, buffer, bufferSize) #else // These macros are defined for Linux, Android, and Arduino #define OC_LOG_INIT() OCLogInit() - #define OC_LOG(level, tag, logStr) OCLog((level), (tag), (logStr)) - #define OC_LOG_BUFFER(level, tag, buffer, bufferSize) OCLogBuffer((level), (tag), (buffer), (bufferSize)) + #define OC_LOG_BUFFER(level, tag, buffer, bufferSize) OCLogBuffer((level), PCF(tag), (buffer), (bufferSize)) #ifdef ARDUINO #define OC_LOG_CONFIG(ctx) #define OC_LOG_SHUTDOWN() + #define OC_LOG(level, tag, logStr) OCLog((level), PCF(tag), PCF(logStr)) // Use full namespace for logInit to avoid function name collision #define OC_LOG_INIT() OCLogInit() // Don't define variable argument log function for Arduino - #define OC_LOG_V(level, tag, ...) OCLogv((level), (tag), __VA_ARGS__) + #define OC_LOG_V(level, tag, format, ...) OCLogv((level), PCF(tag), PCF(format), __VA_ARGS__) #else #define OC_LOG_CONFIG(ctx) OCLogConfig((ctx)) + #define OC_LOG(level, tag, logStr) OCLog((level), (tag), (logStr)) #define OC_LOG_SHUTDOWN() OCLogShutdown() // Define variable argument log function for Linux and Android #define OC_LOG_V(level, tag, ...) OCLogv((level), (tag), __VA_ARGS__) diff --git a/resource/csdk/logger/src/logger.c b/resource/csdk/logger/src/logger.c index 3d8e4d9c1..da1a420c5 100644 --- a/resource/csdk/logger/src/logger.c +++ b/resource/csdk/logger/src/logger.c @@ -361,7 +361,7 @@ void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint1 * @param tag - Module name * @param format - variadic log string */ - void OCLogv(LogLevel level, PROGMEM const char * tag, const char * format, ...) + void OCLogv(LogLevel level, PROGMEM const char * tag, PROGMEM const char * format, ...) { char buffer[LINE_BUFFER_SIZE]; va_list ap; @@ -379,7 +379,11 @@ void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint1 } Serial.print(F(": ")); +#ifdef __AVR__ + vsnprintf_P(buffer, sizeof(buffer), format, ap); +#else vsnprintf(buffer, sizeof(buffer), format, ap); +#endif for(char *p = &buffer[0]; *p; p++) // emulate cooked mode for newlines { if(*p == '\n') @@ -391,51 +395,5 @@ void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint1 Serial.println(); va_end(ap); } - /** - * Output a variable argument list log string with the specified priority level. - * Only defined for Arduino as depicted below. - * - * @param level - DEBUG, INFO, WARNING, ERROR, FATAL - * @param tag - Module name - * @param format - variadic log string - */ - void OCLogv(LogLevel level, PROGMEM const char * tag, const __FlashStringHelper *format, ...) - { - char buffer[LINE_BUFFER_SIZE]; - va_list ap; - va_start(ap, format); - - GET_PROGMEM_BUFFER(buffer, &(LEVEL[level])); - Serial.print(buffer); - - char c; - Serial.print(F(": ")); - - while ((c = pgm_read_byte(tag))) { - Serial.write(c); - tag++; - } - Serial.print(F(": ")); - - #ifdef __AVR__ - vsnprintf_P(buffer, sizeof(buffer), (const char *)format, ap); // progmem for AVR - #else - vsnprintf(buffer, sizeof(buffer), (const char *)format, ap); // for the rest of the world - #endif - for(char *p = &buffer[0]; *p; p++) // emulate cooked mode for newlines - { - if(*p == '\n') - { - Serial.write('\r'); - } - Serial.write(*p); - } - Serial.println(); - va_end(ap); - } - #endif - - - diff --git a/resource/csdk/logger/test/arduino/ArduinoLoggerTest.cpp b/resource/csdk/logger/test/arduino/ArduinoLoggerTest.cpp index f1f89abae..a1a698777 100644 --- a/resource/csdk/logger/test/arduino/ArduinoLoggerTest.cpp +++ b/resource/csdk/logger/test/arduino/ArduinoLoggerTest.cpp @@ -23,16 +23,16 @@ #include "ArduinoLoggerTest.h" #include "logger.h" -PROGMEM const char tag[] = "Arduino"; -PROGMEM const char msg[] = "Arduino Logger Test"; +#define tag "Arduino" +#define msg "Arduino Logger Test" -PROGMEM const char debugMsg[] = "this is a DEBUG message"; -PROGMEM const char infoMsg[] = "this is a INFO message"; -PROGMEM const char warningMsg[] = "this is a WARNING message"; -PROGMEM const char errorMsg[] = "this is a ERROR message"; -PROGMEM const char fatalMsg[] = "this is a FATAL message"; +#define debugMsg "this is a DEBUG message" +#define infoMsg "this is a INFO message" +#define warningMsg "this is a WARNING message" +#define errorMsg "this is a ERROR message" +#define fatalMsg "this is a FATAL message" -PROGMEM const char multiLineMsg[] = "this is a DEBUG message\non multiple\nlines"; +#define multiLineMsg "this is a DEBUG message\non multiple\nlines" //----------------------------------------------------------------------------- diff --git a/resource/csdk/security/include/srmutility.h b/resource/csdk/security/include/srmutility.h index 9230ef6ea..b14d469c0 100644 --- a/resource/csdk/security/include/srmutility.h +++ b/resource/csdk/security/include/srmutility.h @@ -65,7 +65,7 @@ struct OicParseQueryIter * */ #define VERIFY_SUCCESS(tag, op, logLevel) do{ if (!(op)) \ - {OC_LOG((logLevel), tag, PCF(#op " failed!!")); goto exit; } }while(0) + {OC_LOG((logLevel), tag, #op " failed!!"); goto exit; } }while(0) /** * @def VERIFY_NON_NULL @@ -75,7 +75,7 @@ struct OicParseQueryIter * */ #define VERIFY_NON_NULL(tag, arg, logLevel) do{ if (NULL == (arg)) \ - { OC_LOG((logLevel), tag, PCF(#arg " is NULL")); goto exit; } }while(0) + { OC_LOG((logLevel), tag, #arg " is NULL"); goto exit; } }while(0) /** * This method initializes the OicParseQueryIter_t struct diff --git a/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp b/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp index 1bbaf4142..c31a61267 100644 --- a/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp +++ b/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp @@ -132,7 +132,7 @@ OCRepPayload* getPayload(const char* uri, int64_t power, bool state) OCRepPayload* payload = OCRepPayloadCreate(); if(!payload) { - OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); + OC_LOG(ERROR, TAG, "Failed to allocate Payload"); return NULL; } @@ -148,7 +148,7 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) { if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, TAG, PCF("Incoming payload not a representation")); + OC_LOG(ERROR, TAG, "Incoming payload not a representation"); return NULL; } diff --git a/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp b/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp index bd9560fb8..f00f3dcb0 100644 --- a/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp +++ b/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp @@ -133,7 +133,7 @@ OCRepPayload* getPayload(const char* uri, int64_t power, bool state) OCRepPayload* payload = OCRepPayloadCreate(); if(!payload) { - OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); + OC_LOG(ERROR, TAG, "Failed to allocate Payload"); return NULL; } @@ -149,7 +149,7 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) { if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, TAG, PCF("Incoming payload not a representation")); + OC_LOG(ERROR, TAG, "Incoming payload not a representation"); return NULL; } diff --git a/resource/csdk/security/provisioning/src/credentialgenerator.c b/resource/csdk/security/provisioning/src/credentialgenerator.c index 03436275f..ece5cf669 100644 --- a/resource/csdk/security/provisioning/src/credentialgenerator.c +++ b/resource/csdk/security/provisioning/src/credentialgenerator.c @@ -37,7 +37,7 @@ * must define "OCStackResult res" for setting error code. * */ #define PM_VERIFY_SUCCESS(tag, op, errCode, logLevel) { if (!(op)) \ - {OC_LOG((logLevel), tag, PCF(#op " failed!!")); res = errCode; goto bail;} } + {OC_LOG((logLevel), tag, #op " failed!!"); res = errCode; goto bail;} } /** * @def PM_VERIFY_NON_NULL * @brief Macro to verify argument is not equal to NULL. @@ -45,7 +45,7 @@ * @note Invoking function must define "bail:" label for goto functionality to work correctly. * */ #define PM_VERIFY_NON_NULL(tag, arg, errCode, logLevel) { if (NULL == (arg)) \ - { OC_LOG((logLevel), tag, PCF(#arg " is NULL")); res = errCode; goto bail;} } + { OC_LOG((logLevel), tag, #arg " is NULL"); res = errCode; goto bail;} } OCStackResult PMGeneratePairWiseCredentials(OicSecCredType_t type, size_t keySize, const OicUuid_t *ptDeviceId, diff --git a/resource/csdk/security/src/aclresource.c b/resource/csdk/security/src/aclresource.c index 1b858f8ac..3a18703f9 100644 --- a/resource/csdk/security/src/aclresource.c +++ b/resource/csdk/security/src/aclresource.c @@ -41,7 +41,7 @@ #include #endif -#define TAG PCF("SRM-ACL") +#define TAG "SRM-ACL" OicSecAcl_t *gAcl = NULL; static OCResourceHandle gAclHandle = NULL; @@ -54,7 +54,7 @@ static void FreeACE(OicSecAcl_t *ace) size_t i; if(NULL == ace) { - OC_LOG (INFO, TAG, PCF("Invalid Parameter")); + OC_LOG (INFO, TAG, "Invalid Parameter"); return; } @@ -423,7 +423,7 @@ static bool UpdatePersistentStorage(const OicSecAcl_t *acl) static OCStackResult RemoveACE(const OicUuid_t * subject, const char * resource) { - OC_LOG(INFO, TAG, PCF("IN RemoveACE")); + OC_LOG(INFO, TAG, "IN RemoveACE"); OicSecAcl_t *acl = NULL; OicSecAcl_t *tempAcl = NULL; @@ -432,7 +432,7 @@ static OCStackResult RemoveACE(const OicUuid_t * subject, if(memcmp(subject->id, &WILDCARD_SUBJECT_ID, sizeof(subject->id)) == 0) { - OC_LOG_V (INFO, TAG, PCF("%s received invalid parameter"), __func__ ); + OC_LOG_V (INFO, TAG, "%s received invalid parameter", __func__ ); return OC_STACK_INVALID_PARAM; } @@ -521,7 +521,7 @@ static OCEntityHandlerResult HandleACLGetRequest (const OCEntityHandlerRequest * OICFree(jsonStr); - OC_LOG_V (INFO, TAG, PCF("%s RetVal %d"), __func__ , ehRet); + OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -546,13 +546,13 @@ static OCEntityHandlerResult HandleACLPostRequest (const OCEntityHandlerRequest // Send payload to request originator SendSRMResponse(ehRequest, ehRet, NULL); - OC_LOG_V (INFO, TAG, PCF("%s RetVal %d"), __func__ , ehRet); + OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } static OCEntityHandlerResult HandleACLDeleteRequest(const OCEntityHandlerRequest *ehRequest) { - OC_LOG (INFO, TAG, PCF("Processing ACLDeleteRequest")); + OC_LOG (INFO, TAG, "Processing ACLDeleteRequest"); OCEntityHandlerResult ehRet = OC_EH_ERROR; if(NULL == ehRequest->query) @@ -609,7 +609,7 @@ OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag, OCEntityHandlerRequest * ehRequest, void* callbackParameter) { - OC_LOG(INFO, TAG, PCF("Received request ACLEntityHandler")); + OC_LOG(INFO, TAG, "Received request ACLEntityHandler"); (void)callbackParameter; OCEntityHandlerResult ehRet = OC_EH_ERROR; @@ -621,7 +621,7 @@ OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { // TODO : Handle PUT and DEL methods - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: @@ -662,7 +662,7 @@ OCStackResult CreateACLResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, PCF("Unable to instantiate ACL resource")); + OC_LOG (FATAL, TAG, "Unable to instantiate ACL resource"); DeInitACLResource(); } return ret; diff --git a/resource/csdk/security/src/amaclresource.c b/resource/csdk/security/src/amaclresource.c index 5b80fbe3e..e0ba0b2be 100644 --- a/resource/csdk/security/src/amaclresource.c +++ b/resource/csdk/security/src/amaclresource.c @@ -36,7 +36,7 @@ #include #include -#define TAG PCF("SRM-AMACL") +#define TAG "SRM-AMACL" OicSecAmacl_t *gAmacl = NULL; static OCResourceHandle gAmaclHandle = NULL; @@ -259,7 +259,7 @@ static OCEntityHandlerResult HandleAmaclGetRequest (const OCEntityHandlerRequest OICFree(jsonStr); - OC_LOG_V (INFO, TAG, PCF("%s RetVal %d"), __func__ , ehRet); + OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -294,7 +294,7 @@ static OCEntityHandlerResult HandleAmaclPostRequest (const OCEntityHandlerReques // Send payload to request originator SendSRMResponse(ehRequest, ehRet, NULL); - OC_LOG_V (INFO, TAG, PCF("%s RetVal %d"), __func__ , ehRet); + OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -316,7 +316,7 @@ OCEntityHandlerResult AmaclEntityHandler (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: @@ -353,7 +353,7 @@ OCStackResult CreateAmaclResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, PCF("Unable to instantiate Amacl resource")); + OC_LOG (FATAL, TAG, "Unable to instantiate Amacl resource"); DeInitAmaclResource(); } return ret; diff --git a/resource/csdk/security/src/credresource.c b/resource/csdk/security/src/credresource.c index 901e5d53a..f2c1dc8f4 100644 --- a/resource/csdk/security/src/credresource.c +++ b/resource/csdk/security/src/credresource.c @@ -42,7 +42,7 @@ #endif #include -#define TAG PCF("SRM-CREDL") +#define TAG "SRM-CREDL" static OicSecCred_t *gCred = NULL; @@ -55,7 +55,7 @@ static void FreeCred(OicSecCred_t *cred) { if(NULL == cred) { - OC_LOG (INFO, TAG, PCF("Invalid Parameter")); + OC_LOG (INFO, TAG, "Invalid Parameter"); return; } //Note: Need further clarification on roleID data type @@ -587,7 +587,7 @@ static OCEntityHandlerResult HandlePostRequest(const OCEntityHandlerRequest * eh static OCEntityHandlerResult HandleDeleteRequest(const OCEntityHandlerRequest *ehRequest) { - OC_LOG_V (INFO, TAG, PCF("Processing CredDeleteRequest")); + OC_LOG(INFO, TAG, "Processing CredDeleteRequest"); OCEntityHandlerResult ehRet = OC_EH_ERROR; @@ -645,7 +645,7 @@ OCEntityHandlerResult CredEntityHandler (OCEntityHandlerFlag flag, } if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); //TODO : Handle PUT/DEL methods switch(ehRequest->method) { @@ -688,7 +688,7 @@ OCStackResult CreateCredResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, PCF("Unable to instantiate Cred resource")); + OC_LOG (FATAL, TAG, "Unable to instantiate Cred resource"); DeInitCredResource(); } return ret; diff --git a/resource/csdk/security/src/doxmresource.c b/resource/csdk/security/src/doxmresource.c index 78d91ba61..feb9d1ca5 100644 --- a/resource/csdk/security/src/doxmresource.c +++ b/resource/csdk/security/src/doxmresource.c @@ -47,7 +47,7 @@ #include #endif -#define TAG PCF("SRM-DOXM") +#define TAG "SRM-DOXM" static OicSecDoxm_t *gDoxm = NULL; static OCResourceHandle gDoxmHandle = NULL; @@ -350,7 +350,7 @@ static bool ValidateQuery(unsigned char * query) // access rules. Eventually, the PE and PM code will // not send a request to the /doxm Entity Handler at all // if it should not respond. - OC_LOG (INFO, TAG, PCF("In ValidateQuery")); + OC_LOG (INFO, TAG, "In ValidateQuery"); if(NULL == gDoxm) { return false; @@ -384,12 +384,12 @@ static OCEntityHandlerResult HandleDoxmGetRequest (const OCEntityHandlerRequest char* jsonStr = NULL; OCEntityHandlerResult ehRet = OC_EH_OK; - OC_LOG (INFO, TAG, PCF("Doxm EntityHandle processing GET request")); + OC_LOG (INFO, TAG, "Doxm EntityHandle processing GET request"); //Checking if Get request is a query. if(ehRequest->query) { - OC_LOG (INFO, TAG, PCF("HandleDoxmGetRequest processing query")); + OC_LOG (INFO, TAG, "HandleDoxmGetRequest processing query"); if(!ValidateQuery((unsigned char *)ehRequest->query)) { ehRet = OC_EH_ERROR; @@ -408,7 +408,7 @@ static OCEntityHandlerResult HandleDoxmGetRequest (const OCEntityHandlerRequest // Send response payload to request originator if(OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, jsonStr)) { - OC_LOG (ERROR, TAG, PCF("SendSRMResponse failed in HandleDoxmGetRequest")); + OC_LOG (ERROR, TAG, "SendSRMResponse failed in HandleDoxmGetRequest"); } OICFree(jsonStr); @@ -444,7 +444,7 @@ static OCEntityHandlerResult AddOwnerPSK(const CAEndpoint_t* endpoint, sizeof(base64Buff), &outLen); VERIFY_SUCCESS(TAG, b64Ret == B64_OK, ERROR); - OC_LOG (INFO, TAG, PCF("Doxm EntityHandle generating Credential")); + OC_LOG (INFO, TAG, "Doxm EntityHandle generating Credential"); cred = GenerateCredential(&ptDoxm->owner, SYMMETRIC_PAIR_WISE_KEY, NULL, base64Buff, ownLen, &ptDoxm->owner); VERIFY_NON_NULL(TAG, cred, ERROR); @@ -465,7 +465,7 @@ exit: static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest * ehRequest) { - OC_LOG (INFO, TAG, PCF("Doxm EntityHandle processing PUT request")); + OC_LOG (INFO, TAG, "Doxm EntityHandle processing PUT request"); OCEntityHandlerResult ehRet = OC_EH_ERROR; OicUuid_t emptyOwner = {.id = {0}}; @@ -487,7 +487,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest */ if ((false == gDoxm->owned) && (false == newDoxm->owned)) { - OC_LOG (INFO, TAG, PCF("Doxm EntityHandle enabling AnonECDHCipherSuite")); + OC_LOG (INFO, TAG, "Doxm EntityHandle enabling AnonECDHCipherSuite"); #ifdef __WITH_DTLS__ ehRet = (CAEnableAnonECDHCipherSuite(true) == CA_STATUS_OK) ? OC_EH_OK : OC_EH_ERROR; #endif //__WITH_DTLS__ @@ -512,7 +512,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest OCServerRequest *request = (OCServerRequest *)ehRequest->requestHandle; //Generating OwnerPSK - OC_LOG (INFO, TAG, PCF("Doxm EntityHandle generating OwnerPSK")); + OC_LOG (INFO, TAG, "Doxm EntityHandle generating OwnerPSK"); //Generate new credential for provisioning tool ehRet = AddOwnerPSK((CAEndpoint_t *)&request->devAddr, newDoxm, @@ -637,7 +637,7 @@ exit: //Send payload to request originator if(OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, NULL)) { - OC_LOG (ERROR, TAG, PCF("SendSRMResponse failed in HandlePstatPostRequest")); + OC_LOG (ERROR, TAG, "SendSRMResponse failed in HandlePstatPostRequest"); } DeleteDoxmBinData(newDoxm); @@ -662,7 +662,7 @@ OCEntityHandlerResult DoxmEntityHandler (OCEntityHandlerFlag flag, if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: @@ -700,7 +700,7 @@ OCStackResult CreateDoxmResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, PCF("Unable to instantiate Doxm resource")); + OC_LOG (FATAL, TAG, "Unable to instantiate Doxm resource"); DeInitDoxmResource(); } return ret; @@ -729,7 +729,7 @@ static OCStackResult CheckDeviceID() { if (OCGenerateUuid(gDoxm->deviceID.id) != RAND_UUID_OK) { - OC_LOG(FATAL, TAG, PCF("Generate UUID for Server Instance failed!")); + OC_LOG(FATAL, TAG, "Generate UUID for Server Instance failed!"); return ret; } ret = OC_STACK_OK; @@ -737,7 +737,7 @@ static OCStackResult CheckDeviceID() if (UpdatePersistentStorage(gDoxm)) { //TODO: After registering PSI handler in all samples, do ret = OC_STACK_OK here. - OC_LOG(FATAL, TAG, PCF("UpdatePersistentStorage failed!")); + OC_LOG(FATAL, TAG, "UpdatePersistentStorage failed!"); } } else @@ -753,7 +753,7 @@ static OCStackResult CheckDeviceID() */ static OicSecDoxm_t* GetDoxmDefault() { - OC_LOG (INFO, TAG, PCF("GetDoxmToDefault")); + OC_LOG (INFO, TAG, "GetDoxmToDefault"); return &gDefaultDoxm; } @@ -800,7 +800,7 @@ OCStackResult InitDoxmResource() } else { - OC_LOG (ERROR, TAG, PCF("CheckDeviceID failed")); + OC_LOG (ERROR, TAG, "CheckDeviceID failed"); } OICFree(jsonSVRDatabase); return ret; diff --git a/resource/csdk/security/src/oxmpincommon.c b/resource/csdk/security/src/oxmpincommon.c index fc7c0f3f0..85612e936 100644 --- a/resource/csdk/security/src/oxmpincommon.c +++ b/resource/csdk/security/src/oxmpincommon.c @@ -22,7 +22,7 @@ #include "logger.h" #include "pinoxmcommon.h" -#define TAG PCF("PIN_OXM_COMMON") +#define TAG "PIN_OXM_COMMON" static GeneratePinCallback gGenPinCallback = NULL; static InputPinCallback gInputPinCallback = NULL; diff --git a/resource/csdk/security/src/policyengine.c b/resource/csdk/security/src/policyengine.c index 9a61f0075..00fe55b9e 100644 --- a/resource/csdk/security/src/policyengine.c +++ b/resource/csdk/security/src/policyengine.c @@ -30,7 +30,7 @@ #include "iotvticalendar.h" #include -#define TAG PCF("SRM-PE") +#define TAG "SRM-PE" /** * Return the uint16_t CRUDN permission corresponding to passed CAMethod_t. @@ -208,11 +208,11 @@ static bool IsAccessWithinValidTime(const OicSecAcl_t *acl) if(IOTVTICAL_VALID_ACCESS == IsRequestWithinValidTime(acl->periods[i], acl->recurrences[i])) { - OC_LOG(INFO, TAG, PCF("Access request is in allowed time period")); + OC_LOG(INFO, TAG, "Access request is in allowed time period"); return true; } } - OC_LOG(INFO, TAG, PCF("Access request is in invalid time period")); + OC_LOG(INFO, TAG, "Access request is in invalid time period"); return false; #else @@ -250,7 +250,7 @@ static bool IsAccessWithinValidTime(const OicSecAcl_t *acl) */ void ProcessAccessRequest(PEContext_t *context) { - OC_LOG(INFO, TAG, PCF("Entering ProcessAccessRequest()")); + OC_LOG(INFO, TAG, "Entering ProcessAccessRequest()"); if(NULL != context) { const OicSecAcl_t *currentAcl = NULL; @@ -260,20 +260,20 @@ void ProcessAccessRequest(PEContext_t *context) context->retVal = ACCESS_DENIED_SUBJECT_NOT_FOUND; do { - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): getting ACL...")); + OC_LOG(INFO, TAG, "ProcessAccessRequest(): getting ACL..."); currentAcl = GetACLResourceData(context->subject, &savePtr); if(NULL != currentAcl) { // Found the subject, so how about resource? - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - found ACL matching subject.")); + OC_LOG(INFO, TAG, "ProcessAccessRequest(): \ + found ACL matching subject."); context->retVal = ACCESS_DENIED_RESOURCE_NOT_FOUND; - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - Searching for resource...")); + OC_LOG(INFO, TAG, "ProcessAccessRequest(): \ + Searching for resource..."); if(IsResourceInAcl(context->resource, currentAcl)) { - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - found matching resource in ACL.")); + OC_LOG(INFO, TAG, "ProcessAccessRequest(): \ + found matching resource in ACL."); context->matchingAclFound = true; // Found the resource, so it's down to valid period & permission. @@ -291,27 +291,27 @@ void ProcessAccessRequest(PEContext_t *context) } else { - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - no ACL found matching subject .")); + OC_LOG(INFO, TAG, "ProcessAccessRequest(): \ + no ACL found matching subject ."); } } while((NULL != currentAcl) && (false == context->matchingAclFound)); if(IsAccessGranted(context->retVal)) { - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - Leaving ProcessAccessRequest(ACCESS_GRANTED)")); + OC_LOG(INFO, TAG, "ProcessAccessRequest(): \ + Leaving ProcessAccessRequest(ACCESS_GRANTED)"); } else { - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - Leaving ProcessAccessRequest(ACCESS_DENIED)")); + OC_LOG(INFO, TAG, "ProcessAccessRequest(): \ + Leaving ProcessAccessRequest(ACCESS_DENIED)"); } } else { - OC_LOG(INFO, TAG, PCF("ProcessAccessRequest(): \ - Leaving ProcessAccessRequest(context is NULL)")); + OC_LOG(INFO, TAG, "ProcessAccessRequest(): \ + Leaving ProcessAccessRequest(context is NULL)"); } } diff --git a/resource/csdk/security/src/psinterface.c b/resource/csdk/security/src/psinterface.c index 746a16495..293892dc5 100644 --- a/resource/csdk/security/src/psinterface.c +++ b/resource/csdk/security/src/psinterface.c @@ -30,7 +30,7 @@ #include #include -#define TAG PCF("SRM-PSI") +#define TAG "SRM-PSI" //SVR database buffer block size const size_t DB_FILE_SIZE_BLOCK = 1023; @@ -81,7 +81,7 @@ char * GetSVRDatabase() int size = GetSVRDatabaseSize(ps); if (0 == size) { - OC_LOG (ERROR, TAG, PCF("FindSVRDatabaseSize failed")); + OC_LOG (ERROR, TAG, "FindSVRDatabaseSize failed"); return NULL; } @@ -96,13 +96,13 @@ char * GetSVRDatabase() size_t bytesRead = ps->read(jsonStr, 1, size, fp); jsonStr[bytesRead] = '\0'; - OC_LOG_V(INFO, TAG, PCF("Read %d bytes from SVR database file"), bytesRead); + OC_LOG_V(INFO, TAG, "Read %d bytes from SVR database file", bytesRead); ps->close(fp); fp = NULL; } else { - OC_LOG (ERROR, TAG, PCF("Unable to open SVR database file!!")); + OC_LOG (ERROR, TAG, "Unable to open SVR database file!!"); } } @@ -189,13 +189,13 @@ OCStackResult UpdateSVRDatabase(const char* rsrcName, cJSON* jsonObj) { ret = OC_STACK_OK; } - OC_LOG_V(INFO, TAG, PCF("Written %d bytes into SVR database file"), bytesWritten); + OC_LOG_V(INFO, TAG, "Written %d bytes into SVR database file", bytesWritten); ps->close(fp); fp = NULL; } else { - OC_LOG (ERROR, TAG, PCF("Unable to open SVR database file!! ")); + OC_LOG (ERROR, TAG, "Unable to open SVR database file!! "); } } diff --git a/resource/csdk/security/src/pstatresource.c b/resource/csdk/security/src/pstatresource.c index 7ca79b1be..f7beefd2d 100644 --- a/resource/csdk/security/src/pstatresource.c +++ b/resource/csdk/security/src/pstatresource.c @@ -32,7 +32,7 @@ #include #include -#define TAG PCF("SRM-PSTAT") +#define TAG "SRM-PSTAT" static OicSecDpom_t gSm = SINGLE_SERVICE_CLIENT_DRIVEN; static OicSecPstat_t gDefaultPstat = @@ -183,7 +183,7 @@ exit: cJSON_Delete(jsonRoot); if (OC_STACK_OK != ret) { - OC_LOG (ERROR, TAG, PCF("JSONToPstatBin failed")); + OC_LOG (ERROR, TAG, "JSONToPstatBin failed"); DeletePstatBinData(pstat); pstat = NULL; } @@ -238,11 +238,11 @@ static OCEntityHandlerResult HandlePstatPutRequest(const OCEntityHandlerRequest { gPstat->isOp = true; gPstat->cm = NORMAL; - OC_LOG (INFO, TAG, PCF("CommitHash is valid and isOp is TRUE")); + OC_LOG (INFO, TAG, "CommitHash is valid and isOp is TRUE"); } else { - OC_LOG (INFO, TAG, PCF("CommitHash is not valid")); + OC_LOG (INFO, TAG, "CommitHash is not valid"); } } cJSON *omJson = cJSON_GetObjectItem(jsonPstat, OIC_JSON_OM_NAME); @@ -277,7 +277,7 @@ static OCEntityHandlerResult HandlePstatPutRequest(const OCEntityHandlerRequest //Send payload to request originator if(OC_STACK_OK != SendSRMResponse(ehRequest, ehRet, NULL)) { - OC_LOG (ERROR, TAG, PCF("SendSRMResponse failed in HandlePstatPostRequest")); + OC_LOG (ERROR, TAG, "SendSRMResponse failed in HandlePstatPostRequest"); } cJSON_Delete(postJson); return ehRet; @@ -295,7 +295,7 @@ OCEntityHandlerResult PstatEntityHandler(OCEntityHandlerFlag flag, // This method will handle REST request (GET/POST) for /oic/sec/pstat if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG"); switch (ehRequest->method) { case OC_REST_GET: @@ -330,7 +330,7 @@ OCStackResult CreatePstatResource() if (ret != OC_STACK_OK) { - OC_LOG (FATAL, TAG, PCF("Unable to instantiate pstat resource")); + OC_LOG (FATAL, TAG, "Unable to instantiate pstat resource"); DeInitPstatResource(); } return ret; diff --git a/resource/csdk/security/src/resourcemanager.c b/resource/csdk/security/src/resourcemanager.c index 5eefbd4a5..5faeb1c54 100644 --- a/resource/csdk/security/src/resourcemanager.c +++ b/resource/csdk/security/src/resourcemanager.c @@ -32,7 +32,7 @@ #include "utlist.h" #include -#define TAG PCF("SRM-RM") +#define TAG "SRM-RM" /** * This method is used by all secure resource modules to send responses to REST queries. @@ -46,7 +46,7 @@ OCStackResult SendSRMResponse(const OCEntityHandlerRequest *ehRequest, OCEntityHandlerResult ehRet, const char *rspPayload) { - OC_LOG (INFO, TAG, PCF("SRM sending SRM response")); + OC_LOG (INFO, TAG, "SRM sending SRM response"); OCEntityHandlerResponse response = {.requestHandle = NULL}; if (ehRequest) { diff --git a/resource/csdk/security/src/secureresourcemanager.c b/resource/csdk/security/src/secureresourcemanager.c index ab560711b..2a7e39531 100644 --- a/resource/csdk/security/src/secureresourcemanager.c +++ b/resource/csdk/security/src/secureresourcemanager.c @@ -28,7 +28,7 @@ #include "oic_string.h" #include -#define TAG PCF("SRM") +#define TAG "SRM" //Request Callback handler static CARequestCallback gRequestHandler = NULL; @@ -63,11 +63,11 @@ void SRMRegisterProvisioningResponseHandler(SPResponseCallback respHandler) */ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requestInfo) { - OC_LOG(INFO, TAG, PCF("Received request from remote device")); + OC_LOG(INFO, TAG, "Received request from remote device"); if (!endPoint || !requestInfo) { - OC_LOG(ERROR, TAG, PCF("Invalid arguments")); + OC_LOG(ERROR, TAG, "Invalid arguments"); return; } @@ -84,7 +84,7 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ } if (position > MAX_URI_LENGTH) { - OC_LOG(ERROR, TAG, PCF("URI length is too long")); + OC_LOG(ERROR, TAG, "URI length is too long"); return; } SRMAccessResponse_t response = ACCESS_DENIED; @@ -129,7 +129,7 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ if (CA_STATUS_OK != CASendResponse(endPoint, &responseInfo)) { - OC_LOG(ERROR, TAG, PCF("Failed in sending response to a unauthorized request!")); + OC_LOG(ERROR, TAG, "Failed in sending response to a unauthorized request!"); } } @@ -141,7 +141,7 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ */ void SRMResponseHandler(const CAEndpoint_t *endPoint, const CAResponseInfo_t *responseInfo) { - OC_LOG(INFO, TAG, PCF("Received response from remote device")); + OC_LOG(INFO, TAG, "Received response from remote device"); // isProvResponse flag is to check whether response is catered by provisioning APIs or not. // When token sent by CA response matches with token generated by provisioning request, @@ -169,7 +169,7 @@ void SRMResponseHandler(const CAEndpoint_t *endPoint, const CAResponseInfo_t *re */ void SRMErrorHandler(const CAEndpoint_t *endPoint, const CAErrorInfo_t *errorInfo) { - OC_LOG(INFO, TAG, PCF("Received error from remote device")); + OC_LOG(INFO, TAG, "Received error from remote device"); if (gErrorHandler) { gErrorHandler(endPoint, errorInfo); @@ -190,10 +190,10 @@ OCStackResult SRMRegisterHandler(CARequestCallback reqHandler, CAResponseCallback respHandler, CAErrorCallback errHandler) { - OC_LOG(INFO, TAG, PCF("SRMRegisterHandler !!")); + OC_LOG(INFO, TAG, "SRMRegisterHandler !!"); if( !reqHandler || !respHandler || !errHandler) { - OC_LOG(ERROR, TAG, PCF("Callback handlers are invalid")); + OC_LOG(ERROR, TAG, "Callback handlers are invalid"); return OC_STACK_INVALID_PARAM; } gRequestHandler = reqHandler; @@ -218,10 +218,10 @@ OCStackResult SRMRegisterHandler(CARequestCallback reqHandler, */ OCStackResult SRMRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler) { - OC_LOG(INFO, TAG, PCF("SRMRegisterPersistentStorageHandler !!")); + OC_LOG(INFO, TAG, "SRMRegisterPersistentStorageHandler !!"); if(!persistentStorageHandler) { - OC_LOG(ERROR, TAG, PCF("The persistent storage handler is invalid")); + OC_LOG(ERROR, TAG, "The persistent storage handler is invalid"); return OC_STACK_INVALID_PARAM; } gPersistentStorageHandler = persistentStorageHandler; diff --git a/resource/csdk/security/src/srmutility.c b/resource/csdk/security/src/srmutility.c index 510a5c5ce..af529389d 100644 --- a/resource/csdk/security/src/srmutility.c +++ b/resource/csdk/security/src/srmutility.c @@ -26,7 +26,7 @@ #include "oic_malloc.h" #include "base64.h" -#define TAG PCF("SRM-UTILITY") +#define TAG "SRM-UTILITY" /** * This method initializes the OicParseQueryIter_t struct @@ -37,7 +37,7 @@ */ void ParseQueryIterInit(unsigned char * query, OicParseQueryIter_t * parseIter) { - OC_LOG (INFO, TAG, PCF("Initializing coap iterator")); + OC_LOG (INFO, TAG, "Initializing coap iterator"); if((NULL == query) || (NULL == parseIter)) return; @@ -61,7 +61,7 @@ void ParseQueryIterInit(unsigned char * query, OicParseQueryIter_t * parseIter) */ OicParseQueryIter_t * GetNextQuery(OicParseQueryIter_t * parseIter) { - OC_LOG (INFO, TAG, PCF("Getting Next Query")); + OC_LOG (INFO, TAG, "Getting Next Query"); if(NULL == parseIter) return NULL; diff --git a/resource/csdk/security/src/svcresource.c b/resource/csdk/security/src/svcresource.c index abd6bc471..29bbec181 100644 --- a/resource/csdk/security/src/svcresource.c +++ b/resource/csdk/security/src/svcresource.c @@ -32,7 +32,7 @@ #include #include -#define TAG PCF("SRM-SVC") +#define TAG "SRM-SVC" OicSecSvc_t *gSvc = NULL; static OCResourceHandle gSvcHandle = NULL; @@ -239,7 +239,7 @@ static OCEntityHandlerResult HandleSVCGetRequest (const OCEntityHandlerRequest * OICFree(jsonStr); - OC_LOG_V (INFO, TAG, PCF("%s RetVal %d"), __func__ , ehRet); + OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -274,7 +274,7 @@ static OCEntityHandlerResult HandleSVCPostRequest (const OCEntityHandlerRequest // Send payload to request originator SendSRMResponse(ehRequest, ehRet, NULL); - OC_LOG_V (INFO, TAG, PCF("%s RetVal %d"), __func__ , ehRet); + OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet); return ehRet; } @@ -332,7 +332,7 @@ OCStackResult CreateSVCResource() if (OC_STACK_OK != ret) { - OC_LOG (FATAL, TAG, PCF("Unable to instantiate SVC resource")); + OC_LOG (FATAL, TAG, "Unable to instantiate SVC resource"); DeInitSVCResource(); } return ret; @@ -343,7 +343,7 @@ OCStackResult InitSVCResource() { OCStackResult ret = OC_STACK_ERROR; - OC_LOG_V (INFO, TAG, PCF("Begin %s "), __func__ ); + OC_LOG_V (INFO, TAG, "Begin %s ", __func__ ); // Read SVC resource from PS char* jsonSVRDatabase = GetSVRDatabase(); @@ -363,7 +363,7 @@ OCStackResult InitSVCResource() DeInitSVCResource(); } - OC_LOG_V (INFO, TAG, PCF("%s RetVal %d"), __func__ , ret); + OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ret); return ret; } diff --git a/resource/csdk/security/unittest/aclresourcetest.cpp b/resource/csdk/security/unittest/aclresourcetest.cpp index 9bbca6cc3..d6da2af66 100644 --- a/resource/csdk/security/unittest/aclresourcetest.cpp +++ b/resource/csdk/security/unittest/aclresourcetest.cpp @@ -39,7 +39,7 @@ using namespace std; -#define TAG PCF("SRM-ACL-UT") +#define TAG "SRM-ACL-UT" #ifdef __cplusplus extern "C" { diff --git a/resource/csdk/security/unittest/credentialresource.cpp b/resource/csdk/security/unittest/credentialresource.cpp index 1ee92385e..e510b6db4 100644 --- a/resource/csdk/security/unittest/credentialresource.cpp +++ b/resource/csdk/security/unittest/credentialresource.cpp @@ -28,7 +28,7 @@ #include "srmutility.h" #include "logger.h" -#define TAG PCF("SRM-CRED-UT") +#define TAG "SRM-CRED-UT" #ifdef __cplusplus extern "C" { @@ -120,21 +120,21 @@ static void printCred(const OicSecCred_t * cred) const OicSecCred_t *credTmp1 = NULL; for(credTmp1 = cred; credTmp1; credTmp1 = credTmp1->next) { - OC_LOG_V(INFO, TAG, PCF("\ncred->credId = %d"), credTmp1->credId); - OC_LOG_V(INFO, TAG, PCF("cred->subject.id = %s"), credTmp1->subject.id); - OC_LOG_V(INFO, TAG, PCF("cred->credType = %d"), credTmp1->credType); + OC_LOG_V(INFO, TAG, "\ncred->credId = %d", credTmp1->credId); + OC_LOG_V(INFO, TAG, "cred->subject.id = %s", credTmp1->subject.id); + OC_LOG_V(INFO, TAG, "cred->credType = %d", credTmp1->credType); if(credTmp1->privateData.data) { - OC_LOG_V(INFO, TAG, PCF("cred->privateData.data = %s"), credTmp1->privateData.data); + OC_LOG_V(INFO, TAG, "cred->privateData.data = %s", credTmp1->privateData.data); } if(credTmp1->publicData.data) { - OC_LOG_V(INFO, TAG, PCF("cred->publicData.data = %s"), credTmp1->publicData.data); + OC_LOG_V(INFO, TAG, "cred->publicData.data = %s", credTmp1->publicData.data); } - OC_LOG_V(INFO, TAG, PCF("cred->ownersLen = %zd"), credTmp1->ownersLen); + OC_LOG_V(INFO, TAG, "cred->ownersLen = %zd", credTmp1->ownersLen); for(size_t i = 0; i < cred->ownersLen; i++) { - OC_LOG_V(INFO, TAG, PCF("cred->owners[%zd].id = %s"), i, credTmp1->owners[i].id); + OC_LOG_V(INFO, TAG, "cred->owners[%zd].id = %s", i, credTmp1->owners[i].id); } } } @@ -246,7 +246,7 @@ TEST(BinToCredJSONTest, BinToCredJSONValidCred) json = BinToCredJSON(cred); - OC_LOG_V(INFO, TAG, PCF("BinToCredJSON:%s\n"), json); + OC_LOG_V(INFO, TAG, "BinToCredJSON:%s\n", json); EXPECT_TRUE(json != NULL); DeleteCredList(cred); OICFree(json); diff --git a/resource/csdk/security/unittest/doxmresource.cpp b/resource/csdk/security/unittest/doxmresource.cpp index cfee71a80..1f138c94d 100644 --- a/resource/csdk/security/unittest/doxmresource.cpp +++ b/resource/csdk/security/unittest/doxmresource.cpp @@ -27,7 +27,7 @@ #include "oic_malloc.h" #include "logger.h" -#define TAG PCF("SRM-DOXM") +#define TAG "SRM-DOXM" #ifdef __cplusplus extern "C" { @@ -152,7 +152,7 @@ TEST(BinToDoxmJSONTest, BinToDoxmJSONValidDoxm) OicSecDoxm_t * doxm = getBinDoxm(); char * json = BinToDoxmJSON(doxm); - OC_LOG_V(INFO, TAG, PCF("BinToDoxmJSON:%s"), json); + OC_LOG_V(INFO, TAG, "BinToDoxmJSON:%s", json); EXPECT_TRUE(json != NULL); DeleteDoxmBinData(doxm); diff --git a/resource/csdk/security/unittest/iotvticalendartest.cpp b/resource/csdk/security/unittest/iotvticalendartest.cpp index 781eddbcc..5fc09313a 100644 --- a/resource/csdk/security/unittest/iotvticalendartest.cpp +++ b/resource/csdk/security/unittest/iotvticalendartest.cpp @@ -23,7 +23,7 @@ #include "iotvticalendar.h" #include "logger.h" -#define TAG PCF("CALENDAR-UT") +#define TAG "CALENDAR-UT" static void printPeriod(IotvtICalPeriod_t *period) { @@ -32,56 +32,56 @@ static void printPeriod(IotvtICalPeriod_t *period) return; } - OC_LOG_V(INFO, TAG, PCF("period->startDateTime.tm_year = %d"),period->startDateTime.tm_year); - OC_LOG_V(INFO, TAG, PCF("period->startDateTime.tm_mon = %d"),period->startDateTime.tm_mon); - OC_LOG_V(INFO, TAG, PCF("period->startDateTime.tm_mday = %d"),period->startDateTime.tm_mday); - OC_LOG_V(INFO, TAG, PCF("period->startDateTime.tm_hour = %d"),period->startDateTime.tm_hour); - OC_LOG_V(INFO, TAG, PCF("period->startDateTime.tm_min = %d"),period->startDateTime.tm_min); - OC_LOG_V(INFO, TAG, PCF("period->startDateTime.tm_sec = %d"),period->startDateTime.tm_sec); - - OC_LOG_V(INFO, TAG, PCF("period->endDateTime.tm_year = %d"),period->endDateTime.tm_year); - OC_LOG_V(INFO, TAG, PCF("period->endDateTime.tm_mon = %d"),period->endDateTime.tm_mon); - OC_LOG_V(INFO, TAG, PCF("period->endDateTime.tm_mday = %d"),period->endDateTime.tm_mday); - OC_LOG_V(INFO, TAG, PCF("period->endDateTime.tm_hour = %d"),period->endDateTime.tm_hour); - OC_LOG_V(INFO, TAG, PCF("period->endDateTime.tm_min = %d"),period->endDateTime.tm_min); - OC_LOG_V(INFO, TAG, PCF("period->startDateTime.tm_sec = %d"),period->endDateTime.tm_sec); + OC_LOG_V(INFO, TAG, "period->startDateTime.tm_year = %d",period->startDateTime.tm_year); + OC_LOG_V(INFO, TAG, "period->startDateTime.tm_mon = %d",period->startDateTime.tm_mon); + OC_LOG_V(INFO, TAG, "period->startDateTime.tm_mday = %d",period->startDateTime.tm_mday); + OC_LOG_V(INFO, TAG, "period->startDateTime.tm_hour = %d",period->startDateTime.tm_hour); + OC_LOG_V(INFO, TAG, "period->startDateTime.tm_min = %d",period->startDateTime.tm_min); + OC_LOG_V(INFO, TAG, "period->startDateTime.tm_sec = %d",period->startDateTime.tm_sec); + + OC_LOG_V(INFO, TAG, "period->endDateTime.tm_year = %d",period->endDateTime.tm_year); + OC_LOG_V(INFO, TAG, "period->endDateTime.tm_mon = %d",period->endDateTime.tm_mon); + OC_LOG_V(INFO, TAG, "period->endDateTime.tm_mday = %d",period->endDateTime.tm_mday); + OC_LOG_V(INFO, TAG, "period->endDateTime.tm_hour = %d",period->endDateTime.tm_hour); + OC_LOG_V(INFO, TAG, "period->endDateTime.tm_min = %d",period->endDateTime.tm_min); + OC_LOG_V(INFO, TAG, "period->startDateTime.tm_sec = %d",period->endDateTime.tm_sec); } static void printRecur(IotvtICalRecur_t *recur) { - OC_LOG_V(INFO, TAG, PCF("recur->freq = %d"), recur->freq); - OC_LOG_V(INFO, TAG, PCF("recur->until.tm_year = %d"), recur->until.tm_year); - OC_LOG_V(INFO, TAG, PCF("recur->until.tm_mon = %d"), recur->until.tm_mon); - OC_LOG_V(INFO, TAG, PCF("recur->until.tm_mday = %d"), recur->until.tm_mday); + OC_LOG_V(INFO, TAG, "recur->freq = %d", recur->freq); + OC_LOG_V(INFO, TAG, "recur->until.tm_year = %d", recur->until.tm_year); + OC_LOG_V(INFO, TAG, "recur->until.tm_mon = %d", recur->until.tm_mon); + OC_LOG_V(INFO, TAG, "recur->until.tm_mday = %d", recur->until.tm_mday); if(recur->byDay & SUNDAY) { - OC_LOG_V(INFO, TAG, PCF("recur->byDay = %s"), "Sunday"); + OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Sunday"); } if(recur->byDay & MONDAY) { - OC_LOG_V(INFO, TAG, PCF("recur->byDay = %s"), "Monday"); + OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Monday"); } if(recur->byDay & TUESDAY) { - OC_LOG_V(INFO, TAG, PCF("recur->byDay = %s"), "Tuesday"); + OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Tuesday"); } if(recur->byDay & WEDNESDAY) { - OC_LOG_V(INFO, TAG, PCF("recur->byDay = %s"), "Wednesday"); + OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Wednesday"); } if(recur->byDay & THURSDAY) { - OC_LOG_V(INFO, TAG, PCF("recur->byDay = %s"), "Thursday"); + OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Thursday"); } if(recur->byDay & FRIDAY) { - OC_LOG_V(INFO, TAG, PCF("recur->byDay = %s"), "Friday"); + OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Friday"); } if(recur->byDay & SATURDAY) { - OC_LOG_V(INFO, TAG, PCF("recur->byDay = %s"), "Saturday"); + OC_LOG_V(INFO, TAG, "recur->byDay = %s", "Saturday"); } } @@ -110,8 +110,8 @@ static void checkValidityOfRequest(char *recurStr, char *periodStr,int startTime tzset(); localtime_r(&rt, &t2); - OC_LOG_V(INFO, TAG, PCF("t1 = %02d:%02d:%02d"), t1.tm_hour, t1.tm_min, t1.tm_sec ); - OC_LOG_V(INFO, TAG, PCF("t2 = %02d:%02d:%02d"), t2.tm_hour, t2.tm_min, t2.tm_sec ); + OC_LOG_V(INFO, TAG, "t1 = %02d:%02d:%02d", t1.tm_hour, t1.tm_min, t1.tm_sec ); + OC_LOG_V(INFO, TAG, "t2 = %02d:%02d:%02d", t2.tm_hour, t2.tm_min, t2.tm_sec ); }while(t1.tm_hour != t2.tm_hour); if(byDay > 0) diff --git a/resource/csdk/stack/include/payload_logging.h b/resource/csdk/stack/include/payload_logging.h index acc207a28..422100d68 100644 --- a/resource/csdk/stack/include/payload_logging.h +++ b/resource/csdk/stack/include/payload_logging.h @@ -26,107 +26,110 @@ extern "C" { #endif +// PL_TAG is made as generic predefined tag because of build problems in arduino for using logging +#define PL_TAG "PayloadLog" + #ifdef TB_LOG - #define OC_LOG_PAYLOAD(level, tag, payload) OCPayloadLog((level),(tag),(payload)) + #define OC_LOG_PAYLOAD(level, payload) OCPayloadLog((level),(payload)) #define UUID_SIZE (16) #define UUID_LENGTH (37) const char *convertTriggerEnumToString(OCPresenceTrigger trigger); OCPresenceTrigger convertTriggerStringToEnum(const char * triggerStr); -static inline void OCPayloadLogRep(LogLevel level, const char* tag, OCRepPayload* payload) +static inline void OCPayloadLogRep(LogLevel level, OCRepPayload* payload) { - OC_LOG(level, tag, PCF("Payload Type: Representation")); + OC_LOG(level, (PL_TAG), "Payload Type: Representation"); OCRepPayload* rep = payload; int i = 1; while(rep) { - OC_LOG_V(level, tag, "\tResource #%d", i); - OC_LOG_V(level, tag, "\tURI:%s", rep->uri); - OC_LOG(level, tag, PCF("\tResource Types:")); + OC_LOG_V(level, PL_TAG, "\tResource #%d", i); + OC_LOG_V(level, PL_TAG, "\tURI:%s", rep->uri); + OC_LOG(level, PL_TAG, "\tResource Types:"); OCStringLL* strll = rep->types; while(strll) { - OC_LOG_V(level, tag, "\t\t%s", strll->value); + OC_LOG_V(level, PL_TAG, "\t\t%s", strll->value); strll = strll->next; } - OC_LOG(level, tag, PCF("\tInterfaces:")); + OC_LOG(level, PL_TAG, "\tInterfaces:"); strll = rep->interfaces; while(strll) { - OC_LOG_V(level, tag, "\t\t%s", strll->value); + OC_LOG_V(level, PL_TAG, "\t\t%s", strll->value); strll = strll->next; } // TODO Finish Logging: Values OCRepPayloadValue* val = rep->values; - OC_LOG(level, tag, PCF("\tValues:")); + OC_LOG(level, PL_TAG, "\tValues:"); while(val) { switch(val->type) { case OCREP_PROP_NULL: - OC_LOG_V(level, tag, "\t\t%s: NULL", val->name); + OC_LOG_V(level, PL_TAG, "\t\t%s: NULL", val->name); break; case OCREP_PROP_INT: - OC_LOG_V(level, tag, "\t\t%s(int):%lld", val->name, val->i); + OC_LOG_V(level, PL_TAG, "\t\t%s(int):%lld", val->name, val->i); break; case OCREP_PROP_DOUBLE: - OC_LOG_V(level, tag, "\t\t%s(double):%f", val->name, val->d); + OC_LOG_V(level, PL_TAG, "\t\t%s(double):%f", val->name, val->d); break; case OCREP_PROP_BOOL: - OC_LOG_V(level, tag, "\t\t%s(bool):%s", val->name, val->b ? "true" : "false"); + OC_LOG_V(level, PL_TAG, "\t\t%s(bool):%s", val->name, val->b ? "true" : "false"); break; case OCREP_PROP_STRING: - OC_LOG_V(level, tag, "\t\t%s(string):%s", val->name, val->str); + OC_LOG_V(level, PL_TAG, "\t\t%s(string):%s", val->name, val->str); break; case OCREP_PROP_OBJECT: // Note: Only prints the URI (if available), to print further, you'll // need to dig into the object better! - OC_LOG_V(level, tag, "\t\t%s(OCRep):%s", val->name, val->obj->uri); + OC_LOG_V(level, PL_TAG, "\t\t%s(OCRep):%s", val->name, val->obj->uri); break; case OCREP_PROP_ARRAY: switch(val->arr.type) { case OCREP_PROP_INT: - OC_LOG_V(level, tag, "\t\t%s(int array):%lld x %lld x %lld", + OC_LOG_V(level, PL_TAG, "\t\t%s(int array):%lld x %lld x %lld", val->name, val->arr.dimensions[0], val->arr.dimensions[1], val->arr.dimensions[2]); break; case OCREP_PROP_DOUBLE: - OC_LOG_V(level, tag, "\t\t%s(double array):%lld x %lld x %lld", + OC_LOG_V(level, PL_TAG, "\t\t%s(double array):%lld x %lld x %lld", val->name, val->arr.dimensions[0], val->arr.dimensions[1], val->arr.dimensions[2]); break; case OCREP_PROP_BOOL: - OC_LOG_V(level, tag, "\t\t%s(bool array):%lld x %lld x %lld", + OC_LOG_V(level, PL_TAG, "\t\t%s(bool array):%lld x %lld x %lld", val->name, val->arr.dimensions[0], val->arr.dimensions[1], val->arr.dimensions[2]); break; case OCREP_PROP_STRING: - OC_LOG_V(level, tag, "\t\t%s(string array):%lld x %lld x %lld", + OC_LOG_V(level, PL_TAG, "\t\t%s(string array):%lld x %lld x %lld", val->name, val->arr.dimensions[0], val->arr.dimensions[1], val->arr.dimensions[2]); break; case OCREP_PROP_OBJECT: - OC_LOG_V(level, tag, "\t\t%s(OCRep array):%lld x %lld x %lld", + OC_LOG_V(level, PL_TAG, "\t\t%s(OCRep array):%lld x %lld x %lld", val->name, val->arr.dimensions[0], val->arr.dimensions[1], val->arr.dimensions[2]); break; default: - OC_LOG_V(ERROR, tag, "\t\t%s <-- Unknown/unsupported array type!", + OC_LOG_V(ERROR, PL_TAG, "\t\t%s <-- Unknown/unsupported array type!", val->name); break; } break; default: - OC_LOG_V(ERROR, tag, "\t\t%s <-- Unknown type!", val->name); + OC_LOG_V(ERROR, PL_TAG, "\t\t%s <-- Unknown type!", val->name); break; } val = val -> next; @@ -138,15 +141,14 @@ static inline void OCPayloadLogRep(LogLevel level, const char* tag, OCRepPayload } -static inline void OCPayloadLogDiscovery(LogLevel level, const char* tag, - OCDiscoveryPayload* payload) +static inline void OCPayloadLogDiscovery(LogLevel level, OCDiscoveryPayload* payload) { - OC_LOG(level, tag, PCF("Payload Type: Discovery")); + OC_LOG(level, PL_TAG, "Payload Type: Discovery"); int i = 1; if(!payload->resources) { - OC_LOG(level, tag, PCF("\tNO Resources")); + OC_LOG(level, PL_TAG, "\tNO Resources"); return; } @@ -154,112 +156,111 @@ static inline void OCPayloadLogDiscovery(LogLevel level, const char* tag, while(res) { - OC_LOG_V(level, tag, "\tResource #%d", i); - OC_LOG_V(level, tag, "\tURI:%s", res->uri); - OC_LOG(level, tag, PCF("\tSID:")); - OC_LOG_BUFFER(level, tag, res->sid, UUID_SIZE); - OC_LOG(level, tag, PCF("\tResource Types:")); + OC_LOG_V(level, PL_TAG, "\tResource #%d", i); + OC_LOG_V(level, PL_TAG, "\tURI:%s", res->uri); + OC_LOG(level, PL_TAG, "\tSID:"); + OC_LOG_BUFFER(level, PL_TAG, res->sid, UUID_SIZE); + OC_LOG(level, PL_TAG, "\tResource Types:"); OCStringLL* strll = res->types; while(strll) { - OC_LOG_V(level, tag, "\t\t%s", strll->value); + OC_LOG_V(level, PL_TAG, "\t\t%s", strll->value); strll = strll->next; } - OC_LOG(level, tag, PCF("\tInterfaces:")); + OC_LOG(level, PL_TAG, "\tInterfaces:"); strll = res->interfaces; while(strll) { - OC_LOG_V(level, tag, "\t\t%s", strll->value); + OC_LOG_V(level, PL_TAG, "\t\t%s", strll->value); strll = strll->next; } - OC_LOG_V(level, tag, "\tBitmap: %u", res->bitmap); - OC_LOG_V(level, tag, "\tSecure?: %s", res->secure ? "true" : "false"); - OC_LOG_V(level, tag, "\tPort: %u", res->port); - OC_LOG(level, tag, PCF("")); + OC_LOG_V(level, PL_TAG, "\tBitmap: %u", res->bitmap); + OC_LOG_V(level, PL_TAG, "\tSecure?: %s", res->secure ? "true" : "false"); + OC_LOG_V(level, PL_TAG, "\tPort: %u", res->port); + OC_LOG(level, PL_TAG, ""); res = res->next; ++i; } } -static inline void OCPayloadLogDevice(LogLevel level, const char* tag, OCDevicePayload* payload) +static inline void OCPayloadLogDevice(LogLevel level, OCDevicePayload* payload) { - OC_LOG(level, tag, PCF("Payload Type: Device")); - OC_LOG_V(level, tag, "\tURI:%s", payload->uri); - OC_LOG(level, tag, PCF("\tSID:")); - OC_LOG_BUFFER(level, tag, payload->sid, UUID_SIZE); - OC_LOG_V(level, tag, "\tDevice Name:%s", payload->deviceName); - OC_LOG_V(level, tag, "\tSpec Version%s", payload->specVersion); - OC_LOG_V(level, tag, "\tData Model Version:%s", payload->dataModelVersion); + OC_LOG(level, PL_TAG, "Payload Type: Device"); + OC_LOG_V(level, PL_TAG, "\tURI:%s", payload->uri); + OC_LOG(level, PL_TAG, "\tSID:"); + OC_LOG_BUFFER(level, PL_TAG, payload->sid, UUID_SIZE); + OC_LOG_V(level, PL_TAG, "\tDevice Name:%s", payload->deviceName); + OC_LOG_V(level, PL_TAG, "\tSpec Version%s", payload->specVersion); + OC_LOG_V(level, PL_TAG, "\tData Model Version:%s", payload->dataModelVersion); } -static inline void OCPayloadLogPlatform(LogLevel level, const char* tag, OCPlatformPayload* payload) +static inline void OCPayloadLogPlatform(LogLevel level, OCPlatformPayload* payload) { - OC_LOG(level, tag, PCF("Payload Type: Platform")); - OC_LOG_V(level, tag, "\tURI:%s", payload->uri); - OC_LOG_V(level, tag, "\tPlatform ID:%s", payload->info.platformID); - OC_LOG_V(level, tag, "\tMfg Name:%s", payload->info.manufacturerName); - OC_LOG_V(level, tag, "\tMfg URL:%s", payload->info.manufacturerUrl); - OC_LOG_V(level, tag, "\tModel Number:%s", payload->info.modelNumber); - OC_LOG_V(level, tag, "\tDate of Mfg:%s", payload->info.dateOfManufacture); - OC_LOG_V(level, tag, "\tPlatform Version:%s", payload->info.platformVersion); - OC_LOG_V(level, tag, "\tOS Version:%s", payload->info.operatingSystemVersion); - OC_LOG_V(level, tag, "\tHardware Version:%s", payload->info.hardwareVersion); - OC_LOG_V(level, tag, "\tFirmware Version:%s", payload->info.firmwareVersion); - OC_LOG_V(level, tag, "\tSupport URL:%s", payload->info.supportUrl); - OC_LOG_V(level, tag, "\tSystem Time:%s", payload->info.systemTime); + OC_LOG(level, PL_TAG, "Payload Type: Platform"); + OC_LOG_V(level, PL_TAG, "\tURI:%s", payload->uri); + OC_LOG_V(level, PL_TAG, "\tPlatform ID:%s", payload->info.platformID); + OC_LOG_V(level, PL_TAG, "\tMfg Name:%s", payload->info.manufacturerName); + OC_LOG_V(level, PL_TAG, "\tMfg URL:%s", payload->info.manufacturerUrl); + OC_LOG_V(level, PL_TAG, "\tModel Number:%s", payload->info.modelNumber); + OC_LOG_V(level, PL_TAG, "\tDate of Mfg:%s", payload->info.dateOfManufacture); + OC_LOG_V(level, PL_TAG, "\tPlatform Version:%s", payload->info.platformVersion); + OC_LOG_V(level, PL_TAG, "\tOS Version:%s", payload->info.operatingSystemVersion); + OC_LOG_V(level, PL_TAG, "\tHardware Version:%s", payload->info.hardwareVersion); + OC_LOG_V(level, PL_TAG, "\tFirmware Version:%s", payload->info.firmwareVersion); + OC_LOG_V(level, PL_TAG, "\tSupport URL:%s", payload->info.supportUrl); + OC_LOG_V(level, PL_TAG, "\tSystem Time:%s", payload->info.systemTime); } -static inline void OCPayloadLogPresence(LogLevel level, const char* tag, OCPresencePayload* payload) +static inline void OCPayloadLogPresence(LogLevel level, OCPresencePayload* payload) { - OC_LOG(level, tag, PCF("Payload Type: Presence")); - OC_LOG_V(level, tag, "\tSequence Number:%u", payload->sequenceNumber); - OC_LOG_V(level, tag, "\tMax Age:%d", payload->maxAge); - OC_LOG_V(level, tag, "\tTrigger:%s", convertTriggerEnumToString(payload->trigger)); - OC_LOG_V(level, tag, "\tResource Type:%s", payload->resourceType); + OC_LOG(level, PL_TAG, "Payload Type: Presence"); + OC_LOG_V(level, PL_TAG, "\tSequence Number:%u", payload->sequenceNumber); + OC_LOG_V(level, PL_TAG, "\tMax Age:%d", payload->maxAge); + OC_LOG_V(level, PL_TAG, "\tTrigger:%s", convertTriggerEnumToString(payload->trigger)); + OC_LOG_V(level, PL_TAG, "\tResource Type:%s", payload->resourceType); } -static inline void OCPayloadLogSecurity(LogLevel level, const char* tag, - OCSecurityPayload* payload) +static inline void OCPayloadLogSecurity(LogLevel level, OCSecurityPayload* payload) { - OC_LOG(level, tag, PCF("Payload Type: Security")); - OC_LOG_V(level, tag, "\tSecurity Data: %s", payload->securityData); + OC_LOG(level, PL_TAG, "Payload Type: Security"); + OC_LOG_V(level, PL_TAG, "\tSecurity Data: %s", payload->securityData); } -static inline void OCPayloadLog(LogLevel level, const char* tag, OCPayload* payload) +static inline void OCPayloadLog(LogLevel level, OCPayload* payload) { if(!payload) { - OC_LOG(level, tag, PCF("NULL Payload")); + OC_LOG(level, PL_TAG, "NULL Payload"); return; } switch(payload->type) { case PAYLOAD_TYPE_REPRESENTATION: - OCPayloadLogRep(level, tag, (OCRepPayload*)payload); + OCPayloadLogRep(level, (OCRepPayload*)payload); break; case PAYLOAD_TYPE_DISCOVERY: - OCPayloadLogDiscovery(level, tag, (OCDiscoveryPayload*)payload); + OCPayloadLogDiscovery(level, (OCDiscoveryPayload*)payload); break; case PAYLOAD_TYPE_DEVICE: - OCPayloadLogDevice(level, tag, (OCDevicePayload*)payload); + OCPayloadLogDevice(level, (OCDevicePayload*)payload); break; case PAYLOAD_TYPE_PLATFORM: - OCPayloadLogPlatform(level, tag, (OCPlatformPayload*)payload); + OCPayloadLogPlatform(level, (OCPlatformPayload*)payload); break; case PAYLOAD_TYPE_PRESENCE: - OCPayloadLogPresence(level, tag, (OCPresencePayload*)payload); + OCPayloadLogPresence(level, (OCPresencePayload*)payload); break; case PAYLOAD_TYPE_SECURITY: - OCPayloadLogSecurity(level, tag, (OCSecurityPayload*)payload); + OCPayloadLogSecurity(level, (OCSecurityPayload*)payload); break; default: - OC_LOG_V(level, tag, "Unknown Payload Type: %d", payload->type); + OC_LOG_V(level, PL_TAG, "Unknown Payload Type: %d", payload->type); break; } } #else - #define OC_LOG_PAYLOAD(level, tag, payload) + #define OC_LOG_PAYLOAD(level, payload) #endif #ifdef __cplusplus diff --git a/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/ocserver.cpp b/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/ocserver.cpp index 52e42f21d..22aab3167 100644 --- a/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/ocserver.cpp +++ b/resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/ocserver.cpp @@ -44,7 +44,7 @@ const char *getResult(OCStackResult result); -PROGMEM const char TAG[] = "ArduinoServer"; +#define TAG "ArduinoServer" int gLightUnderObservation = 0; void createLightResource(); @@ -79,7 +79,7 @@ int ConnectToNetwork() // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { - OC_LOG(ERROR, TAG, PCF("WiFi shield not present")); + OC_LOG(ERROR, TAG, ("WiFi shield not present")); return -1; } @@ -88,7 +88,7 @@ int ConnectToNetwork() OC_LOG_V(INFO, 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, TAG, PCF("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); + OC_LOG(DEBUG, TAG, ("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); return -1; } @@ -101,7 +101,7 @@ int ConnectToNetwork() // wait 10 seconds for connection: delay(10000); } - OC_LOG(DEBUG, TAG, PCF("Connected to wifi")); + OC_LOG(DEBUG, TAG, ("Connected to wifi")); IPAddress ip = WiFi.localIP(); OC_LOG_V(INFO, TAG, "IP Address: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); @@ -155,13 +155,13 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, OCEntityHandle OCRepPayload* payload = OCRepPayloadCreate(); if(!payload) { - OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); + OC_LOG(ERROR, TAG, ("Failed to allocate Payload")); return OC_EH_ERROR; } if(entityHandlerRequest && (flag & OC_REQUEST_FLAG)) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, ("Flag includes OC_REQUEST_FLAG")); if(OC_REST_GET == entityHandlerRequest->method) { @@ -203,12 +203,12 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, OCEntityHandle { if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo.action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_REGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_REGISTER from client")); gLightUnderObservation = 1; } else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo.action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_DEREGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_DEREGISTER from client")); gLightUnderObservation = 0; } } @@ -246,19 +246,19 @@ void setup() // Add your initialization code here // Note : This will initialize Serial port on Arduino at 115200 bauds OC_LOG_INIT(); - OC_LOG(DEBUG, TAG, PCF("OCServer is starting...")); + OC_LOG(DEBUG, TAG, ("OCServer is starting...")); // Connect to Ethernet or WiFi network if (ConnectToNetwork() != 0) { - OC_LOG(ERROR, TAG, PCF("Unable to connect to network")); + OC_LOG(ERROR, TAG, ("Unable to connect to network")); return; } // Initialize the OC Stack in Server mode if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack init error")); + OC_LOG(ERROR, TAG, ("OCStack init error")); return; } @@ -279,7 +279,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, PCF("OCStack process error")); + OC_LOG(ERROR, TAG, ("OCStack process error")); return; } ChangeLightRepresentation(NULL); diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp index 5faaccdf0..38b92398b 100644 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/occlient.cpp @@ -176,8 +176,8 @@ OCStackApplicationResult putReqCB(void* ctx, OCDoHandle /*handle*/, if (clientResponse) { OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Put Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Put Response")); } else { @@ -197,8 +197,8 @@ OCStackApplicationResult postReqCB(void *ctx, OCDoHandle /*handle*/, if (clientResponse) { OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Post Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Post Response")); } else { @@ -219,8 +219,8 @@ OCStackApplicationResult deleteReqCB(void *ctx, if (clientResponse) { OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Delete Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Delete Response")); } else { @@ -245,8 +245,8 @@ OCStackApplicationResult getReqCB(void* ctx, OCDoHandle /*handle*/, OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Get Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Get Response")); if (clientResponse->numRcvdVendorSpecificHeaderOptions > 0) { @@ -282,8 +282,8 @@ OCStackApplicationResult obsReqCB(void* ctx, OCDoHandle /*handle*/, OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); OC_LOG_V(INFO, TAG, "Callback Context for OBSERVE notification recvd successfully %d", gNumObserveNotifies); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Obs Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Obs Response")); gNumObserveNotifies++; if (gNumObserveNotifies == 15) //large number to test observing in DELETE case. { @@ -338,8 +338,8 @@ OCStackApplicationResult presenceCB(void* ctx, OCDoHandle /*handle*/, OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); OC_LOG_V(INFO, TAG, "Callback Context for Presence notification recvd successfully %d", gNumPresenceNotifies); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Presence Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Presence Response")); gNumPresenceNotifies++; if (gNumPresenceNotifies == 20) { @@ -377,7 +377,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/, "Device =============> Discovered @ %s:%d", clientResponse->devAddr.addr, clientResponse->devAddr.port); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); ConnType = clientResponse->connType; serverAddr = clientResponse->devAddr; @@ -459,8 +459,8 @@ OCStackApplicationResult PlatformDiscoveryReqCB(void* ctx, if (clientResponse) { - OC_LOG(INFO, TAG, PCF("Discovery Response:")); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG(INFO, TAG, ("Discovery Response:")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); } else { @@ -480,8 +480,8 @@ OCStackApplicationResult DeviceDiscoveryReqCB(void* ctx, OCDoHandle /*handle*/, if (clientResponse) { - OC_LOG(INFO, TAG, PCF("Discovery Response:")); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG(INFO, TAG, ("Discovery Response:")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); } else { diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp index e2a4a695d..d396db197 100644 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp @@ -138,8 +138,8 @@ OCStackApplicationResult putReqCB(void* ctx, OCDoHandle /*handle*/, if(clientResponse) { - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Put Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Put Response")); } else { @@ -162,8 +162,8 @@ OCStackApplicationResult postReqCB(void *ctx, OCDoHandle /*handle*/, if(clientResponse) { - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Post Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Post Response")); } else { @@ -189,8 +189,8 @@ OCStackApplicationResult getReqCB(void* ctx, OCDoHandle /*handle*/, { OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Get Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Get Response")); if (clientResponse->numRcvdVendorSpecificHeaderOptions > 0 ) { @@ -239,7 +239,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/, "Device =============> Discovered @ %s:%d", clientResponse->devAddr.addr, clientResponse->devAddr.port); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); collectUniqueResource(clientResponse); } diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp index c023c26ce..ff404d9f2 100644 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/occlientcoll.cpp @@ -32,7 +32,7 @@ const char *getResult(OCStackResult result); std::string getQueryStrForGetPut(); -#define TAG PCF("occlient") +#define TAG ("occlient") #define DEFAULT_CONTEXT_VALUE 0x99 #ifndef MAX_LENGTH_IPv4_ADDR #define MAX_LENGTH_IPv4_ADDR 16 @@ -166,7 +166,7 @@ OCStackApplicationResult putReqCB(void* ctx, OCDoHandle /*handle*/, if(ctx == (void*)DEFAULT_CONTEXT_VALUE) { OC_LOG_V(INFO, TAG, "Callback Context for PUT query recvd successfully"); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); } return OC_STACK_KEEP_TRANSACTION; @@ -183,13 +183,13 @@ OCStackApplicationResult getReqCB(void* ctx, OCDoHandle /*handle*/, if(clientResponse->sequenceNumber == 0) { OC_LOG_V(INFO, TAG, "Callback Context for GET query recvd successfully"); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); } else { OC_LOG_V(INFO, TAG, "Callback Context for Get recvd successfully %d", gNumObserveNotifies); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload);; + OC_LOG_PAYLOAD(INFO, clientResponse->payload);; gNumObserveNotifies++; if (gNumObserveNotifies == 3) { @@ -225,7 +225,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/, "Device =============> Discovered @ %s:%d", clientResponse->devAddr.addr, clientResponse->devAddr.port); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); ConnType = clientResponse->connType; @@ -275,7 +275,7 @@ int InitObserveRequest(OCClientResponse * clientResponse) cbData.cd = NULL; OC_LOG_V(INFO, TAG, "OBSERVE payload from client ="); OCPayload* payload = putPayload(); - OC_LOG_PAYLOAD(INFO, TAG, payload); + OC_LOG_PAYLOAD(INFO, payload); OCPayloadDestroy(payload); ret = OCDoResource(&handle, OC_REST_OBSERVE, obsReg.str().c_str(), @@ -307,7 +307,7 @@ int InitPutRequest(OCClientResponse * clientResponse) cbData.cd = NULL; OC_LOG_V(INFO, TAG, "PUT payload from client = "); OCPayload* payload = putPayload(); - OC_LOG_PAYLOAD(INFO, TAG, payload); + OC_LOG_PAYLOAD(INFO, payload); OCPayloadDestroy(payload); ret = OCDoResource(NULL, OC_REST_PUT, getQuery.str().c_str(), diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp index 03792de4e..3a7f26ec8 100644 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/occlientslow.cpp @@ -125,7 +125,7 @@ OCStackApplicationResult getReqCB(void* ctx, OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); OC_LOG(INFO, TAG, "Get Response =============> "); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); if(clientResponse->rcvdVendorSpecificHeaderOptions && clientResponse->numRcvdVendorSpecificHeaderOptions) @@ -163,7 +163,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle /*handle*/, OC_LOG_V(INFO, TAG, "Discovered @ %s:%u =============> ", clientResponse->devAddr.addr, clientResponse->devAddr.port); - OC_LOG_PAYLOAD (INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD (INFO, clientResponse->payload); endpoint = clientResponse->devAddr; diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/ocremoteaccessclient.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/ocremoteaccessclient.cpp index 4f82a0252..918d3e062 100644 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/ocremoteaccessclient.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/ocremoteaccessclient.cpp @@ -156,7 +156,7 @@ OCStackApplicationResult restRequestCB(void* ctx, OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); if(clientResponse->numRcvdVendorSpecificHeaderOptions > 0) { @@ -178,7 +178,7 @@ OCStackApplicationResult obsReqCB(void* ctx, OCDoHandle handle, OCClientResponse OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); OC_LOG_V(INFO, TAG, "OBSERVE notification %d recvd", gNumObserveNotifies); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); gNumObserveNotifies++; if (gNumObserveNotifies == maxNotification) @@ -227,7 +227,7 @@ OCStackApplicationResult presenceCB(void* ctx, OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); OC_LOG_V(INFO, TAG, "NONCE NUMBER: %u", clientResponse->sequenceNumber); OC_LOG_V(INFO, TAG, "PRESENCE notification %d recvd", gNumPresenceNotifies); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); gNumPresenceNotifies++; if (gNumPresenceNotifies == maxNotification) @@ -262,7 +262,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle, } OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); responseAddr = clientResponse->devAddr; @@ -302,7 +302,7 @@ OCStackApplicationResult PlatformDiscoveryReqCB (void* ctx, OCDoHandle handle, if(clientResponse) { - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); } else { @@ -322,7 +322,7 @@ OCStackApplicationResult DeviceDiscoveryReqCB (void* ctx, OCDoHandle handle, if(clientResponse) { - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); } else { diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp index 3de44562f..3858b2321 100644 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp @@ -73,7 +73,7 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) { if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, TAG, PCF("Incoming payload not a representation")); + OC_LOG(ERROR, TAG, ("Incoming payload not a representation")); return nullptr; } @@ -202,7 +202,7 @@ OCEntityHandlerResult OCEntityHandlerCb (OCEntityHandlerFlag flag, { OC_LOG_V (INFO, TAG, "request query %s from client", entityHandlerRequest->query); - OC_LOG_PAYLOAD (INFO, TAG, entityHandlerRequest->payload); + OC_LOG_PAYLOAD (INFO, entityHandlerRequest->payload); // Make deep copy of received request and queue it for slow processing request = CopyRequest(entityHandlerRequest); diff --git a/resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp b/resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp index 41a9b6617..c72458ac2 100644 --- a/resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp +++ b/resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp @@ -124,8 +124,8 @@ OCStackApplicationResult putReqCB(void*, OCDoHandle, OCClientResponse * clientRe if(clientResponse) { OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Put Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Put Response")); } return OC_STACK_DELETE_TRANSACTION; } @@ -137,8 +137,8 @@ OCStackApplicationResult postReqCB(void *, OCDoHandle, OCClientResponse *clientR if(clientResponse) { OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Post Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Post Response")); } return OC_STACK_DELETE_TRANSACTION; } @@ -151,8 +151,8 @@ OCStackApplicationResult getReqCB(void*, OCDoHandle, OCClientResponse * clientRe { OC_LOG_V(INFO, TAG, "StackResult: %s", getResult(clientResponse->result)); OC_LOG_V(INFO, TAG, "SEQUENCE NUMBER: %d", clientResponse->sequenceNumber); - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); - OC_LOG(INFO, TAG, PCF("=============> Get Response")); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); + OC_LOG(INFO, TAG, ("=============> Get Response")); } return OC_STACK_DELETE_TRANSACTION; } @@ -173,7 +173,7 @@ OCStackApplicationResult discoveryReqCB(void*, OCDoHandle, if (clientResponse->result == OC_STACK_OK) { - OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + OC_LOG_PAYLOAD(INFO, clientResponse->payload); ocConnType = clientResponse->connType; endpoint = clientResponse->devAddr; diff --git a/resource/csdk/stack/samples/tizen/SimpleClientServer/occlient.cpp b/resource/csdk/stack/samples/tizen/SimpleClientServer/occlient.cpp index 420fd0999..a24814e6a 100644 --- a/resource/csdk/stack/samples/tizen/SimpleClientServer/occlient.cpp +++ b/resource/csdk/stack/samples/tizen/SimpleClientServer/occlient.cpp @@ -221,7 +221,7 @@ OCStackApplicationResult deleteReqCB(void *ctx, if(clientResponse) { cout << "\nStackResult: " << getResult(clientResponse->result); - //OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + //OC_LOG_PAYLOAD(INFO, clientResponse->payload); } else { @@ -275,7 +275,7 @@ OCStackApplicationResult obsReqCB(void* ctx, OCDoHandle handle, OCClientResponse cout << "\nStackResult: " << getResult(clientResponse->result); cout << "\nSEQUENCE NUMBER: " << clientResponse->sequenceNumber; cout << "\nCallback Context for OBSERVE notification recvd successfully "; - //OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + //OC_LOG_PAYLOAD(INFO, clientResponse->payload); gNumObserveNotifies++; if (gNumObserveNotifies == 15) //large number to test observing in DELETE case. { @@ -329,7 +329,7 @@ OCStackApplicationResult presenceCB(void* ctx, OCDoHandle handle, OCClientRespon cout << "\nStackResult: " << getResult(clientResponse->result); cout << "\nNONCE NUMBER: " << clientResponse->sequenceNumber; cout << "\nCallback Context for Presence notification recvd successfully "; - //OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + //OC_LOG_PAYLOAD(INFO, clientResponse->payload); gNumPresenceNotifies++; if (gNumPresenceNotifies == 20) { @@ -370,7 +370,7 @@ OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle, { cout << ":" << clientResponse->devAddr.port; } - //OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + //OC_LOG_PAYLOAD(INFO, clientResponse->payload); cout << "\nConnectivity type: " << clientResponse->connType; OC_CONNTYPE = clientResponse->connType; parseClientResponse(clientResponse); @@ -451,7 +451,7 @@ OCStackApplicationResult PlatformDiscoveryReqCB (void* ctx, OCDoHandle handle, if(clientResponse) { //OC_LOG truncates the response as it is too long. - //OC_LOG_PAYLOAD(INFO, TAG, clientResponse->payload); + //OC_LOG_PAYLOAD(INFO, clientResponse->payload); } else { diff --git a/resource/csdk/stack/src/occlientcb.c b/resource/csdk/stack/src/occlientcb.c index 9ea19eef3..ecfcfb0de 100644 --- a/resource/csdk/stack/src/occlientcb.c +++ b/resource/csdk/stack/src/occlientcb.c @@ -36,7 +36,7 @@ #include "cainterface.h" /// Module Name -#define TAG PCF("occlientcb") +#define TAG "occlientcb" struct ClientCB *cbList = NULL; static OCMulticastNode * mcPresenceNodes = NULL; @@ -72,7 +72,7 @@ AddClientCB (ClientCB** clientCB, OCCallbackData* cbData, } else { - OC_LOG(INFO, TAG, PCF("Adding client callback with token")); + OC_LOG(INFO, TAG, "Adding client callback with token"); OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)token, tokenLength); cbNode->callBack = cbData->cb; cbNode->context = cbData->context; @@ -150,7 +150,7 @@ void DeleteClientCB(ClientCB * cbNode) if(cbNode) { LL_DELETE(cbList, cbNode); - OC_LOG (INFO, TAG, PCF("Deleting token")); + OC_LOG (INFO, TAG, "Deleting token"); OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)cbNode->token, cbNode->tokenLength); CADestroyToken (cbNode->token); OICFree(cbNode->devAddr); @@ -208,7 +208,7 @@ static void CheckAndDeleteTimedOutCB(ClientCB* cbNode) if (cbNode->TTL < now) { - OC_LOG(INFO, TAG, PCF("Deleting timed-out callback")); + OC_LOG(INFO, TAG, "Deleting timed-out callback"); DeleteClientCB(cbNode); } } @@ -221,9 +221,9 @@ ClientCB* GetClientCB(const CAToken_t token, uint8_t tokenLength, if(token && *token && tokenLength <= CA_MAX_TOKEN_LEN && tokenLength > 0) { - OC_LOG (INFO, TAG, PCF ("Looking for token")); + OC_LOG (INFO, TAG, "Looking for token"); OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)token, tokenLength); - OC_LOG(INFO, TAG, PCF("\tFound in callback list")); + OC_LOG(INFO, TAG, "\tFound in callback list"); LL_FOREACH(cbList, out) { OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)out->token, tokenLength); @@ -259,7 +259,7 @@ ClientCB* GetClientCB(const CAToken_t token, uint8_t tokenLength, CheckAndDeleteTimedOutCB(out); } } - OC_LOG(INFO, TAG, PCF("Callback Not found !!")); + OC_LOG(INFO, TAG, "Callback Not found !!"); return NULL; } @@ -350,7 +350,7 @@ OCMulticastNode* GetMCPresenceNode(const char * uri) } } } - OC_LOG(INFO, TAG, PCF("MulticastNode Not found !!")); + OC_LOG(INFO, TAG, "MulticastNode Not found !!"); return NULL; } diff --git a/resource/csdk/stack/src/occollection.c b/resource/csdk/stack/src/occollection.c index 31105c78b..de00ebba2 100644 --- a/resource/csdk/stack/src/occollection.c +++ b/resource/csdk/stack/src/occollection.c @@ -44,7 +44,7 @@ #include "oicgroup.h" -#define TAG PCF("occollection") +#define TAG "occollection" #define NUM_PARAM_IN_QUERY 2 // The expected number of parameters in a query #define NUM_FIELDS_IN_QUERY 2 // The expected number of fields in a query @@ -99,7 +99,7 @@ ValidateQuery (const char *query, OCResourceHandle resource, //TODO: Query and URL validation is being done for virtual resource case // using ValidateUrlQuery function. We should be able to merge it with this // function. - OC_LOG(INFO, TAG, PCF("Entering ValidateQuery")); + OC_LOG(INFO, TAG, "Entering ValidateQuery"); if (!query) return OC_STACK_ERROR; @@ -112,7 +112,7 @@ ValidateQuery (const char *query, OCResourceHandle resource, if (!(*query)) { // Query string is empty - OC_LOG_V(INFO, TAG, PCF("Empty query string, use default IF and RT")); + OC_LOG(INFO, TAG, "Empty query string, use default IF and RT"); *ifParam = STACK_IF_DEFAULT; *rtParam = (char *) OCGetResourceTypeName (resource, 0); return OC_STACK_OK; @@ -324,7 +324,7 @@ HandleBatchInterface(OCEntityHandlerRequest *ehRequest) // as slow response if(ehResult == OC_EH_SLOW) { - OC_LOG(INFO, TAG, PCF("This is a slow resource")); + OC_LOG(INFO, TAG, "This is a slow resource"); ((OCServerRequest *)ehRequest->requestHandle)->slowFlag = 1; stackRet = EntityHandlerCodeToOCStackCode(ehResult); } @@ -396,15 +396,15 @@ OCStackResult DefaultCollectionEntityHandler (OCEntityHandlerFlag flag, // Get attributes of collection resource and properties of contained resources // M1 release does not support attributes for collection resource, so the GET // operation is same as the GET on LL interface. - OC_LOG(INFO, TAG, PCF("STACK_IF_DEFAULT")); + OC_LOG(INFO, TAG, "STACK_IF_DEFAULT"); return HandleLinkedListInterface(ehRequest, STACK_RES_DISCOVERY_NOFILTER, NULL); case STACK_IF_LL: - OC_LOG(INFO, TAG, PCF("STACK_IF_LL")); + OC_LOG(INFO, TAG, "STACK_IF_LL"); return HandleLinkedListInterface(ehRequest, STACK_RES_DISCOVERY_NOFILTER, NULL); case STACK_IF_BATCH: - OC_LOG(INFO, TAG, PCF("STACK_IF_BATCH")); + OC_LOG(INFO, TAG, "STACK_IF_BATCH"); ((OCServerRequest *)ehRequest->requestHandle)->ehResponseHandler = HandleAggregateResponse; @@ -440,8 +440,8 @@ OCStackResult DefaultCollectionEntityHandler (OCEntityHandlerFlag flag, return HandleBatchInterface(ehRequest); case STACK_IF_GROUP: - OC_LOG(INFO, TAG, PCF("IF_COLLECTION PUT with request ::\n")); - OC_LOG_PAYLOAD(INFO, TAG, ehRequest->payload); + OC_LOG(INFO, TAG, "IF_COLLECTION PUT with request ::\n"); + OC_LOG_PAYLOAD(INFO, ehRequest->payload); return BuildCollectionGroupActionCBORResponse(OC_REST_PUT/*flag*/, (OCResource *) ehRequest->resource, ehRequest); @@ -468,8 +468,8 @@ OCStackResult DefaultCollectionEntityHandler (OCEntityHandlerFlag flag, return HandleBatchInterface(ehRequest); case STACK_IF_GROUP: - OC_LOG(INFO, TAG, PCF("IF_COLLECTION POST with request ::\n")); - OC_LOG_PAYLOAD(INFO, TAG, ehRequest->payload); + OC_LOG(INFO, TAG, "IF_COLLECTION POST with request ::\n"); + OC_LOG_PAYLOAD(INFO, ehRequest->payload); return BuildCollectionGroupActionCBORResponse(OC_REST_POST/*flag*/, (OCResource *) ehRequest->resource, ehRequest); diff --git a/resource/csdk/stack/src/ocobserve.c b/resource/csdk/stack/src/ocobserve.c index 72a3e7ce8..5f09f1ebc 100644 --- a/resource/csdk/stack/src/ocobserve.c +++ b/resource/csdk/stack/src/ocobserve.c @@ -35,9 +35,9 @@ // Module Name -#define MOD_NAME PCF("ocobserve") +#define MOD_NAME "ocobserve" -#define TAG PCF("OCStackObserve") +#define TAG "OCStackObserve" #define VERIFY_NON_NULL(arg) { if (!arg) {OC_LOG(FATAL, TAG, #arg " is NULL"); goto exit;} } @@ -84,7 +84,7 @@ static OCQualityOfService DetermineObserverQoS(OCMethod method, resourceObserver->lowQosCount = 0; // at some point we have to to send CON to check on the // availability of observer - OC_LOG(INFO, TAG, PCF("This time we are sending the notification as High qos")); + OC_LOG(INFO, TAG, "This time we are sending the notification as High qos"); decidedQoS = OC_HIGH_QOS; } else @@ -103,7 +103,7 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr, OCQualityOfService qos) #endif { - OC_LOG(INFO, TAG, PCF("Entering SendObserverNotification")); + OC_LOG(INFO, TAG, "Entering SendObserverNotification"); if(!resPtr) { return OC_STACK_INVALID_PARAM; @@ -173,7 +173,7 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr, OCEntityHandlerResponse ehResponse = {0}; //This is effectively the implementation for the presence entity handler. - OC_LOG(DEBUG, TAG, PCF("This notification is for Presence")); + OC_LOG(DEBUG, TAG, "This notification is for Presence"); result = AddServerRequest(&request, 0, 0, 1, OC_REST_GET, 0, resPtr->sequenceNum, qos, resourceObserver->query, NULL, NULL, @@ -220,12 +220,12 @@ OCStackResult SendAllObserverNotification (OCMethod method, OCResource *resPtr, if (numObs == 0) { - OC_LOG(INFO, TAG, PCF("Resource has no observers")); + OC_LOG(INFO, TAG, "Resource has no observers"); result = OC_STACK_NO_OBSERVERS; } else if (observeErrorFlag) { - OC_LOG(ERROR, TAG, PCF("Observer notification error")); + OC_LOG(ERROR, TAG, "Observer notification error"); result = OC_STACK_ERROR; } return result; @@ -250,7 +250,7 @@ OCStackResult SendListObserverNotification (OCResource * resource, OCStackResult result = OC_STACK_ERROR; bool observeErrorFlag = false; - OC_LOG(INFO, TAG, PCF("Entering SendListObserverNotification")); + OC_LOG(INFO, TAG, "Entering SendListObserverNotification"); while(numIds) { observer = GetObserverUsingId (*obsIdList); @@ -328,7 +328,7 @@ OCStackResult SendListObserverNotification (OCResource * resource, } else { - OC_LOG(ERROR, TAG, PCF("Observer notification error")); + OC_LOG(ERROR, TAG, "Observer notification error"); return OC_STACK_ERROR; } } @@ -337,7 +337,7 @@ OCStackResult GenerateObserverId (OCObservationId *observationId) { ResourceObserver *resObs = NULL; - OC_LOG(INFO, TAG, PCF("Entering GenerateObserverId")); + OC_LOG(INFO, TAG, "Entering GenerateObserverId"); VERIFY_NON_NULL (observationId); do @@ -435,7 +435,7 @@ ResourceObserver* GetObserverUsingId (const OCObservationId observeId) } } } - OC_LOG(INFO, TAG, PCF("Observer node not found!!")); + OC_LOG(INFO, TAG, "Observer node not found!!"); return NULL; } @@ -445,9 +445,9 @@ ResourceObserver* GetObserverUsingToken (const CAToken_t token, uint8_t tokenLen if(token && *token) { - OC_LOG(INFO, TAG,PCF("Looking for token")); + OC_LOG(INFO, TAG, "Looking for token"); OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)token, tokenLength); - OC_LOG(INFO, TAG,PCF("\tFound token:")); + OC_LOG(INFO, TAG, "\tFound token:"); LL_FOREACH (serverObsList, out) { @@ -460,10 +460,10 @@ ResourceObserver* GetObserverUsingToken (const CAToken_t token, uint8_t tokenLen } else { - OC_LOG(ERROR, TAG,PCF("Passed in NULL token")); + OC_LOG(ERROR, TAG, "Passed in NULL token"); } - OC_LOG(INFO, TAG, PCF("Observer node not found!!")); + OC_LOG(INFO, TAG, "Observer node not found!!"); return NULL; } diff --git a/resource/csdk/stack/src/ocpayload.c b/resource/csdk/stack/src/ocpayload.c index 3c7bcc571..ba2e408bf 100755 --- a/resource/csdk/stack/src/ocpayload.c +++ b/resource/csdk/stack/src/ocpayload.c @@ -148,7 +148,7 @@ static void OCCopyPropertyValueArray(OCRepPayloadValue* dest, OCRepPayloadValue* } break; default: - OC_LOG(ERROR, TAG, PCF("CopyPropertyValueArray invalid type")); + OC_LOG(ERROR, TAG, "CopyPropertyValueArray invalid type"); break; } } @@ -337,7 +337,7 @@ static OCRepPayloadValue* OCRepPayloadFindAndSetValue(OCRepPayload* payload, con val = val->next; } - OC_LOG(ERROR, TAG, PCF("FindAndSetValue reached point after while loop, pointer corruption?")); + OC_LOG(ERROR, TAG, "FindAndSetValue reached point after while loop, pointer corruption?"); return NULL; } diff --git a/resource/csdk/stack/src/ocpayloadconvert.c b/resource/csdk/stack/src/ocpayloadconvert.c index 02a5b0f74..0dfd056da 100644 --- a/resource/csdk/stack/src/ocpayloadconvert.c +++ b/resource/csdk/stack/src/ocpayloadconvert.c @@ -28,7 +28,7 @@ #include "ocresourcehandler.h" #include "cbor.h" -#define TAG PCF("OCPayloadConvert") +#define TAG "OCPayloadConvert" // Arbitrarily chosen size that seems to contain the majority of packages #define INIT_SIZE (255) @@ -67,13 +67,13 @@ OCStackResult OCConvertPayload(OCPayload* payload, uint8_t** outPayload, size_t* #undef CborNeedsUpdating if (!payload) { - OC_LOG(ERROR, TAG, PCF("Payload parameter NULL")); + OC_LOG(ERROR, TAG, "Payload parameter NULL"); return OC_STACK_INVALID_PARAM; } if (!outPayload || !size) { - OC_LOG(ERROR, TAG, PCF("Out parameter/s parameter NULL")); + OC_LOG(ERROR, TAG, "Out parameter/s parameter NULL"); return OC_STACK_INVALID_PARAM; } @@ -482,7 +482,7 @@ static int64_t OCConvertArray(CborEncoder* parent, const OCRepPayloadValueArray* switch(valArray->type) { case OCREP_PROP_NULL: - OC_LOG(ERROR, TAG, PCF("ConvertArray Invalid NULL")); + OC_LOG(ERROR, TAG, "ConvertArray Invalid NULL"); err = CborUnknownError; break; case OCREP_PROP_INT: @@ -502,7 +502,7 @@ static int64_t OCConvertArray(CborEncoder* parent, const OCRepPayloadValueArray* err = OCConvertSingleRepPayload(&array, valArray->objArray[i]); break; case OCREP_PROP_ARRAY: - OC_LOG(ERROR, TAG, PCF("ConvertArray Invalid child array")); + OC_LOG(ERROR, TAG, "ConvertArray Invalid child array"); err = CborUnknownError; break; } @@ -527,7 +527,7 @@ static int64_t OCConvertSingleRepPayload(CborEncoder* parent, const OCRepPayload // resource types, interfaces if(payload->types || payload->interfaces) { - OC_LOG_V(INFO, TAG, "Payload has types or interfaces"); + OC_LOG(INFO, TAG, "Payload has types or interfaces"); err = err | cbor_encode_text_string(&map, OC_RSRVD_PROPERTY, sizeof(OC_RSRVD_PROPERTY) - 1); diff --git a/resource/csdk/stack/src/ocpayloadparse.c b/resource/csdk/stack/src/ocpayloadparse.c index aa63c530d..1d4e57f90 100644 --- a/resource/csdk/stack/src/ocpayloadparse.c +++ b/resource/csdk/stack/src/ocpayloadparse.c @@ -26,7 +26,7 @@ #include "ocpayload.h" #include "cbor.h" -#define TAG PCF("OCPayloadParse") +#define TAG "OCPayloadParse" static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue* arrayVal); static OCStackResult OCParseDevicePayload(OCPayload** outPayload, CborValue* arrayVal); @@ -132,7 +132,7 @@ static OCStackResult OCParseSecurityPayload(OCPayload** outPayload, CborValue* a } else { - OC_LOG_V(ERROR, TAG, PCF("Cbor main value not a map")); + OC_LOG(ERROR, TAG, "Cbor main value not a map"); return OC_STACK_MALFORMED_RESPONSE; } @@ -140,7 +140,7 @@ static OCStackResult OCParseSecurityPayload(OCPayload** outPayload, CborValue* a if(err) { - OC_LOG_V(ERROR, TAG, "Cbor in error condition"); + OC_LOG(ERROR, TAG, "Cbor in error condition"); OICFree(securityData); return OC_STACK_MALFORMED_RESPONSE; } @@ -170,7 +170,7 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue* OCResourcePayload* resource = (OCResourcePayload*)OICCalloc(1, sizeof(OCResourcePayload)); if(!resource) { - OC_LOG_V(ERROR, TAG, "Memory allocation failed"); + OC_LOG(ERROR, TAG, "Memory allocation failed"); OCDiscoveryPayloadDestroy(out); return OC_STACK_NO_MEMORY; } @@ -204,7 +204,7 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue* llPtr = resource->types; if(!llPtr) { - OC_LOG(ERROR, TAG, PCF("Memory allocation failed")); + OC_LOG(ERROR, TAG, "Memory allocation failed"); OICFree(resource->uri); OICFree(resource->sid); OICFree(resource); @@ -218,7 +218,7 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue* llPtr = llPtr->next; if(!llPtr) { - OC_LOG(ERROR, TAG, PCF("Memory allocation failed")); + OC_LOG(ERROR, TAG, "Memory allocation failed"); OICFree(resource->uri); OICFree(resource->sid); OCFreeOCStringLL(resource->types); @@ -229,7 +229,7 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue* } else { - OC_LOG(ERROR, TAG, PCF("Unknown state in resource type copying")); + OC_LOG(ERROR, TAG, "Unknown state in resource type copying"); OICFree(resource->uri); OICFree(resource->sid); OCFreeOCStringLL(resource->types); @@ -259,7 +259,7 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue* llPtr = resource->interfaces; if(!llPtr) { - OC_LOG_V(ERROR, TAG, "Memory allocation failed"); + OC_LOG(ERROR, TAG, "Memory allocation failed"); OICFree(resource->uri); OICFree(resource->sid); OCFreeOCStringLL(resource->types); @@ -274,7 +274,7 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue* llPtr = llPtr->next; if(!llPtr) { - OC_LOG_V(ERROR, TAG, "Memory allocation failed"); + OC_LOG(ERROR, TAG, "Memory allocation failed"); OICFree(resource->uri); OICFree(resource->sid); OCFreeOCStringLL(resource->types); @@ -286,7 +286,7 @@ static OCStackResult OCParseDiscoveryPayload(OCPayload** outPayload, CborValue* } else { - OC_LOG(ERROR, TAG, PCF("Unknown state in resource interfaces copying")); + OC_LOG(ERROR, TAG, "Unknown state in resource interfaces copying"); OICFree(resource->uri); OICFree(resource->sid); OCFreeOCStringLL(resource->types); @@ -422,7 +422,7 @@ static OCStackResult OCParseDevicePayload(OCPayload** outPayload, CborValue* arr } else { - OC_LOG(ERROR, TAG, PCF("Root device node was not a map")); + OC_LOG(ERROR, TAG, "Root device node was not a map"); return OC_STACK_MALFORMED_RESPONSE; } @@ -538,7 +538,7 @@ static OCStackResult OCParsePlatformPayload(OCPayload** outPayload, CborValue* a OICFree(info.platformVersion); OICFree(info.supportUrl); OICFree(info.systemTime); - OC_LOG(ERROR, TAG, PCF("CBOR error In ParsePlatformPayload")); + OC_LOG(ERROR, TAG, "CBOR error In ParsePlatformPayload"); return OC_STACK_MALFORMED_RESPONSE; } @@ -553,7 +553,7 @@ static OCStackResult OCParsePlatformPayload(OCPayload** outPayload, CborValue* a } else { - OC_LOG(ERROR, TAG, PCF("Root device node was not a map")); + OC_LOG(ERROR, TAG, "Root device node was not a map"); return OC_STACK_MALFORMED_RESPONSE; } } @@ -868,7 +868,7 @@ static OCStackResult OCParseRepPayload(OCPayload** outPayload, CborValue* arrayV if(err) { OCRepPayloadDestroy(rootPayload); - OC_LOG_V(ERROR, TAG, PCF("CBOR error in ParseRepPayload")); + OC_LOG(ERROR, TAG, "CBOR error in ParseRepPayload"); return OC_STACK_MALFORMED_RESPONSE; } } @@ -923,7 +923,7 @@ static OCStackResult OCParsePresencePayload(OCPayload** outPayload, CborValue* a if(err) { OCPayloadDestroy(*outPayload); - OC_LOG_V(ERROR, TAG, PCF("CBOR error Parse Presence Payload")); + OC_LOG(ERROR, TAG, "CBOR error Parse Presence Payload"); return OC_STACK_MALFORMED_RESPONSE; } @@ -936,7 +936,7 @@ static OCStackResult OCParsePresencePayload(OCPayload** outPayload, CborValue* a } else { - OC_LOG(ERROR, TAG, PCF("Root presence node was not a map")); + OC_LOG(ERROR, TAG, "Root presence node was not a map"); return OC_STACK_MALFORMED_RESPONSE; } } diff --git a/resource/csdk/stack/src/ocresource.c b/resource/csdk/stack/src/ocresource.c index c38bc6d08..2b0a17439 100644 --- a/resource/csdk/stack/src/ocresource.c +++ b/resource/csdk/stack/src/ocresource.c @@ -41,12 +41,12 @@ /// Module Name -#define TAG PCF("ocresource") +#define TAG "ocresource" #define VERIFY_SUCCESS(op, successCode) { if (op != successCode) \ {OC_LOG_V(FATAL, TAG, "%s failed!!", #op); goto exit;} } #define VERIFY_NON_NULL(arg, logLevel, retVal) { if (!(arg)) { OC_LOG((logLevel), \ - TAG, PCF(#arg " is NULL")); return (retVal); } } + TAG, #arg " is NULL"); return (retVal); } } extern OCResource *headResource; static OCPlatformInfo savedPlatformInfo = {0}; @@ -113,7 +113,7 @@ static OCStackResult ExtractFiltersFromQuery(char *query, char **filterOne, char { if (numKeyValuePairsParsed >= 2) { - OC_LOG(ERROR, TAG, PCF("More than 2 queries params in URI.")); + OC_LOG(ERROR, TAG, "More than 2 queries params in URI."); return OC_STACK_INVALID_QUERY; } @@ -187,7 +187,7 @@ static OCStackResult getQueryParamsForFiltering (OCVirtualResources uri, char *q if (uri == OC_PRESENCE) { //Nothing needs to be done, except for pass a OC_PRESENCE query through as OC_STACK_OK. - OC_LOG(INFO, TAG, PCF("OC_PRESENCE Request for virtual resource.")); + OC_LOG(INFO, TAG, "OC_PRESENCE Request for virtual resource."); return OC_STACK_OK; } #endif @@ -446,7 +446,7 @@ static bool resourceMatchesRTFilter(OCResource *resource, char *resourceTypeFilt resourceTypePtr = resourceTypePtr->next; } - OC_LOG_V(INFO, TAG, PCF("%s does not contain rt=%s."), resource->uri, resourceTypeFilter); + OC_LOG_V(INFO, TAG, "%s does not contain rt=%s.", resource->uri, resourceTypeFilter); return false; } @@ -474,7 +474,7 @@ static bool resourceMatchesIFFilter(OCResource *resource, char *interfaceFilter) interfacePtr = interfacePtr->next; } - OC_LOG_V(INFO, TAG, PCF("%s does not contain if=%s."), resource->uri, interfaceFilter); + OC_LOG_V(INFO, TAG, "%s does not contain if=%s.", resource->uri, interfaceFilter); return false; } @@ -489,7 +489,7 @@ static bool includeThisResourceInResponse(OCResource *resource, { if (!resource) { - OC_LOG(ERROR, TAG, PCF("Invalid resource")); + OC_LOG(ERROR, TAG, "Invalid resource"); return false; } @@ -502,15 +502,15 @@ static bool includeThisResourceInResponse(OCResource *resource, if (!((interfaceFilter && *interfaceFilter ) || (resourceTypeFilter && *resourceTypeFilter))) { - OC_LOG_V(INFO, TAG, PCF("%s no query string for EXPLICIT_DISCOVERABLE \ - resource"), resource->uri); + OC_LOG_V(INFO, TAG, "%s no query string for EXPLICIT_DISCOVERABLE \ + resource", resource->uri); return false; } } else if ( !(resource->resourceProperties & OC_ACTIVE) || !(resource->resourceProperties & OC_DISCOVERABLE)) { - OC_LOG_V(INFO, TAG, PCF("%s not ACTIVE or DISCOVERABLE"), resource->uri); + OC_LOG_V(INFO, TAG, "%s not ACTIVE or DISCOVERABLE", resource->uri); return false; } @@ -545,7 +545,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource bool bMulticast = false; // Was the discovery request a multicast request? OCPayload* payload = NULL; - OC_LOG(INFO, TAG, PCF("Entering HandleVirtualResource")); + OC_LOG(INFO, TAG, "Entering HandleVirtualResource"); OCVirtualResources virtualUriInRequest = GetTypeOfVirtualURI (request->resourceUrl); @@ -664,7 +664,7 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource else { // Ignoring the discovery request as per RFC 7252, Section #8.2 - OC_LOG_V(INFO, TAG, "Silently ignoring the request since device does not have \ + OC_LOG(INFO, TAG, "Silently ignoring the request since device does not have \ any useful data to send"); } } @@ -686,7 +686,7 @@ HandleDefaultDeviceEntityHandler (OCServerRequest *request) OCEntityHandlerResult ehResult = OC_EH_ERROR; OCEntityHandlerRequest ehRequest = {0}; - OC_LOG(INFO, TAG, PCF("Entering HandleResourceWithDefaultDeviceEntityHandler")); + OC_LOG(INFO, TAG, "Entering HandleResourceWithDefaultDeviceEntityHandler"); result = FormOCEntityHandlerRequest(&ehRequest, (OCRequestHandle) request, request->method, @@ -705,7 +705,7 @@ HandleDefaultDeviceEntityHandler (OCServerRequest *request) (char*) request->resourceUrl, defaultDeviceHandlerCallbackParameter); if(ehResult == OC_EH_SLOW) { - OC_LOG(INFO, TAG, PCF("This is a slow resource")); + OC_LOG(INFO, TAG, "This is a slow resource"); request->slowFlag = 1; } else if(ehResult == OC_EH_ERROR) @@ -735,7 +735,7 @@ HandleResourceWithEntityHandler (OCServerRequest *request, OCEntityHandlerRequest ehRequest = {0}; - OC_LOG(INFO, TAG, PCF("Entering HandleResourceWithEntityHandler")); + OC_LOG(INFO, TAG, "Entering HandleResourceWithEntityHandler"); result = FormOCEntityHandlerRequest(&ehRequest, (OCRequestHandle)request, @@ -753,12 +753,12 @@ HandleResourceWithEntityHandler (OCServerRequest *request, if(ehRequest.obsInfo.action == OC_OBSERVE_NO_OPTION) { - OC_LOG(INFO, TAG, PCF("No observation requested")); + OC_LOG(INFO, TAG, "No observation requested"); ehFlag = OC_REQUEST_FLAG; } else if(ehRequest.obsInfo.action == OC_OBSERVE_REGISTER && !collectionResource) { - OC_LOG(INFO, TAG, PCF("Observation registration requested")); + OC_LOG(INFO, TAG, "Observation registration requested"); result = GenerateObserverId(&ehRequest.obsInfo.obsId); VERIFY_SUCCESS(result, OC_STACK_OK); @@ -771,7 +771,7 @@ HandleResourceWithEntityHandler (OCServerRequest *request, if(result == OC_STACK_OK) { - OC_LOG(INFO, TAG, PCF("Added observer successfully")); + OC_LOG(INFO, TAG, "Added observer successfully"); request->observeResult = OC_STACK_OK; ehFlag = (OCEntityHandlerFlag)(OC_REQUEST_FLAG | OC_OBSERVE_FLAG); } @@ -782,7 +782,7 @@ HandleResourceWithEntityHandler (OCServerRequest *request, // The error in observeResult for the request will be used when responding to this // request by omitting the observation option/sequence number. request->observeResult = OC_STACK_ERROR; - OC_LOG(ERROR, TAG, PCF("Observer Addition failed")); + OC_LOG(ERROR, TAG, "Observer Addition failed"); ehFlag = OC_REQUEST_FLAG; } @@ -790,7 +790,7 @@ HandleResourceWithEntityHandler (OCServerRequest *request, else if(ehRequest.obsInfo.action == OC_OBSERVE_DEREGISTER && !collectionResource) { - OC_LOG(INFO, TAG, PCF("Deregistering observation requested")); + OC_LOG(INFO, TAG, "Deregistering observation requested"); resObs = GetObserverUsingToken (request->requestToken, request->tokenLength); @@ -808,14 +808,14 @@ HandleResourceWithEntityHandler (OCServerRequest *request, if(result == OC_STACK_OK) { - OC_LOG(INFO, TAG, PCF("Removed observer successfully")); + OC_LOG(INFO, TAG, "Removed observer successfully"); request->observeResult = OC_STACK_OK; } else { result = OC_STACK_OK; request->observeResult = OC_STACK_ERROR; - OC_LOG(ERROR, TAG, PCF("Observer Removal failed")); + OC_LOG(ERROR, TAG, "Observer Removal failed"); } } else @@ -827,7 +827,7 @@ HandleResourceWithEntityHandler (OCServerRequest *request, ehResult = resource->entityHandler(ehFlag, &ehRequest, resource->entityHandlerCallbackParam); if(ehResult == OC_EH_SLOW) { - OC_LOG(INFO, TAG, PCF("This is a slow resource")); + OC_LOG(INFO, TAG, "This is a slow resource"); request->slowFlag = 1; } else if(ehResult == OC_EH_ERROR) @@ -892,7 +892,7 @@ ProcessRequest(ResourceHandling resHandling, OCResource *resource, OCServerReque } case OC_RESOURCE_NOT_COLLECTION_DEFAULT_ENTITYHANDLER: { - OC_LOG(INFO, TAG, PCF("OC_RESOURCE_NOT_COLLECTION_DEFAULT_ENTITYHANDLER")); + OC_LOG(INFO, TAG, "OC_RESOURCE_NOT_COLLECTION_DEFAULT_ENTITYHANDLER"); return OC_STACK_ERROR; } case OC_RESOURCE_NOT_COLLECTION_WITH_ENTITYHANDLER: @@ -917,7 +917,7 @@ ProcessRequest(ResourceHandling resHandling, OCResource *resource, OCServerReque } default: { - OC_LOG(INFO, TAG, PCF("Invalid Resource Determination")); + OC_LOG(INFO, TAG, "Invalid Resource Determination"); return OC_STACK_ERROR; } } @@ -926,7 +926,7 @@ ProcessRequest(ResourceHandling resHandling, OCResource *resource, OCServerReque void DeletePlatformInfo() { - OC_LOG(INFO, TAG, PCF("Deleting platform info.")); + OC_LOG(INFO, TAG, "Deleting platform info."); OICFree(savedPlatformInfo.platformID); savedPlatformInfo.platformID = NULL; @@ -1004,11 +1004,11 @@ OCStackResult SavePlatformInfo(OCPlatformInfo info) if (res != OC_STACK_OK) { - OC_LOG_V(ERROR, TAG, PCF("Failed to save platform info. errno(%d)"), res); + OC_LOG_V(ERROR, TAG, "Failed to save platform info. errno(%d)", res); } else { - OC_LOG(ERROR, TAG, PCF("Platform info saved.")); + OC_LOG(ERROR, TAG, "Platform info saved."); } return res; @@ -1016,7 +1016,7 @@ OCStackResult SavePlatformInfo(OCPlatformInfo info) void DeleteDeviceInfo() { - OC_LOG(INFO, TAG, PCF("Deleting device info.")); + OC_LOG(INFO, TAG, "Deleting device info."); OICFree(savedDeviceInfo.deviceName); savedDeviceInfo.deviceName = NULL; @@ -1047,12 +1047,12 @@ OCStackResult SaveDeviceInfo(OCDeviceInfo info) if(OCGetServerInstanceID() == NULL) { - OC_LOG(INFO, TAG, PCF("Device ID generation failed")); + OC_LOG(INFO, TAG, "Device ID generation failed"); res = OC_STACK_ERROR; goto exit; } - OC_LOG(INFO, TAG, PCF("Device initialized successfully.")); + OC_LOG(INFO, TAG, "Device initialized successfully."); return OC_STACK_OK; exit: diff --git a/resource/csdk/stack/src/ocserverrequest.c b/resource/csdk/stack/src/ocserverrequest.c index cbf4d0b0c..47a280a08 100644 --- a/resource/csdk/stack/src/ocserverrequest.c +++ b/resource/csdk/stack/src/ocserverrequest.c @@ -36,7 +36,7 @@ // Module Name #define VERIFY_NON_NULL(arg) { if (!arg) {OC_LOG(FATAL, TAG, #arg " is NULL"); goto exit;} } -#define TAG PCF("ocserverrequest") +#define TAG "ocserverrequest" static struct OCServerRequest * serverRequestList = NULL; static struct OCServerResponse * serverResponseList = NULL; @@ -66,7 +66,7 @@ static OCStackResult AddServerResponse (OCServerResponse ** response, OCRequestH serverResponse->requestHandle = requestHandle; *response = serverResponse; - OC_LOG(INFO, TAG, PCF("Server Response Added!!")); + OC_LOG(INFO, TAG, "Server Response Added!!"); LL_APPEND (serverResponseList, serverResponse); return OC_STACK_OK; @@ -93,7 +93,7 @@ static void DeleteServerRequest(OCServerRequest * serverRequest) OICFree(serverRequest->requestToken); OICFree(serverRequest); serverRequest = NULL; - OC_LOG(INFO, TAG, PCF("Server Request Removed!!")); + OC_LOG(INFO, TAG, "Server Request Removed!!"); } } @@ -109,7 +109,7 @@ static void DeleteServerResponse(OCServerResponse * serverResponse) LL_DELETE(serverResponseList, serverResponse); OICFree(serverResponse->payload); OICFree(serverResponse); - OC_LOG(INFO, TAG, PCF("Server Response Removed!!")); + OC_LOG(INFO, TAG, "Server Response Removed!!"); } } @@ -151,15 +151,15 @@ OCServerRequest * GetServerRequestUsingToken (const CAToken_t token, uint8_t tok { if(!token) { - OC_LOG(ERROR, TAG, PCF("Invalid Parameter Token")); + OC_LOG(ERROR, TAG, "Invalid Parameter Token"); return NULL; } OCServerRequest * out = NULL; - OC_LOG(INFO, TAG,PCF("Get server request with token")); + OC_LOG(INFO, TAG,"Get server request with token"); OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)token, tokenLength); - OC_LOG(INFO, TAG,PCF("Found token")); + OC_LOG(INFO, TAG,"Found token"); LL_FOREACH (serverRequestList, out) { OC_LOG_BUFFER(INFO, TAG, (const uint8_t *)out->requestToken, tokenLength); @@ -168,7 +168,7 @@ OCServerRequest * GetServerRequestUsingToken (const CAToken_t token, uint8_t tok return out; } } - OC_LOG(ERROR, TAG, PCF("Server Request not found!!")); + OC_LOG(ERROR, TAG, "Server Request not found!!"); return NULL; } @@ -189,7 +189,7 @@ OCServerRequest * GetServerRequestUsingHandle (const OCServerRequest * handle) return out; } } - OC_LOG(ERROR, TAG, PCF("Server Request not found!!")); + OC_LOG(ERROR, TAG, "Server Request not found!!"); return NULL; } @@ -211,7 +211,7 @@ OCServerResponse * GetServerResponseUsingHandle (const OCServerRequest * handle) return out; } } - OC_LOG(ERROR, TAG, PCF("Server Response not found!!")); + OC_LOG(ERROR, TAG, "Server Response not found!!"); return NULL; } @@ -284,7 +284,7 @@ OCStackResult AddServerRequest (OCServerRequest ** request, uint16_t coapID, serverRequest->devAddr = *devAddr; *request = serverRequest; - OC_LOG(INFO, TAG, PCF("Server Request Added!!")); + OC_LOG(INFO, TAG, "Server Request Added!!"); LL_APPEND (serverRequestList, serverRequest); return OC_STACK_OK; @@ -474,7 +474,7 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse) if(!responseInfo.info.options) { - OC_LOG(FATAL, TAG, PCF("Memory alloc for options failed")); + OC_LOG(FATAL, TAG, "Memory alloc for options failed"); return OC_STACK_NO_MEMORY; } @@ -593,7 +593,7 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse) } #else - OC_LOG(INFO, TAG, PCF("Calling CASendResponse with:")); + OC_LOG(INFO, TAG, "Calling CASendResponse with:"); OC_LOG_V(INFO, TAG, "\tEndpoint address: %s", responseEndpoint.addr); OC_LOG_V(INFO, TAG, "\tEndpoint adapter: %s", responseEndpoint.adapter); OC_LOG_V(INFO, TAG, "\tResponse result : %s", responseInfo.result); @@ -602,7 +602,7 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse) CAResult_t caResult = CASendResponse(&responseEndpoint, &responseInfo); if(caResult != CA_STATUS_OK) { - OC_LOG(ERROR, TAG, PCF("CASendResponse failed")); + OC_LOG(ERROR, TAG, "CASendResponse failed"); result = CAResultToOCResult(caResult); } else @@ -638,7 +638,7 @@ OCStackResult HandleAggregateResponse(OCEntityHandlerResponse * ehResponse) if(!ehResponse || !ehResponse->payload) { - OC_LOG(ERROR, TAG, PCF("HandleAggregateResponse invalid parameters")); + OC_LOG(ERROR, TAG, "HandleAggregateResponse invalid parameters"); return OC_STACK_INVALID_PARAM; } @@ -651,11 +651,11 @@ OCStackResult HandleAggregateResponse(OCEntityHandlerResponse * ehResponse) { if(!serverResponse) { - OC_LOG(INFO, TAG, PCF("This is the first response fragment")); + OC_LOG(INFO, TAG, "This is the first response fragment"); stackRet = AddServerResponse(&serverResponse, ehResponse->requestHandle); if (OC_STACK_OK != stackRet) { - OC_LOG(ERROR, TAG, PCF("Error adding server response")); + OC_LOG(ERROR, TAG, "Error adding server response"); return stackRet; } VERIFY_NON_NULL(serverResponse); @@ -664,7 +664,7 @@ OCStackResult HandleAggregateResponse(OCEntityHandlerResponse * ehResponse) if(ehResponse->payload->type != PAYLOAD_TYPE_REPRESENTATION) { stackRet = OC_STACK_ERROR; - OC_LOG(ERROR, TAG, PCF("Error adding payload, as it was the incorrect type")); + OC_LOG(ERROR, TAG, "Error adding payload, as it was the incorrect type"); goto exit; } @@ -683,7 +683,7 @@ OCStackResult HandleAggregateResponse(OCEntityHandlerResponse * ehResponse) if(serverRequest->numResponses == 0) { - OC_LOG(INFO, TAG, PCF("This is the last response fragment")); + OC_LOG(INFO, TAG, "This is the last response fragment"); ehResponse->payload = serverResponse->payload; stackRet = HandleSingleResponse(ehResponse); //Delete the request and response @@ -692,7 +692,7 @@ OCStackResult HandleAggregateResponse(OCEntityHandlerResponse * ehResponse) } else { - OC_LOG(INFO, TAG, PCF("More response fragments to come")); + OC_LOG(INFO, TAG, "More response fragments to come"); stackRet = OC_STACK_OK; } } diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index f0538d1c8..8ab815bae 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -109,13 +109,13 @@ void* defaultDeviceHandlerCallbackParameter = NULL; //----------------------------------------------------------------------------- // Macros //----------------------------------------------------------------------------- -#define TAG PCF("OCStack") +#define TAG "OCStack" #define VERIFY_SUCCESS(op, successCode) { if ((op) != (successCode)) \ {OC_LOG_V(FATAL, TAG, "%s failed!!", #op); goto exit;} } #define VERIFY_NON_NULL(arg, logLevel, retVal) { if (!(arg)) { OC_LOG((logLevel), \ - TAG, PCF(#arg " is NULL")); return (retVal); } } + TAG, #arg " is NULL"); return (retVal); } } #define VERIFY_NON_NULL_NR(arg, logLevel) { if (!(arg)) { OC_LOG((logLevel), \ - TAG, PCF(#arg " is NULL")); return; } } + TAG, #arg " is NULL"); return; } } #define VERIFY_NON_NULL_V(arg) { if (!arg) {OC_LOG_V(FATAL, TAG, "%s is NULL", #arg);\ goto exit;} } @@ -439,7 +439,7 @@ OCStackResult OCStackFeedBack(CAToken_t token, uint8_t tokenLength, uint8_t stat switch(status) { case OC_OBSERVER_NOT_INTERESTED: - OC_LOG(DEBUG, TAG, PCF("observer not interested in our notifications")); + OC_LOG(DEBUG, TAG, "observer not interested in our notifications"); observer = GetObserverUsingToken (token, tokenLength); if(observer) { @@ -462,17 +462,17 @@ OCStackResult OCStackFeedBack(CAToken_t token, uint8_t tokenLength, uint8_t stat result = DeleteObserverUsingToken (token, tokenLength); if(result == OC_STACK_OK) { - OC_LOG(DEBUG, TAG, PCF("Removed observer successfully")); + OC_LOG(DEBUG, TAG, "Removed observer successfully"); } else { result = OC_STACK_OK; - OC_LOG(DEBUG, TAG, PCF("Observer Removal failed")); + OC_LOG(DEBUG, TAG, "Observer Removal failed"); } break; case OC_OBSERVER_STILL_INTERESTED: - OC_LOG(DEBUG, TAG, PCF("observer still interested, reset the failedCount")); + OC_LOG(DEBUG, TAG, "observer still interested, reset the failedCount"); observer = GetObserverUsingToken (token, tokenLength); if(observer) { @@ -487,7 +487,7 @@ OCStackResult OCStackFeedBack(CAToken_t token, uint8_t tokenLength, uint8_t stat break; case OC_OBSERVER_FAILED_COMM: - OC_LOG(DEBUG, TAG, PCF("observer is unreachable")); + OC_LOG(DEBUG, TAG, "observer is unreachable"); observer = GetObserverUsingToken (token, tokenLength); if(observer) { @@ -511,12 +511,12 @@ OCStackResult OCStackFeedBack(CAToken_t token, uint8_t tokenLength, uint8_t stat result = DeleteObserverUsingToken (token, tokenLength); if(result == OC_STACK_OK) { - OC_LOG(DEBUG, TAG, PCF("Removed observer successfully")); + OC_LOG(DEBUG, TAG, "Removed observer successfully"); } else { result = OC_STACK_OK; - OC_LOG(DEBUG, TAG, PCF("Observer Removal failed")); + OC_LOG(DEBUG, TAG, "Observer Removal failed"); } } else @@ -529,7 +529,7 @@ OCStackResult OCStackFeedBack(CAToken_t token, uint8_t tokenLength, uint8_t stat } break; default: - OC_LOG(ERROR, TAG, PCF("Unknown status")); + OC_LOG(ERROR, TAG, "Unknown status"); result = OC_STACK_ERROR; break; } @@ -817,7 +817,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, if (!presenceSubscribe && !multicastPresenceSubscribe) { - OC_LOG(ERROR, TAG, PCF("Received a presence notification, but no callback, ignoring")); + OC_LOG(ERROR, TAG, "Received a presence notification, but no callback, ignoring"); goto exit; } @@ -834,12 +834,12 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, if(result != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("Presence parse failed")); + OC_LOG(ERROR, TAG, "Presence parse failed"); goto exit; } if(!response.payload || response.payload->type != PAYLOAD_TYPE_PRESENCE) { - OC_LOG(ERROR, TAG, PCF("Presence payload was wrong type")); + OC_LOG(ERROR, TAG, "Presence payload was wrong type"); result = OC_STACK_ERROR; goto exit; } @@ -852,13 +852,13 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, { if(cbNode->sequenceNumber == response.sequenceNumber) { - OC_LOG(INFO, TAG, PCF("No presence change")); + OC_LOG(INFO, TAG, "No presence change"); goto exit; } if(maxAge == 0) { - OC_LOG(INFO, TAG, PCF("Stopping presence")); + OC_LOG(INFO, TAG, "Stopping presence"); response.result = OC_STACK_PRESENCE_STOPPED; if(cbNode->presence) { @@ -875,7 +875,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, if(!(cbNode->presence)) { - OC_LOG(ERROR, TAG, PCF("Could not allocate memory for cbNode->presence")); + OC_LOG(ERROR, TAG, "Could not allocate memory for cbNode->presence"); result = OC_STACK_NO_MEMORY; goto exit; } @@ -886,7 +886,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, OICMalloc(PresenceTimeOutSize * sizeof(uint32_t)); if(!(cbNode->presence->timeOut)){ OC_LOG(ERROR, TAG, - PCF("Could not allocate memory for cbNode->presence->timeOut")); + "Could not allocate memory for cbNode->presence->timeOut"); OICFree(cbNode->presence); result = OC_STACK_NO_MEMORY; goto exit; @@ -917,14 +917,14 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, { if(mcNode->nonce == response.sequenceNumber) { - OC_LOG(INFO, TAG, PCF("No presence change (Multicast)")); + OC_LOG(INFO, TAG, "No presence change (Multicast)"); goto exit; } mcNode->nonce = response.sequenceNumber; if(maxAge == 0) { - OC_LOG(INFO, TAG, PCF("Stopping presence")); + OC_LOG(INFO, TAG, "Stopping presence"); response.result = OC_STACK_PRESENCE_STOPPED; } } @@ -934,7 +934,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, if (!uri) { OC_LOG(INFO, TAG, - PCF("No Memory for URI to store in the presence node")); + "No Memory for URI to store in the presence node"); result = OC_STACK_NO_MEMORY; goto exit; } @@ -943,7 +943,7 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint, if(result == OC_STACK_NO_MEMORY) { OC_LOG(INFO, TAG, - PCF("No Memory for Multicast Presence Node")); + "No Memory for Multicast Presence Node"); OICFree(uri); goto exit; } @@ -977,7 +977,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res VERIFY_NON_NULL_NR(endPoint, FATAL); VERIFY_NON_NULL_NR(responseInfo, FATAL); - OC_LOG(INFO, TAG, PCF("Enter HandleCAResponses")); + OC_LOG(INFO, TAG, "Enter HandleCAResponses"); if(responseInfo->info.resourceUri && strcmp(responseInfo->info.resourceUri, OC_RSRVD_PRESENCE_URI) == 0) @@ -994,23 +994,23 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res if(cbNode) { - OC_LOG(INFO, TAG, PCF("There is a cbNode associated with the response token")); + OC_LOG(INFO, TAG, "There is a cbNode associated with the response token"); if(responseInfo->result == CA_EMPTY) { - OC_LOG(INFO, TAG, PCF("Receiving A ACK/RESET for this token")); + OC_LOG(INFO, TAG, "Receiving A ACK/RESET for this token"); // We do not have a case for the client to receive a RESET if(responseInfo->info.type == CA_MSG_ACKNOWLEDGE) { //This is the case of receiving an ACK on a request to a slow resource! - OC_LOG(INFO, TAG, PCF("This is a pure ACK")); + OC_LOG(INFO, TAG, "This is a pure ACK"); //TODO: should we inform the client // app that at least the request was received at the server? } } else if(responseInfo->result == CA_RETRANSMIT_TIMEOUT) { - OC_LOG(INFO, TAG, PCF("Receiving A Timeout for this token")); - OC_LOG(INFO, TAG, PCF("Calling into application address space")); + OC_LOG(INFO, TAG, "Receiving A Timeout for this token"); + OC_LOG(INFO, TAG, "Calling into application address space"); OCClientResponse response = {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}}; @@ -1028,8 +1028,8 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res } else { - OC_LOG(INFO, TAG, PCF("This is a regular response, A client call back is found")); - OC_LOG(INFO, TAG, PCF("Calling into application address space")); + OC_LOG(INFO, TAG, "This is a regular response, A client call back is found"); + OC_LOG(INFO, TAG, "Calling into application address space"); OCClientResponse response = {.devAddr = {.adapter = OC_DEFAULT_ADAPTER}}; @@ -1047,7 +1047,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res OC_STACK_OK != OCParsePayload(&response.payload, responseInfo->info.payload, responseInfo->info.payloadSize)) { - OC_LOG(ERROR, TAG, PCF("Error converting payload")); + OC_LOG(ERROR, TAG, "Error converting payload"); OCPayloadDestroy(response.payload); return; } @@ -1081,7 +1081,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res if(response.numRcvdVendorSpecificHeaderOptions > MAX_HEADER_OPTIONS) { - OC_LOG(ERROR, TAG, PCF("#header options are more than MAX_HEADER_OPTIONS")); + OC_LOG(ERROR, TAG, "#header options are more than MAX_HEADER_OPTIONS"); OCPayloadDestroy(response.payload); return; } @@ -1097,7 +1097,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res response.sequenceNumber > OC_OFFSET_SEQUENCE_NUMBER && response.sequenceNumber <= cbNode->sequenceNumber) { - OC_LOG_V(INFO, TAG, PCF("Received stale notification. Number :%d"), + OC_LOG_V(INFO, TAG, "Received stale notification. Number :%d", response.sequenceNumber); } else @@ -1133,26 +1133,26 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res if(observer) { - OC_LOG(INFO, TAG, PCF("There is an observer associated with the response token")); + OC_LOG(INFO, TAG, "There is an observer associated with the response token"); if(responseInfo->result == CA_EMPTY) { - OC_LOG(INFO, TAG, PCF("Receiving A ACK/RESET for this token")); + OC_LOG(INFO, TAG, "Receiving A ACK/RESET for this token"); if(responseInfo->info.type == CA_MSG_RESET) { - OC_LOG(INFO, TAG, PCF("This is a RESET")); + OC_LOG(INFO, TAG, "This is a RESET"); OCStackFeedBack(responseInfo->info.token, responseInfo->info.tokenLength, OC_OBSERVER_NOT_INTERESTED); } else if(responseInfo->info.type == CA_MSG_ACKNOWLEDGE) { - OC_LOG(INFO, TAG, PCF("This is a pure ACK")); + OC_LOG(INFO, TAG, "This is a pure ACK"); OCStackFeedBack(responseInfo->info.token, responseInfo->info.tokenLength, OC_OBSERVER_STILL_INTERESTED); } } else if(responseInfo->result == CA_RETRANSMIT_TIMEOUT) { - OC_LOG(INFO, TAG, PCF("Receiving Time Out for an observer")); + OC_LOG(INFO, TAG, "Receiving Time Out for an observer"); OCStackFeedBack(responseInfo->info.token, responseInfo->info.tokenLength, OC_OBSERVER_FAILED_COMM); } @@ -1163,14 +1163,14 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res { if(myStackMode == OC_CLIENT || myStackMode == OC_CLIENT_SERVER) { - OC_LOG(INFO, TAG, PCF("This is a client, but no cbNode was found for token")); + OC_LOG(INFO, TAG, "This is a client, but no cbNode was found for token"); if(responseInfo->result == CA_EMPTY) { - OC_LOG(INFO, TAG, PCF("Receiving CA_EMPTY in the ocstack")); + OC_LOG(INFO, TAG, "Receiving CA_EMPTY in the ocstack"); } else { - OC_LOG(INFO, TAG, PCF("Received a message without callbacks. Sending RESET")); + OC_LOG(INFO, TAG, "Received a message without callbacks. Sending RESET"); SendDirectStackResponse(endPoint, responseInfo->info.messageId, CA_EMPTY, CA_MSG_RESET, 0, NULL, NULL, 0); } @@ -1178,15 +1178,15 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res if(myStackMode == OC_SERVER || myStackMode == OC_CLIENT_SERVER) { - OC_LOG(INFO, TAG, PCF("This is a server, but no observer was found for token")); + OC_LOG(INFO, TAG, "This is a server, but no observer was found for token"); if (responseInfo->info.type == CA_MSG_ACKNOWLEDGE) { - OC_LOG_V(INFO, TAG, PCF("Received ACK at server for messageId : %d"), + OC_LOG_V(INFO, TAG, "Received ACK at server for messageId : %d", responseInfo->info.messageId); } if (responseInfo->info.type == CA_MSG_RESET) { - OC_LOG_V(INFO, TAG, PCF("Received RESET at server for messageId : %d"), + OC_LOG_V(INFO, TAG, "Received RESET at server for messageId : %d", responseInfo->info.messageId); } } @@ -1194,7 +1194,7 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res return; } - OC_LOG(INFO, TAG, PCF("Exit HandleCAResponses")); + OC_LOG(INFO, TAG, "Exit HandleCAResponses"); } /* @@ -1203,20 +1203,20 @@ void HandleCAResponses(const CAEndpoint_t* endPoint, const CAResponseInfo_t* res */ void HandleCAErrorResponse(const CAEndpoint_t *endPoint, const CAErrorInfo_t *errrorInfo) { - OC_LOG(INFO, TAG, PCF("Enter HandleCAErrorResponse")); + OC_LOG(INFO, TAG, "Enter HandleCAErrorResponse"); if(NULL == endPoint) { - OC_LOG(ERROR, TAG, PCF("endPoint is NULL")); + OC_LOG(ERROR, TAG, "endPoint is NULL"); return; } if(NULL == errrorInfo) { - OC_LOG(ERROR, TAG, PCF("errrorInfo is NULL")); + OC_LOG(ERROR, TAG, "errrorInfo is NULL"); return; } - OC_LOG(INFO, TAG, PCF("Exit HandleCAErrorResponse")); + OC_LOG(INFO, TAG, "Exit HandleCAErrorResponse"); } /* @@ -1243,7 +1243,7 @@ OCStackResult SendDirectStackResponse(const CAEndpoint_t* endPoint, const uint16 CAResult_t caResult = CASendResponse(endPoint, &respInfo); if(caResult != CA_STATUS_OK) { - OC_LOG(ERROR, TAG, PCF("CASendResponse error")); + OC_LOG(ERROR, TAG, "CASendResponse error"); return OC_STACK_ERROR; } return OC_STACK_OK; @@ -1252,16 +1252,16 @@ OCStackResult SendDirectStackResponse(const CAEndpoint_t* endPoint, const uint16 //This function will be called back by CA layer when a request is received void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* requestInfo) { - OC_LOG(INFO, TAG, PCF("Enter HandleCARequests")); + OC_LOG(INFO, TAG, "Enter HandleCARequests"); if(!endPoint) { - OC_LOG(ERROR, TAG, PCF("endPoint is NULL")); + OC_LOG(ERROR, TAG, "endPoint is NULL"); return; } if(!requestInfo) { - OC_LOG(ERROR, TAG, PCF("requestInfo is NULL")); + OC_LOG(ERROR, TAG, "requestInfo is NULL"); return; } @@ -1275,7 +1275,7 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque OCServerProtocolRequest serverRequest = {0}; - OC_LOG_V(INFO, TAG, PCF("Endpoint URI : %s"), requestInfo->info.resourceUri); + OC_LOG_V(INFO, TAG, "Endpoint URI : %s", requestInfo->info.resourceUri); char * uriWithoutQuery = NULL; char * query = NULL; @@ -1287,8 +1287,8 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque OC_LOG_V(ERROR, TAG, "getQueryFromUri() failed with OC error code %d\n", requestResult); return; } - OC_LOG_V(INFO, TAG, PCF("URI without query: %s"), uriWithoutQuery); - OC_LOG_V(INFO, TAG, PCF("Query : %s"), query); + OC_LOG_V(INFO, TAG, "URI without query: %s", uriWithoutQuery); + OC_LOG_V(INFO, TAG, "Query : %s", query); if(strlen(uriWithoutQuery) < MAX_URI_LENGTH) { @@ -1297,7 +1297,7 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque } else { - OC_LOG(ERROR, TAG, PCF("URI length exceeds MAX_URI_LENGTH.")); + OC_LOG(ERROR, TAG, "URI length exceeds MAX_URI_LENGTH."); OICFree(uriWithoutQuery); OICFree(query); return; @@ -1312,7 +1312,7 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque } else { - OC_LOG(ERROR, TAG, PCF("Query length exceeds MAX_QUERY_LENGTH.")); + OC_LOG(ERROR, TAG, "Query length exceeds MAX_QUERY_LENGTH."); OICFree(query); return; } @@ -1393,7 +1393,7 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque if (requestInfo->info.numOptions > MAX_HEADER_OPTIONS) { OC_LOG(ERROR, TAG, - PCF("The request info numOptions is greater than MAX_HEADER_OPTIONS")); + "The request info numOptions is greater than MAX_HEADER_OPTIONS"); SendDirectStackResponse(endPoint, requestInfo->info.messageId, CA_BAD_OPT, requestInfo->info.type, requestInfo->info.numOptions, requestInfo->info.options, requestInfo->info.token, @@ -1419,7 +1419,7 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque } else if(requestResult != OC_STACK_OK) { - OC_LOG_V(ERROR, TAG, PCF("HandleStackRequests failed. error: %d"), requestResult); + OC_LOG_V(ERROR, TAG, "HandleStackRequests failed. error: %d", requestResult); CAResponseResult_t stackResponse = OCToCAStackResult(requestResult); @@ -1432,18 +1432,18 @@ void HandleCARequests(const CAEndpoint_t* endPoint, const CARequestInfo_t* reque // The token is copied in there, and is thus still owned by this function. OICFree(serverRequest.payload); OICFree(serverRequest.requestToken); - OC_LOG(INFO, TAG, PCF("Exit HandleCARequests")); + OC_LOG(INFO, TAG, "Exit HandleCARequests"); } OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest) { - OC_LOG(INFO, TAG, PCF("Entering HandleStackRequests (OCStack Layer)")); + OC_LOG(INFO, TAG, "Entering HandleStackRequests (OCStack Layer)"); OCStackResult result = OC_STACK_ERROR; ResourceHandling resHandling; OCResource *resource; if(!protocolRequest) { - OC_LOG(ERROR, TAG, PCF("protocolRequest is NULL")); + OC_LOG(ERROR, TAG, "protocolRequest is NULL"); return OC_STACK_INVALID_PARAM; } @@ -1451,7 +1451,7 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest) protocolRequest->tokenLength); if(!request) { - OC_LOG(INFO, TAG, PCF("This is a new Server Request")); + OC_LOG(INFO, TAG, "This is a new Server Request"); result = AddServerRequest(&request, protocolRequest->coapID, protocolRequest->delayedResNeeded, 0, protocolRequest->method, protocolRequest->numRcvdVendorSpecificHeaderOptions, @@ -1463,13 +1463,13 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest) &protocolRequest->devAddr); if (OC_STACK_OK != result) { - OC_LOG(ERROR, TAG, PCF("Error adding server request")); + OC_LOG(ERROR, TAG, "Error adding server request"); return result; } if(!request) { - OC_LOG(ERROR, TAG, PCF("Out of Memory")); + OC_LOG(ERROR, TAG, "Out of Memory"); return OC_STACK_NO_MEMORY; } @@ -1480,12 +1480,12 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest) } else { - OC_LOG(INFO, TAG, PCF("This is either a repeated or blocked Server Request")); + OC_LOG(INFO, TAG, "This is either a repeated or blocked Server Request"); } if(request->requestComplete) { - OC_LOG(INFO, TAG, PCF("This Server Request is complete")); + OC_LOG(INFO, TAG, "This Server Request is complete"); result = DetermineResourceHandling (request, &resHandling, &resource); if (result == OC_STACK_OK) { @@ -1494,7 +1494,7 @@ OCStackResult HandleStackRequests(OCServerProtocolRequest * protocolRequest) } else { - OC_LOG(INFO, TAG, PCF("This Server Request is incomplete")); + OC_LOG(INFO, TAG, "This Server Request is incomplete"); result = OC_STACK_CONTINUE; } return result; @@ -1505,7 +1505,7 @@ bool validatePlatformInfo(OCPlatformInfo info) if (!info.platformID) { - OC_LOG(ERROR, TAG, PCF("No platform ID found.")); + OC_LOG(ERROR, TAG, "No platform ID found."); return false; } @@ -1515,13 +1515,13 @@ bool validatePlatformInfo(OCPlatformInfo info) if(lenManufacturerName == 0 || lenManufacturerName > MAX_MANUFACTURER_NAME_LENGTH) { - OC_LOG(ERROR, TAG, PCF("Manufacturer name fails length requirements.")); + OC_LOG(ERROR, TAG, "Manufacturer name fails length requirements."); return false; } } else { - OC_LOG(ERROR, TAG, PCF("No manufacturer name present")); + OC_LOG(ERROR, TAG, "No manufacturer name present"); return false; } @@ -1529,7 +1529,7 @@ bool validatePlatformInfo(OCPlatformInfo info) { if(strlen(info.manufacturerUrl) > MAX_MANUFACTURER_URL_LENGTH) { - OC_LOG(ERROR, TAG, PCF("Manufacturer url fails length requirements.")); + OC_LOG(ERROR, TAG, "Manufacturer url fails length requirements."); return false; } } @@ -1568,26 +1568,26 @@ OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlag { if(stackState == OC_STACK_INITIALIZED) { - OC_LOG(INFO, TAG, PCF("Subsequent calls to OCInit() without calling \ - OCStop() between them are ignored.")); + OC_LOG(INFO, TAG, "Subsequent calls to OCInit() without calling \ + OCStop() between them are ignored."); return OC_STACK_OK; } #ifdef RA_ADAPTER if(!gRASetInfo) { - OC_LOG(ERROR, TAG, PCF("Need to call OCSetRAInfo before calling OCInit")); + OC_LOG(ERROR, TAG, "Need to call OCSetRAInfo before calling OCInit"); return OC_STACK_ERROR; } #endif OCStackResult result = OC_STACK_ERROR; - OC_LOG(INFO, TAG, PCF("Entering OCInit")); + OC_LOG(INFO, TAG, "Entering OCInit"); // Validate mode if (!((mode == OC_CLIENT) || (mode == OC_SERVER) || (mode == OC_CLIENT_SERVER))) { - OC_LOG(ERROR, TAG, PCF("Invalid mode")); + OC_LOG(ERROR, TAG, "Invalid mode"); return OC_STACK_ERROR; } myStackMode = mode; @@ -1627,12 +1627,12 @@ OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlag case OC_CLIENT: CARegisterHandler(HandleCARequests, HandleCAResponses, HandleCAErrorResponse); result = CAResultToOCResult(CAStartDiscoveryServer()); - OC_LOG(INFO, TAG, PCF("Client mode: CAStartDiscoveryServer")); + OC_LOG(INFO, TAG, "Client mode: CAStartDiscoveryServer"); break; case OC_SERVER: SRMRegisterHandler(HandleCARequests, HandleCAResponses, HandleCAErrorResponse); result = CAResultToOCResult(CAStartListeningServer()); - OC_LOG(INFO, TAG, PCF("Server mode: CAStartListeningServer")); + OC_LOG(INFO, TAG, "Server mode: CAStartListeningServer"); break; case OC_CLIENT_SERVER: SRMRegisterHandler(HandleCARequests, HandleCAResponses, HandleCAErrorResponse); @@ -1668,7 +1668,7 @@ OCStackResult OCInit1(OCMode mode, OCTransportFlags serverFlags, OCTransportFlag exit: if(result != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("Stack initialization error")); + OC_LOG(ERROR, TAG, "Stack initialization error"); deleteAllResources(); CATerminate(); stackState = OC_STACK_UNINITIALIZED; @@ -1678,16 +1678,16 @@ exit: OCStackResult OCStop() { - OC_LOG(INFO, TAG, PCF("Entering OCStop")); + OC_LOG(INFO, TAG, "Entering OCStop"); if (stackState == OC_STACK_UNINIT_IN_PROGRESS) { - OC_LOG(DEBUG, TAG, PCF("Stack already stopping, exiting")); + OC_LOG(DEBUG, TAG, "Stack already stopping, exiting"); return OC_STACK_OK; } else if (stackState != OC_STACK_INITIALIZED) { - OC_LOG(ERROR, TAG, PCF("Stack not initialized")); + OC_LOG(ERROR, TAG, "Stack not initialized"); return OC_STACK_ERROR; } @@ -1976,7 +1976,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, OCHeaderOption *options, uint8_t numOptions) { - OC_LOG(INFO, TAG, PCF("Entering OCDoResource")); + OC_LOG(INFO, TAG, "Entering OCDoResource"); // Validate input parameters VERIFY_NON_NULL(cbData, FATAL, OC_STACK_INVALID_CALLBACK); @@ -2072,7 +2072,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, if (!devAddr && !destination) { - OC_LOG_V(DEBUG, TAG, "no devAddr and no destination"); + OC_LOG(DEBUG, TAG, "no devAddr and no destination"); result = OC_STACK_INVALID_PARAM; goto exit; } @@ -2099,7 +2099,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, caResult = CAGenerateToken(&token, tokenLength); if (caResult != CA_STATUS_OK) { - OC_LOG(ERROR, TAG, PCF("CAGenerateToken error")); + OC_LOG(ERROR, TAG, "CAGenerateToken error"); result= OC_STACK_ERROR; goto exit; } @@ -2135,7 +2135,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, OCConvertPayload(payload, &requestInfo.info.payload, &requestInfo.info.payloadSize)) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("Failed to create CBOR Payload")); + OC_LOG(ERROR, TAG, "Failed to create CBOR Payload"); goto exit; } requestInfo.info.payloadFormat = CA_FORMAT_CBOR; @@ -2149,7 +2149,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, if (result != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("CACreateEndpoint error")); + OC_LOG(ERROR, TAG, "CACreateEndpoint error"); goto exit; } @@ -2187,7 +2187,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, caResult = CASendRequest(&endpoint, &requestInfo); if (caResult != CA_STATUS_OK) { - OC_LOG(ERROR, TAG, PCF("CASendRequest")); + OC_LOG(ERROR, TAG, "CASendRequest"); result = OC_STACK_COMM_ERROR; goto exit; } @@ -2200,7 +2200,7 @@ OCStackResult OCDoResource(OCDoHandle *handle, exit: if (result != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCDoResource error")); + OC_LOG(ERROR, TAG, "OCDoResource error"); FindAndDeleteClientCB(clientCB); CADestroyToken(token); if (handle) @@ -2257,7 +2257,7 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption ClientCB *clientCB = GetClientCB(NULL, 0, handle, NULL); if (!clientCB) { - OC_LOG(ERROR, TAG, PCF("Client callback not found. Called OCCancel twice?")); + OC_LOG(ERROR, TAG, "Client callback not found. Called OCCancel twice?"); goto Error; } @@ -2274,7 +2274,7 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption } else { - OC_LOG(INFO, TAG, PCF("Cancelling observation as CONFIRMABLE")); + OC_LOG(INFO, TAG, "Cancelling observation as CONFIRMABLE"); } requestData.type = qualityOfServiceToMessageType(qos); @@ -2297,7 +2297,7 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption caResult = CASendRequest(&endpoint, &requestInfo); if (caResult != CA_STATUS_OK) { - OC_LOG(ERROR, TAG, PCF("CASendRequest error")); + OC_LOG(ERROR, TAG, "CASendRequest error"); ret = OC_STACK_ERROR; } ret = CAResultToOCResult (caResult); @@ -2335,10 +2335,10 @@ Error: */ OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler) { - OC_LOG(INFO, TAG, PCF("RegisterPersistentStorageHandler !!")); + OC_LOG(INFO, TAG, "RegisterPersistentStorageHandler !!"); if(!persistentStorageHandler) { - OC_LOG(ERROR, TAG, PCF("The persistent storage handler is invalid")); + OC_LOG(ERROR, TAG, "The persistent storage handler is invalid"); return OC_STACK_INVALID_PARAM; } else @@ -2349,7 +2349,7 @@ OCStackResult OCRegisterPersistentStorageHandler(OCPersistentStorage* persistent !persistentStorageHandler->unlink || !persistentStorageHandler->write) { - OC_LOG(ERROR, TAG, PCF("The persistent storage handler is invalid")); + OC_LOG(ERROR, TAG, "The persistent storage handler is invalid"); return OC_STACK_INVALID_PARAM; } } @@ -2364,7 +2364,7 @@ OCStackResult OCProcessPresence() // the following line floods the log with messages that are irrelevant // to most purposes. Uncomment as needed. - //OC_LOG(INFO, TAG, PCF("Entering RequestPresence")); + //OC_LOG(INFO, TAG, "Entering RequestPresence"); ClientCB* cbNode = NULL; OCClientResponse clientResponse; OCStackApplicationResult cbResult = OC_STACK_DELETE_TRANSACTION; @@ -2393,7 +2393,7 @@ OCStackResult OCProcessPresence() } if (cbNode->presence->TTLlevel >= PresenceTimeOutSize) { - OC_LOG(DEBUG, TAG, PCF("No more timeout ticks")); + OC_LOG(DEBUG, TAG, "No more timeout ticks"); clientResponse.sequenceNumber = 0; clientResponse.result = OC_STACK_PRESENCE_TIMEOUT; @@ -2424,7 +2424,7 @@ OCStackResult OCProcessPresence() CAInfo_t requestData = {.type = CA_MSG_CONFIRM}; CARequestInfo_t requestInfo = {.method = CA_GET}; - OC_LOG(DEBUG, TAG, PCF("time to test server presence")); + OC_LOG(DEBUG, TAG, "time to test server presence"); CopyDevAddrToEndpoint(cbNode->devAddr, &endpoint); @@ -2439,7 +2439,7 @@ OCStackResult OCProcessPresence() if (caResult != CA_STATUS_OK) { - OC_LOG(ERROR, TAG, PCF("CASendRequest error")); + OC_LOG(ERROR, TAG, "CASendRequest error"); goto exit; } @@ -2449,7 +2449,7 @@ OCStackResult OCProcessPresence() exit: if (result != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCProcessPresence error")); + OC_LOG(ERROR, TAG, "OCProcessPresence error"); } return result; @@ -2477,12 +2477,12 @@ OCStackResult OCStartPresence(const uint32_t ttl) if (OC_MAX_PRESENCE_TTL_SECONDS < ttl) { presenceResource.presenceTTL = OC_MAX_PRESENCE_TTL_SECONDS; - OC_LOG(INFO, TAG, PCF("Setting Presence TTL to max value")); + OC_LOG(INFO, TAG, "Setting Presence TTL to max value"); } else if (0 == ttl) { presenceResource.presenceTTL = OC_DEFAULT_PRESENCE_TTL_SECONDS; - OC_LOG(INFO, TAG, PCF("Setting Presence TTL to default value")); + OC_LOG(INFO, TAG, "Setting Presence TTL to default value"); } else { @@ -2500,7 +2500,7 @@ OCStackResult OCStartPresence(const uint32_t ttl) CAResult_t caResult = CAGenerateToken(&caToken, tokenLength); if (caResult != CA_STATUS_OK) { - OC_LOG(ERROR, TAG, PCF("CAGenerateToken error")); + OC_LOG(ERROR, TAG, "CAGenerateToken error"); CADestroyToken(caToken); return OC_STACK_ERROR; } @@ -2535,7 +2535,7 @@ OCStackResult OCStopPresence() if(result != OC_STACK_OK) { OC_LOG(ERROR, TAG, - PCF("Changing the presence resource properties to ACTIVE not successful")); + "Changing the presence resource properties to ACTIVE not successful"); return result; } @@ -2554,7 +2554,7 @@ OCStackResult OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandler entityHandle OCStackResult OCSetPlatformInfo(OCPlatformInfo platformInfo) { - OC_LOG(INFO, TAG, PCF("Entering OCSetPlatformInfo")); + OC_LOG(INFO, TAG, "Entering OCSetPlatformInfo"); if(myStackMode == OC_SERVER || myStackMode == OC_CLIENT_SERVER) { @@ -2575,11 +2575,11 @@ OCStackResult OCSetPlatformInfo(OCPlatformInfo platformInfo) OCStackResult OCSetDeviceInfo(OCDeviceInfo deviceInfo) { - OC_LOG(INFO, TAG, PCF("Entering OCSetDeviceInfo")); + OC_LOG(INFO, TAG, "Entering OCSetDeviceInfo"); if (!deviceInfo.deviceName || deviceInfo.deviceName[0] == '\0') { - OC_LOG(ERROR, TAG, PCF("Null or empty device name.")); + OC_LOG(ERROR, TAG, "Null or empty device name."); return OC_STACK_INVALID_PARAM; } @@ -2598,7 +2598,7 @@ OCStackResult OCCreateResource(OCResourceHandle *handle, char *str = NULL; OCStackResult result = OC_STACK_ERROR; - OC_LOG(INFO, TAG, PCF("Entering OCCreateResource")); + OC_LOG(INFO, TAG, "Entering OCCreateResource"); if(myStackMode == OC_CLIENT) { @@ -2607,13 +2607,13 @@ OCStackResult OCCreateResource(OCResourceHandle *handle, // Validate parameters if(!uri || uri[0]=='\0' || strlen(uri)>=MAX_URI_LENGTH ) { - OC_LOG(ERROR, TAG, PCF("URI is empty or too long")); + OC_LOG(ERROR, TAG, "URI is empty or too long"); return OC_STACK_INVALID_URI; } // Is it presented during resource discovery? if (!handle || !resourceTypeName || resourceTypeName[0] == '\0' ) { - OC_LOG(ERROR, TAG, PCF("Input parameter is NULL")); + OC_LOG(ERROR, TAG, "Input parameter is NULL"); return OC_STACK_INVALID_PARAM; } @@ -2627,7 +2627,7 @@ OCStackResult OCCreateResource(OCResourceHandle *handle, > (OC_ACTIVE | OC_DISCOVERABLE | OC_OBSERVABLE | OC_SLOW | OC_SECURE | OC_EXPLICIT_DISCOVERABLE)) { - OC_LOG(ERROR, TAG, PCF("Invalid property")); + OC_LOG(ERROR, TAG, "Invalid property"); return OC_STACK_INVALID_PARAM; } @@ -2675,7 +2675,7 @@ OCStackResult OCCreateResource(OCResourceHandle *handle, result = BindResourceTypeToResource(pointer, resourceTypeName); if (result != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("Error adding resourcetype")); + OC_LOG(ERROR, TAG, "Error adding resourcetype"); goto exit; } @@ -2683,7 +2683,7 @@ OCStackResult OCCreateResource(OCResourceHandle *handle, result = BindResourceInterfaceToResource(pointer, resourceInterfaceName); if (result != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("Error adding resourceinterface")); + OC_LOG(ERROR, TAG, "Error adding resourceinterface"); goto exit; } @@ -2727,7 +2727,7 @@ OCStackResult OCBindResource( OCResource *resource = NULL; uint8_t i = 0; - OC_LOG(INFO, TAG, PCF("Entering OCBindResource")); + OC_LOG(INFO, TAG, "Entering OCBindResource"); // Validate parameters VERIFY_NON_NULL(collectionHandle, ERROR, OC_STACK_ERROR); @@ -2735,7 +2735,7 @@ OCStackResult OCBindResource( // Container cannot contain itself if (collectionHandle == resourceHandle) { - OC_LOG(ERROR, TAG, PCF("Added handle equals collection handle")); + OC_LOG(ERROR, TAG, "Added handle equals collection handle"); return OC_STACK_INVALID_PARAM; } @@ -2743,7 +2743,7 @@ OCStackResult OCBindResource( resource = findResource((OCResource *) collectionHandle); if (!resource) { - OC_LOG(ERROR, TAG, PCF("Collection handle not found")); + OC_LOG(ERROR, TAG, "Collection handle not found"); return OC_STACK_INVALID_PARAM; } @@ -2754,7 +2754,7 @@ OCStackResult OCBindResource( if (!resource->rsrcResources[i]) { resource->rsrcResources[i] = (OCResource *) resourceHandle; - OC_LOG(INFO, TAG, PCF("resource bound")); + OC_LOG(INFO, TAG, "resource bound"); #ifdef WITH_PRESENCE if (presenceResource.handle) @@ -2779,7 +2779,7 @@ OCStackResult OCUnBindResource( OCResource *resource = NULL; uint8_t i = 0; - OC_LOG(INFO, TAG, PCF("Entering OCUnBindResource")); + OC_LOG(INFO, TAG, "Entering OCUnBindResource"); // Validate parameters VERIFY_NON_NULL(collectionHandle, ERROR, OC_STACK_ERROR); @@ -2787,7 +2787,7 @@ OCStackResult OCUnBindResource( // Container cannot contain itself if (collectionHandle == resourceHandle) { - OC_LOG(ERROR, TAG, PCF("removing handle equals collection handle")); + OC_LOG(ERROR, TAG, "removing handle equals collection handle"); return OC_STACK_INVALID_PARAM; } @@ -2795,7 +2795,7 @@ OCStackResult OCUnBindResource( resource = findResource((OCResource *) collectionHandle); if (!resource) { - OC_LOG(ERROR, TAG, PCF("Collection handle not found")); + OC_LOG(ERROR, TAG, "Collection handle not found"); return OC_STACK_INVALID_PARAM; } @@ -2806,7 +2806,7 @@ OCStackResult OCUnBindResource( if (resourceHandle == resource->rsrcResources[i]) { resource->rsrcResources[i] = (OCResource *) NULL; - OC_LOG(INFO, TAG, PCF("resource unbound")); + OC_LOG(INFO, TAG, "resource unbound"); // Send notification when resource is unbounded successfully. #ifdef WITH_PRESENCE @@ -2821,7 +2821,7 @@ OCStackResult OCUnBindResource( } } - OC_LOG(INFO, TAG, PCF("resource not found in collection")); + OC_LOG(INFO, TAG, "resource not found in collection"); // Unable to add resourceHandle, so return error return OC_STACK_ERROR; @@ -2915,7 +2915,7 @@ OCStackResult OCBindResourceTypeToResource(OCResourceHandle handle, resource = findResource((OCResource *) handle); if (!resource) { - OC_LOG(ERROR, TAG, PCF("Resource not found")); + OC_LOG(ERROR, TAG, "Resource not found"); return OC_STACK_ERROR; } @@ -2942,7 +2942,7 @@ OCStackResult OCBindResourceInterfaceToResource(OCResourceHandle handle, resource = findResource((OCResource *) handle); if (!resource) { - OC_LOG(ERROR, TAG, PCF("Resource not found")); + OC_LOG(ERROR, TAG, "Resource not found"); return OC_STACK_ERROR; } @@ -2988,20 +2988,20 @@ OCStackResult OCDeleteResource(OCResourceHandle handle) { if (!handle) { - OC_LOG(ERROR, TAG, PCF("Invalid handle for deletion")); + OC_LOG(ERROR, TAG, "Invalid handle for deletion"); return OC_STACK_INVALID_PARAM; } OCResource *resource = findResource((OCResource *) handle); if (resource == NULL) { - OC_LOG(ERROR, TAG, PCF("Resource not found")); + OC_LOG(ERROR, TAG, "Resource not found"); return OC_STACK_NO_RESOURCE; } if (deleteResource((OCResource *) handle) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("Error deleting resource")); + OC_LOG(ERROR, TAG, "Error deleting resource"); return OC_STACK_ERROR; } @@ -3135,7 +3135,7 @@ OCStackResult OCBindResourceHandler(OCResourceHandle handle, resource = findResource((OCResource *)handle); if (!resource) { - OC_LOG(ERROR, TAG, PCF("Resource not found")); + OC_LOG(ERROR, TAG, "Resource not found"); return OC_STACK_ERROR; } @@ -3161,7 +3161,7 @@ OCEntityHandler OCGetResourceHandler(OCResourceHandle handle) resource = findResource((OCResource *)handle); if (!resource) { - OC_LOG(ERROR, TAG, PCF("Resource not found")); + OC_LOG(ERROR, TAG, "Resource not found"); return NULL; } @@ -3231,9 +3231,9 @@ OCStackResult OCNotifyAllObservers(OCResourceHandle handle, OCQualityOfService q OCMethod method = OC_REST_NOMETHOD; uint32_t maxAge = 0; - OC_LOG(INFO, TAG, PCF("Notifying all observers")); + OC_LOG(INFO, TAG, "Notifying all observers"); #ifdef WITH_PRESENCE - if (handle == presenceResource.handle) + if(handle == presenceResource.handle) { return OC_STACK_OK; } @@ -3269,7 +3269,7 @@ OCNotifyListOfObservers (OCResourceHandle handle, const OCRepPayload *payload, OCQualityOfService qos) { - OC_LOG(INFO, TAG, PCF("Entering OCNotifyListOfObservers")); + OC_LOG(INFO, TAG, "Entering OCNotifyListOfObservers"); OCResource *resPtr = NULL; //TODO: we should allow the server to define this @@ -3297,7 +3297,7 @@ OCStackResult OCDoResponse(OCEntityHandlerResponse *ehResponse) OCStackResult result = OC_STACK_ERROR; OCServerRequest *serverRequest = NULL; - OC_LOG(INFO, TAG, PCF("Entering OCDoResponse")); + OC_LOG(INFO, TAG, "Entering OCDoResponse"); // Validate input parameters VERIFY_NON_NULL(ehResponse, ERROR, OC_STACK_INVALID_PARAM); @@ -3342,7 +3342,7 @@ OCStackResult OCChangeResourceProperty(OCResourceProperty * inputProperty, if (resourceProperties > (OC_ACTIVE | OC_DISCOVERABLE | OC_OBSERVABLE | OC_SLOW)) { - OC_LOG(ERROR, TAG, PCF("Invalid property")); + OC_LOG(ERROR, TAG, "Invalid property"); return OC_STACK_INVALID_PARAM; } if(!enable) @@ -3452,7 +3452,7 @@ OCStackResult deleteResource(OCResource *resource) OCResource *temp = NULL; if(!resource) { - OC_LOG_V(DEBUG,TAG,"resource is NULL"); + OC_LOG(DEBUG,TAG,"resource is NULL"); return OC_STACK_INVALID_PARAM; } @@ -3791,7 +3791,7 @@ const OicUuid_t* OCGetServerInstanceID(void) if (GetDoxmDeviceID(&sid) != OC_STACK_OK) { - OC_LOG(FATAL, TAG, PCF("Generate UUID for Server Instance failed!")); + OC_LOG(FATAL, TAG, "Generate UUID for Server Instance failed!"); return NULL; } generated = true; @@ -3812,7 +3812,7 @@ const char* OCGetServerInstanceIDString(void) if(OCConvertUuidToString(sid->id, sidStr) != RAND_UUID_OK) { - OC_LOG(FATAL, TAG, PCF("Generate UUID String for Server Instance failed!")); + OC_LOG(FATAL, TAG, "Generate UUID String for Server Instance failed!"); return NULL; } diff --git a/resource/csdk/stack/src/oicgroup.c b/resource/csdk/stack/src/oicgroup.c index 00d429b2a..fd0890748 100755 --- a/resource/csdk/stack/src/oicgroup.c +++ b/resource/csdk/stack/src/oicgroup.c @@ -36,7 +36,7 @@ #include #endif -#define TAG PCF("OICGROUP") +#define TAG "OICGROUP" #define DESC_DELIMITER "\"" #define ACTION_DELIMITER "*" @@ -98,7 +98,7 @@ ScheduledResourceInfo *scheduleResourceList = NULL; void AddScheduledResource(ScheduledResourceInfo **head, ScheduledResourceInfo* add) { - OC_LOG(INFO, TAG, PCF("AddScheduledResource Entering...")); + OC_LOG(INFO, TAG, "AddScheduledResource Entering..."); #ifndef WITH_ARDUINO pthread_mutex_lock(&lock); @@ -126,7 +126,7 @@ void AddScheduledResource(ScheduledResourceInfo **head, ScheduledResourceInfo* GetScheduledResource(ScheduledResourceInfo *head) { - OC_LOG(INFO, TAG, PCF("GetScheduledResource Entering...")); + OC_LOG(INFO, TAG, "GetScheduledResource Entering..."); #ifndef WITH_ARDUINO pthread_mutex_lock(&lock); @@ -156,7 +156,7 @@ ScheduledResourceInfo* GetScheduledResource(ScheduledResourceInfo *head) if (diffTm <= (time_t) 0) { - OC_LOG(INFO, TAG, PCF("return Call INFO.")); + OC_LOG(INFO, TAG, "return Call INFO."); goto exit; } @@ -170,14 +170,14 @@ ScheduledResourceInfo* GetScheduledResource(ScheduledResourceInfo *head) #endif if (tmp == NULL) { - OC_LOG(INFO, TAG, PCF("Cannot Find Call Info.")); + OC_LOG(INFO, TAG, "Cannot Find Call Info."); } return tmp; } ScheduledResourceInfo* GetScheduledResourceByActionSetName(ScheduledResourceInfo *head, char *setName) { - OC_LOG(INFO, TAG, PCF("GetScheduledResourceByActionSetName Entering...")); + OC_LOG(INFO, TAG, "GetScheduledResourceByActionSetName Entering..."); #ifndef WITH_ARDUINO pthread_mutex_lock(&lock); @@ -191,7 +191,7 @@ ScheduledResourceInfo* GetScheduledResourceByActionSetName(ScheduledResourceInfo { if (strcmp(tmp->actionset->actionsetName, setName) == 0) { - OC_LOG(INFO, TAG, PCF("return Call INFO.")); + OC_LOG(INFO, TAG, "return Call INFO."); goto exit; } tmp = tmp->next; @@ -204,7 +204,7 @@ exit: #endif if (tmp == NULL) { - OC_LOG(INFO, TAG, PCF("Cannot Find Call Info.")); + OC_LOG(INFO, TAG, "Cannot Find Call Info."); } return tmp; } @@ -215,7 +215,7 @@ void RemoveScheduledResource(ScheduledResourceInfo **head, #ifndef WITH_ARDUINO pthread_mutex_lock(&lock); #endif - OC_LOG(INFO, TAG, PCF("RemoveScheduledResource Entering...")); + OC_LOG(INFO, TAG, "RemoveScheduledResource Entering..."); ScheduledResourceInfo *tmp = NULL; if (del == NULL) @@ -640,7 +640,7 @@ OCStackResult BuildActionSetFromString(OCActionSet **set, char* actiondesc) OCAction *action = NULL; OCCapability *capa = NULL; - OC_LOG(INFO, TAG, PCF("Build ActionSet Instance.")); + OC_LOG(INFO, TAG, "Build ActionSet Instance."); *set = (OCActionSet*) OICMalloc(sizeof(OCActionSet)); VARIFY_POINTER_NULL(*set, result, exit) @@ -698,7 +698,7 @@ OCStackResult BuildActionSetFromString(OCActionSet **set, char* actiondesc) if (strcmp(key, "uri") == 0) { - OC_LOG(INFO, TAG, PCF("Build OCAction Instance.")); + OC_LOG(INFO, TAG, "Build OCAction Instance."); if(action) { @@ -717,7 +717,7 @@ OCStackResult BuildActionSetFromString(OCActionSet **set, char* actiondesc) { if ((key != NULL) && (value != NULL)) { - OC_LOG(INFO, TAG, PCF("Build OCCapability Instance.")); + OC_LOG(INFO, TAG, "Build OCCapability Instance."); capa = (OCCapability*) OICMalloc(sizeof(OCCapability)); VARIFY_POINTER_NULL(capa, result, exit) @@ -864,7 +864,7 @@ OCStackApplicationResult ActionSetCB(void* context, OCDoHandle handle, { (void)context; (void)clientResponse; - OC_LOG(INFO, TAG, PCF("Entering ActionSetCB")); + OC_LOG(INFO, TAG, "Entering ActionSetCB"); ClientRequestInfo *info = GetClientRequestInfo(clientRequstList, handle); @@ -920,7 +920,7 @@ OCStackResult BuildActionJSON(OCAction* action, unsigned char* bufferPtr, char *jsonStr; uint16_t jsonLen; - OC_LOG(INFO, TAG, PCF("Entering BuildActionJSON")); + OC_LOG(INFO, TAG, "Entering BuildActionJSON"); json = cJSON_CreateObject(); cJSON_AddItemToObject(json, "rep", body = cJSON_CreateObject()); @@ -956,7 +956,7 @@ OCPayload* BuildActionCBOR(OCAction* action) if (!payload) { - OC_LOG(INFO, TAG, PCF("Failed to create put payload object")); + OC_LOG(INFO, TAG, "Failed to create put payload object"); return NULL; } @@ -1050,27 +1050,27 @@ OCStackResult DoAction(OCResource* resource, OCActionSet* actionset, void DoScheduledGroupAction() { - OC_LOG(INFO, TAG, PCF("DoScheduledGroupAction Entering...")); + OC_LOG(INFO, TAG, "DoScheduledGroupAction Entering..."); ScheduledResourceInfo* info = GetScheduledResource(scheduleResourceList); if (info == NULL) { - OC_LOG(INFO, TAG, PCF("Target resource is NULL")); + OC_LOG(INFO, TAG, "Target resource is NULL"); goto exit; } else if (info->resource == NULL) { - OC_LOG(INFO, TAG, PCF("Target resource is NULL")); + OC_LOG(INFO, TAG, "Target resource is NULL"); goto exit; } else if (info->actionset == NULL) { - OC_LOG(INFO, TAG, PCF("Target ActionSet is NULL")); + OC_LOG(INFO, TAG, "Target ActionSet is NULL"); goto exit; } else if (info->ehRequest == NULL) { - OC_LOG(INFO, TAG, PCF("Target ActionSet is NULL")); + OC_LOG(INFO, TAG, "Target ActionSet is NULL"); goto exit; } #ifndef WITH_ARDUINO @@ -1089,7 +1089,7 @@ void DoScheduledGroupAction() if (schedule) { - OC_LOG(INFO, TAG, PCF("Building New Call Info.")); + OC_LOG(INFO, TAG, "Building New Call Info."); memset(schedule, 0, sizeof(ScheduledResourceInfo)); if (info->actionset->timesteps > 0) @@ -1105,7 +1105,7 @@ void DoScheduledGroupAction() &schedule->timer_id, &DoScheduledGroupAction); - OC_LOG(INFO, TAG, PCF("Reregisteration.")); + OC_LOG(INFO, TAG, "Reregisteration."); #ifndef WITH_ARDUINO pthread_mutex_unlock(&lock); #endif @@ -1131,7 +1131,7 @@ OCStackResult BuildCollectionGroupActionCBORResponse( { OCStackResult stackRet = OC_STACK_ERROR; - OC_LOG(INFO, TAG, PCF("Group Action is requested.")); + OC_LOG(INFO, TAG, "Group Action is requested."); char *doWhat = NULL; char *details = NULL; @@ -1148,7 +1148,7 @@ OCStackResult BuildCollectionGroupActionCBORResponse( if (method == OC_REST_PUT) { - OC_LOG(INFO, TAG, PCF("Group Action[PUT].")); + OC_LOG(INFO, TAG, "Group Action[PUT]."); if (strcmp(doWhat, ACTIONSET) == 0) { @@ -1167,7 +1167,7 @@ OCStackResult BuildCollectionGroupActionCBORResponse( { DeleteActionSet( &actionSet ); } - OC_LOG(INFO, TAG, PCF("Duplicated ActionSet ")); + OC_LOG(INFO, TAG, "Duplicated ActionSet "); } } else @@ -1198,7 +1198,7 @@ OCStackResult BuildCollectionGroupActionCBORResponse( if(!payload) { - OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); + OC_LOG(ERROR, TAG, "Failed to allocate Payload"); stackRet = OC_STACK_ERROR; } else @@ -1261,18 +1261,18 @@ OCStackResult BuildCollectionGroupActionCBORResponse( if (GetActionSet(details, resource->actionsetHead, &actionset) != OC_STACK_OK) { - OC_LOG(INFO, TAG, PCF("ERROR")); + OC_LOG(INFO, TAG, "ERROR"); stackRet = OC_STACK_ERROR; } if (actionset == NULL) { - OC_LOG(INFO, TAG, PCF("Cannot Find ActionSet")); + OC_LOG(INFO, TAG, "Cannot Find ActionSet"); stackRet = OC_STACK_ERROR; } else { - OC_LOG(INFO, TAG, PCF("Group Action[POST].")); + OC_LOG(INFO, TAG, "Group Action[POST]."); if (actionset->type == NONE) { OC_LOG_V(INFO, TAG, "Execute ActionSet : %s", @@ -1303,7 +1303,7 @@ OCStackResult BuildCollectionGroupActionCBORResponse( if (schedule) { - OC_LOG(INFO, TAG, PCF("Building New Call Info.")); + OC_LOG(INFO, TAG, "Building New Call Info."); memset(schedule, 0, sizeof(ScheduledResourceInfo)); @@ -1373,7 +1373,7 @@ OCStackResult BuildCollectionGroupActionCBORResponse( if(!payload) { - OC_LOG(ERROR, TAG, PCF("Failed to allocate Payload")); + OC_LOG(ERROR, TAG, "Failed to allocate Payload"); stackRet = OC_STACK_ERROR; } else diff --git a/resource/csdk/stack/test/arduino/ArduinoStackTest.cpp b/resource/csdk/stack/test/arduino/ArduinoStackTest.cpp index 69cf8b53a..dec98ac47 100644 --- a/resource/csdk/stack/test/arduino/ArduinoStackTest.cpp +++ b/resource/csdk/stack/test/arduino/ArduinoStackTest.cpp @@ -27,9 +27,7 @@ #include "ocstackinternal.h" #include -#define PCF(str) ((PROGMEM const char *)(F(str))) - -PROGMEM const char TAG[] = "Arduino"; +#define TAG "Arduino" static OCUri SERVICE_URI = "coap://127.0.0.1:5683/"; #if 0 // Turn off logger test stuff @@ -47,17 +45,17 @@ PROGMEM const char multiLineMsg[] = "this is a DEBUG message\non multiple\nlines void EXPECT_EQ(int a, int b) { if (a == b) { - OC_LOG(INFO, TAG, PCF("PASS")); + OC_LOG(INFO, TAG, ("PASS")); } else { - OC_LOG(ERROR, TAG, PCF("FAIL")); + OC_LOG(ERROR, TAG, ("FAIL")); } } void EXPECT_STREQ(const char *a, const char *b) { if (strcmp(a, b) == 0) { - OC_LOG(INFO, TAG, PCF("PASS")); + OC_LOG(INFO, TAG, ("PASS")); } else { - OC_LOG(ERROR, TAG, PCF("FAIL")); + OC_LOG(ERROR, TAG, ("FAIL")); } } //----------------------------------------------------------------------------- @@ -125,7 +123,7 @@ void test6() { #endif extern "C" void asyncDoResourcesCallback(OCStackResult result, OCRepresentationHandle representation) { - OC_LOG(INFO, TAG, PCF("Entering asyncDoResourcesCallback")); + OC_LOG(INFO, TAG, ("Entering asyncDoResourcesCallback")); EXPECT_EQ(OC_STACK_OK, result); OCResource *resource = (OCResource *)representation; @@ -134,34 +132,34 @@ extern "C" void asyncDoResourcesCallback(OCStackResult result, OCRepresentationH } void test0() { - OC_LOG(INFO, TAG, PCF("test0")); + OC_LOG(INFO, TAG, ("test0")); EXPECT_EQ(OC_STACK_OK, OCInit(0, 5683, OC_SERVER)); } void test1() { - OC_LOG(INFO, TAG, PCF("test1")); + OC_LOG(INFO, TAG, ("test1")); EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 0, OC_SERVER)); } void test2() { - OC_LOG(INFO, TAG, PCF("test2")); + OC_LOG(INFO, TAG, ("test2")); EXPECT_EQ(OC_STACK_OK, OCInit(0, 0, OC_SERVER)); } void test3() { - OC_LOG(INFO, TAG, PCF("test3")); + OC_LOG(INFO, TAG, ("test3")); EXPECT_EQ(OC_STACK_ERROR, OCInit(0, 0, (OCMode)10)); } void test4() { - OC_LOG(INFO, TAG, PCF("test4")); + OC_LOG(INFO, TAG, ("test4")); EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_CLIENT)); EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_SERVER)); EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_CLIENT_SERVER)); } void test5() { - OC_LOG(INFO, TAG, PCF("test5")); + OC_LOG(INFO, TAG, ("test5")); EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_CLIENT)); EXPECT_EQ(OC_STACK_OK, OCDoResource(OC_REST_GET, OC_EXPLICIT_DEVICE_DISCOVERY_URI, 0, 0, asyncDoResourcesCallback), NULL, 0); EXPECT_EQ(OC_STACK_OK, OCUpdateResources(SERVICE_URI)); @@ -169,14 +167,14 @@ void test5() { } void test6() { - OC_LOG(INFO, TAG, PCF("test6")); + OC_LOG(INFO, TAG, ("test6")); EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_CLIENT)); EXPECT_EQ(OC_STACK_OK, OCStop()); EXPECT_EQ(OC_STACK_ERROR, OCStop()); } void test7() { - OC_LOG(INFO, TAG, PCF("test7")); + OC_LOG(INFO, TAG, ("test7")); EXPECT_EQ(OC_STACK_OK, OCInit("127.0.0.1", 5683, OC_CLIENT)); EXPECT_EQ(OC_STACK_OK, OCDoResource(OC_REST_GET, OC_EXPLICIT_DEVICE_DISCOVERY_URI, 0, 0, asyncDoResourcesCallback), NULL, 0); EXPECT_EQ(OC_STACK_INVALID_URI, OCUpdateResources(0)); diff --git a/resource/csdk/stack/test/arduino/ocserver.cpp b/resource/csdk/stack/test/arduino/ocserver.cpp index dc8be911d..5ced8c9fd 100644 --- a/resource/csdk/stack/test/arduino/ocserver.cpp +++ b/resource/csdk/stack/test/arduino/ocserver.cpp @@ -6,10 +6,10 @@ static uint8_t ETHERNET_MAC[] = {0x90, 0xA2, 0xDA, 0x0F, 0x2B, 0x72 }; -#define TAG PCF("ocserver") +#define TAG ("ocserver") void ocInitialize () { - OC_LOG(DEBUG, TAG, PCF("IP addr is:")); + OC_LOG(DEBUG, TAG, ("IP addr is:")); OC_LOG_BUFFER(INFO, TAG, (uint8_t*)ipAddr, sizeof(ipAddr)); delay(2000); OCInit (NULL, 0, OC_SERVER); diff --git a/resource/csdk/stack/test/linux/occlient.c b/resource/csdk/stack/test/linux/occlient.c index 823adf582..fca60157d 100644 --- a/resource/csdk/stack/test/linux/occlient.c +++ b/resource/csdk/stack/test/linux/occlient.c @@ -27,7 +27,7 @@ #include #include -#define TAG PCF("occlient") +#define TAG ("occlient") int gQuitFlag = 0; diff --git a/resource/csdk/stack/test/linux/ocserver.c b/resource/csdk/stack/test/linux/ocserver.c index 3813637a1..239f8a108 100644 --- a/resource/csdk/stack/test/linux/ocserver.c +++ b/resource/csdk/stack/test/linux/ocserver.c @@ -28,7 +28,7 @@ #include #include -#define TAG PCF("ocserver") +#define TAG ("ocserver") int gQuitFlag = 0; OCStackResult createLightResource(); diff --git a/resource/oc_logger/samples/linux/test_logging.c b/resource/oc_logger/samples/linux/test_logging.c index 2ddd9ffdc..533a59ae8 100644 --- a/resource/oc_logger/samples/linux/test_logging.c +++ b/resource/oc_logger/samples/linux/test_logging.c @@ -24,7 +24,7 @@ #include #include -#define TAG PCF("MAIN") +#define TAG ("MAIN") static int customLogger = 0; diff --git a/service/notification-manager/NotificationManager/include/hosting.h b/service/notification-manager/NotificationManager/include/hosting.h index e4b7ed85e..5e733dda4 100644 --- a/service/notification-manager/NotificationManager/include/hosting.h +++ b/service/notification-manager/NotificationManager/include/hosting.h @@ -36,7 +36,7 @@ extern "C" { #endif // __cplusplus -#define HOSTING_TAG PCF("Hosting") +#define HOSTING_TAG "Hosting" /** * Start resource hosting. diff --git a/service/notification-manager/NotificationManager/src/HostingObject.cpp b/service/notification-manager/NotificationManager/src/HostingObject.cpp index 6228e3b92..43cb8c2b2 100644 --- a/service/notification-manager/NotificationManager/src/HostingObject.cpp +++ b/service/notification-manager/NotificationManager/src/HostingObject.cpp @@ -36,7 +36,7 @@ void OIC_HOSTING_LOG(LogLevel level, const char * format, ...) va_start(args, format); vsnprintf(buffer, sizeof buffer - 1, format, args); va_end(args); - OCLog(level, PCF("Hosting"), buffer); + OCLog(level, "Hosting", buffer); } HostingObject::HostingObject() diff --git a/service/resource-encapsulation/src/resourceBroker/include/BrokerTypes.h b/service/resource-encapsulation/src/resourceBroker/include/BrokerTypes.h index 8ef780faf..f74944341 100644 --- a/service/resource-encapsulation/src/resourceBroker/include/BrokerTypes.h +++ b/service/resource-encapsulation/src/resourceBroker/include/BrokerTypes.h @@ -32,7 +32,7 @@ namespace OIC { namespace Service { - #define BROKER_TAG PCF("BROKER") + #define BROKER_TAG "BROKER" #define BROKER_DEVICE_PRESENCE_TIMEROUT (15000l) #define BROKER_SAFE_SECOND (5l) #define BROKER_SAFE_MILLISECOND (BROKER_SAFE_SECOND * (1000)) diff --git a/service/resource-encapsulation/src/resourceCache/include/CacheTypes.h b/service/resource-encapsulation/src/resourceCache/include/CacheTypes.h index 0f9460e50..fa08cc8bd 100644 --- a/service/resource-encapsulation/src/resourceCache/include/CacheTypes.h +++ b/service/resource-encapsulation/src/resourceCache/include/CacheTypes.h @@ -38,7 +38,7 @@ namespace OIC class DataCache; -#define CACHE_TAG PCF("CACHE") +#define CACHE_TAG "CACHE" #define CACHE_DEFAULT_REPORT_MILLITIME 10000 #define CACHE_DEFAULT_EXPIRED_MILLITIME 15000 diff --git a/service/resource-encapsulation/src/resourceClient/RCSDiscoveryManager.cpp b/service/resource-encapsulation/src/resourceClient/RCSDiscoveryManager.cpp index 7e19d4daa..318d602dd 100644 --- a/service/resource-encapsulation/src/resourceClient/RCSDiscoveryManager.cpp +++ b/service/resource-encapsulation/src/resourceClient/RCSDiscoveryManager.cpp @@ -25,7 +25,7 @@ #include "ScopeLogger.h" -#define TAG PCF("RCSDiscoveryManager") +#define TAG "RCSDiscoveryManager" using namespace OIC::Service; diff --git a/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp b/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp index c842038b0..f8d40671d 100644 --- a/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp +++ b/service/resource-encapsulation/src/resourceClient/RCSRemoteResourceObject.cpp @@ -25,7 +25,7 @@ #include "ScopeLogger.h" -#define TAG PCF("RCSRemoteResourceObject") +#define TAG "RCSRemoteResourceObject" namespace { diff --git a/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/oic_lanLib.cpp b/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/oic_lanLib.cpp index 24979063a..f15a4bb0b 100644 --- a/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/oic_lanLib.cpp +++ b/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/oic_lanLib.cpp @@ -63,7 +63,7 @@ int ConnectToNetwork() // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { - OC_LOG(ERROR, TAG, PCF("WiFi shield not present")); + OC_LOG(ERROR, TAG, ("WiFi shield not present")); return -1; } @@ -72,7 +72,7 @@ int ConnectToNetwork() OC_LOG_V(INFO, TAG, "WiFi Shield Firmware version %s", fwVersion); if ( strncmp(fwVersion, INTEL_WIFI_SHIELD_FW_VER, sizeof(INTEL_WIFI_SHIELD_FW_VER)) != 0 ) { - OC_LOG(DEBUG, TAG, PCF("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); + OC_LOG(DEBUG, TAG, ("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); return -1; } @@ -85,7 +85,7 @@ int ConnectToNetwork() // wait 10 seconds for connection: delay(10000); } - OC_LOG(DEBUG, TAG, PCF("Connected to wifi")); + OC_LOG(DEBUG, TAG, ("Connected to wifi")); IPAddress ip = WiFi.localIP(); OC_LOG_V(INFO, TAG, "IP Address: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); diff --git a/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/reference.cpp b/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/reference.cpp index 0dff6c562..260292591 100644 --- a/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/reference.cpp +++ b/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/reference.cpp @@ -107,7 +107,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, if (entityHandlerRequest && (flag & OC_REQUEST_FLAG)) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, ("Flag includes OC_REQUEST_FLAG")); if (OC_REST_GET == entityHandlerRequest->method) { if (JsonGenerator( REFER, (char *)entityHandlerRequest->resJSONPayload, \ @@ -136,12 +136,12 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, { if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo->action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_REGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_REGISTER from client")); g_REFERUnderObservation = 1; } else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo->action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_DEREGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_DEREGISTER from client")); } } @@ -176,7 +176,7 @@ void setup() // Add your initialization code here OC_LOG_INIT(); - OC_LOG(DEBUG, TAG, PCF("OCServer is starting...")); + OC_LOG(DEBUG, TAG, ("OCServer is starting...")); // Connect to Ethernet or WiFi network if (ConnectToNetwork() != 0) @@ -188,7 +188,7 @@ void setup() // Initialize the OC Stack in Server mode if (OCInit(NULL, OC_WELL_KNOWN_PORT, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack init error")); + OC_LOG(ERROR, TAG, ("OCStack init error")); return; } @@ -221,7 +221,7 @@ void loop() delay(5000); if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack process error")); + OC_LOG(ERROR, TAG, ("OCStack process error")); return; } ChangeREFERRepresentation(NULL); diff --git a/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/trackee.cpp b/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/trackee.cpp index 688273fde..f370d6235 100644 --- a/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/trackee.cpp +++ b/service/soft-sensor-manager/SampleApp/arduino/Reference_Thing/src/trackee.cpp @@ -87,7 +87,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, { if (flag & OC_REQUEST_FLAG) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, ("Flag includes OC_REQUEST_FLAG")); if (OC_REST_GET == entityHandlerRequest->method) { if ( JsonGenerator( (char *)entityHandlerRequest->resJSONPayload, @@ -108,15 +108,15 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, } else if (flag & OC_OBSERVE_FLAG) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_OBSERVE_FLAG")); + OC_LOG (INFO, TAG, ("Flag includes OC_OBSERVE_FLAG")); if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo->action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_REGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_REGISTER from client")); g_PROXIUnderObservation = 1; } else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo->action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_DEREGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_DEREGISTER from client")); } } @@ -134,7 +134,7 @@ void setup() // Add your initialization code here OC_LOG_INIT(); - OC_LOG(DEBUG, TAG, PCF("OCServer is starting...")); + OC_LOG(DEBUG, TAG, ("OCServer is starting...")); // uint16_t port = OC_WELL_KNOWN_PORT; // Connect to Ethernet or WiFi network @@ -147,7 +147,7 @@ void setup() // Initialize the OC Stack in Server mode if (OCInit(NULL, OC_WELL_KNOWN_PORT, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack init error")); + OC_LOG(ERROR, TAG, ("OCStack init error")); return; } @@ -172,7 +172,7 @@ void loop() // of Arduino microcontroller. Modify it as per specfic application needs. if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack process error")); + OC_LOG(ERROR, TAG, ("OCStack process error")); return; } diff --git a/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/src/thserver.cpp b/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/src/thserver.cpp index 5d6ca842e..b526fb9af 100644 --- a/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/src/thserver.cpp +++ b/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/src/thserver.cpp @@ -124,7 +124,7 @@ int ConnectToNetwork() // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { - OC_LOG(ERROR, TAG, PCF("WiFi shield not present")); + OC_LOG(ERROR, TAG, ("WiFi shield not present")); return -1; } @@ -133,7 +133,7 @@ int ConnectToNetwork() OC_LOG_V(INFO, TAG, "WiFi Shield Firmware version %s", fwVersion); if ( strncmp(fwVersion, INTEL_WIFI_SHIELD_FW_VER, sizeof(INTEL_WIFI_SHIELD_FW_VER)) != 0 ) { - OC_LOG(DEBUG, TAG, PCF("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); + OC_LOG(DEBUG, TAG, ("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); return -1; } @@ -146,7 +146,7 @@ int ConnectToNetwork() // wait 10 seconds for connection: delay(10000); } - OC_LOG(DEBUG, TAG, PCF("Connected to wifi")); + OC_LOG(DEBUG, TAG, ("Connected to wifi")); IPAddress ip = WiFi.localIP(); OC_LOG_V(INFO, TAG, "IP Address: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); @@ -202,7 +202,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, if (entityHandlerRequest && (flag & OC_REQUEST_FLAG)) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, ("Flag includes OC_REQUEST_FLAG")); if (OC_REST_GET == entityHandlerRequest->method) { if (JsonGenerator( TH, payload, MAX_RESPONSE_LENGTH)) @@ -252,12 +252,12 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, { if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo.action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_REGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_REGISTER from client")); g_THUnderObservation = 1; } else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo.action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_DEREGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_DEREGISTER from client")); } } @@ -348,7 +348,7 @@ void setup() // Add your initialization code here OC_LOG_INIT(); - OC_LOG(DEBUG, TAG, PCF("OCServer is starting...")); + OC_LOG(DEBUG, TAG, ("OCServer is starting...")); uint16_t port = OC_WELL_KNOWN_PORT; // Connect to Ethernet or WiFi network @@ -361,7 +361,7 @@ void setup() // Initialize the OC Stack in Server mode if (OCInit(NULL, port, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack init error")); + OC_LOG(ERROR, TAG, ("OCStack init error")); return; } OCStartPresence(60); @@ -382,7 +382,7 @@ void loop() if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack process error")); + OC_LOG(ERROR, TAG, ("OCStack process error")); return; } ChangeTHRepresentation(NULL); diff --git a/service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/src/thserver.cpp b/service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/src/thserver.cpp index 047ee14e9..5ba0211cc 100644 --- a/service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/src/thserver.cpp +++ b/service/soft-sensor-manager/SampleApp/arduino/THSensorApp1/src/thserver.cpp @@ -124,7 +124,7 @@ int ConnectToNetwork() // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { - OC_LOG(ERROR, TAG, PCF("WiFi shield not present")); + OC_LOG(ERROR, TAG, ("WiFi shield not present")); return -1; } @@ -133,7 +133,7 @@ int ConnectToNetwork() OC_LOG_V(INFO, TAG, "WiFi Shield Firmware version %s", fwVersion); if ( strncmp(fwVersion, INTEL_WIFI_SHIELD_FW_VER, sizeof(INTEL_WIFI_SHIELD_FW_VER)) != 0 ) { - OC_LOG(DEBUG, TAG, PCF("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); + OC_LOG(DEBUG, TAG, ("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); return -1; } @@ -146,7 +146,7 @@ int ConnectToNetwork() // wait 10 seconds for connection: delay(10000); } - OC_LOG(DEBUG, TAG, PCF("Connected to wifi")); + OC_LOG(DEBUG, TAG, ("Connected to wifi")); IPAddress ip = WiFi.localIP(); OC_LOG_V(INFO, TAG, "IP Address: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); @@ -202,7 +202,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, if (entityHandlerRequest && (flag & OC_REQUEST_FLAG)) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, ("Flag includes OC_REQUEST_FLAG")); if (OC_REST_GET == entityHandlerRequest->method) { if (JsonGenerator( TH, payload, MAX_RESPONSE_LENGTH)) @@ -252,12 +252,12 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, { if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo.action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_REGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_REGISTER from client")); g_THUnderObservation = 1; } else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo.action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_DEREGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_DEREGISTER from client")); } } @@ -348,7 +348,7 @@ void setup() // Add your initialization code here OC_LOG_INIT(); - OC_LOG(DEBUG, TAG, PCF("OCServer is starting...")); + OC_LOG(DEBUG, TAG, ("OCServer is starting...")); uint16_t port = OC_WELL_KNOWN_PORT; // Connect to Ethernet or WiFi network @@ -361,7 +361,7 @@ void setup() // Initialize the OC Stack in Server mode if (OCInit(NULL, port, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack init error")); + OC_LOG(ERROR, TAG, ("OCStack init error")); return; } OCStartPresence(60); @@ -382,7 +382,7 @@ void loop() if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack process error")); + OC_LOG(ERROR, TAG, ("OCStack process error")); return; } ChangeTHRepresentation(NULL); diff --git a/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/src/oic_lanLib.cpp b/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/src/oic_lanLib.cpp index e668fa444..470de6776 100644 --- a/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/src/oic_lanLib.cpp +++ b/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/src/oic_lanLib.cpp @@ -63,7 +63,7 @@ int ConnectToNetwork() // check for the presence of the shield: if (WiFi.status() == WL_NO_SHIELD) { - OC_LOG(ERROR, TAG, PCF("WiFi shield not present")); + OC_LOG(ERROR, TAG, ("WiFi shield not present")); return -1; } @@ -72,7 +72,7 @@ int ConnectToNetwork() OC_LOG_V(INFO, TAG, "WiFi Shield Firmware version %s", fwVersion); if ( strncmp(fwVersion, INTEL_WIFI_SHIELD_FW_VER, sizeof(INTEL_WIFI_SHIELD_FW_VER)) != 0 ) { - OC_LOG(DEBUG, TAG, PCF("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); + OC_LOG(DEBUG, TAG, ("!!!!! Upgrade WiFi Shield Firmware version !!!!!!")); return -1; } @@ -85,7 +85,7 @@ int ConnectToNetwork() // wait 10 seconds for connection: delay(10000); } - OC_LOG(DEBUG, TAG, PCF("Connected to wifi")); + OC_LOG(DEBUG, TAG, ("Connected to wifi")); IPAddress ip = WiFi.localIP(); OC_LOG_V(INFO, TAG, "IP Address: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); diff --git a/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/src/trackee.cpp b/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/src/trackee.cpp index 312ae75b9..04d7d1018 100644 --- a/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/src/trackee.cpp +++ b/service/soft-sensor-manager/SampleApp/arduino/Trackee_Thing/src/trackee.cpp @@ -168,7 +168,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, if (entityHandlerRequest && (flag & OC_REQUEST_FLAG)) { - OC_LOG (INFO, TAG, PCF("Flag includes OC_REQUEST_FLAG")); + OC_LOG (INFO, TAG, ("Flag includes OC_REQUEST_FLAG")); if (OC_REST_GET == entityHandlerRequest->method) { if (JsonGenerator((char *)entityHandlerRequest->resJSONPayload, \ @@ -197,12 +197,12 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, { if (OC_OBSERVE_REGISTER == entityHandlerRequest->obsInfo->action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_REGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_REGISTER from client")); g_PROXIUnderObservation = 1; } else if (OC_OBSERVE_DEREGISTER == entityHandlerRequest->obsInfo->action) { - OC_LOG (INFO, TAG, PCF("Received OC_OBSERVE_DEREGISTER from client")); + OC_LOG (INFO, TAG, ("Received OC_OBSERVE_DEREGISTER from client")); } } @@ -317,7 +317,7 @@ void setup() // Add your initialization code here OC_LOG_INIT(); - OC_LOG(DEBUG, TAG, PCF("OCServer is starting...")); + OC_LOG(DEBUG, TAG, ("OCServer is starting...")); // uint16_t port = OC_WELL_KNOWN_PORT; // Connect to Ethernet or WiFi network @@ -330,7 +330,7 @@ void setup() // Initialize the OC Stack in Server mode if (OCInit(NULL, OC_WELL_KNOWN_PORT, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack init error")); + OC_LOG(ERROR, TAG, ("OCStack init error")); return; } @@ -362,7 +362,7 @@ void loop() if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("OCStack process error")); + OC_LOG(ERROR, TAG, ("OCStack process error")); return; } #if (ARDUINO == 0) -- 2.34.1