WatchComplicationStub(int id, int supported_types, int supported_event_types,
const std::string& default_provider_id,
ComplicationType default_type)
- : Complication(id, supported_types, supported_event_types,
- default_provider_id, default_type) {
- }
+ : Complication(id, supported_types, supported_event_types,
+ default_provider_id, default_type) {}
/* LCOV_EXCL_START */
void OnProviderError(const std::string& provider_id, ComplicationType type,
- int error) override {
+ int error) override {
for (auto& i : cb_list_) {
i->InvokeErrorCallback(GetComplicationId(), provider_id, type, error);
}
/* LCOV_EXCL_STOP */
void OnDataUpdated(const std::string& provider_id, ComplicationType type,
- const std::unique_ptr<Bundle>& data) override {
- for (auto& i : cb_list_) {
- i->Invoke(GetComplicationId(), provider_id, type, data);
- }
- LOGI("update call!! done");
- }
+ const std::unique_ptr<tizen_base::Bundle>& data) override;
int AddCallbackInfo(unique_ptr<CallbackInfo> ci) {
for (auto& i : cb_list_) {
- if (i.get()->GetCallback() != ci->GetCallback())
- continue;
+ if (i.get()->GetCallback() != ci->GetCallback()) continue;
LOGI("already registered callback");
return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
}
- if (cb_list_.empty())
- NotifyListeningStart();
+ if (cb_list_.empty()) NotifyListeningStart();
cb_list_.emplace_back(move(ci));
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
int RemoveCallbackInfo(watchface_complication_updated_cb cb) {
for (auto& i : cb_list_) {
- if (i.get()->GetCallback() != cb)
- continue;
+ if (i.get()->GetCallback() != cb) continue;
cb_list_.remove(i);
- if (cb_list_.empty())
- NotifyListeningStop();
+ if (cb_list_.empty()) NotifyListeningStop();
return WATCHFACE_COMPLICATION_ERROR_NONE;
}
std::list<std::unique_ptr<CallbackInfo>> cb_list_;
};
+void WatchComplicationStub::OnDataUpdated(
+ const std::string& provider_id, ComplicationType type,
+ const std::unique_ptr<tizen_base::Bundle>& data) {
+ for (auto& i : cb_list_) {
+ i->Invoke(GetComplicationId(), provider_id, type, data);
+ }
+ LOGI("update call!! done");
+}
+
extern "C" EXPORT_API int watchface_complication_add_updated_cb(
complication_h handle, watchface_complication_updated_cb cb,
watchface_complication_error_cb error_cb, void* user_data) {