s->Refresh();
}
-void ConvergenceDevice::Refresh() {
+void ConvergenceDevice::Refresh(conv_device_h device_handle) {
ScopeLogger();
// Getting device properties from handle
id_ = ExtractDevicePropery(CONV_DEVICE_ID);
id_.c_str(), name_.c_str(), type_.c_str());
// Extracting services
- const int error = conv_device_foreach_service(device_handle_, ForEachServiceCb, this);
+ conv_device_h handle = nullptr;
+ if (device_handle) {
+ handle = device_handle;
+ } else {
+ handle = device_handle_;
+ }
+
+ const int error = conv_device_foreach_service(handle, ForEachServiceCb, this);
if (CONV_ERROR_NONE != error) {
trace_conv_error(error, __LINE__, "conv_device_foreach_service");
}
public:
- void Refresh();
+ void Refresh(conv_device_h device_handle = nullptr);
ConvergenceService *GetService(const int service_type) const;
//picojson::object ToJson() const;
picojson::value ToJson() const;
//std::string get_device() const {return device_handle_; }
+ int ServiceCount() {return services_.size();};
public:
ConvergenceService *RegisterLocalService(const int service_type);
d->SetId(device_id);
registered_devices_[device_id] = d;
LoggerI("...registering the device [%s, %x]", device_id, device_handle);
+ // Assume that there are only two services
+ } else if(registered_devices_[device_id]->ServiceCount() < 2) {
+ registered_devices_[device_id]->Refresh(device_handle);
}
return registered_devices_[device_id];
}