summaryrefslogtreecommitdiff
path: root/src/libembim/embim-enums.h
blob: fc35d9226704fea200a12b06820703addf992d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * libembim -- Library to control MBIM devices
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA.
 *
 * Copyright (C) 2013 - 2015 Aleksander Morgado <aleksander@aleksander.es>
 */

#ifndef EMBIM_ENUMS_H
#define EMBIM_ENUMS_H

#if !defined (__LIBEMBIM_H_INSIDE__) && !defined (LIBEMBIM_COMPILATION)
#error "Only <embim.h> should be included directly."
#endif

/**
 * SECTION: embim-enums
 * @title: Enumerations and Flags
 * @short_description: Common enumeration and flag types.
 *
 * This section defines common enum and flag types used in the interface.
 */

/*****************************************************************************/

/**
 * embim_message_type_e:
 * @EMBIM_MESSAGE_TYPE_INVALID: Invalid MBIM message.
 * @EMBIM_MESSAGE_TYPE_OPEN: Initialization request.
 * @EMBIM_MESSAGE_TYPE_CLOSE: Close request.
 * @EMBIM_MESSAGE_TYPE_COMMAND: Command request.
 * @EMBIM_MESSAGE_TYPE_HOST_ERROR: Host-reported error in the communication.
 * @EMBIM_MESSAGE_TYPE_OPEN_DONE: Response to initialization request.
 * @EMBIM_MESSAGE_TYPE_CLOSE_DONE: Response to close request.
 * @EMBIM_MESSAGE_TYPE_COMMAND_DONE: Response to command request.
 * @EMBIM_MESSAGE_TYPE_FUNCTION_ERROR: Function-reported error in the communication.
 * @EMBIM_MESSAGE_TYPE_INDICATE_STATUS: Unsolicited message from the function.
 *
 * Type of MBIM messages.
 */
typedef enum {
    EMBIM_MESSAGE_TYPE_INVALID         = 0x00000000,
    /* From Host to Function */
    EMBIM_MESSAGE_TYPE_OPEN            = 0x00000001,
    EMBIM_MESSAGE_TYPE_CLOSE           = 0x00000002,
    EMBIM_MESSAGE_TYPE_COMMAND         = 0x00000003,
    EMBIM_MESSAGE_TYPE_HOST_ERROR      = 0x00000004,
    /* From Function to Host */
    EMBIM_MESSAGE_TYPE_OPEN_DONE       = 0x80000001,
    EMBIM_MESSAGE_TYPE_CLOSE_DONE      = 0x80000002,
    EMBIM_MESSAGE_TYPE_COMMAND_DONE    = 0x80000003,
    EMBIM_MESSAGE_TYPE_FUNCTION_ERROR  = 0x80000004,
    EMBIM_MESSAGE_TYPE_INDICATE_STATUS = 0x80000007,
} embim_message_type_e;

/**
 * embim_message_type_to_string:
 * @type: a #embim_message_type_e.
 *
 * Gets a string representation of the message type value.
 *
 * Returns: a constant string.
 */
const char *embim_message_type_to_string (embim_message_type_e type);

/**
 * embim_message_command_type_e:
 * @EMBIM_MESSAGE_COMMAND_TYPE_INVALID: Invalid type.
 * @EMBIM_MESSAGE_COMMAND_TYPE_QUERY: Query command.
 * @EMBIM_MESSAGE_COMMAND_TYPE_SET: Set command.
 *
 * Type of command message.
 */
typedef enum {
    EMBIM_MESSAGE_COMMAND_TYPE_INVALID = -1,
    EMBIM_MESSAGE_COMMAND_TYPE_QUERY   =  0,
    EMBIM_MESSAGE_COMMAND_TYPE_SET     =  1
} embim_message_command_type_e;

/**
 * embim_message_command_type_to_string:
 * @type: a #embim_message_command_type_e.
 *
 * Gets a string representation of the message command type value.
 *
 * Returns: a constant string.
 */
const char *embim_message_command_type_to_string (embim_message_command_type_e type);

/**
 * embim_status_e:
 * @EMBIM_STATUS_SUCCESS: Success in the operation.
 * @EMBIM_STATUS_ERROR_GENERIC: Generic error.
 * @EMBIM_STATUS_ERROR_INVALID: Invalid operation.
 * @EMBIM_STATUS_ERROR_NO_MEMORY: Memory allocation error.
 * @EMBIM_STATUS_ERROR_NO_SPACE: Insufficient space in the given buffer.
 * @EMBIM_STATUS_ERROR_NO_SPACE_FIXED: Insufficient space in the fixed buffer.
 * @EMBIM_STATUS_ERROR_NO_SPACE_VARIABLE: Insufficient space in the variable buffer.
 * @EMBIM_STATUS_ERROR_NO_SPACE_OFFSETS: Insufficient space in the offsets buffer.
 * @EMBIM_STATUS_ERROR_FRAGMENT_INVALID: Invalid fragment.
 * @EMBIM_STATUS_ERROR_FRAGMENT_OUT_OF_SEQUENCE: Fragment out of sequence.
 * @EMBIM_STATUS_ERROR_FRAGMENT_OUT_OF_TRANSACTION: Fragment doesn't belong to the expected transaction.
 * @EMBIM_STATUS_ERROR_ENCODING: Encoding error.
 * @EMBIM_STATUS_ERROR_NOT_FOUND: Item not found.
 * @EMBIM_STATUS_ERROR_EXISTS: Item already exists.
 * @EMBIM_STATUS_ERROR_WRONG_STATE: Operation not allowed in current state.
 * @EMBIM_STATUS_ERROR_UNAUTHORIZED: Operation not allowed.
 *
 * Status of the operation.
 */
typedef enum {
    EMBIM_STATUS_SUCCESS                           = 0,
    EMBIM_STATUS_ERROR_GENERIC                     = 1,
    EMBIM_STATUS_ERROR_INVALID                     = 2,
    EMBIM_STATUS_ERROR_NO_MEMORY                   = 3,
    EMBIM_STATUS_ERROR_NO_SPACE                    = 4,
    EMBIM_STATUS_ERROR_NO_SPACE_FIXED              = 5,
    EMBIM_STATUS_ERROR_NO_SPACE_VARIABLE           = 6,
    EMBIM_STATUS_ERROR_NO_SPACE_OFFSETS            = 7,
    EMBIM_STATUS_ERROR_FRAGMENT_INVALID            = 8,
    EMBIM_STATUS_ERROR_FRAGMENT_OUT_OF_SEQUENCE    = 9,
    EMBIM_STATUS_ERROR_FRAGMENT_OUT_OF_TRANSACTION = 10,
    EMBIM_STATUS_ERROR_ENCODING                    = 11,
    EMBIM_STATUS_ERROR_NOT_FOUND                   = 12,
    EMBIM_STATUS_ERROR_EXISTS                      = 13,
    EMBIM_STATUS_ERROR_WRONG_STATE                 = 14,
    EMBIM_STATUS_ERROR_UNAUTHORIZED                = 15,
} embim_status_e;

/**
 * embim_status_to_string:
 * @status: a #embim_status_e.
 *
 * Gets a string representation of the status value.
 *
 * Returns: a constant string.
 */
const char *embim_status_to_string (embim_status_e status);

/**
 * embim_status_error_e:
 * @EMBIM_STATUS_ERROR_NONE: Success, no error.
 * @EMBIM_STATUS_ERROR_BUSY: Busy.
 * @EMBIM_STATUS_ERROR_FAILURE: Failure.
 * @EMBIM_STATUS_ERROR_SIM_NOT_INSERTED: SIM not inserted.
 * @EMBIM_STATUS_ERROR_BAD_SIM: Bad SIM.
 * @EMBIM_STATUS_ERROR_PIN_REQUIRED: PIN required.
 * @EMBIM_STATUS_ERROR_PIN_DISABLED: PIN disabled.
 * @EMBIM_STATUS_ERROR_NOT_REGISTERED: Not registered.
 * @EMBIM_STATUS_ERROR_PROVIDERS_NOT_FOUND: Providers not found.
 * @EMBIM_STATUS_ERROR_NO_DEVICE_SUPPORT: No device support.
 * @EMBIM_STATUS_ERROR_PROVIDER_NOT_VISIBLE: Provider not visible.
 * @EMBIM_STATUS_ERROR_DATA_CLASS_NOT_AVAILABLE: Data class not available.
 * @EMBIM_STATUS_ERROR_PACKET_SERVICE_DETACHED: Packet service detached.
 * @EMBIM_STATUS_ERROR_MAX_ACTIVATED_CONTEXTS: Max activated contexts.
 * @EMBIM_STATUS_ERROR_NOT_INITIALIZED: Not initialized.
 * @EMBIM_STATUS_ERROR_VOICE_CALL_IN_PROGRESS: Voice call in progress.
 * @EMBIM_STATUS_ERROR_CONTEXT_NOT_ACTIVATED: Context not activated.
 * @EMBIM_STATUS_ERROR_SERVICE_NOT_ACTIVATED: Service not activated.
 * @EMBIM_STATUS_ERROR_INVALID_ACCESS_STRING: Invalid access string.
 * @EMBIM_STATUS_ERROR_INVALID_USER_NAME_PWD: Invalid user name or password.
 * @EMBIM_STATUS_ERROR_RADIO_POWER_OFF: Radio power off.
 * @EMBIM_STATUS_ERROR_INVALID_PARAMETERS: Invalid parameters.
 * @EMBIM_STATUS_ERROR_READ_FAILURE: Read failure.
 * @EMBIM_STATUS_ERROR_WRITE_FAILURE: Write failure.
 * @EMBIM_STATUS_ERROR_NO_PHONEBOOK: No phonebook.
 * @EMBIM_STATUS_ERROR_PARAMETER_TOO_LONG: Parameter too long.
 * @EMBIM_STATUS_ERROR_STK_BUSY: SIM toolkit busy.
 * @EMBIM_STATUS_ERROR_OPERATION_NOT_ALLOWED: Operation not allowed.
 * @EMBIM_STATUS_ERROR_MEMORY_FAILURE: Memory failure.
 * @EMBIM_STATUS_ERROR_INVALID_MEMORY_INDEX: Invalid memory index.
 * @EMBIM_STATUS_ERROR_MEMORY_FULL: Memory full.
 * @EMBIM_STATUS_ERROR_FILTER_NOT_SUPPORTED: Filter not supported.
 * @EMBIM_STATUS_ERROR_DSS_INSTANCE_LIMIT: DSS instance limit.
 * @EMBIM_STATUS_ERROR_INVALID_DEVICE_SERVICE_OPERATION: Invalid device service operation.
 * @EMBIM_STATUS_ERROR_AUTH_INCORRECT_AUTN: Incorrect AUTN when sending authentication.
 * @EMBIM_STATUS_ERROR_AUTH_SYNC_FAILURE: Synchronization failure during the authentication.
 * @EMBIM_STATUS_ERROR_AUTH_AMF_NOT_SET: AMF bit not set in the authentication.
 * @EMBIM_STATUS_ERROR_SMS_UNKNOWN_SMSC_ADDRESS: Unknown SMSC address.
 * @EMBIM_STATUS_ERROR_SMS_NETWORK_TIMEOUT: Network timeout when sending SMS.
 * @EMBIM_STATUS_ERROR_SMS_LANG_NOT_SUPPORTED: Language not supported in SMS.
 * @EMBIM_STATUS_ERROR_SMS_ENCODING_NOT_SUPPORTED: Encoding not supported in SMS.
 * @EMBIM_STATUS_ERROR_SMS_FORMAT_NOT_SUPPORTED: Format not supported in SMS.
 *
 * Status of the MBIM request.
 */
typedef enum {
    EMBIM_STATUS_ERROR_NONE                             = 0,
    EMBIM_STATUS_ERROR_BUSY                             = 1,
    EMBIM_STATUS_ERROR_FAILURE                          = 2,
    EMBIM_STATUS_ERROR_SIM_NOT_INSERTED                 = 3,
    EMBIM_STATUS_ERROR_BAD_SIM                          = 4,
    EMBIM_STATUS_ERROR_PIN_REQUIRED                     = 5,
    EMBIM_STATUS_ERROR_PIN_DISABLED                     = 6,
    EMBIM_STATUS_ERROR_NOT_REGISTERED                   = 7,
    EMBIM_STATUS_ERROR_PROVIDERS_NOT_FOUND              = 8,
    EMBIM_STATUS_ERROR_NO_DEVICE_SUPPORT                = 9,
    EMBIM_STATUS_ERROR_PROVIDER_NOT_VISIBLE             = 10,
    EMBIM_STATUS_ERROR_DATA_CLASS_NOT_AVAILABLE         = 11,
    EMBIM_STATUS_ERROR_PACKET_SERVICE_DETACHED          = 12,
    EMBIM_STATUS_ERROR_MAX_ACTIVATED_CONTEXTS           = 13,
    EMBIM_STATUS_ERROR_NOT_INITIALIZED                  = 14,
    EMBIM_STATUS_ERROR_VOICE_CALL_IN_PROGRESS           = 15,
    EMBIM_STATUS_ERROR_CONTEXT_NOT_ACTIVATED            = 16,
    EMBIM_STATUS_ERROR_SERVICE_NOT_ACTIVATED            = 17,
    EMBIM_STATUS_ERROR_INVALID_ACCESS_STRING            = 18,
    EMBIM_STATUS_ERROR_INVALID_USER_NAME_PWD            = 19,
    EMBIM_STATUS_ERROR_RADIO_POWER_OFF                  = 20,
    EMBIM_STATUS_ERROR_INVALID_PARAMETERS               = 21,
    EMBIM_STATUS_ERROR_READ_FAILURE                     = 22,
    EMBIM_STATUS_ERROR_WRITE_FAILURE                    = 23,
    /* 24 reserved */
    EMBIM_STATUS_ERROR_NO_PHONEBOOK                     = 25,
    EMBIM_STATUS_ERROR_PARAMETER_TOO_LONG               = 26,
    EMBIM_STATUS_ERROR_STK_BUSY                         = 27,
    EMBIM_STATUS_ERROR_OPERATION_NOT_ALLOWED            = 28,
    EMBIM_STATUS_ERROR_MEMORY_FAILURE                   = 29,
    EMBIM_STATUS_ERROR_INVALID_MEMORY_INDEX             = 30,
    EMBIM_STATUS_ERROR_MEMORY_FULL                      = 31,
    EMBIM_STATUS_ERROR_FILTER_NOT_SUPPORTED             = 32,
    EMBIM_STATUS_ERROR_DSS_INSTANCE_LIMIT               = 33,
    EMBIM_STATUS_ERROR_INVALID_DEVICE_SERVICE_OPERATION = 34,
    EMBIM_STATUS_ERROR_AUTH_INCORRECT_AUTN              = 35,
    EMBIM_STATUS_ERROR_AUTH_SYNC_FAILURE                = 36,
    EMBIM_STATUS_ERROR_AUTH_AMF_NOT_SET                 = 37,
    /* 38-99 undefined */
    EMBIM_STATUS_ERROR_SMS_UNKNOWN_SMSC_ADDRESS         = 100,
    EMBIM_STATUS_ERROR_SMS_NETWORK_TIMEOUT              = 101,
    EMBIM_STATUS_ERROR_SMS_LANG_NOT_SUPPORTED           = 102,
    EMBIM_STATUS_ERROR_SMS_ENCODING_NOT_SUPPORTED       = 103,
    EMBIM_STATUS_ERROR_SMS_FORMAT_NOT_SUPPORTED         = 104,
} embim_status_error_e;

/**
 * embim_status_error_to_string:
 * @status_error: a #embim_status_error_e.
 *
 * Gets a string representation of the status error value.
 *
 * Returns: a constant string.
 */
const char *embim_status_error_to_string (embim_status_error_e status_error);

/**
 * embim_protocol_error_e:
 * @EMBIM_PROTOCOL_ERROR_INVALID: Invalid MBIM error.
 * @EMBIM_PROTOCOL_ERROR_TIMEOUT_FRAGMENT: Timeout waiting for fragment.
 * @EMBIM_PROTOCOL_ERROR_FRAGMENT_OUT_OF_SEQUENCE: Fragment received out of sequence.
 * @EMBIM_PROTOCOL_ERROR_LENGTH_MISMATCH: Length mismatch.
 * @EMBIM_PROTOCOL_ERROR_DUPLICATED_TID: Duplicated transaction ID.
 * @EMBIM_PROTOCOL_ERROR_NOT_OPENED: Not opened.
 * @EMBIM_PROTOCOL_ERROR_UNKNOWN: Unknown error.
 * @EMBIM_PROTOCOL_ERROR_CANCEL: Cancel the operation.
 * @EMBIM_PROTOCOL_ERROR_MAX_TRANSFER: Maximum control transfer not supported.
 *
 * MBIM protocol errors.
 */
typedef enum {
    EMBIM_PROTOCOL_ERROR_INVALID                  = 0,
    EMBIM_PROTOCOL_ERROR_TIMEOUT_FRAGMENT         = 1,
    EMBIM_PROTOCOL_ERROR_FRAGMENT_OUT_OF_SEQUENCE = 2,
    EMBIM_PROTOCOL_ERROR_LENGTH_MISMATCH          = 3,
    EMBIM_PROTOCOL_ERROR_DUPLICATED_TID           = 4,
    EMBIM_PROTOCOL_ERROR_NOT_OPENED               = 5,
    EMBIM_PROTOCOL_ERROR_UNKNOWN                  = 6,
    EMBIM_PROTOCOL_ERROR_CANCEL                   = 7,
    EMBIM_PROTOCOL_ERROR_MAX_TRANSFER             = 8,
} embim_protocol_error_e;

/**
 * embim_protocol_error_to_string:
 * @protocol_error: a #embim_protocol_error_e.
 *
 * Gets a string representation of the protocol error value.
 *
 * Returns: a constant string.
 */
const char *embim_protocol_error_to_string (embim_protocol_error_e protocol_error);

#endif /* EMBIM_ENUMS_H */