using namespace OC;
-//Set of strings for each of deviceInfo fields
-std::string dateOfManufacture = "myDateOfManufacture";
-std::string firmwareVersion = "my.Firmware.Version";
-std::string manufacturerName = "myName";
-std::string operatingSystemVersion = "myOS";
-std::string hardwareVersion = "myHardwareVersion";
-std::string platformID = "myPlatformID";
-std::string manufacturerUrl = "www.myurl.com";
-std::string modelNumber = "myModelNumber";
-std::string platformVersion = "platformVersion";
-std::string supportUrl = "www.mysupporturl.com";
-std::string systemTime = "mySystemTime";
-
-//Set of strings for each of platform info fields
-std::string deviceName = "Bill's Battlestar";
-
-//OCPlatformInfo Contains all the platform info to be stored
+// Set of strings for each of platform Info fields
+std::string platformID = "0A3E0D6F-DBF5-404E-8719-D6880042463A";
+std::string manufacturerName = "myName";
+std::string manufacturerLink = "https://www.example.com";
+std::string modelNumber = "myModelNumber";
+std::string dateOfManufacture = "2016-01-15";
+std::string platformVersion = "platformVersion";
+std::string operatingSystemVersion = "myOS";
+std::string hardwareVersion = "myHardwareVersion";
+std::string firmwareVersion = "1.0";
+std::string supportLink = "https://www.examplesupport.com";
+std::string systemTime = "2016-01-15T11.01";
+
+// Set of strings for each of device info fields
+std::string deviceName = "Bill's Battlestar";
+std::string specVersion = "core.1.1.0";
+std::string dataModelVersions = "res.1.1.0,sh.1.1.0";
+
+// OCPlatformInfo Contains all the platform info to be stored
OCPlatformInfo platformInfo;
-//OCDeviceInfo Contains all the device info to be stored
+// OCDeviceInfo Contains all the device info to be stored
OCDeviceInfo deviceInfo;
void DeletePlatformInfo()
void DeleteDeviceInfo()
{
delete[] deviceInfo.deviceName;
+ delete[] deviceInfo.specVersion;
+ OCFreeOCStringLL(deviceInfo.dataModelVersions);
}
void DuplicateString(char ** targetString, std::string sourceString)
DuplicateString(&platformInfo.firmwareVersion, firmwareVersion);
DuplicateString(&platformInfo.supportUrl, supportUrl);
DuplicateString(&platformInfo.systemTime, systemTime);
+
return OC_STACK_OK;
}
-
-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;
}
-
int main()
{
// Create PlatformConfig object
std::cout<<"Starting server & setting platform info\n";
- OCStackResult result = SetPlatformInfo(platformID, manufacturerName, manufacturerUrl,
+ OCStackResult result = SetPlatformInfo(platformID, manufacturerName, manufacturerLink,
modelNumber, dateOfManufacture, platformVersion, operatingSystemVersion,
- hardwareVersion, firmwareVersion, supportUrl, systemTime);
+ hardwareVersion, firmwareVersion, supportLink, systemTime);
result = OCPlatform::registerPlatformInfo(platformInfo);
}
- result = SetDeviceInfo(deviceName);
+ result = SetDeviceInfo(deviceName, specVersion, dataModelVersions);
OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.wk.d");
OCResourcePayloadAddStringLL(&deviceInfo.types, "oic.d.tv");