Tizen 2.0 beta Release
[profile/ivi/tel-plugin-imc.git] / include / s_common.h
1 /*
2  * tel-plugin-imc
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hayoon Ko <hayoon.ko@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20
21
22 #ifndef __S_COMMON_H__
23 #define __S_COMMON_H__
24
25 #include <tcore.h>
26 #include <glib.h>
27 #include <user_request.h>
28
29
30 #define EVENT_SYS_NOTI_MODEM_POWER          "system_power"
31 #define EVENT_NOTI_MODEM_POWER          "modem_power"
32 #define EVENT_NOTI_MODEM_PHONE_STATE    "modem_phone_state"
33 #define EVENT_NOTI_MODEM_PIN_CTRL          "ps_pin_control"
34
35 #define EVENT_NOTI_CALL_STATUS                  "call_status"
36 #define EVENT_NOTI_CALL_INCOMING                "call_incoming"
37 #define EVENT_NOTI_CALL_WAITING                 "call_waiting"
38 #define EVENT_NOTI_CALL_SOUND_WBAMR_REPORT "call_sound_wbamr_report"
39 #define EVENT_NOTI_CALL_SOUND_TWO_MIC   "call_sound_two_mic"
40 #define EVENT_NOTI_CALL_SOUND_DHA               "call_sound_dha"
41
42 #define EVENT_NOTI_SS_INFO                              "ss_info"
43 #define EVENT_NOTI_SS_USSD                              "ss_ussd"
44
45 #define EVENT_NOTI_PS_CALL_STATUS       "ps_call_status"
46 #define EVENT_NOTI_PS_DATA_COUNTER      "ps_data_counter"
47 #define EVENT_NOTI_PS_IPCONFIGURATION   "ps_ipconfiguration"
48 #define EVENT_NOTI_PS_HSDPA_STATUS      "ps_hsdpa_status"
49 #define EVENT_NOTI_PS_ATTACH_DETACH     "ps_attach_detach"
50 #define EVENT_NOTI_PS_EXTERNAL_CALL     "ps_external_call"
51
52 #define EVENT_NOTI_SAP_STATUS           "sap_status"
53 #define EVENT_NOTI_SAP_DISCONNECT       "sap_disconnect"
54
55 #define EVENT_NOTI_SIM_PIN_STATUS       "sim_pin_status"
56
57 #define EVENT_NOTI_SAT_ENVELOPE_RESP       "sat_envelope_response"
58 #define EVENT_NOTI_SAT_REFRESH_STATUS       "sat_refresh_status"
59 #define EVENT_NOTI_SAT_PROACTIVE_COMMAND       "sat_proactive_command"
60 #define EVENT_NOTI_SAT_CONTROL_RESULT       "sat_control_result"
61
62 #define EVENT_NOTI_NETWORK_REGISTRATION "network_regist"
63 #define EVENT_NOTI_NETWORK_ICON_INFO    "network_icon_info"
64 #define EVENT_NOTI_NETWORK_TIME_INFO    "network_time_info"
65 #define EVENT_NOTI_NETWORK_IDENTITY     "network_identity"
66
67 #define EVENT_NOTI_SMS_INCOM_MSG        "sms_incom_msg"
68 #define EVENT_NOTI_SMS_SEND_ACK         "sms_send_ack"
69 #define EVENT_NOTI_SMS_MEMORY_STATUS    "sms_memory_status"
70 #define EVENT_NOTI_SMS_CB_INCOM_MSG     "sms_cb_incom_msg"
71 #define EVENT_NOTI_SMS_DELETE_MSG_CNF   "sms_delete_msg_cnf"
72 #define EVENT_NOTI_SMS_WRITE_MSG_CNF    "sms_write_msg_cnf"
73 #define EVENT_NOTI_SMS_DELIVERY_RPT_CNF "sms_deliver_rpt_cnf"
74 #define EVENT_NOTI_SMS_DEVICE_READY     "sms_device_ready"
75
76 #define EVENT_NOTI_PHONEBOOK_STATUS       "phonebook_status"
77 #define EVENT_NOTI_PHONEBOOK_FIRST_INDEX        "phonebook_first_index"
78
79 #define EVENT_NOTI_GPS_ASSIST_DATA       "gps_assist_data"
80 #define EVENT_IND_GPS_MEASURE_POSITION   "gps_measure_position"
81 #define EVENT_NOTI_RESET_ASSIST_DATA     "gps_reset_assist_data"
82
83 enum direction_e {
84         RX,
85         TX
86 };
87
88 struct global_data {
89         unsigned int msg_auto_id_current;
90         unsigned int msg_auto_id_start;
91         unsigned int msg_auto_id_end;
92         
93         TcoreHal *hal;
94 };
95
96 struct work_queue_data {
97         unsigned int id;
98         UserRequest *ur;
99 };
100
101 #define UTIL_ID(hdr)            ((hdr).main_cmd << 8 | (hdr).sub_cmd)
102 #define UTIL_IDP(hdr)           ((hdr)->main_cmd << 8 | (hdr)->sub_cmd)
103
104 void                    hook_hex_dump(enum direction_e d, int size, const void *data);
105 unsigned int    util_assign_message_sequence_id(TcorePlugin *p);
106 gboolean                util_add_waiting_job(GQueue *queue, unsigned int id, UserRequest *ur);
107 UserRequest*    util_pop_waiting_job(GQueue *queue, unsigned int id);
108 void                    util_hex_dump(char *pad, int size, const void *data);
109 unsigned char   util_hexCharToInt(char c);
110 char*           util_hexStringToBytes(char * s);
111
112 #endif