2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <app_event.h>
24 #define EVENT_NAME "event.org.tizen.sticker-receiver.user_event"
26 bool send_message(const char *cmd, const char *data)
32 bundle *b = bundle_create();
33 bundle_add_str(b, "command", cmd);
35 bundle_add_str(b, "data", data);
37 message_port_check_remote_port(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, &found);
39 ret = message_port_send_message(REMOTE_APP_ID, MESSAGE_PORT_REMOTE_NAME, b);
40 if (ret != MESSAGE_PORT_ERROR_NONE)
42 LOGW("message port send message error. err : %d", ret);
47 LOGI("Succeed to send message.");
53 LOGW("Can't find remote port");
57 ret = event_publish_app_event(EVENT_NAME, b);
58 if (ret != EVENT_ERROR_NONE) {
60 LOGE("Failed to send message by event publish. error : %d", ret);