}
}
-void receivedPlatformInfo(const OCRepresentation& rep)
-{
- std::cout << "\nPlatform Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "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 "
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if(rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : "<< value << std::endl;
- }
- }
-}
-
-void receivedDeviceInfo(const OCRepresentation& rep)
-{
- std::cout << "\nDevice Information received ---->\n";
- std::string value;
- std::string values[] =
- {
- "di", "Device ID ",
- "n", "Device name ",
- "lcv", "Spec version url ",
- "dmv", "Data Model Model ",
- };
-
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
- {
- if (rep.getValue(values[i], value))
- {
- std::cout << values[i + 1] << " : " << value << std::endl;
- }
- }
-}
-
// Callback to found resources
void foundResource(std::shared_ptr<OCResource> resource)
{
std::cout << "In foundResource\n";
std::string resourceURI;
std::string hostAddress;
-
- std::string platformDiscoveryURI = "/oic/p";
- std::string deviceDiscoveryURI = "/oic/d";
-
try
{
{
hostAddress = resource->host();
std::cout << "\tHost address of the resource: " << hostAddress << std::endl;
- OCStackResult ret;
-
- std::cout << "Querying for platform information... " << std::endl;
-
- ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI,
- resource->connectivityType(),
- &receivedPlatformInfo);
-
- if (ret == OC_STACK_OK)
- {
- std::cout << "Get platform information is done." << std::endl;
- }
- else
- {
- std::cout << "Get platform information failed." << std::endl;
- }
-
- std::cout << "Querying for device information... " << std::endl;
-
- ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI,
- resource->connectivityType(), &receivedDeviceInfo);
-
- if (ret == OC_STACK_OK)
- {
- std::cout << "Getting device information is done." << std::endl;
- }
- else
- {
- std::cout << "Getting device information failed." << std::endl;
- }
-
// Get the resource types
std::cout << "\tList of resource types: " << std::endl;
for(auto &resourceTypes : resource->getResourceTypes())
int main(int argc, char* argv[]) {
std::ostringstream requestURI;
- OCPersistentStorage ps {client_open, fread, fwrite, fclose, unlink };
+ OCPersistentStorage ps {client_open, fread, fwrite, fclose, unlink, NULL, NULL};
try
{
printUsage();
PlatformConfig cfg {
OC::ServiceType::InProc,
OC::ModeType::Both,
- "0.0.0.0",
- 0,
+ OCConnectivityType::CT_ADAPTER_IP,
+ OCConnectivityType::CT_ADAPTER_IP,
+ (OCTransportAdapter)(OCTransportAdapter::OC_ADAPTER_IP|OCTransportAdapter::OC_ADAPTER_TCP),
OC::QualityOfService::HighQos,
&ps
};