Added platform discovery to go woth changeset moving oc/d to oic/p.
Updated ocserver/client and devicediscoveryserver/client to make
platform discovery requests.
Change-Id: I972fa8585c966a7d047f82d0cc0f18c01dcd6508
Signed-off-by: Mandeep Shetty <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1008
Reviewed-by: Erich Keane <erich.keane@intel.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
static int TEST_CASE = 0;
static const char * UNICAST_DISCOVERY_QUERY = "coap://%s:6298/oc/core";
static const char * UNICAST_DEVICE_DISCOVERY_QUERY = "coap://%s:6298/oc/core/d";
+static const char * UNICAST_PLATFORM_DISCOVERY_QUERY = "coap://%s:6298/oic/p";
static const char * MULTICAST_DEVICE_DISCOVERY_QUERY = "/oc/core/d";
+static const char * MULTICAST_PLATFORM_DISCOVERY_QUERY = "/oic/p";
static const char * MULTICAST_RESOURCE_DISCOVERY_QUERY = "/oc/core";
//The following variable determines the interface protocol (IPv4, IPv6, etc)
//to be used for sending unicast messages. Default set to IPv4.
"then cancel immediately with High QOS");
OC_LOG(INFO, TAG, "-t 18 : Discover Resources and Initiate Nonconfirmable Get Request and "\
"add vendor specific header options");
- OC_LOG(INFO, TAG, "-t 19 : Discover Devices");
+ OC_LOG(INFO, TAG, "-t 19 : Discover Platform");
}
OCStackResult InvokeOCDoResource(std::ostringstream &query,
return OC_STACK_KEEP_TRANSACTION;
}
-OCStackApplicationResult DeviceDiscoveryReqCB (void* ctx, OCDoHandle handle,
+OCStackApplicationResult PlatformDiscoveryReqCB (void* ctx, OCDoHandle handle,
OCClientResponse * clientResponse)
{
if (ctx == (void*) DEFAULT_CONTEXT_VALUE)
{
- OC_LOG(INFO, TAG, "Callback Context for Device DISCOVER query recvd successfully");
+ OC_LOG(INFO, TAG, "Callback Context for Platform DISCOVER query recvd successfully");
}
if(clientResponse)
}
else
{
- OC_LOG_V(INFO, TAG, "DeviceDiscoveryReqCB received Null clientResponse");
+ OC_LOG_V(INFO, TAG, "PlatformDiscoveryReqCB received Null clientResponse");
}
return (UNICAST_DISCOVERY) ? OC_STACK_DELETE_TRANSACTION : OC_STACK_KEEP_TRANSACTION;
OCCallbackData cbData;
char szQueryUri[64] = { 0 };
- cbData.cb = DeviceDiscoveryReqCB;
+ cbData.cb = PlatformDiscoveryReqCB;
cbData.context = (void*)DEFAULT_CONTEXT_VALUE;
cbData.cd = NULL;
if(UNICAST_DISCOVERY)
{
- snprintf(szQueryUri, sizeof(szQueryUri), UNICAST_DEVICE_DISCOVERY_QUERY, ipv4addr);
+ snprintf(szQueryUri, sizeof(szQueryUri), UNICAST_PLATFORM_DISCOVERY_QUERY, ipv4addr);
}
else
{
- strncpy(szQueryUri, MULTICAST_DEVICE_DISCOVERY_QUERY,
+ strncpy(szQueryUri, MULTICAST_PLATFORM_DISCOVERY_QUERY,
sizeof(szQueryUri) -1 );
szQueryUri[sizeof(szQueryUri) -1] = '\0';
}
const char *deviceUUID = "myDeviceUUID";
const char *firmwareVersion = "myFirmwareVersion";
const char *hostName = "myHostName";
-const char *manufacturerName = "myManufacturerNa";
+const char *manufacturerName = "myName";
+const char *operatingSystemVersion = "myOS";
+const char *hardwareVersion = "myHardwareVersion";
+const char* platformID = "myPlatformID";
const char *manufacturerUrl = "myManufacturerUrl";
const char *modelNumber = "myModelNumber";
const char *platformVersion = "myPlatformVersion";
const char *supportUrl = "mySupportUrl";
const char *version = "myVersion";
+const char *systemTime = "2015-05-15T11.04";
// Entity handler should check for resourceTypeName and ResourceInterface in order to GET
// the existence of a known resource
const char *resourceTypeName = "core.light";
const char *resourceInterface = OC_RSRVD_INTERFACE_DEFAULT;
-OCDeviceInfo deviceInfo;
+OCPlatformInfo platformInfo;
//This function takes the request as an input and returns the response
//in JSON format.
}
#endif
+int createLightResource (char *uri, LightResource *lightResource)
+{
+ if (!uri)
+ {
+ OC_LOG(ERROR, TAG, "Resource URI cannot be NULL");
+ return -1;
+ }
+
+ lightResource->state = false;
+ lightResource->power= 0;
+ OCStackResult res = OCCreateResource(&(lightResource->handle),
+ "core.light",
+ "oc.mi.def",
+ uri,
+ OCEntityHandlerCb,
+ OC_DISCOVERABLE|OC_OBSERVABLE);
+ OC_LOG_V(INFO, TAG, "Created Light resource with result: %s", getResult(res));
+
+ return 0;
+}
+
+void DeletePlatformInfo()
+{
+ free (platformInfo.platformID);
+ free (platformInfo.manufacturerName);
+ free (platformInfo.manufacturerUrl);
+ free (platformInfo.modelNumber);
+ free (platformInfo.dateOfManufacture);
+ free (platformInfo.platformVersion);
+ free (platformInfo.operatingSystemVersion);
+ free (platformInfo.hardwareVersion);
+ free (platformInfo.firmwareVersion);
+ free (platformInfo.supportUrl);
+ free (platformInfo.systemTime);
+}
+
+bool DuplicateString(char** targetString, const char* sourceString)
+{
+ if(!sourceString)
+ {
+ return false;
+ }
+ else
+ {
+ *targetString = (char *) malloc(strlen(sourceString) + 1);
+
+ if(*targetString)
+ {
+ strncpy(*targetString, sourceString, (strlen(sourceString) + 1));
+ return true;
+ }
+ }
+ return false;
+}
+
+OCStackResult SetPlatformInfo(const char* platformID, const char *manufacturerName,
+ const char *manufacturerUrl, const char *modelNumber, const char *dateOfManufacture,
+ const char *platformVersion, const char* operatingSystemVersion, const char* hardwareVersion,
+ const char *firmwareVersion, const char* supportUrl, const char* systemTime)
+{
+
+ bool success = true;
+
+ if(manufacturerName != NULL && (strlen(manufacturerName) > MAX_MANUFACTURER_NAME_LENGTH))
+ {
+ return OC_STACK_INVALID_PARAM;
+ }
+
+ if(manufacturerUrl != NULL && (strlen(manufacturerUrl) > MAX_MANUFACTURER_URL_LENGTH))
+ {
+ return OC_STACK_INVALID_PARAM;
+ }
+
+ if(!DuplicateString(&platformInfo.platformID, platformID))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.manufacturerName, manufacturerName))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.manufacturerUrl, manufacturerUrl))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.modelNumber, modelNumber))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.dateOfManufacture, dateOfManufacture))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.platformVersion, platformVersion))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.operatingSystemVersion, operatingSystemVersion))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.hardwareVersion, hardwareVersion))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.firmwareVersion, firmwareVersion))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.supportUrl, supportUrl))
+ {
+ success = false;
+ }
+
+ if(!DuplicateString(&platformInfo.systemTime, systemTime))
+ {
+ success = false;
+ }
+
+ if(success)
+ {
+ return OC_STACK_OK;
+ }
+
+ DeletePlatformInfo();
+ return OC_STACK_ERROR;
+}
+
static void PrintUsage()
{
OC_LOG(INFO, TAG, "Usage : ocserver -o <0|1>");
OCSetDefaultDeviceEntityHandler(OCDeviceEntityHandlerCb);
- OCStackResult deviceResult = SetDeviceInfo(contentType, dateOfManufacture, deviceName,
- deviceUUID, firmwareVersion, hostName, manufacturerName,
- manufacturerUrl, modelNumber, platformVersion, supportUrl, version);
+ OCStackResult platformRegistrationResult =
+ SetPlatformInfo(platformID, manufacturerName, manufacturerUrl, modelNumber,
+ dateOfManufacture, platformVersion, operatingSystemVersion, hardwareVersion,
+ firmwareVersion, supportUrl, systemTime);
- if (deviceResult != OC_STACK_OK)
+ if (platformRegistrationResult != OC_STACK_OK)
{
- OC_LOG(INFO, TAG, "Device Registration failed!");
+ OC_LOG(INFO, TAG, "Platform info setting failed locally!");
exit (EXIT_FAILURE);
}
- deviceResult = OCSetDeviceInfo(deviceInfo);
+ platformRegistrationResult = OCSetPlatformInfo(platformInfo);
- if (deviceResult != OC_STACK_OK)
+ if (platformRegistrationResult != OC_STACK_OK)
{
- OC_LOG(INFO, TAG, "Device Registration failed!");
+ OC_LOG(INFO, TAG, "Platform Registration failed!");
exit (EXIT_FAILURE);
}
// Break from loop with Ctrl-C
OC_LOG(INFO, TAG, "Entering ocserver main loop...");
- DeleteDeviceInfo();
+ DeletePlatformInfo();
signal(SIGINT, handleSigInt);
while (!gQuitFlag)
{
}
return 0;
-}
-
-int createLightResource (char *uri, LightResource *lightResource)
-{
- if (!uri)
- {
- OC_LOG(ERROR, TAG, "Resource URI cannot be NULL");
- return -1;
- }
-
- lightResource->state = false;
- lightResource->power= 0;
- OCStackResult res = OCCreateResource(&(lightResource->handle),
- "core.light",
- OC_RSRVD_INTERFACE_DEFAULT,
- uri,
- OCEntityHandlerCb,
- OC_DISCOVERABLE|OC_OBSERVABLE);
- OC_LOG_V(INFO, TAG, "Created Light resource with result: %s", getResult(res));
-
- return 0;
-}
-
-void DeleteDeviceInfo()
-{
- free(deviceInfo.contentType);
- free(deviceInfo.dateOfManufacture);
- free(deviceInfo.deviceName);
- free(deviceInfo.deviceUUID);
- free(deviceInfo.firmwareVersion);
- free(deviceInfo.hostName);
- free(deviceInfo.manufacturerName);
- free(deviceInfo.manufacturerUrl);
- free(deviceInfo.modelNumber);
- free(deviceInfo.platformVersion);
- free(deviceInfo.supportUrl);
- free(deviceInfo.version);
-}
-
-bool DuplicateString(char** targetString, const char* sourceString)
-{
- if(!sourceString)
- {
- return false;
- }
- else
- {
- *targetString = (char *) malloc(strlen(sourceString) + 1);
-
- if(*targetString)
- {
- strncpy(*targetString, sourceString, (strlen(sourceString) + 1));
- return true;
- }
- }
- return false;
-}
-
-OCStackResult SetDeviceInfo(const char *contentType, const char *dateOfManufacture,
- const char *deviceName, const char *deviceUUID, const char *firmwareVersion,
- const char *hostName, const char *manufacturerName, const char *manufacturerUrl,
- const char *modelNumber, const char *platformVersion, const char *supportUrl,
- const char *version)
-{
-
- bool success = true;
-
- if(manufacturerName != NULL && (strlen(manufacturerName) > MAX_MANUFACTURER_NAME_LENGTH))
- {
- return OC_STACK_INVALID_PARAM;
- }
-
- if(manufacturerUrl != NULL && (strlen(manufacturerUrl) > MAX_MANUFACTURER_URL_LENGTH))
- {
- return OC_STACK_INVALID_PARAM;
- }
-
- if(!DuplicateString(&deviceInfo.contentType, contentType))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.dateOfManufacture, dateOfManufacture))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.deviceName, deviceName))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.deviceUUID, deviceUUID))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.firmwareVersion, firmwareVersion))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.hostName, hostName))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.manufacturerName, manufacturerName))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.manufacturerUrl, manufacturerUrl))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.modelNumber, modelNumber))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.platformVersion, platformVersion))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.supportUrl, supportUrl))
- {
- success = false;
- }
-
- if(!DuplicateString(&deviceInfo.version, version))
- {
- success = false;
- }
-
- if(success)
- {
- return OC_STACK_OK;
- }
-
- DeleteDeviceInfo();
- return OC_STACK_ERROR;
-}
+}
\ No newline at end of file
using namespace OC;
//Callback after device information is received
-void receivedDeviceInfo(const OCRepresentation& rep)
+void receivedPlatformInfo(const OCRepresentation& rep)
{
- std::cout << "\nDevice Information received ---->\n";
-
- std::string contentType;
- std::string dateOfManufacture;
- std::string deviceName;
- std::string deviceUUID;
- std::string firmwareVersion;
- std::string hostName;
- std::string manufacturerName;
- std::string manufacturerUrl;
- std::string modelNumber;
- std::string platformVersion;
- std::string supportUrl;
- std::string version;
-
- if(rep.getValue("ct", contentType))
- {
- std::cout << "Content Type: " << contentType << std::endl;
- }
-
- if(rep.getValue("mndt", dateOfManufacture))
- {
- std::cout << "Date of manufacture: " << dateOfManufacture << std::endl;
- }
-
- if(rep.getValue("dn", deviceName))
- {
- std::cout << "Device Name: " << deviceName << std::endl;
- }
-
- if(rep.getValue("di", deviceUUID))
- {
- std::cout << "Device UUID: " << deviceUUID << std::endl;
- }
-
- if(rep.getValue("mnfv", firmwareVersion))
- {
- std::cout << "Firmware Version: " << firmwareVersion << std::endl;
- }
-
- if(rep.getValue("hn", hostName))
- {
- std::cout << "Host Name: " << hostName << std::endl;
- }
-
- if(rep.getValue("mnmn", manufacturerName))
- {
- std::cout << "Manufacturer Name: " << manufacturerName << std::endl;
- }
-
- if(rep.getValue("mnml", manufacturerUrl))
- {
- std::cout << "Manufacturer Url: " << manufacturerUrl << std::endl;
- }
-
- if(rep.getValue("mnmo", modelNumber))
- {
- std::cout << "Model No. : " << modelNumber << std::endl;
- }
-
- if(rep.getValue("mnpv", platformVersion))
- {
- std::cout << "Platform Version: " << platformVersion << std::endl;
- }
+ std::cout << "\nPlatform Information received ---->\n";
+ std::string value;
+ std::string values[22] =
+ {
+ "pi", "Platform ID ",
+ "mnmn", "Manufacturer name ",
+ "mnml", "Manufacturer url ",
+ "mnmo", "Manufacturer Model No ",
+ "mndt", "Manufactured Date ",
+ "mnpv", "Manufacturer Platform Version ",
+ "mnos", "Manufacturer OS version ",
+ "mnhw", "Manufacturer hardware version ",
+ "mnfv", "Manufacturer firmware version ",
+ "mnsl", "Manufacturer support url ",
+ "st", "Manufacturer system time "
+ };
- if(rep.getValue("mnsl", supportUrl))
+ for (int i = 0; i < 22; i += 2)
{
- std::cout << "Support URL: " << supportUrl << std::endl;
+ if(rep.getValue(values[i], value))
+ {
+ std::cout << values[i + 1] << " : "<< value << std::endl;
+ }
}
+}
- if(rep.getValue("icv", version))
- {
- std::cout << "Version: " << version << std::endl;
- }
+void receivedDeviceInfo(const OCRepresentation& rep)
+{
+ std::cout << "Implement me !" << std::endl;
}
int main(int argc, char* argv[]) {
- std::ostringstream requestURI;
- std::string deviceDiscoveryURI = "/oc/core/d";
+ std::ostringstream platformDiscoveryRequest;
+ std::ostringstream deviceDiscoveryRequest;
+
+ std::string platformDiscoveryURI = "/oic/p";
+ std::string deviceDiscoveryURI = "/oic/d";
OCConnectivityType connectivityType = OC_IPV4;
OCPlatform::Configure(cfg);
try
{
- requestURI << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
+ platformDiscoveryRequest << OC_MULTICAST_PREFIX << platformDiscoveryURI;
+ deviceDiscoveryRequest << OC_MULTICAST_PREFIX << deviceDiscoveryURI;
- OCPlatform::getDeviceInfo("", requestURI.str(), connectivityType,
- &receivedDeviceInfo);
- std::cout<< "Querying for device information... " <<std::endl;
+ OCStackResult ret;
+ std::cout<< "Querying for platform information... ";
+
+ ret = OCPlatform::getPlatformInfo("", platformDiscoveryRequest.str(), connectivityType,
+ &receivedPlatformInfo);
+
+ if (ret == OC_STACK_OK)
+ {
+ std::cout << "done." << std::endl;
+ }
+ else
+ {
+ std::cout << "failed." << std::endl;
+ }
+
+ bool is_oic_d_implemented = false;
+ if (is_oic_d_implemented)
+ {
+ std::cout<< "Querying for device information... ";
+
+ ret = OCPlatform::getDeviceInfo("", deviceDiscoveryRequest.str(), connectivityType,
+ &receivedDeviceInfo);
+
+ if (ret == OC_STACK_OK)
+ {
+ std::cout << "done." << std::endl;
+ }
+ else
+ {
+ std::cout << "failed." << std::endl;
+ }
+ }
// A condition variable will free the mutex it is given, then do a non-
// intensive block until 'notify' is called on it. In this case, since we
// don't ever call cv.notify, this should be a non-processor intensive version
using namespace OC;
//Set of strings for each of deviceInfo fields
-std::string contentType = "myContentType";
std::string dateOfManufacture = "myDateOfManufacture";
-std::string deviceName = "myDeviceName";
-std::string deviceUUID = "myDeviceUUID";
-std::string firmwareVersion = "myFirmwareVersion";
-std::string hostName = "myHostName";
-std::string manufacturerName = "myManufacturerNa";
-std::string manufacturerUrl = "myManufacturerUrl";
+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 = "myPlatformVersion";
-std::string supportUrl = "mySupportUrl";
-std::string version = "myVersion";
+std::string platformVersion = "platformVersion";
+std::string supportUrl = "www.mysupporturl.com";
+std::string systemTime = "mySystemTime";
-//OCDeviceInfo Contains all the device info to be stored
-OCDeviceInfo deviceInfo;
+//OCPlatformInfo Contains all the platform info to be stored
+OCPlatformInfo platformInfo;
-void DeleteDeviceInfo()
+void DeletePlatformInfo()
{
- delete[] deviceInfo.contentType;
- delete[] deviceInfo.dateOfManufacture;
- delete[] deviceInfo.deviceName;
- delete[] deviceInfo.deviceUUID;
- delete[] deviceInfo.firmwareVersion;
- delete[] deviceInfo.hostName;
- delete[] deviceInfo.manufacturerName;
- delete[] deviceInfo.manufacturerUrl;
- delete[] deviceInfo.modelNumber;
- delete[] deviceInfo.platformVersion;
- delete[] deviceInfo.supportUrl;
- delete[] deviceInfo.version;
+ delete[] platformInfo.platformID;
+ delete[] platformInfo.manufacturerName;
+ delete[] platformInfo.manufacturerUrl;
+ delete[] platformInfo.modelNumber;
+ delete[] platformInfo.dateOfManufacture;
+ delete[] platformInfo.platformVersion;
+ delete[] platformInfo.operatingSystemVersion;
+ delete[] platformInfo.hardwareVersion;
+ delete[] platformInfo.firmwareVersion;
+ delete[] platformInfo.supportUrl;
+ delete[] platformInfo.systemTime;
}
void DuplicateString(char ** targetString, std::string sourceString)
strncpy(*targetString, sourceString.c_str(), (sourceString.length() + 1));
}
-OCStackResult SetDeviceInfo(std::string contentType, std::string dateOfManufacture,
- std::string deviceName, std::string deviceUUID, std::string firmwareVersion,
- std::string hostName, std::string manufacturerName, std::string manufacturerUrl,
- std::string modelNumber, std::string platformVersion, std::string supportUrl,
- std::string version)
+OCStackResult SetPlatformInfo(std::string platformID, std::string manufacturerName,
+ std::string manufacturerUrl, std::string modelNumber, std::string dateOfManufacture,
+ std::string platformVersion, std::string operatingSystemVersion, std::string hardwareVersion,
+ std::string firmwareVersion, std::string supportUrl, std::string systemTime)
{
- if(manufacturerName.length() > MAX_MANUFACTURER_NAME_LENGTH)
- {
- return OC_STACK_INVALID_PARAM;
-
- }
-
- if(manufacturerUrl.length() > MAX_MANUFACTURER_URL_LENGTH)
- {
- return OC_STACK_INVALID_PARAM;
-
- }
-
- try
- {
- DuplicateString(&deviceInfo.contentType, contentType);
- DuplicateString(&deviceInfo.dateOfManufacture, dateOfManufacture);
- DuplicateString(&deviceInfo.deviceName, deviceName);
- DuplicateString(&deviceInfo.deviceUUID, deviceUUID);
- DuplicateString(&deviceInfo.firmwareVersion, firmwareVersion);
- DuplicateString(&deviceInfo.hostName, hostName);
- DuplicateString(&deviceInfo.manufacturerName, manufacturerName);
- DuplicateString(&deviceInfo.manufacturerUrl, manufacturerUrl);
- DuplicateString(&deviceInfo.modelNumber, modelNumber);
- DuplicateString(&deviceInfo.platformVersion, platformVersion);
- DuplicateString(&deviceInfo.supportUrl, supportUrl);
- DuplicateString(&deviceInfo.version, version);
- }catch(std::exception &)
- {
- std::cout<<"String Copy failed!!\n";
- return OC_STACK_ERROR;
- }
-
+ DuplicateString(&platformInfo.platformID, platformID);
+ DuplicateString(&platformInfo.manufacturerName, manufacturerName);
+ DuplicateString(&platformInfo.manufacturerUrl, manufacturerUrl);
+ DuplicateString(&platformInfo.modelNumber, modelNumber);
+ DuplicateString(&platformInfo.dateOfManufacture, dateOfManufacture);
+ DuplicateString(&platformInfo.platformVersion, platformVersion);
+ DuplicateString(&platformInfo.operatingSystemVersion, operatingSystemVersion);
+ DuplicateString(&platformInfo.hardwareVersion, hardwareVersion);
+ DuplicateString(&platformInfo.firmwareVersion, firmwareVersion);
+ DuplicateString(&platformInfo.supportUrl, supportUrl);
+ DuplicateString(&platformInfo.systemTime, systemTime);
return OC_STACK_OK;
}
OCPlatform::Configure(cfg);
- std::cout<<"Starting server & setting device info\n";
+ std::cout<<"Starting server & setting platform info\n";
- OCStackResult result = SetDeviceInfo(contentType, dateOfManufacture, deviceName,
- deviceUUID, firmwareVersion, hostName, manufacturerName, manufacturerUrl,
- modelNumber, platformVersion, supportUrl, version);
+ OCStackResult result = SetPlatformInfo(platformID, manufacturerName, manufacturerUrl,
+ modelNumber, dateOfManufacture, platformVersion, operatingSystemVersion,
+ hardwareVersion, firmwareVersion, supportUrl, systemTime);
if(result != OC_STACK_OK)
{
- std::cout << "Device Registration failed\n";
+ std::cout << "Platform Registration failed\n";
return -1;
}
- result = OCPlatform::registerDeviceInfo(deviceInfo);
+ result = OCPlatform::registerPlatformInfo(platformInfo);
if(result != OC_STACK_OK)
{
- std::cout << "Device Registration failed\n";
+ std::cout << "Platform Registration failed\n";
return -1;
}
- DeleteDeviceInfo();
+ DeletePlatformInfo();
// A condition variable will free the mutex it is given, then do a non-
// intensive block until 'notify' is called on it. In this case, since we