component_suspended_state_e state,
void *user_data);
+typedef void (*base_component_time_zone_changed_cb)(
+ component_h context,
+ const char *time_zone,
+ const char *time_zone_id,
+ void *user_data);
+
typedef struct {
base_component_restore_content_cb restore_content;
base_component_save_content_cb save_content;
base_component_low_battery_cb low_battery;
base_component_low_memory_cb low_memory;
base_component_suspended_state_changed_cb suspended_state_changed;
+ base_component_time_zone_changed_cb time_zone_changed;
} base_component_lifecycle_callback_s;
#ifdef __cplusplus
component_suspended_state_e state,
void *user_data);
+typedef void (*base_frame_component_time_zone_changed_cb)(
+ component_h context,
+ const char *time_zone,
+ const char *time_zone_id,
+ void *user_data);
+
typedef struct {
base_frame_component_create_cb create;
base_frame_component_start_cb start;
base_frame_component_low_battery_cb low_battery;
base_frame_component_low_memory_cb low_memory;
base_frame_component_suspended_state_changed_cb suspended_state_changed;
+ base_frame_component_time_zone_changed_cb time_zone_changed;
} base_frame_component_lifecycle_callback_s;
#ifdef __cplusplus
component_suspended_state_e state,
void *user_data);
+typedef void (*base_service_component_time_zone_changed_cb)(
+ component_h context,
+ const char *time_zone,
+ const char *time_zone_id,
+ void *user_data);
+
typedef struct {
base_service_component_create_cb create;
base_service_component_start_command_cb start_command;
base_service_component_low_battery_cb low_battery;
base_service_component_low_memory_cb low_memory;
base_service_component_suspended_state_changed_cb suspended_state_changed;
+ base_service_component_time_zone_changed_cb time_zone_changed;
} base_service_component_lifecycle_callback_s;
#ifdef __cplusplus
void Component::OnSuspendedStateChanged(SuspendedState::State state) {
}
+void Component::OnTimeZoneChanged(const std::string& time_zone,
+ const std::string& time_zone_id) {
+}
+
Component::State Component::GetState() {
return impl_->state_;
}
void OnLowBattery(LowBattery::Status status) override;
void OnLowMemory(LowMemory::Status status) override;
void OnSuspendedStateChanged(SuspendedState::State state) override;
+ void OnTimeZoneChanged(const std::string& time_zone,
+ const std::string& time_zone_id) override;
void Finish();
void RegisterAction(std::string app_control_name);
bool DeregisterAction(std::string app_control_name);
}
}
+ void OnTimeZoneChanged(const std::string& time_zone,
+ const std::string& time_zone_id) override {
+ Component::OnTimeZoneChanged(time_zone, time_zone_id);
+
+ if (cb_.time_zone_changed) {
+ cb_.time_zone_changed(this, time_zone.c_str(),
+ time_zone_id.c_str(), user_data_);
+ }
+ }
+
private:
base_component_lifecycle_callback_s cb_;
void* user_data_;
DeviceOrientation::Orientation orientation) = 0;
virtual void OnRegionFormatChanged(std::string region) = 0;
virtual void OnSuspendedStateChanged(SuspendedState::State state) = 0;
+ virtual void OnTimeZoneChanged(const std::string& time_zone,
+ const std::string& time_zone_id) = 0;
};
} // namespace component_based
ISystemEvent* ev_;
};
+class TimeZoneChangedEvent : public tizen_cpp::AppCoreBase::EventBase {
+ public:
+ TimeZoneChangedEvent(ISystemEvent* ev)
+ : tizen_cpp::AppCoreBase::EventBase(
+ tizen_cpp::AppCoreBase::IEvent::Type::TIME_ZONE_CHANGED), ev_(ev) {
+ }
+
+ void OnEvent(const std::string& val) override {
+ size_t split_pos = val.find('|');
+ std::string time_zone = val.substr(0, split_pos);
+ std::string time_zone_id = val.substr(split_pos + 1);
+ ev_->OnTimeZoneChanged(time_zone, time_zone_id);
+ }
+
+ void OnEvent(int val) override {
+ }
+
+ private:
+ ISystemEvent* ev_;
+};
+
class SystemEvent {
public:
explicit SystemEvent(ISystemEvent* ev, tizen_cpp::AppCoreBase* app) {
app->AddEvent(std::make_shared<DeviceOrientationChangedEvent>(ev));
app->AddEvent(std::make_shared<RegionChangeEvent>(ev));
app->AddEvent(std::make_shared<SuspendedStateChangeEvent>(ev));
+ app->AddEvent(std::make_shared<TimeZoneChangedEvent>(ev));
}
};
component_suspended_state_e state,
void *user_data);
+/**
+ * @brief Called when the time zone of the frame component is changed.
+ * @details An application can obtain a changed time zone (e.g., "+9:00") and a time zone id (e.g., "Asia/Seoul").
+ * @since_tizen 8.0
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @remarks @a time_zone and @a time_zone_id must not be deallocated by the component. @a time_zone and @a time_zone_id can be used only in the callback.
+ *
+ * @param[in] context The context of the frame component instance
+ * @param[in] time_zone The time zone
+ * @param[in] time_zone_id The time zone id
+ * @param[in] user_data The user data passed from component_based_app_add_frame_component() function
+ */
+typedef void (*frame_component_time_zone_changed_cb)(
+ component_h context,
+ const char *time_zone,
+ const char *time_zone_id,
+ void *user_data);
+
/**
* @brief The structure type containing the set of callback functions for lifecycle of a frame component instance.
* @since_tizen 5.5
frame_component_low_battery_cb low_battery; /**< The callback function called when the battery status is changed. */
frame_component_low_memory_cb low_memory; /**< The callback function called when the memory status is changed */
frame_component_suspended_state_changed_cb suspended_state_changed; /**< The callback function called when the suspended state of the frame component is changed */
+ frame_component_time_zone_changed_cb time_zone_changed; /**< The callback function called when the time zone of the frame component is changed (Since 8.0) */
} frame_component_lifecycle_callback_s;
/**
component_suspended_state_e state,
void *user_data);
+/**
+ * @brief Called when the time zone of the service component is changed.
+ * @details An application can obtain a changed time zone (e.g., "+9:00") and a time zone id (e.g., "Asia/Seoul").
+ * @since_tizen 8.0
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @remarks @a time_zone and @a time_zone_id must not be deallocated by the component. @a time_zone and @a time_zone_id can be used only in the callback.
+ *
+ * @param[in] context The context of the service component instance
+ * @param[in] time_zone The time zone
+ * @param[in] time_zone_id The time zone id
+ * @param[in] user_data The user data passed from component_based_app_add_service_component() function
+ */
+typedef void (*service_component_time_zone_changed_cb)(
+ component_h context,
+ const char *time_zone,
+ const char *time_zone_id,
+ void *user_data);
+
/**
* @brief The structure type containing the set of callback functions for lifecycle of a service component instance.
* @since_tizen 5.5
service_component_low_battery_cb low_battery; /**< The callback function called when the battery status is changed. */
service_component_low_memory_cb low_memory; /**< The callback function called when the memory status is changed */
service_component_suspended_state_changed_cb suspended_state_changed; /**< The callback function called when the suspended state of the service component is changed */
+ service_component_time_zone_changed_cb time_zone_changed; /**< The callback function called when the time zone of the service component is changed (Since 8.0) */
} service_component_lifecycle_callback_s;
}
}
+ void OnTimeZoneChanged(const std::string& time_zone, const std::string& time_zone_id) override {
+ FrameComponent::OnTimeZoneChanged(time_zone, time_zone_id);
+ if (cb_.time_zone_changed) {
+ cb_.time_zone_changed(this,
+ time_zone.c_str(),
+ time_zone_id.c_str(),
+ user_data_);
+ }
+ }
+
private:
frame_component_lifecycle_callback_s cb_;
void* user_data_;
component_suspended_state_e state,
void *user_data);
+/**
+ * @brief Called when the time zone of the widget component is changed.
+ * @details An application can obtain a changed time zone (e.g., "+9:00") and a time zone id (e.g., "Asia/Seoul").
+ * @since_tizen 8.0
+ * @remarks The @a context should not be released. The @a context can be used only in the callback.
+ * @remarks @a time_zone and @a time_zone_id must not be deallocated by the component. @a time_zone and @a time_zone_id can be used only in the callback.
+ *
+ * @param[in] context The context of the frame component instance
+ * @param[in] time_zone The time zone
+ * @param[in] time_zone_id The time zone id
+ * @param[in] user_data The user data passed from component_based_app_add_widget_component() function
+ */
+typedef void (*widget_component_time_zone_changed_cb)(
+ component_h context,
+ const char *time_zone,
+ const char *time_zone_id,
+ void *user_data);
+
/**
* @brief The structure type containing the set of callback functions for lifecycle of a widget component instance.
* @since_tizen 6.5
widget_component_low_battery_cb low_battery;
widget_component_low_memory_cb low_memory;
widget_component_suspended_state_changed_cb suspended_state_changed;
+ widget_component_time_zone_changed_cb time_zone_changed;
} widget_component_lifecycle_callback_s;
/**
}
}
+ void OnTimeZoneChanged(const std::string& time_zone,
+ const std::string& time_zone_id) override {
+ if (cb_.time_zone_changed) {
+ cb_.time_zone_changed(this, time_zone.c_str(),
+ time_zone_id.c_str(), user_data_);
+ }
+ }
+
private:
widget_component_lifecycle_callback_s cb_;
void* user_data_;
component_suspended_state_e state,
void *user_data);
+typedef void (*base_widget_component_time_zone_changed_cb)(
+ component_h context,
+ const char *time_zone,
+ const char *time_zone_id,
+ void *user_data);
+
typedef struct {
base_widget_component_create_cb create;
base_widget_component_start_cb start;
base_widget_component_low_battery_cb low_battery;
base_widget_component_low_memory_cb low_memory;
base_widget_component_suspended_state_changed_cb suspended_state_changed;
+ base_widget_component_time_zone_changed_cb time_zone_changed;
} base_widget_component_lifecycle_callback_s;
#ifdef __cplusplus
}
}
+ void OnTimeZoneChanged(const std::string& time_zone,
+ const std::string& time_zone_id) override {
+ WidgetComponent::OnTimeZoneChanged(time_zone, time_zone_id);
+ if (cb_.time_zone_changed) {
+ cb_.time_zone_changed(this,
+ time_zone.c_str(),
+ time_zone_id.c_str(),
+ user_data_);
+ }
+ }
+
private:
base_widget_component_lifecycle_callback_s cb_;
void* user_data_;
com->OnLowBattery(LowBattery::Status::CriticalLow);
com->OnLowMemory(LowMemory::Status::SoftWarning);
com->OnSuspendedStateChanged(SuspendedState::State::Will_Enter);
+ com->OnTimeZoneChanged("+9:00", "Asia/Seoul");
}
ACTION_P(RegisterAction, id) {
com->OnLowBattery(LowBattery::Status::CriticalLow);
com->OnLowMemory(LowMemory::Status::SoftWarning);
com->OnSuspendedStateChanged(SuspendedState::State::Will_Enter);
+ com->OnTimeZoneChanged("+9:00", "Asia/Seoul");
}
} // namespace
base_component_suspended_state_changed_cb, context, state, user_data);
}
+void __base_component_time_zone_changed_cb(component_h context,
+ const char* time_zone, const char* time_zone_id, void* user_data) {
+ MOCK_HOOK_P4(BaseComponentCallbackMock,
+ base_component_time_zone_changed_cb,
+ context, time_zone, time_zone_id, user_data);
+}
+
} // namespace
base_component_lifecycle_callback_s BaseComponentCallbackMock::GetCallbacks() {
__base_component_low_memory_cb;
callback.suspended_state_changed =
__base_component_suspended_state_changed_cb;
+ callback.time_zone_changed =
+ __base_component_time_zone_changed_cb;
return callback;
}
void (component_h, component_low_memory_status_e, void*));
MOCK_METHOD3(base_component_suspended_state_changed_cb,
void (component_h, component_suspended_state_e, void*));
+ MOCK_METHOD4(base_component_time_zone_changed_cb,
+ void (component_h, const char*, const char*, void*));
};
#endif // MOCK_BASE_COMPONENT_CALLBACK_MOCK_H_
user_data);
}
+void __base_frame_component_time_zone_changed_cb(component_h context,
+ const char* time_zone, const char* time_zone_id, void* user_data) {
+ MOCK_HOOK_P4(BaseFrameComponentCallbackMock,
+ base_frame_component_time_zone_changed_cb,
+ context, time_zone, time_zone_id, user_data);
+}
+
} // namespace
base_frame_component_lifecycle_callback_s
__base_frame_component_low_memory_cb;
callback.suspended_state_changed =
__base_frame_component_suspended_state_changed_cb;
+ callback.time_zone_changed =
+ __base_frame_component_time_zone_changed_cb;
return callback;
}
void (component_h, component_low_memory_status_e, void*));
MOCK_METHOD3(base_frame_component_suspended_state_changed_cb,
void (component_h, component_suspended_state_e, void*));
+ MOCK_METHOD4(base_frame_component_time_zone_changed_cb,
+ void (component_h, const char*, const char*, void*));
};
#endif // MOCK_BASE_FRAME_COMPONENT_CALLBACK_MOCK_H_
base_service_component_suspended_state_changed_cb, context, state, user_data);
}
+void __base_service_component_time_zone_changed_cb(component_h context,
+ const char* time_zone, const char* time_zone_id, void* user_data) {
+ MOCK_HOOK_P4(BaseServiceComponentCallbackMock,
+ base_service_component_time_zone_changed_cb,
+ context, time_zone, time_zone_id, user_data);
+}
+
} // namespace
base_service_component_lifecycle_callback_s
__base_service_component_low_memory_cb;
callback.suspended_state_changed =
__base_service_component_suspended_state_changed_cb;
+ callback.time_zone_changed =
+ __base_service_component_time_zone_changed_cb;
return callback;
}
void (component_h, component_low_memory_status_e, void*));
MOCK_METHOD3(base_service_component_suspended_state_changed_cb,
void (component_h, component_suspended_state_e, void*));
+ MOCK_METHOD4(base_service_component_time_zone_changed_cb,
+ void (component_h, const char*, const char*, void*));
};
#endif // MOCK_BASE_SERVICE_COMPONENT_CALLBACK_MOCK_H_
context, state, user_data);
}
+void __frame_component_time_zone_changed_cb(component_h context,
+ const char* time_zone, const char* time_zone_id, void* user_data) {
+ MOCK_HOOK_P4(FrameComponentCallbackMock, frame_component_time_zone_changed_cb,
+ context, time_zone, time_zone_id, user_data);
+}
+
} // namespace
frame_component_lifecycle_callback_s FrameComponentCallbackMock::GetCallbacks() {
__frame_component_low_memory_cb;
callback.suspended_state_changed =
__frame_component_suspended_state_changed_cb;
+ callback.time_zone_changed =
+ __frame_component_time_zone_changed_cb;
return callback;
}
void (component_h, component_low_memory_status_e, void*));
MOCK_METHOD3(frame_component_suspended_state_changed_cb,
void (component_h, component_suspended_state_e, void*));
+ MOCK_METHOD4(frame_component_time_zone_changed_cb,
+ void (component_h, const char*, const char*, void*));
};
#endif // MOCK_FRAME_COMPONENT_CALLBACK_MOCK_H_
context, state, user_data);
}
+void __service_component_time_zone_changed_cb(component_h context,
+ const char* time_zone, const char* time_zone_id, void* user_data) {
+ MOCK_HOOK_P4(ServiceComponentCallbackMock, service_component_time_zone_changed_cb,
+ context, time_zone, time_zone_id, user_data);
+}
+
} // namespace
service_component_lifecycle_callback_s ServiceComponentCallbackMock::GetCallbacks() {
__service_component_low_memory_cb;
callback.suspended_state_changed =
__service_component_suspended_state_changed_cb;
+ callback.time_zone_changed =
+ __service_component_time_zone_changed_cb;
return callback;
}
void (component_h, component_low_memory_status_e, void*));
MOCK_METHOD3(service_component_suspended_state_changed_cb,
void (component_h, component_suspended_state_e, void*));
+ MOCK_METHOD4(service_component_time_zone_changed_cb,
+ void (component_h, const char*, const char*, void*));
};
#endif // MOCK_SERVICE_COMPONENT_CALLBACK_MOCK_H_