Commit 2be79ca3 authored by koushik.girijala's avatar koushik.girijala Committed by Jon A. Cruz

[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: default avatarkoushik.girijala <g.koushik@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2363Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarAshok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: default avatarAbhishek Pandey <abhi.siso@samsung.com>
Reviewed-by: default avatarJon A. Cruz <jonc@osg.samsung.com>
parent 0d41aa47
......@@ -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);
......
......@@ -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__)
......
......@@ -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
......@@ -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"
//-----------------------------------------------------------------------------
......
......@@ -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
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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,
......
......@@ -41,7 +41,7 @@
#include <strings.h>
#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;
......
......@@ -36,7 +36,7 @@
#include <stdlib.h>
#include <string.h>
#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;
......
......@@ -42,7 +42,7 @@
#endif
#include <stdint.h>
#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;
......
......@@ -47,7 +47,7 @@
#include <strings.h>
#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;
......
......@@ -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;
......
......@@ -30,7 +30,7 @@
#include "iotvticalendar.h"
#include <string.h>
#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,