Print elevator server's device ID.
authorSoemin Tjong <stjong@microsoft.com>
Tue, 4 Apr 2017 21:47:30 +0000 (14:47 -0700)
committerDan Mihai <Daniel.Mihai@microsoft.com>
Thu, 6 Apr 2017 13:55:56 +0000 (13:55 +0000)
This simplifies identifying the target elevator when there are multiple
of them running.

Also, remove hardcoded device ID in the configuration file so multiple
servers don't conflict.

Change-Id: I18b318c844e769529ae9f50e79ff85114a9f5b6d
Signed-off-by: Soemin Tjong <stjong@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18489
Reviewed-by: Way Vadhanasin <wayvad@microsoft.com>
Reviewed-by: Ibrahim Esmat <iesmat@microsoft.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Alex Kelley <alexke@microsoft.com>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Reviewed-by: Dan Mihai <Daniel.Mihai@microsoft.com>
resource/IPCA/samples/ElevatorServer/ElevatorServerSecurityDB.dat
resource/IPCA/samples/ElevatorServer/ElevatorServerSecurityDB.json
resource/IPCA/samples/ElevatorServer/elevatorserver.cpp

index 66b3443..e9a5141 100644 (file)
Binary files a/resource/IPCA/samples/ElevatorServer/ElevatorServerSecurityDB.dat and b/resource/IPCA/samples/ElevatorServer/ElevatorServerSecurityDB.dat differ
index 86143a7..786f505 100644 (file)
                 }
             ]
         },
-        "rowneruuid" : "E068A3E6-90EF-4A26-A75F-9B098D43F54D"
+        "rowneruuid" : ""
     },
     "pstat": {
         "isop": false,
-        "deviceuuid": "E068A3E6-90EF-4A26-A75F-9B098D43F54D",
-        "rowneruuid": "E068A3E6-90EF-4A26-A75F-9B098D43F54D",
+        "deviceuuid": "",
+        "rowneruuid": "",
         "cm": 2,
         "tm": 0,
         "om": 4,
@@ -66,8 +66,8 @@
         "oxmsel": 0,
         "sct": 1,
         "owned": false,
-        "deviceuuid": "E068A3E6-90EF-4A26-A75F-9B098D43F54D",
+        "deviceuuid": "",
         "devowneruuid": "",
-        "rowneruuid": "E068A3E6-90EF-4A26-A75F-9B098D43F54D"
+        "rowneruuid": ""
     }
 }
index 65680f9..6e1f0de 100644 (file)
@@ -321,6 +321,21 @@ bool ElevatorServer::Start(const std::string& elevatorName)
                                     std::bind(&ElevatorServer::ElevatorEntityHandler, this, _1),
                                     OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE);
 
+
+        if (result == OC_STACK_OK)
+        {
+            const char* deviceID = OCGetServerInstanceIDString();
+            std::cout << "Elevator server's device ID: ";
+            if (deviceID != nullptr)
+            {
+                 std::cout << deviceID << std::endl;
+            }
+            else
+            {
+                std::cout << "Unknown" << std::endl;
+            }
+        }
+
         return (result == OC_STACK_OK);
     }