Revert "s_modem: Make "AT+CGMR" response parsing be compatible with the modem only...
[platform/core/telephony/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 #ifndef __S_COMMON_H__
22 #define __S_COMMON_H__
23
24 #include <tcore.h>
25 #include <glib.h>
26 #include <user_request.h>
27
28 #define EVENT_SYS_NOTI_MODEM_POWER          "system_power"
29 #define EVENT_NOTI_MODEM_POWER              "modem_power"
30 #define EVENT_NOTI_MODEM_PHONE_STATE        "modem_phone_state"
31 #define EVENT_NOTI_MODEM_PIN_CTRL           "ps_pin_control"
32
33 #define EVENT_NOTI_CALL_STATUS              "call_status"
34 #define EVENT_NOTI_CALL_INCOMING            "call_incoming"
35 #define EVENT_NOTI_CALL_WAITING             "call_waiting"
36 #define EVENT_NOTI_CALL_SOUND_WBAMR_REPORT  "call_sound_wbamr_report"
37 #define EVENT_NOTI_CALL_SOUND_TWO_MIC       "call_sound_two_mic"
38 #define EVENT_NOTI_CALL_SOUND_DHA           "call_sound_dha"
39
40 #define EVENT_NOTI_SS_INFO                  "ss_info"
41 #define EVENT_NOTI_SS_USSD                  "ss_ussd"
42
43 #define EVENT_NOTI_PS_CALL_STATUS           "ps_call_status"
44 #define EVENT_NOTI_PS_DATA_COUNTER          "ps_data_counter"
45 #define EVENT_NOTI_PS_IPCONFIGURATION       "ps_ipconfiguration"
46 #define EVENT_NOTI_PS_HSDPA_STATUS          "ps_hsdpa_status"
47 #define EVENT_NOTI_PS_ATTACH_DETACH         "ps_attach_detach"
48 #define EVENT_NOTI_PS_EXTERNAL_CALL         "ps_external_call"
49
50 #define EVENT_NOTI_SAP_STATUS               "sap_status"
51 #define EVENT_NOTI_SAP_DISCONNECT           "sap_disconnect"
52
53 #define EVENT_NOTI_SIM_PIN_STATUS           "sim_pin_status"
54
55 #define EVENT_NOTI_SAT_ENVELOPE_RESP        "sat_envelope_response"
56 #define EVENT_NOTI_SAT_REFRESH_STATUS       "sat_refresh_status"
57 #define EVENT_NOTI_SAT_PROACTIVE_COMMAND    "sat_proactive_command"
58 #define EVENT_NOTI_SAT_CONTROL_RESULT       "sat_control_result"
59
60 #define EVENT_NOTI_NETWORK_REGISTRATION     "network_regist"
61 #define EVENT_NOTI_NETWORK_ICON_INFO        "network_icon_info"
62 #define EVENT_NOTI_NETWORK_TIME_INFO        "network_time_info"
63 #define EVENT_NOTI_NETWORK_IDENTITY         "network_identity"
64
65 #define EVENT_NOTI_SMS_INCOM_MSG            "sms_incom_msg"
66 #define EVENT_NOTI_SMS_SEND_ACK             "sms_send_ack"
67 #define EVENT_NOTI_SMS_MEMORY_STATUS        "sms_memory_status"
68 #define EVENT_NOTI_SMS_CB_INCOM_MSG         "sms_cb_incom_msg"
69 #define EVENT_NOTI_SMS_DELETE_MSG_CNF       "sms_delete_msg_cnf"
70 #define EVENT_NOTI_SMS_WRITE_MSG_CNF        "sms_write_msg_cnf"
71 #define EVENT_NOTI_SMS_DELIVERY_RPT_CNF     "sms_deliver_rpt_cnf"
72 #define EVENT_NOTI_SMS_DEVICE_READY         "sms_device_ready"
73
74 #define EVENT_NOTI_PHONEBOOK_STATUS         "phonebook_status"
75 #define EVENT_NOTI_PHONEBOOK_FIRST_INDEX    "phonebook_first_index"
76
77 #define EVENT_NOTI_GPS_ASSIST_DATA          "gps_assist_data"
78 #define EVENT_IND_GPS_MEASURE_POSITION      "gps_measure_position"
79 #define EVENT_NOTI_RESET_ASSIST_DATA        "gps_reset_assist_data"
80
81 enum direction_e {
82         RX,
83         TX
84 };
85
86 struct global_data {
87         unsigned int msg_auto_id_current;
88         unsigned int msg_auto_id_start;
89         unsigned int msg_auto_id_end;
90
91         TcoreHal *hal;
92 };
93
94 struct work_queue_data {
95         unsigned int id;
96         UserRequest *ur;
97 };
98
99 #define UTIL_ID(hdr)        ((hdr).main_cmd << 8 | (hdr).sub_cmd)
100 #define UTIL_IDP(hdr)       ((hdr)->main_cmd << 8 | (hdr)->sub_cmd)
101
102 void hook_hex_dump(enum direction_e d, int size, const void *data);
103 unsigned int util_assign_message_sequence_id(TcorePlugin *p);
104 gboolean util_add_waiting_job(GQueue *queue, unsigned int id, UserRequest *ur);
105 UserRequest* util_pop_waiting_job(GQueue *queue, unsigned int id);
106 void util_hex_dump(char *pad, int size, const void *data);
107 unsigned char util_hexCharToInt(char c);
108 char* util_hexStringToBytes(char *s);
109 char* util_removeQuotes(void *data);
110
111 #endif