3
* BlueZ - Bluetooth protocol stack for Linux
5
* Copyright (C) 2006-2007 Nokia Corporation
6
* Copyright (C) 2004-2008 Marcel Holtmann <marcel@holtmann.org>
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
/* HFP feature bits */
30
#define AG_FEATURE_THREE_WAY_CALLING 0x0001
31
#define AG_FEATURE_EC_ANDOR_NR 0x0002
32
#define AG_FEATURE_VOICE_RECOGNITION 0x0004
33
#define AG_FEATURE_INBAND_RINGTONE 0x0008
34
#define AG_FEATURE_ATTACH_NUMBER_TO_VOICETAG 0x0010
35
#define AG_FEATURE_REJECT_A_CALL 0x0020
36
#define AG_FEATURE_ENHANCED_CALL_STATUS 0x0040
37
#define AG_FEATURE_ENHANCED_CALL_CONTROL 0x0080
38
#define AG_FEATURE_EXTENDED_ERROR_RESULT_CODES 0x0100
40
#define HF_FEATURE_EC_ANDOR_NR 0x0001
41
#define HF_FEATURE_CALL_WAITING_AND_3WAY 0x0002
42
#define HF_FEATURE_CLI_PRESENTATION 0x0004
43
#define HF_FEATURE_VOICE_RECOGNITION 0x0008
44
#define HF_FEATURE_REMOTE_VOLUME_CONTROL 0x0010
45
#define HF_FEATURE_ENHANCED_CALL_STATUS 0x0020
46
#define HF_FEATURE_ENHANCED_CALL_CONTROL 0x0040
48
/* Indicator event values */
49
#define EV_SERVICE_NONE 0
50
#define EV_SERVICE_PRESENT 1
52
#define EV_CALL_INACTIVE 0
53
#define EV_CALL_ACTIVE 1
55
#define EV_CALLSETUP_INACTIVE 0
56
#define EV_CALLSETUP_INCOMING 1
57
#define EV_CALLSETUP_OUTGOING 2
58
#define EV_CALLSETUP_ALERTING 3
60
#define EV_CALLHELD_NONE 0
61
#define EV_CALLHELD_MULTIPLE 1
62
#define EV_CALLHELD_ON_HOLD 2
64
#define EV_ROAM_INACTIVE 0
65
#define EV_ROAM_ACTIVE 1
68
#define CALL_DIR_OUTGOING 0
69
#define CALL_DIR_INCOMING 1
71
#define CALL_STATUS_ACTIVE 0
72
#define CALL_STATUS_HELD 1
73
#define CALL_STATUS_DIALING 2
74
#define CALL_STATUS_ALERTING 3
75
#define CALL_STATUS_INCOMING 4
76
#define CALL_STATUS_WAITING 5
78
#define CALL_MODE_VOICE 0
79
#define CALL_MODE_DATA 1
80
#define CALL_MODE_FAX 2
82
#define CALL_MULTIPARTY_NO 0
83
#define CALL_MULTIPARTY_YES 1
85
/* Subscriber number parameters */
86
#define SUBSCRIBER_SERVICE_VOICE 4
87
#define SUBSCRIBER_SERVICE_FAX 5
89
/* Extended Audio Gateway Error Result Codes */
92
CME_ERROR_AG_FAILURE = 0,
93
CME_ERROR_NO_PHONE_CONNECTION = 1,
94
CME_ERROR_NOT_ALLOWED = 3,
95
CME_ERROR_NOT_SUPPORTED = 4,
96
CME_ERROR_PH_SIM_PIN_REQUIRED = 5,
97
CME_ERROR_SIM_NOT_INSERTED = 10,
98
CME_ERROR_SIM_PIN_REQUIRED = 11,
99
CME_ERROR_SIM_PUK_REQUIRED = 12,
100
CME_ERROR_SIM_FAILURE = 13,
101
CME_ERROR_SIM_BUSY = 14,
102
CME_ERROR_INCORRECT_PASSWORD = 16,
103
CME_ERROR_SIM_PIN2_REQUIRED = 17,
104
CME_ERROR_SIM_PUK2_REQUIRED = 18,
105
CME_ERROR_MEMORY_FULL = 20,
106
CME_ERROR_INVALID_INDEX = 21,
107
CME_ERROR_MEMORY_FAILURE = 23,
108
CME_ERROR_TEXT_STRING_TOO_LONG = 24,
109
CME_ERROR_INVALID_TEXT_STRING = 25,
110
CME_ERROR_DIAL_STRING_TOO_LONG = 26,
111
CME_ERROR_INVALID_DIAL_STRING = 27,
112
CME_ERROR_NO_NETWORK_SERVICE = 30,
113
CME_ERROR_NETWORK_NOT_ALLOWED = 32,
122
/* Notify telephony-*.c of connected/disconnected devices. Implemented by
125
void telephony_device_connected(void *telephony_device);
126
void telephony_device_disconnected(void *telephony_device);
128
/* HF requests (sent by the handsfree device). These are implemented by
131
void telephony_event_reporting_req(void *telephony_device, int ind);
132
void telephony_response_and_hold_req(void *telephony_device, int rh);
133
void telephony_last_dialed_number_req(void *telephony_device);
134
void telephony_terminate_call_req(void *telephony_device);
135
void telephony_answer_call_req(void *telephony_device);
136
void telephony_dial_number_req(void *telephony_device, const char *number);
137
void telephony_transmit_dtmf_req(void *telephony_device, char tone);
138
void telephony_subscriber_number_req(void *telephony_device);
139
void telephony_list_current_calls_req(void *telephony_device);
141
/* AG responses to HF requests. These are implemented by headset.c */
142
int telephony_event_reporting_rsp(void *telephony_device, cme_error_t err);
143
int telephony_response_and_hold_rsp(void *telephony_device, cme_error_t err);
144
int telephony_last_dialed_number_rsp(void *telephony_device, cme_error_t err);
145
int telephony_terminate_call_rsp(void *telephony_device, cme_error_t err);
146
int telephony_answer_call_rsp(void *telephony_device, cme_error_t err);
147
int telephony_dial_number_rsp(void *telephony_device, cme_error_t err);
148
int telephony_transmit_dtmf_rsp(void *telephony_device, cme_error_t err);
149
int telephony_subscriber_number_rsp(void *telephony_device, cme_error_t err);
150
int telephony_list_current_calls_rsp(void *telephony_device, cme_error_t err);
152
/* Event indications by AG. These are implemented by headset.c */
153
int telephony_event_ind(int index);
154
int telephony_response_and_hold_ind(int rh);
155
int telephony_incoming_call_ind(const char *number, int type);
156
int telephony_calling_stopped_ind(void);
157
int telephony_ready_ind(uint32_t features, const struct indicator *indicators,
159
int telephony_list_current_call_ind(int idx, int dir, int status, int mode,
160
int mprty, const char *number,
162
int telephony_subscriber_number_ind(const char *number, int type,
164
int telephony_call_waiting_ind(const char *number, int type);
166
/* Helper function for quick indicator updates */
167
static inline int telephony_update_indicator(struct indicator *indicators,
172
struct indicator *ind = NULL;
174
for (i = 0; indicators[i].desc != NULL; i++) {
175
if (g_str_equal(indicators[i].desc, desc)) {
176
ind = &indicators[i];
186
return telephony_event_ind(i);
189
static inline int telephony_get_indicator(const struct indicator *indicators,
194
for (i = 0; indicators[i].desc != NULL; i++) {
195
if (g_str_equal(indicators[i].desc, desc))
196
return indicators[i].val;
202
int telephony_init(void);
203
void telephony_exit(void);