+OCStackResult SetDeviceInfo()
+{
+ OCStackResult result = OC_STACK_ERROR;
+
+ OCResourceHandle handle = OCGetResourceHandleAtUri(OC_RSRVD_DEVICE_URI);
+ if (handle == NULL)
+ {
+ cout << "Failed to find resource " << OC_RSRVD_DEVICE_URI << endl;
+ return result;
+ }
+
+ result = OCBindResourceTypeToResource(handle, deviceType.c_str());
+ if (result != OC_STACK_OK)
+ {
+ cout << "Failed to add device type" << endl;
+ return result;
+ }
+
+ result = OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DEVICE_NAME, deviceName);
+ if (result != OC_STACK_OK)
+ {
+ cout << "Failed to set device name" << endl;
+ return result;
+ }
+
+ result = OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_DATA_MODEL_VERSION,
+ dataModelVersions);
+ if (result != OC_STACK_OK)
+ {
+ cout << "Failed to set data model versions" << endl;
+ return result;
+ }
+
+ result = OCPlatform::setPropertyValue(PAYLOAD_TYPE_DEVICE, OC_RSRVD_SPEC_VERSION, specVersion);
+ if (result != OC_STACK_OK)
+ {
+ cout << "Failed to set spec version" << endl;
+ return result;
+ }
+
+ return OC_STACK_OK;
+}
+