cond_var.wait_for(lock, std::chrono::seconds(CALLBACK_WAIT_TIMEOUT_S));
- /* !!! Dima please review !!! */
- this->uuid = device_resource->sid();
-
OCPlatform::getDeviceInfo(device_resource->host(),
dev_info_uri,
device_resource->connectivityType(),
- [this](const OCRepresentation & rep)
+ [this, &device_resource](const OCRepresentation & rep)
{
std::string value;
});
cond_var.wait_for(lock, std::chrono::seconds(CALLBACK_WAIT_TIMEOUT_S));
+
+ if (this->uuid.empty()) this->uuid = device_resource->sid();
+
+ if (name == "undefined" || name.empty())
+ {
+ std::shared_ptr<OIC::Service::RemoteEnrollee> remote_enrollee = OIC::Service::EasySetup::getInstance()->createRemoteEnrollee(device_resource);
+
+ remote_enrollee->getConfiguration(
+ [this](std::shared_ptr<OIC::Service::GetConfigurationStatus> status)
+ {
+ if(status->getESResult() == ES_OK)
+ {
+ OIC::Service::EnrolleeConf conf = status->getEnrolleeConf();
+ name = conf.getDeviceName();
+ model = conf.getModelNumber();
+ }
+ cond_var.notify_one();
+ }
+ );
+
+ cond_var.wait_for(lock, std::chrono::seconds(CALLBACK_WAIT_TIMEOUT_S));
+ }
}
IoTDevice_impl::IoTDevice_impl(const std::string& host, const std::string& uid, bool connected)
throw std::invalid_argument("Wrong login credentials");
OCAccountManager::Ptr accountMgr = OCPlatform::constructAccountManagerObject(host, CT_ADAPTER_TCP);
+
+ if (!accountMgr)
+ throw IoTInternalError("Can not create account manager", EC_IOTIVITY_ERROR);
params->accountMgr = accountMgr;
std::mutex mtx;