Tizen 2.1 base
[platform/core/system/sync-agent.git] / src / framework / event / spec.h
1 /*
2  * sync-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
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
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #ifndef SPEC_H_
19 #define SPEC_H_
20
21 #define EVENT_MAX_EVENT_COUNT 100
22 #define EVENT_MAX_NOTI_COUNT 100
23
24 /**
25  * @file spec.h
26  * @brief       Definition of Event / Noti spec codes for event module
27  */
28
29 /** @addtogroup event
30  *      @{
31  */
32
33 /**
34  * @brief Enumerations for event type
35  */
36 typedef enum {
37         EVENT_TYPE_UNKNOWN = -1, /**< unknown */
38         EVENT_TYPE_NO_RESPONSE = 0, /**< just send event, no response - will be removed */
39         EVENT_TYPE_NEED_RESPONSE, /**< send event & wait for response for sent event - synchronous processing */
40 } event_type_e;
41
42 /**
43  * @brief Enumerations for notification type
44  */
45 typedef enum {
46         NOTI_TYPE_UNKNOWN = -1, /**< unknown */
47         NOTI_TYPE_SIMPLE = 0, /**< just send noti, no response */
48 } noti_type_e;
49
50 /**
51  * @brief Structure for event spec in event config file
52  */
53 typedef struct {
54         int event_num; /**< event number */
55         event_type_e event_type; /**< event type */
56         int relational_noti_num; /**< noti number associated with event number */
57         int pendingtime; /**< pending time for response */
58         sync_agent_event_cb callback; /**< event callback function */
59 } event_spec_s;
60
61 /**
62  * @brief Structure for noti spec in noti config file
63  */
64 typedef struct {
65         int noti_num; /**< noti number */
66         noti_type_e noti_type; /**< noti type */
67         int relational_event_num; /**< event number associated with noti number */
68         int pendingtime; /**< pending time for response */
69         void *additional_param; /**< additional data used in sync_agent_noti_cb */
70         sync_agent_noti_cb callback; /**< noti callback function */
71 } noti_spec_s;
72
73 /**
74  * @brief Structure to manage noti spec
75  */
76 typedef struct {
77         char *noti_key; /**< destination, described in framework initialization config file /<Noti> tag */
78         char *communication_path_noti; /**< noti path */
79         char *communication_path_reply_noti; /**< noti reply path - will be removed */
80         int noti_count; /**< total number of noti */
81         noti_spec_s *noti_spec_list[EVENT_MAX_NOTI_COUNT]; /**< list of noti spec */
82 } noti_spec_bag_s;
83
84 /**
85  *      @}
86  */
87
88 #endif                          /* SPEC_H_ */