X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fexamples%2Fdevicediscoveryserver.cpp;h=dba1515a56e10d9a9710a92c19a83da7bf94a3a8;hb=1cee1631595cac6a6394ac2e0b365c6dd5a42c68;hp=2112ae66d31017745abb60cbff78cb8cb77926d7;hpb=390866079e285d2c74918432c0d597d5da52f8a0;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/examples/devicediscoveryserver.cpp b/resource/examples/devicediscoveryserver.cpp index 2112ae6..dba1515 100644 --- a/resource/examples/devicediscoveryserver.cpp +++ b/resource/examples/devicediscoveryserver.cpp @@ -33,7 +33,7 @@ using namespace OC; -//Set of strings for each of deviceInfo fields +//Set of strings for each of platform Info fields std::string dateOfManufacture = "myDateOfManufacture"; std::string firmwareVersion = "my.Firmware.Version"; std::string manufacturerName = "myName"; @@ -46,8 +46,10 @@ std::string platformVersion = "platformVersion"; std::string supportUrl = "www.mysupporturl.com"; std::string systemTime = "mySystemTime"; -//Set of strings for each of platform info fields +//Set of strings for each of device info fields std::string deviceName = "Bill's Battlestar"; +std::string specVersion = "myDeviceSpecVersion"; +std::string dataModelVersions = "myDeviceModelVersion"; //OCPlatformInfo Contains all the platform info to be stored OCPlatformInfo platformInfo; @@ -74,6 +76,8 @@ void DeletePlatformInfo() void DeleteDeviceInfo() { delete[] deviceInfo.deviceName; + delete[] deviceInfo.specVersion; + OCFreeOCStringLL(deviceInfo.dataModelVersions); } void DuplicateString(char ** targetString, std::string sourceString) @@ -102,9 +106,16 @@ OCStackResult SetPlatformInfo(std::string platformID, std::string manufacturerNa } -OCStackResult SetDeviceInfo(std::string deviceName) +OCStackResult SetDeviceInfo(std::string deviceName, std::string specVersion, std::string dataModelVersions) { DuplicateString(&deviceInfo.deviceName, deviceName); + + if (!specVersion.empty()) + DuplicateString(&deviceInfo.specVersion, specVersion); + + if (!dataModelVersions.empty()) + OCResourcePayloadAddStringLL(&deviceInfo.dataModelVersions, dataModelVersions.c_str()); + return OC_STACK_OK; } @@ -137,7 +148,7 @@ int main() } - result = SetDeviceInfo(deviceName); + result = SetDeviceInfo(deviceName, specVersion, dataModelVersions); OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.wk.d"); OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.d.tv");