X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fstack%2Fsamples%2Flinux%2FSimpleClientServer%2Focserverslow.cpp;h=e56e144108db0cec13a880a558a53abc260497e0;hb=390866079e285d2c74918432c0d597d5da52f8a0;hp=3858b2321dbc8196fe427a45262f2c248e203ffc;hpb=3e9402ad71cb3e93266a77796f44d17bab9853fd;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp b/resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp index 3858b23..e56e144 100644 --- a/resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp +++ b/resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp @@ -54,17 +54,17 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) { LEDResource *currLEDResource = &LED; - OC_LOG(INFO, TAG, "Entering constructResponse"); + OIC_LOG(INFO, TAG, "Entering constructResponse"); if (ehRequest->resource == gLedInstance[0].handle) { - OC_LOG(INFO, TAG, "handle 0"); + OIC_LOG(INFO, TAG, "handle 0"); currLEDResource = &gLedInstance[0]; gResourceUri = const_cast("a/led/0"); } else if (ehRequest->resource == gLedInstance[1].handle) { - OC_LOG(INFO, TAG, "handle 1"); + OIC_LOG(INFO, TAG, "handle 1"); currLEDResource = &gLedInstance[1]; gResourceUri = const_cast("a/led/1"); } @@ -73,7 +73,7 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) { if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION) { - OC_LOG(ERROR, TAG, ("Incoming payload not a representation")); + OIC_LOG(ERROR, TAG, ("Incoming payload not a representation")); return nullptr; } @@ -96,7 +96,7 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) if (!response) { - OC_LOG_V(ERROR, TAG, "Memory allocation for response payload failed."); + OIC_LOG_V(ERROR, TAG, "Memory allocation for response payload failed."); } OCRepPayloadSetUri (response, gResourceUri); @@ -108,13 +108,13 @@ OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest) void ProcessGetPutRequest (OCEntityHandlerRequest *ehRequest) { - OC_LOG(INFO, TAG, "Entering ProcessGetPutRequest"); + OIC_LOG(INFO, TAG, "Entering ProcessGetPutRequest"); OCRepPayload *getResp = constructResponse(ehRequest); if(!getResp) { - OC_LOG(ERROR, TAG, "Failed to construct response"); + OIC_LOG(ERROR, TAG, "Failed to construct response"); return; } @@ -135,7 +135,7 @@ void ProcessGetPutRequest (OCEntityHandlerRequest *ehRequest) // Send the response if (OCDoResponse(&response) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "Error sending response"); + OIC_LOG(ERROR, TAG, "Error sending response"); } free(getResp); @@ -143,7 +143,7 @@ void ProcessGetPutRequest (OCEntityHandlerRequest *ehRequest) OCEntityHandlerRequest *CopyRequest(OCEntityHandlerRequest *entityHandlerRequest) { - OC_LOG(INFO, TAG, "Copying received request for slow response"); + OIC_LOG(INFO, TAG, "Copying received request for slow response"); OCEntityHandlerRequest *copyOfRequest = (OCEntityHandlerRequest *)OICMalloc(sizeof(OCEntityHandlerRequest)); @@ -159,7 +159,7 @@ OCEntityHandlerRequest *CopyRequest(OCEntityHandlerRequest *entityHandlerRequest copyOfRequest->query = OICStrdup(entityHandlerRequest->query); if(!copyOfRequest->query) { - OC_LOG(ERROR, TAG, "Copy failed due to allocation failure"); + OIC_LOG(ERROR, TAG, "Copy failed due to allocation failure"); OICFree(copyOfRequest); return NULL; } @@ -178,11 +178,11 @@ OCEntityHandlerRequest *CopyRequest(OCEntityHandlerRequest *entityHandlerRequest if (copyOfRequest) { - OC_LOG(INFO, TAG, "Copied client request"); + OIC_LOG(INFO, TAG, "Copied client request"); } else { - OC_LOG(ERROR, TAG, "Error copying client request"); + OIC_LOG(ERROR, TAG, "Error copying client request"); } return copyOfRequest; } @@ -193,16 +193,16 @@ OCEntityHandlerResult OCEntityHandlerCb (OCEntityHandlerFlag flag, OCEntityHandlerResult result = OC_EH_ERROR; OCEntityHandlerRequest *request = NULL; - OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); + OIC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag); if (flag & OC_REQUEST_FLAG) { - OC_LOG(INFO, TAG, "Flag includes OC_REQUEST_FLAG"); + OIC_LOG(INFO, TAG, "Flag includes OC_REQUEST_FLAG"); if (entityHandlerRequest) { - OC_LOG_V (INFO, TAG, "request query %s from client", + OIC_LOG_V (INFO, TAG, "request query %s from client", entityHandlerRequest->query); - OC_LOG_PAYLOAD (INFO, entityHandlerRequest->payload); + OIC_LOG_PAYLOAD (INFO, entityHandlerRequest->payload); // Make deep copy of received request and queue it for slow processing request = CopyRequest(entityHandlerRequest); @@ -210,7 +210,7 @@ OCEntityHandlerResult OCEntityHandlerCb (OCEntityHandlerFlag flag, if (request) { - OC_LOG(INFO, TAG, "Scheduling slow response for received request"); + OIC_LOG(INFO, TAG, "Scheduling slow response for received request"); gRequestList.push_back(request); // Indicate to the stack that this is a slow response result = OC_EH_SLOW; @@ -219,14 +219,14 @@ OCEntityHandlerResult OCEntityHandlerCb (OCEntityHandlerFlag flag, } else { - OC_LOG(ERROR, TAG, "Error queuing request for slow response"); + OIC_LOG(ERROR, TAG, "Error queuing request for slow response"); // Indicate to the stack that this is a slow response result = OC_EH_ERROR; } } else { - OC_LOG(ERROR, TAG, "Invalid request"); + OIC_LOG(ERROR, TAG, "Invalid request"); result = OC_EH_ERROR; } } @@ -248,10 +248,10 @@ void AlarmHandler(int sig) { if (sig == SIGALRM) { - OC_LOG (INFO, TAG, "Server starting slow response"); + OIC_LOG (INFO, TAG, "Server starting slow response"); if (gRequestList.empty()) { - OC_LOG (INFO, TAG, "No requests to service"); + OIC_LOG (INFO, TAG, "No requests to service"); return; } @@ -260,17 +260,17 @@ void AlarmHandler(int sig) gRequestList.pop_front(); if (entityHandlerRequest->method == OC_REST_GET) { - OC_LOG (INFO, TAG, "Received OC_REST_GET from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_GET from client"); ProcessGetPutRequest (entityHandlerRequest); } else if (entityHandlerRequest->method == OC_REST_PUT) { - OC_LOG (INFO, TAG, "Received OC_REST_PUT from client"); + OIC_LOG (INFO, TAG, "Received OC_REST_PUT from client"); ProcessGetPutRequest (entityHandlerRequest); } else { - OC_LOG_V (INFO, TAG, "Received unsupported method %d from client", + OIC_LOG_V (INFO, TAG, "Received unsupported method %d from client", entityHandlerRequest->method); } // Free the request @@ -288,11 +288,11 @@ void AlarmHandler(int sig) int main(int /*argc*/, char** /*argv[]*/) { - OC_LOG(DEBUG, TAG, "OCServer is starting..."); + OIC_LOG(DEBUG, TAG, "OCServer is starting..."); if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack init error"); + OIC_LOG(ERROR, TAG, "OCStack init error"); return 0; } @@ -303,20 +303,20 @@ int main(int /*argc*/, char** /*argv[]*/) signal(SIGALRM, AlarmHandler); // Break from loop with Ctrl-C - OC_LOG(INFO, TAG, "Entering ocserver main loop..."); + OIC_LOG(INFO, TAG, "Entering ocserver main loop..."); signal(SIGINT, handleSigInt); while (!gQuitFlag) { if (OCProcess() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); return 0; } sleep(2); } - OC_LOG(INFO, TAG, "Exiting ocserver main loop..."); + OIC_LOG(INFO, TAG, "Exiting ocserver main loop..."); // Free requests if (!gRequestList.empty()) @@ -332,7 +332,7 @@ int main(int /*argc*/, char** /*argv[]*/) if (OCStop() != OC_STACK_OK) { - OC_LOG(ERROR, TAG, "OCStack process error"); + OIC_LOG(ERROR, TAG, "OCStack process error"); } return 0; @@ -342,7 +342,7 @@ int createLEDResource (char *uri, LEDResource *ledResource, bool resourceState, { if (!uri) { - OC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); + OIC_LOG(ERROR, TAG, "Resource URI cannot be NULL"); return -1; } @@ -355,7 +355,7 @@ int createLEDResource (char *uri, LEDResource *ledResource, bool resourceState, OCEntityHandlerCb, NULL, OC_DISCOVERABLE|OC_OBSERVABLE); - OC_LOG_V(INFO, TAG, "Created LED resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, TAG, "Created LED resource with result: %s", getResult(res)); return 0; }