60a5ad95eb761563195b65982a1b6dba9f83841e
[framework/telephony/libtcore.git] / include / co_ss.h
1 /*
2  * libtcore
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@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 __TCORE_CO_SS_H__
22 #define __TCORE_CO_SS_H__
23
24 #include <core_object.h>
25
26 __BEGIN_DECLS
27
28 #define MAX_TCORE_SS_NUMBER_LEN 83
29
30 enum tcore_ss_class {
31         TCORE_SS_CLATCORE_SS_NONE = 0x00,              /* 0x00 */
32
33         /* TELESERVICE */
34         TCORE_SS_CLATCORE_SS_ALL_TELE = 0x10,          /* 0x10 : All Teleservices */
35         TCORE_SS_CLATCORE_SS_VOICE = 0x11,             /* 0x11 : All Voice (telephony) */
36         TCORE_SS_CLATCORE_SS_ALL_DATA_TELE = 0x12,     /* 0x12 : All Data Teleservices */
37         TCORE_SS_CLATCORE_SS_FAX = 0x13,               /* 0x13 : All Fax Service */
38         TCORE_SS_CLATCORE_SS_SMS = 0x16,               /* 0x16 : SMS service */
39         TCORE_SS_CLATCORE_SS_VGCS = 0x17,              /* 0x17 : Voice Group Call Service */
40         TCORE_SS_CLATCORE_SS_VBS = 0x18,               /* 0x18 : Voice Broadcast */
41         TCORE_SS_CLATCORE_SS_ALL_TELE_EXPT_SMS = 0x19, /* 0x19 : All teleservice except SMS */
42
43         /* BEARER SERVICE */
44         TCORE_SS_CLATCORE_SS_ALL_BEARER = 0x20,        /* 0X20 : all bearer services */
45         TCORE_SS_CLATCORE_SS_ALL_ASYNC = 0x21,         /* 0x21 : All Async services */
46         TCORE_SS_CLATCORE_SS_ALL_SYNC = 0x22,          /* 0x22 : All sync services */
47         TCORE_SS_CLATCORE_SS_ALL_CS_SYNC = 0x24,       /* 0x24 : All Circuit switched sync */
48         TCORE_SS_CLATCORE_SS_ALL_CS_ASYNC = 0x25,      /* 0x25 : All Circuit switched async */
49         TCORE_SS_CLATCORE_SS_ALL_DEDI_PS = 0x26,       /* 0x26 : All Dedicated packet Access */
50         TCORE_SS_CLATCORE_SS_ALL_DEDI_PAD = 0x27,      /* 0x27 : All Dedicated PAD Access */
51         TCORE_SS_CLATCORE_SS_ALL_DATA_CDA = 0x28,      /* 0x28 : All Data CDA */
52
53         /* PLMN SPECIFIC TELESERVICE */
54         TCORE_SS_CLATCORE_SS_PLMN_TELE_ALL = 0x50,     /* 0x50 : PLMN specific teleservices */
55         TCORE_SS_CLATCORE_SS_PLMN_TELE_1 = 0x51,       /* 0x51 : PLMN specific teleservice 1 */
56         TCORE_SS_CLATCORE_SS_PLMN_TELE_2 = 0x52,       /* 0x52 : PLMN specific teleservice 2 */
57         TCORE_SS_CLATCORE_SS_PLMN_TELE_3 = 0x53,       /* 0x53 : PLMN specific teleservice 3 */
58         TCORE_SS_CLATCORE_SS_PLMN_TELE_4 = 0x54,       /* 0x54 : PLMN specific teleservice 4 */
59         TCORE_SS_CLATCORE_SS_PLMN_TELE_5 = 0x55,       /* 0x55 : PLMN specific teleservice 5 */
60         TCORE_SS_CLATCORE_SS_PLMN_TELE_6 = 0x56,       /* 0x56 : PLMN specific teleservice 6 */
61         TCORE_SS_CLATCORE_SS_PLMN_TELE_7 = 0x57,       /* 0x57 : PLMN specific teleservice 7 */
62         TCORE_SS_CLATCORE_SS_PLMN_TELE_8 = 0x58,       /* 0x58 : PLMN specific teleservice 8 */
63         TCORE_SS_CLATCORE_SS_PLMN_TELE_9 = 0x59,       /* 0x59 : PLMN specific teleservice 9 */
64         TCORE_SS_CLATCORE_SS_PLMN_TELE_A = 0x60,       /* 0x60 : PLMN specific teleservice 10 */
65         TCORE_SS_CLATCORE_SS_PLMN_TELE_B = 0x61,       /* 0x61 : PLMN specific teleservice 11 */
66         TCORE_SS_CLATCORE_SS_PLMN_TELE_C = 0x62,       /* 0x62 : PLMN specific teleservice 12 */
67         TCORE_SS_CLATCORE_SS_PLMN_TELE_D = 0x63,       /* 0x63 : PLMN specific teleservice 13 */
68         TCORE_SS_CLATCORE_SS_PLMN_TELE_E = 0x64,       /* 0x64 : PLMN specific teleservice 14 */
69         TCORE_SS_CLATCORE_SS_PLMN_TELE_F = 0x65,       /* 0x65 : PLMN specific teleservice 15 */
70
71         /* PLMN SPECIFIC BEARER SERVICE */
72         TCORE_SS_CLATCORE_SS_PLMN_BEAR_ALL = 0x70,     /* 0x70 : All PLMN specific bearer services */
73         TCORE_SS_CLATCORE_SS_PLMN_BEAR_1 = 0x71,       /* 0x71 : PLMN specific bearer service 1 */
74         TCORE_SS_CLATCORE_SS_PLMN_BEAR_2 = 0x72,       /* 0x72 : PLMN specific bearer service 2 */
75         TCORE_SS_CLATCORE_SS_PLMN_BEAR_3 = 0x73,       /* 0x73 : PLMN specific bearer service 3 */
76         TCORE_SS_CLATCORE_SS_PLMN_BEAR_4 = 0x74,       /* 0x74 : PLMN specific bearer service 4 */
77         TCORE_SS_CLATCORE_SS_PLMN_BEAR_5 = 0x75,       /* 0x75 : PLMN specific bearer service 5 */
78         TCORE_SS_CLATCORE_SS_PLMN_BEAR_6 = 0x76,       /* 0x76 : PLMN specific bearer service 6 */
79         TCORE_SS_CLATCORE_SS_PLMN_BEAR_7 = 0x77,       /* 0x77 : PLMN specific bearer service 7 */
80         TCORE_SS_CLATCORE_SS_PLMN_BEAR_8 = 0x78,       /* 0x78 : PLMN specific bearer service 8 */
81         TCORE_SS_CLATCORE_SS_PLMN_BEAR_9 = 0x79,       /* 0x79 : PLMN specific bearer service 9 */
82         TCORE_SS_CLATCORE_SS_PLMN_BEAR_A = 0x80,       /* 0x80 : PLMN specific bearer service 10 */
83         TCORE_SS_CLATCORE_SS_PLMN_BEAR_B = 0x81,       /* 0x81 : PLMN specific bearer service 11 */
84         TCORE_SS_CLATCORE_SS_PLMN_BEAR_C = 0x82,       /* 0x82 : PLMN specific bearer service 12 */
85         TCORE_SS_CLATCORE_SS_PLMN_BEAR_D = 0x83,       /* 0x83 : PLMN specific bearer service 13 */
86         TCORE_SS_CLATCORE_SS_PLMN_BEAR_E = 0x84,       /* 0x84 : PLMN specific bearer service 14 */
87         TCORE_SS_CLATCORE_SS_PLMN_BEAR_F = 0x85,       /* 0x85 : PLMN specific bearer service 15 */
88
89         /* CPHS - AUXILIARY SERVICE */
90         TCORE_SS_CLATCORE_SS_AUX_VOICE = 0x89,         /* 0x89 : All Auxiliary Voice (Auxiliary telephony) */
91
92         TCORE_SS_CLATCORE_SS_ALL_GPRS_BEARER = 0x99,   /* 0x99 : All GPRS bearer services */
93         TCORE_SS_CLATCORE_SS_ALL_TELE_BEARER = 0xFF,   /* 0xFF : all tele and bearer services */
94 };
95
96 enum tcore_ss_status {
97         TCORE_SS_STATUS_REG = 0x01, /* 0x01 : Registration */
98         TCORE_SS_STATUS_DEREG,      /* 0x02 : De-registration( erase ) */
99         TCORE_SS_STATUS_ACTIVATE,   /* 0x03 : Activation */
100         TCORE_SS_STATUS_DEACTIVATE, /* 0x04 : De-activation */
101         TCORE_SS_STATUS_MAX
102 };
103
104 enum tcore_ss_barring_mode {
105         TCORE_SS_BARR_MODE_NONE,
106         TCORE_SS_BARR_MODE_BAOC,        /* 0x01 : Barring All Outgoing Calls */
107         TCORE_SS_BARR_MODE_BOIC,        /* 0x02 : Barring Outgoing International Calls */
108         TCORE_SS_BARR_MODE_BOIC_NOT_HC, /* 0x03 : Barring Outgoing International Calls  except to Home Country */
109         TCORE_SS_BARR_MODE_BAIC,        /* 0x04 : Barring All Incoming Calls */
110         TCORE_SS_BARR_MODE_BIC_ROAM,    /* 0x05 : Barring Incoming Calls when roam,     outside of the Home Country */
111         TCORE_SS_BARR_MODE_AB,          /* 0x06 : All Barring Services */
112         TCORE_SS_BARR_MODE_AOB,         /* 0x07 : All Outgoing Barring Services */
113         TCORE_SS_BARR_MODE_AIB,         /* 0x08 : All Incoming Barring Services */
114         TCORE_SS_BARR_MODE_BIC_NOT_SIM, /* 0x09 : Barring Incoming Calls which is not stored in the SIM memory */
115         TCORE_SS_BARR_MODE_MAX
116 };
117
118 enum tcore_ss_forwarding_mode {
119         TCORE_SS_CF_MODE_CFU = 0x01, /* 0x01 : Call Forwarding Unconditional */
120         TCORE_SS_CF_MODE_CFB,        /* 0x02 : Call Forwarding Mobile Busy */
121         TCORE_SS_CF_MODE_CFNRy,      /* 0x03 : Call Forwarding No Reply */
122         TCORE_SS_CF_MODE_CFNRc,      /* 0x04 : Call Forwarding Not Reachable */
123         TCORE_SS_CF_MODE_CF_ALL,     /* 0x05 : All Call Forwarding */
124         TCORE_SS_CF_MODE_CFC,        /* 0x06 : All Conditional Call Forwarding */
125         TCORE_SS_CF_MODE_MAX         /* 0x07 : Max */
126 };
127
128 enum tcore_ss_ussd_type {
129         TCORE_SS_USSD_TYPE_USER_INITIATED = 0x01, /* User Initiated USSD Message */
130         TCORE_SS_USSD_TYPE_USER_RES,              /* User Response to Network Initiated Message */
131         TCORE_SS_USSD_TYPE_USER_RELEASE,          /* SS Termination by user */
132         TCORE_SS_USSD_TYPE_NETWORK_INITIATED,     /* Network Initiated USSD Message */
133         TCORE_SS_USSD_TYPE_MAX,
134 };
135
136 enum tcore_ss_ussd_status {
137         TCORE_SS_USSD_NO_ACTION_REQUIRE = 0x01, /* 0x01 : no further user action required  information needed after mobile initiated operation) */
138         TCORE_SS_USSD_ACTION_REQUIRE,           /* 0x02 : further user action required(network initiated USSD Request, or further information needed after mobile initiated operation) */
139         TCORE_SS_USSD_TERMINATED_BY_NET,        /* 0x03 : USSD terminated by network */
140         TCORE_SS_USSD_OTHER_CLIENT,             /* 0x04 : other local client has responded */
141         TCORE_SS_USSD_NOT_SUPPORT,              /* 0x05 : operation not supported */
142         TCORE_SS_USSD_TIME_OUT,                 /* 0x06 : network time out */
143         TCORE_SS_USSD_MAX
144 };
145
146 enum tcore_ss_aoc_type {
147         TCORE_SS_AOC_TYPE_RESET  = 0x00, /* AoC Reset Message */
148         TCORE_SS_AOC_TYPE_ACM    = 0x01, /* Accumulated call meter Message */
149         TCORE_SS_AOC_TYPE_CCM    = 0x02, /* Current call meter Message */
150         TCORE_SS_AOC_TYPE_MAXACM = 0x04, /* Max Accumulated call meter Message */
151         TCORE_SS_AOC_TYPE_PUC    = 0x08, /* Price per unit and currency Message */
152         TCORE_SS_AOC_TYPE_MAX    = 0x10
153 };
154
155 typedef struct ussd_session UssdSession;
156
157 struct tcore_ss_operations {
158         TReturn (*barring_activate)(CoreObject *o, UserRequest *ur);
159         TReturn (*barring_deactivate)(CoreObject *o, UserRequest *ur);
160         TReturn (*barring_change_password)(CoreObject *o, UserRequest *ur);
161         TReturn (*barring_get_status)(CoreObject *o, UserRequest *ur);
162         TReturn (*forwarding_activate)(CoreObject *o, UserRequest *ur);
163         TReturn (*forwarding_deactivate)(CoreObject *o, UserRequest *ur);
164         TReturn (*forwarding_register)(CoreObject *o, UserRequest *ur);
165         TReturn (*forwarding_deregister)(CoreObject *o, UserRequest *ur);
166         TReturn (*forwarding_get_status)(CoreObject *o, UserRequest *ur);
167         TReturn (*waiting_activate)(CoreObject *o, UserRequest *ur);
168         TReturn (*waiting_deactivate)(CoreObject *o, UserRequest *ur);
169         TReturn (*waiting_get_status)(CoreObject *o, UserRequest *ur);
170         TReturn (*cli_activate)(CoreObject *o, UserRequest *ur);
171         TReturn (*cli_deactivate)(CoreObject *o, UserRequest *ur);
172         TReturn (*cli_get_status)(CoreObject *o, UserRequest *ur);
173         TReturn (*send_ussd)(CoreObject *o, UserRequest *ur);
174         TReturn (*set_aoc)(CoreObject *o, UserRequest *ur);
175         TReturn (*get_aoc)(CoreObject *o, UserRequest *ur);
176 };
177
178
179 CoreObject* tcore_ss_new(TcorePlugin *p, const char *name, struct tcore_ss_operations *ops, TcoreHal *hal);
180 void        tcore_ss_free(CoreObject *o);
181
182 struct ussd_session*    tcore_ss_ussd_create_session( CoreObject *o, enum tcore_ss_ussd_type type, void *data, int data_len );
183 void                                    tcore_ss_ussd_destroy_session( struct ussd_session *ussd_s );
184 struct ussd_session*    tcore_ss_ussd_get_session( CoreObject *o );
185 enum tcore_ss_ussd_type tcore_ss_ussd_get_session_type( struct ussd_session* ussd_s );
186 void                                    tcore_ss_ussd_set_session_type( struct ussd_session* ussd_s, enum tcore_ss_ussd_type type );
187 int                                             tcore_ss_ussd_get_session_data( struct ussd_session* ussd_s, void** data );
188
189 __END_DECLS
190
191 #endif