Added check if given HumanActivityRecorderType is supported.
[Verification]
Code compiles without errors.
100% TCT pass rate (humanactivitymonitor)
Change-Id: I8a7ee7ec24eb3b144f651cc244c307d128ad7ac0
Signed-off-by: Jakub Skowron <j.skowron@samsung.com>
void HumanActivityMonitorInstance::HumanActivityMonitorManagerReadRecorderData(
const picojson::value& args, picojson::object& out) {
LoggerD("Enter");
+ CHECK_PRIVILEGE_ACCESS(kPrivilegeHealthInfo, &out);
CHECK_EXIST(args, "type", out)
CHECK_EXIST(args, "query", out)
return;
}
+ /* check if given human activity recorder type is supported */
+ if (!manager_->IsSupported(type)) {
+ LogAndReportError(PlatformResult(ErrorCode::NOT_SUPPORTED_ERR,"NOT_SUPPORTED_ERR"), &out);
+ return;
+ }
+
const auto callback_id = args.get("callbackId").get<double>();
auto get = [this, type, query, callback_id]() -> void {
return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR,"NOT_SUPPORTED_ERR");
}
- private:
+ public:
PlatformResult IsSupported() {
ScopeLogger(type());
}
}
+ private:
std::string type_;
common::optional<bool> is_supported_;
JsonCallback event_callback_;
return PlatformResult(ErrorCode::NO_ERROR);
}
+PlatformResult HumanActivityMonitorManager::IsSupported( const std::string& type ) {
+ return this->GetMonitor(type)->IsSupported();
+}
+
PlatformResult HumanActivityMonitorManager::SetListener(
const std::string& type, JsonCallback callback,
const picojson::value& args) {
common::PlatformResult Init();
+ /* checks if given HumanActivityRecorderType is supported */
+ common::PlatformResult IsSupported( const std::string& type );
+
common::PlatformResult SetListener(const std::string& type,
JsonCallback callback,
const picojson::value& args);