}
}
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
#include <assert.h>
#include <thread>
g_LoopFlag = false;
oc_process_thread->join();
}
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
OCRepPayload* getPayload(const char* uri, int64_t power, bool state)
{
gLedInstance[gCurrLedInstance].state = 0;
gLedInstance[gCurrLedInstance].power = 0;
gCurrLedInstance++;
- strncpy ((char *)response->resourceUri, newLedUri, MAX_URI_LENGTH);
+ strncpy ((char *)response->resourceUri, newLedUri, sizeof(response->resourceUri));
ehResult = OC_EH_RESOURCE_CREATED;
}
}
OIC_LOG(INFO, TAG, "============================");
}
+void ClosePinDisplayCB(void)
+{
+ OIC_LOG(INFO, TAG, "============================");
+ OIC_LOG(INFO, TAG, " PIN DISPLAY CLOSED.");
+ OIC_LOG(INFO, TAG, "============================");
+}
+
int main()
{
OIC_LOG(DEBUG, TAG, "OCServer is starting...");
// Initialize Persistent Storage for SVR database
- OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink};
+ OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink, NULL, NULL};
OCRegisterPersistentStorageHandler(&ps);
if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
SetGeneratePinCB(GeneratePinCB);
/**
+ * If ther server supports random pin based OTM,
+ * the callback to close PIN display can be registered.
+ * This callback will be invoked when random PIN based OTM is done.
+ */
+ SetClosePinDisplayCB(ClosePinDisplayCB);
+
+ /**
* Random PIN generation policy can be changed through SetRandomPinPolicy() API.
* first param : byte length of random PIN ( 4 <= first param <= 32)
* second param : PIN type (This is bitmask)
OIC_LOG(INFO, TAG, "Entering ocserver main loop...");
signal(SIGINT, handleSigInt);
-#ifdef _ENABLE_MULTIPLE_OWNER_
+#ifdef MULTIPLE_OWNER
StartOCProcessThread();
while(!gQuitFlag)
}
nanosleep(&timeout, NULL);
}
-#endif //_ENABLE_MULTIPLE_OWNER_
+#endif //MULTIPLE_OWNER
OIC_LOG(INFO, TAG, "Exiting ocserver main loop...");