observerIds: {
get: function() {
var callArgs = {};
- callArgs.id = data.id;
+ callArgs.id = this[kIdKey];
var result = native.callSync('IotconResource_getObserverIds', callArgs);
return native.getResultObject(result);
- },
+ }.bind(this),
set: function() {},
enumerable: true
}
cachedRepresentation: {
get: function() {
var callArgs = {};
- callArgs.id = data.id;
+ callArgs.id = this[kIdKey];
var result = native.callSync('IotconRemoteResource_getCachedRepresentation', callArgs);
return createRepresentation(native.getResultObject(result));
- },
+ }.bind(this),
set: function() {},
enumerable: true
}
common::TizenResult IotconInstance::ResourceGetObserverIds(const picojson::object& args) {
ScopeLogger();
- return common::UnknownError("Not implemented");
+
+ CHECK_EXIST(args, kId);
+
+ ResourceInfoPtr resource;
+ auto result = IotconServerManager::GetInstance().GetResourceById(GetId(args), &resource);
+
+ if (!result) {
+ LogAndReturnTizenError(result, ("GetResourceById() failed"));
+ }
+
+ picojson::value value{picojson::array{}};
+ auto& arr = value.get<picojson::array>();
+
+ for (auto id : resource->observers) {
+ arr.push_back(picojson::value{static_cast<double>(id)});
+ }
+
+ return common::TizenSuccess(value);
}
common::TizenResult IotconInstance::ResourceNotify(const picojson::object& args) {