return convert_to_tizen_error((messageport_error_e)ret);
}
+int message_port_add_registered_cb(const char *remote_app_id, const char *remote_port, bool is_trusted, message_port_registration_event_cb registered_cb, void *user_data, int *watcher_id)
+{
+ int ret = MESSAGE_PORT_ERROR_NONE;
+
+ if (watcher_id == NULL || remote_app_id == NULL || remote_port == NULL ||
+ registered_cb == NULL) {
+ _LOGE("[MESSAGE_PORT_ERROR_INVALID_PARAMETER] NULL value is not allowed.");
+ return MESSAGE_PORT_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = messageport_add_registered_cb(remote_app_id, remote_port, is_trusted, registered_cb, user_data, watcher_id);
+ if (ret != MESSAGE_PORT_ERROR_NONE) {
+ _SECURE_LOGI("add registered callback fail (%d).", ret);
+ return convert_to_tizen_error((messageport_error_e)ret);
+ }
+
+ return MESSAGE_PORT_ERROR_NONE;
+}
+
+int message_port_add_unregistered_cb(const char *remote_app_id, const char *remote_port, bool is_trusted, message_port_registration_event_cb unregistered_cb, void *user_data, int *watcher_id)
+{
+ int ret = MESSAGE_PORT_ERROR_NONE;
+
+ if (watcher_id == NULL || remote_app_id == NULL || remote_port == NULL ||
+ unregistered_cb == NULL) {
+ _LOGE("[MESSAGE_PORT_ERROR_INVALID_PARAMETER] NULL value is not allowed.");
+ return MESSAGE_PORT_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = messageport_add_unregistered_cb(remote_app_id, remote_port, is_trusted, unregistered_cb, user_data, watcher_id);
+ if (ret != MESSAGE_PORT_ERROR_NONE) {
+ _SECURE_LOGI("add registered callback fail (%d).", ret);
+ return convert_to_tizen_error((messageport_error_e)ret);
+ }
+
+ return MESSAGE_PORT_ERROR_NONE;
+}
+
+int message_port_remove_registration_event_cb(int watcher_id)
+{
+ int ret = MESSAGE_PORT_ERROR_NONE;
+ if (watcher_id < 1) {
+ _LOGE("[MESSAGE_PORT_ERROR_INVALID_PARAMETER] Invalid watcher_id.");
+ return MESSAGE_PORT_ERROR_INVALID_PARAMETER;
+ }
+
+ ret = messageport_remove_registration_event_cb(watcher_id);
+ return convert_to_tizen_error((messageport_error_e)ret);
+}