3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 #include "event/error.h"
22 #include "event/handler.h"
23 #include "event/ui_api.h"
24 #include "event/spec.h"
27 * @file Event_Config.h
28 * @brief Event/Notification Configuration Manager
35 #define EVENT_COMMUNICATION_PATH_EVENT "/tmp/agent_fw_event_"
36 #define EVENT_REPLY_COMMUNICATION_PATH_EVENT "/tmp/agent_fw_event_reply_"
37 #define EVENT_COMMUNICATION_PATH_NOTI "/tmp/agent_fw_noti_"
38 #define EVENT_REPLY_COMMUNICATION_PATH_NOTI "/tmp/agent_fw_noti_reply_"
40 #define EVENT_MAX_STREAM_SIZE 102400
43 * @brief Get real notification socket path file from noti_key (Agent -> UI)
44 * @param[in] noti_key notification key string
45 * @return Operation result
46 * @retval notification socket path success
49 const char *event_get_noti_path(const char *noti_key);
52 * @brief Get real event socket path file (UI -> Agent)
53 * @return Operation result
54 * @retval event socket path success
57 const char *event_get_event_path();
60 * @brief Load to memory event specification from event specification file
61 * @param[in] event_key event key string
62 * @param[in] config_file event specification file
63 * @return Operation result
64 * @retval SYNC_AGENT_EVENT_SUCCESS success
65 * @retval SYNC_AGENT_EVENT_FAIL error
67 sync_agent_event_error_e event_set_event_spec_from_config_file(const char *event_key, const char *config_file);
70 * @brief Free event specification from memory
71 * @return Operation result
72 * @retval SYNC_AGENT_EVENT_SUCCESS success
73 * @retval SYNC_AGENT_EVENT_FAIL error
75 sync_agent_event_error_e event_clean_event_spec();
78 * @brief Load to memory notification specification from notification specification file
79 * @param[in] noti_key notification key string
80 * @param[in] config_file notification specification file
81 * @return Operation result
82 * @retval SYNC_AGENT_EVENT_SUCCESS success
83 * @retval SYNC_AGENT_EVENT_FAIL error
85 sync_agent_event_error_e event_set_noti_spec_from_config_file(const char *noti_key, const char *config_file);
88 * @brief Free notification specification from memory
89 * @return Operation result
90 * @retval SYNC_AGENT_EVENT_SUCCESS success
91 * @retval other error code error
93 sync_agent_event_error_e event_clean_noti_spec();
96 * @brief Register Event Callback function, callback will be called when receive event
97 * @param[in] event_num event number wrote in event specification file
98 * @param[in] callback event callback function
99 * @return Operation result
100 * @retval SYNC_AGENT_EVENT_SUCCESS success
101 * @retval SYNC_AGENT_EVENT_FAIL error
103 sync_agent_event_error_e event_register_event_callback(int event_num, sync_agent_event_cb callback);
106 * @brief Register Notification Callback function, callback will be called when receive event
107 * @param[in] noti_num notification number wrote in notification specification file
108 * @param[in] callback notification callback function
109 * @param[in] data data used in callback function
110 * @return Operation result code
111 * @retval SYNC_AGENT_EVENT_SUCCESS success
112 * @retval SYNC_AGENT_EVENT_FAIL error
114 sync_agent_event_error_e event_register_noti_callback(int noti_num, sync_agent_noti_cb callback, void *data); /* only UI */
117 * @brief Get Event Callback function pointer
118 * @param[in] event_num event number wrote in event specification file
119 * @return Event Callback function pointer
120 * @retval function pointer success
123 sync_agent_event_cb event_get_event_callback(int event_num);
126 * @brief Get Notification Callback function pointer, this function is for only UI
127 * @param[in] noti_num notification number wrote in notification specification file
128 * @return Notification Callback function pointer
129 * @retval function pointer success
132 sync_agent_noti_cb event_get_noti_callback(int noti_num);
135 * @brief Get additional notification data, this function is for only UI
136 * @param[in] noti_num notification number wrote in notification specification file
137 * @return additional data
138 * @retval additional data success
139 * @retval NULL error or data not exist
141 void *event_get_noti_callback_additional_param(int noti_num);
144 * @brief Get event type
145 * @param[in] event_num event number wrote in notification specification file
147 * @retval event type success
150 event_type_e event_get_event_type(int event_num);
153 * @brief Get notification type
154 * @param[in] noti_key means destination UI
155 * @param[in] noti_num notification number wrote in notification specification file
156 * @return notification type
157 * @retval notification type success
160 noti_type_e event_get_noti_type(const char *noti_key, int noti_num);
166 #endif /* CONFIG_H_ */