[IOT-2034] Updating Enrollee sample app for Tizen
authorJay Sharma <jay.sharma@samsung.com>
Thu, 13 Apr 2017 14:09:57 +0000 (19:39 +0530)
committerUze Choi <uzchoi@samsung.com>
Fri, 14 Apr 2017 12:30:17 +0000 (12:30 +0000)
Change-Id: I06468c436db5a883f747772841413a1afef9d23a
Signed-off-by: Harish Kumar Marappa <h.marappa@samsung.com>
Signed-off-by: Jay Sharma <jay.sharma@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18921
Reviewed-by: Jihun Ha <jihun.ha@samsung.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp

index 17a035e..b55a252 100755 (executable)
@@ -45,7 +45,11 @@ static pthread_t gThreadHandle = 0;
  * It contains Server's Identity and the PSK credentials
  * of other devices which the server trusts
  */
+#ifdef MULTIPLE_OWNER
+static char CRED_FILE[] = "oic_svr_db_server_MOT.dat";
+#else
 static char CRED_FILE[] = "oic_svr_db_server.dat";
+#endif
 
 OCPersistentStorage ps;
 
@@ -70,6 +74,25 @@ void PrintMenu()
     cout << "========================" << endl;
 }
 
+void ConnectRequestCbInApp(ESConnectRequest *connectRequest)
+{
+    cout << "ConnectRequestCbInApp IN" << endl;
+
+    if(connectRequest == NULL)
+    {
+        cout << "connectRequest is NULL" << endl;
+        return ;
+    }
+
+    for(int i = 0 ; i < connectRequest->numRequest ; ++i)
+    {
+        cout << "connect : " << connectRequest->connect[i] << endl;
+    }
+
+    cout << "ConnectRequestCbInApp OUT" << endl;
+    PrintMenu();
+}
+
 void WiFiConfProvCbInApp(ESWiFiConfData *eventData)
 {
     cout << "WiFiConfProvCbInApp IN" << endl;
@@ -116,6 +139,7 @@ void DevConfProvCbInApp(ESDevConfData *eventData)
 
     cout << "Language : " << eventData->language << endl;
     cout << "Country : " << eventData->country << endl;
+
     cout << "DevConfProvCbInApp OUT" << endl;
     PrintMenu();
 }
@@ -131,13 +155,17 @@ void CoapCloudConfProvCbInApp(ESCoapCloudConfData *eventData)
     }
 
     cout << "AuthCode : " << eventData->authCode << endl;
+    cout << "AcessToken : " <<  eventData->accessToken << endl;
+    cout << "AcessTokenType : "<< eventData->accessTokenType << endl;
     cout << "AuthProvider : " << eventData->authProvider << endl;
     cout << "CI Server : " << eventData->ciServer << endl;
+
     cout << "CoapCloudConfProvCbInApp OUT" << endl;
     PrintMenu();
 }
 
 ESProvisioningCallbacks gCallbacks = {
+    .ConnectRequestCb = &ConnectRequestCbInApp,
     .WiFiConfProvCb = &WiFiConfProvCbInApp,
     .DevConfProvCb = &DevConfProvCbInApp,
     .CoapCloudConfProvCb = &CoapCloudConfProvCbInApp
@@ -157,7 +185,7 @@ FILE* server_fopen(const char *path, const char *mode)
 
 void EnableSecurity()
 {
-    printf("Inside EnableSecurity API..\n");
+    cout << "Inside EnableSecurity API.." << endl;
 
     gIsSecured = true;
 
@@ -225,13 +253,14 @@ void SetDeviceInfo()
         {{WIFI_11G, WIFI_11N, WIFI_11AC, WiFi_EOF}, WIFI_5G}, {"Tizen Device"}
     };
 
+    // Set user properties if needed
+
+    // Set device properties
     if(ESSetDeviceProperty(&deviceProperty) == ES_ERROR)
     {
         cout << "ESSetDeviceProperty Error" << endl;
     }
 
-    // Set user properties if needed
-
     cout << "SetDeviceInfo OUT" << endl;
 }