projects
/
platform
/
upstream
/
iotivity.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 1.1.0
[platform/upstream/iotivity.git]
/
resource
/
csdk
/
security
/
provisioning
/
sample
/
sampleserver_justworks.cpp
diff --git
a/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp
b/resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp
index
c31a612
..
7047ae9
100644
(file)
--- a/
resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp
+++ b/
resource/csdk/security/provisioning/sample/sampleserver_justworks.cpp
@@
-53,7
+53,7
@@
char *gResourceUri= (char *)"/a/led";
//Secure Virtual Resource database for Iotivity Server
//It contains Server's Identity and the PSK credentials
//of other devices which the server trusts
//Secure Virtual Resource database for Iotivity Server
//It contains Server's Identity and the PSK credentials
//of other devices which the server trusts
-static char CRED_FILE[] = "oic_svr_db_server_justworks.
json
";
+static char CRED_FILE[] = "oic_svr_db_server_justworks.
dat
";
/* Function that creates a new LED resource by calling the
* OCCreateResource() method.
/* Function that creates a new LED resource by calling the
* OCCreateResource() method.
@@
-132,7
+132,7
@@
OCRepPayload* getPayload(const char* uri, int64_t power, bool state)
OCRepPayload* payload = OCRepPayloadCreate();
if(!payload)
{
OCRepPayload* payload = OCRepPayloadCreate();
if(!payload)
{
- OC_LOG(ERROR, TAG, "Failed to allocate Payload");
+ O
I
C_LOG(ERROR, TAG, "Failed to allocate Payload");
return NULL;
}
return NULL;
}
@@
-148,7
+148,7
@@
OCRepPayload* constructResponse (OCEntityHandlerRequest *ehRequest)
{
if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
{
if(ehRequest->payload && ehRequest->payload->type != PAYLOAD_TYPE_REPRESENTATION)
{
- OC_LOG(ERROR, TAG, "Incoming payload not a representation");
+ O
I
C_LOG(ERROR, TAG, "Incoming payload not a representation");
return NULL;
}
return NULL;
}
@@
-258,7
+258,7
@@
OCEntityHandlerResult ProcessPostRequest (OCEntityHandlerRequest *ehRequest,
if (0 == createLEDResource (newLedUri, &gLedInstance[gCurrLedInstance], false, 0))
{
if (0 == createLEDResource (newLedUri, &gLedInstance[gCurrLedInstance], false, 0))
{
- OC_LOG (INFO, TAG, "Created new LED instance");
+ O
I
C_LOG (INFO, TAG, "Created new LED instance");
gLedInstance[gCurrLedInstance].state = 0;
gLedInstance[gCurrLedInstance].power = 0;
gCurrLedInstance++;
gLedInstance[gCurrLedInstance].state = 0;
gLedInstance[gCurrLedInstance].power = 0;
gCurrLedInstance++;
@@
-297,7
+297,7
@@
OCEntityHandlerResult ProcessPostRequest (OCEntityHandlerRequest *ehRequest,
}
else
{
}
else
{
- OC_LOG_V (INFO, TAG, "Payload was NULL");
+ O
I
C_LOG_V (INFO, TAG, "Payload was NULL");
ehResult = OC_EH_ERROR;
}
ehResult = OC_EH_ERROR;
}
@@
-309,7
+309,7
@@
OCEntityHandlerCb (OCEntityHandlerFlag flag,
OCEntityHandlerRequest *entityHandlerRequest,
void* callbackParam)
{
OCEntityHandlerRequest *entityHandlerRequest,
void* callbackParam)
{
- OC_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag);
+ O
I
C_LOG_V (INFO, TAG, "Inside entity handler - flags: 0x%x", flag);
(void)callbackParam;
OCEntityHandlerResult ehResult = OC_EH_ERROR;
(void)callbackParam;
OCEntityHandlerResult ehResult = OC_EH_ERROR;
@@
-319,7
+319,7
@@
OCEntityHandlerCb (OCEntityHandlerFlag flag,
// Validate pointer
if (!entityHandlerRequest)
{
// Validate pointer
if (!entityHandlerRequest)
{
- OC_LOG (ERROR, TAG, "Invalid request pointer");
+ O
I
C_LOG (ERROR, TAG, "Invalid request pointer");
return OC_EH_ERROR;
}
return OC_EH_ERROR;
}
@@
-327,27
+327,27
@@
OCEntityHandlerCb (OCEntityHandlerFlag flag,
if (flag & OC_REQUEST_FLAG)
{
if (flag & OC_REQUEST_FLAG)
{
- OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG");
+ O
I
C_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG");
if (entityHandlerRequest)
{
if (OC_REST_GET == entityHandlerRequest->method)
{
if (entityHandlerRequest)
{
if (OC_REST_GET == entityHandlerRequest->method)
{
- OC_LOG (INFO, TAG, "Received OC_REST_GET from client");
+ O
I
C_LOG (INFO, TAG, "Received OC_REST_GET from client");
ehResult = ProcessGetRequest (entityHandlerRequest, &payload);
}
else if (OC_REST_PUT == entityHandlerRequest->method)
{
ehResult = ProcessGetRequest (entityHandlerRequest, &payload);
}
else if (OC_REST_PUT == entityHandlerRequest->method)
{
- OC_LOG (INFO, TAG, "Received OC_REST_PUT from client");
+ O
I
C_LOG (INFO, TAG, "Received OC_REST_PUT from client");
ehResult = ProcessPutRequest (entityHandlerRequest, &payload);
}
else if (OC_REST_POST == entityHandlerRequest->method)
{
ehResult = ProcessPutRequest (entityHandlerRequest, &payload);
}
else if (OC_REST_POST == entityHandlerRequest->method)
{
- OC_LOG (INFO, TAG, "Received OC_REST_POST from client");
+ O
I
C_LOG (INFO, TAG, "Received OC_REST_POST from client");
ehResult = ProcessPostRequest (entityHandlerRequest, &response, &payload);
}
else
{
ehResult = ProcessPostRequest (entityHandlerRequest, &response, &payload);
}
else
{
- OC_LOG_V (INFO, TAG, "Received unsupported method %d from client",
+ O
I
C_LOG_V (INFO, TAG, "Received unsupported method %d from client",
entityHandlerRequest->method);
ehResult = OC_EH_ERROR;
}
entityHandlerRequest->method);
ehResult = OC_EH_ERROR;
}
@@
-369,7
+369,7
@@
OCEntityHandlerCb (OCEntityHandlerFlag flag,
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
// Send the response
if (OCDoResponse(&response) != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "Error sending response");
+ O
I
C_LOG(ERROR, TAG, "Error sending response");
ehResult = OC_EH_ERROR;
}
}
ehResult = OC_EH_ERROR;
}
}
@@
-399,7
+399,7
@@
int main()
{
struct timespec timeout;
{
struct timespec timeout;
- OC_LOG(DEBUG, TAG, "OCServer is starting...");
+ O
I
C_LOG(DEBUG, TAG, "OCServer is starting...");
// Initialize Persistent Storage for SVR database
OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink};
// Initialize Persistent Storage for SVR database
OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink};
@@
-408,7
+408,7
@@
int main()
if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
{
if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack init error");
+ O
I
C_LOG(ERROR, TAG, "OCStack init error");
return 0;
}
return 0;
}
@@
-421,23
+421,23
@@
int main()
timeout.tv_nsec = 100000000L;
// Break from loop with Ctrl-C
timeout.tv_nsec = 100000000L;
// Break from loop with Ctrl-C
- OC_LOG(INFO, TAG, "Entering ocserver main loop...");
+ O
I
C_LOG(INFO, TAG, "Entering ocserver main loop...");
signal(SIGINT, handleSigInt);
while (!gQuitFlag)
{
if (OCProcess() != OC_STACK_OK)
{
signal(SIGINT, handleSigInt);
while (!gQuitFlag)
{
if (OCProcess() != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack process error");
+ O
I
C_LOG(ERROR, TAG, "OCStack process error");
return 0;
}
nanosleep(&timeout, NULL);
}
return 0;
}
nanosleep(&timeout, NULL);
}
- OC_LOG(INFO, TAG, "Exiting ocserver main loop...");
+ O
I
C_LOG(INFO, TAG, "Exiting ocserver main loop...");
if (OCStop() != OC_STACK_OK)
{
if (OCStop() != OC_STACK_OK)
{
- OC_LOG(ERROR, TAG, "OCStack process error");
+ O
I
C_LOG(ERROR, TAG, "OCStack process error");
}
return 0;
}
return 0;
@@
-447,7
+447,7
@@
int createLEDResource (char *uri, LEDResource *ledResource, bool resourceState,
{
if (!uri)
{
{
if (!uri)
{
- OC_LOG(ERROR, TAG, "Resource URI cannot be NULL");
+ O
I
C_LOG(ERROR, TAG, "Resource URI cannot be NULL");
return -1;
}
return -1;
}
@@
-460,7
+460,7
@@
int createLEDResource (char *uri, LEDResource *ledResource, bool resourceState,
OCEntityHandlerCb,
NULL,
OC_DISCOVERABLE|OC_OBSERVABLE | OC_SECURE);
OCEntityHandlerCb,
NULL,
OC_DISCOVERABLE|OC_OBSERVABLE | OC_SECURE);
- OC_LOG_V(INFO, TAG, "Created LED resource with result: %s", getResult(res));
+ O
I
C_LOG_V(INFO, TAG, "Created LED resource with result: %s", getResult(res));
return 0;
}
return 0;
}