}
private:
+ 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;
+ }
+ }
+ }
+
void foundDevice(std::shared_ptr<OCResource> resource)
{
using namespace OC::OCPlatform;
std::cout << "Querying for platform information... " << std::endl;
- ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, CT_ADAPTER_IP, NULL);
+ ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI,
+ resource->connectivityType(),
+ std::bind(&ClientFridge::receivedPlatformInfo,
+ this, PH::_1));
if (ret == OC_STACK_OK)
{
std::cout << "Querying for device information... " << std::endl;
- ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI,
- resource->connectivityType(), NULL);
+ ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI,
+ resource->connectivityType(),
+ std::bind(&ClientFridge::receivedDeviceInfo,
+ this, PH::_1));
if (ret == OC_STACK_OK)
{
}
}
+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)
{
OCStackResult ret;
std::cout << "Querying for platform information... " << std::endl;
- ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, CT_ADAPTER_IP, NULL);
+ ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI,
+ resource->connectivityType(),
+ &receivedPlatformInfo);
if (ret == OC_STACK_OK)
{
std::cout << "Querying for device information... " << std::endl;
ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI,
- resource->connectivityType(), NULL);
+ resource->connectivityType(),
+ &receivedDeviceInfo);
if (ret == OC_STACK_OK)
{
}
}
+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)
{
OCStackResult ret;
std::cout << "Querying for platform information... " << std::endl;
- ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, CT_ADAPTER_IP, NULL);
+ ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI,
+ resource->connectivityType(),
+ &receivedPlatformInfo);
if (ret == OC_STACK_OK)
{
std::cout << "Querying for device information... " << std::endl;
ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI,
- resource->connectivityType(), NULL);
+ resource->connectivityType(),
+ &receivedDeviceInfo);
if (ret == OC_STACK_OK)
{
std::cout << "Getting device information is done." << std::endl;
"st", "Manufacturer system time "
};
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]) ; i += 2)
+ for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
{
if(rep.getValue(values[i], value))
{
std::cout << "Querying for platform information... " << std::endl;
- ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, CT_ADAPTER_IP,
- &receivedPlatformInfo);
+ ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI,
+ resource->connectivityType(),
+ &receivedPlatformInfo);
if (ret == OC_STACK_OK)
{
"st", "Manufacturer system time "
};
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]) ; i += 2)
+ for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)
{
if(rep.getValue(values[i], value))
{
std::cout << "Querying for platform information... " << std::endl;
- ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, CT_ADAPTER_IP,
- &receivedPlatformInfo);
+ ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI,
+ resource->connectivityType(),
+ &receivedPlatformInfo);
if (ret == OC_STACK_OK)
{
"st", "Manufacturer system time "\r
};\r
\r
- for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]) ; i += 2)\r
+ for (unsigned int i = 0; i < sizeof(values) / sizeof(values[0]); i += 2)\r
{\r
if(rep.getValue(values[i], value))\r
{\r
OCStackResult ret;\r
std::cout << "Querying for platform information... " << std::endl;\r
\r
- ret = OCPlatform::getPlatformInfo("", platformDiscoveryURI, CT_ADAPTER_IP,\r
- &receivedPlatformInfo);\r
+ ret = OCPlatform::getPlatformInfo(resource->host(), platformDiscoveryURI,\r
+ resource->connectivityType(),\r
+ &receivedPlatformInfo);\r
\r
if (ret == OC_STACK_OK)\r
{\r
std::cout << "Querying for device information... " << std::endl;\r
\r
ret = OCPlatform::getDeviceInfo(resource->host(), deviceDiscoveryURI,\r
- resource->connectivityType(), &receivedDeviceInfo);\r
+ resource->connectivityType(),\r
+ &receivedDeviceInfo);\r
\r
\r
if (ret == OC_STACK_OK)\r