X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fsecurity%2Fprovisioning%2Fsample%2Fsampleserver_randompin.cpp;h=0f750a0836e491bdb58c2c4ba7dc874c07a14977;hb=7f00f942c39b7bc27c7eeecf213a239c3fe4173c;hp=81b07c40d505670f3c51cc08cf011b298223c9b2;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp b/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp index 81b07c4..0f750a0 100644 --- a/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp +++ b/resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp @@ -142,7 +142,7 @@ const char *getResult(OCStackResult result) { } } -#ifdef _ENABLE_MULTIPLE_OWNER_ +#ifdef MULTIPLE_OWNER #include #include @@ -177,7 +177,7 @@ static void StopOCProcessThread() g_LoopFlag = false; oc_process_thread->join(); } -#endif //_ENABLE_MULTIPLE_OWNER_ +#endif //MULTIPLE_OWNER OCRepPayload* getPayload(const char* uri, int64_t power, bool state) { @@ -460,12 +460,19 @@ void GeneratePinCB(char* pin, size_t pinSize) 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) @@ -481,6 +488,13 @@ int main() 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) @@ -500,7 +514,7 @@ int main() OIC_LOG(INFO, TAG, "Entering ocserver main loop..."); signal(SIGINT, handleSigInt); -#ifdef _ENABLE_MULTIPLE_OWNER_ +#ifdef MULTIPLE_OWNER StartOCProcessThread(); while(!gQuitFlag) @@ -534,7 +548,7 @@ int main() } nanosleep(&timeout, NULL); } -#endif //_ENABLE_MULTIPLE_OWNER_ +#endif //MULTIPLE_OWNER OIC_LOG(INFO, TAG, "Exiting ocserver main loop...");