1 /**
2  * \file gammu-error.h
3  * \author Michal Čihař
4  *
5  * Error codes definitions.
6  */
7 #ifndef __gammu_error_h
8 #define __gammu_error_h
9 
10 /**
11  * \defgroup Error Error handling
12  * Error handling and manipulation.
13  */
14 
15 #ifdef	__cplusplus
16 extern "C" {
17 #endif
18 
19 /**
20  * Error types.
21  * \ingroup Error
22  */
23 typedef enum {
24 	/**
25 	 * No error
26 	 */
27 	ERR_NONE = 1,
28 	/**
29 	 * Error during opening device
30 	 */
31 	ERR_DEVICEOPENERROR,
32 	/**
33 	 * Device locked
34 	 */
35 	ERR_DEVICELOCKED,
36 	/**
37 	 * Device does not exits
38 	 */
39 	ERR_DEVICENOTEXIST,
40 	/**
41 	 * Device is busy
42 	 */
43 	ERR_DEVICEBUSY,
44 	/**
45 	 * No permissions to open device
46 	 */
47 	ERR_DEVICENOPERMISSION,
48 	/**
49 	 * No driver installed for a device
50 	 */
51 	ERR_DEVICENODRIVER,
52 	/**
53 	 * Device doesn't seem to be working
54 	 */
55 	ERR_DEVICENOTWORK,
56 	/**
57 	 * Error during setting DTR/RTS in device
58 	 */
59 	ERR_DEVICEDTRRTSERROR,
60 
61 	/** 10 **/
62 	/**
63 	 * Error during changing speed in device
64 	 */
65 	ERR_DEVICECHANGESPEEDERROR,
66 	/**
67 	 * Error during writing device
68 	 */
69 	ERR_DEVICEWRITEERROR,
70 	/**
71 	 * Error during reading device
72 	 */
73 	ERR_DEVICEREADERROR,
74 	/**
75 	 * Can't set parity on device
76 	 */
77 	ERR_DEVICEPARITYERROR,
78 	/**
79 	 * Command timed out
80 	 */
81 	ERR_TIMEOUT,
82 	/**
83 	 * Frame handled, but not requested in this moment
84 	 */
85 	ERR_FRAMENOTREQUESTED,
86 	/**
87 	 * Response not handled by gammu
88 	 */
89 	ERR_UNKNOWNRESPONSE,
90 	/**
91 	 * Frame not handled by gammu
92 	 */
93 	ERR_UNKNOWNFRAME,
94 	/**
95 	 * Unknown connection type given by user
96 	 */
97 	ERR_UNKNOWNCONNECTIONTYPESTRING,
98 	/**
99 	 * Unknown model given by user
100 	 */
101 	ERR_UNKNOWNMODELSTRING,
102 
103 	/** 20 **/
104 	/**
105 	 * Some functions not compiled in your OS
106 	 */
107 	ERR_SOURCENOTAVAILABLE,
108 	/**
109 	 * Not supported by phone
110 	 */
111 	ERR_NOTSUPPORTED,
112 	/**
113 	 * Empty entry or transfer end.
114 	 */
115 	ERR_EMPTY,
116 	/**
117 	 * Not allowed
118 	 */
119 	ERR_SECURITYERROR,
120 	/**
121 	 * Too high or too low location...
122 	 */
123 	ERR_INVALIDLOCATION,
124 	/**
125 	 * Function not implemented
126 	 */
127 	ERR_NOTIMPLEMENTED,
128 	/**
129 	 * Memory is full
130 	 */
131 	ERR_FULL,
132 	/**
133 	 * Unknown response from phone
134 	 */
135 	ERR_UNKNOWN,
136 	/**
137 	 * Error during opening file
138 	 */
139 	ERR_CANTOPENFILE,
140 	/**
141 	 * More memory required
142 	 */
143 	ERR_MOREMEMORY,
144 
145 	/** 30 **/
146 	/**
147 	 * No permission
148 	 */
149 	ERR_PERMISSION,
150 	/**
151 	 * SMSC number is empty
152 	 */
153 	ERR_EMPTYSMSC,
154 	/**
155 	 * Inside phone menu - can't make something
156 	 */
157 	ERR_INSIDEPHONEMENU,
158 	/**
159 	 * Phone NOT connected - can't make something
160 	 */
161 	ERR_NOTCONNECTED,
162 	/**
163 	 * Work in progress
164 	 */
165 	ERR_WORKINPROGRESS,
166 	/**
167 	 * Phone is disabled and connected to charger
168 	 */
169 	ERR_PHONEOFF,
170 	/**
171 	 * File format not supported by Gammu
172 	 */
173 	ERR_FILENOTSUPPORTED,
174 	/**
175 	 * Found bug in implementation or phone
176 	 */
177 	ERR_BUG,
178 	/**
179 	 * Action was canceled by user
180 	 */
181 	ERR_CANCELED,
182 	/**
183 	 * Inside Gammu: phone module need to send another answer frame
184 	 */
185 	ERR_NEEDANOTHERANSWER,
186 
187 	/** 40 **/
188 	/**
189 	 * You need other connectin for this operation.
190 	 */
191 	ERR_OTHERCONNECTIONREQUIRED,
192 	/**
193 	 * Wrong CRC
194 	 */
195 	ERR_WRONGCRC,
196 	/**
197 	 * Invalid date/time
198 	 */
199 	ERR_INVALIDDATETIME,
200 	/**
201 	 * Phone memory error, maybe it is read only
202 	 */
203 	ERR_MEMORY,
204 	/**
205 	 * Invalid data given to phone
206 	 */
207 	ERR_INVALIDDATA,
208 	/**
209 	 * File with specified name already exist
210 	 */
211 	ERR_FILEALREADYEXIST,
212 	/**
213 	 * File with specified name doesn't exist
214 	 */
215 	ERR_FILENOTEXIST,
216 	/**
217 	 * You have to give folder (not file) name
218 	 */
219 	ERR_SHOULDBEFOLDER,
220 	/**
221 	 * You have to give file (not folder) name
222 	 */
223 	ERR_SHOULDBEFILE,
224 	/**
225 	 * Can not access SIM card
226 	 */
227 	ERR_NOSIM,
228 
229 	/** 50 **/
230 	/**
231 	 * Invalid gnapplet version
232 	 */
233 	ERR_GNAPPLETWRONG,
234 	/**
235 	 * Only part of folders listed
236 	 */
237 	ERR_FOLDERPART,
238 	/**
239 	 * Folder is not empty
240 	 */
241 	ERR_FOLDERNOTEMPTY,
242 	/**
243 	 * Data were converted
244 	 */
245 	ERR_DATACONVERTED,
246 	/**
247 	 * Gammu is not configured.
248 	 */
249 	ERR_UNCONFIGURED,
250 	/**
251 	 * Wrong folder selected (eg. for SMS).
252 	 */
253 	ERR_WRONGFOLDER,
254 	/**
255 	 * Internal phone error (phone got crazy).
256 	 */
257 	ERR_PHONE_INTERNAL,
258 	/**
259 	 * Could not write to a file (on local filesystem).
260 	 */
261 	ERR_WRITING_FILE,
262 	/**
263 	 * No such section exists.
264 	 */
265 	ERR_NONE_SECTION,
266 	/**
267 	 * Using default values.
268 	 */
269 	ERR_USING_DEFAULTS,
270 
271 	/** 60 **/
272 	/**
273 	 * Corrupted data returned by phone.
274 	 */
275 	ERR_CORRUPTED,
276 	/**
277 	 * Bad feature string.
278 	 */
279 	ERR_BADFEATURE,
280 	/**
281 	 * Some functions not compiled in your OS
282 	 */
283 	ERR_DISABLED,
284 	/**
285 	 * Bluetooth configuration requires channel option.
286 	 */
287 	ERR_SPECIFYCHANNEL,
288 	/**
289 	 * Service is not running.
290 	 */
291 	ERR_NOTRUNNING,
292 	/**
293 	 * Service setup is missing.
294 	 */
295 	ERR_NOSERVICE,
296 	/**
297 	 * Command failed. Try again.
298 	 */
299 	ERR_BUSY,
300 	/**
301 	 * Can not connect to server.
302 	 */
303 	ERR_COULDNT_CONNECT,
304 	/**
305 	 * Can not resolve host name.
306 	 */
307 	ERR_COULDNT_RESOLVE,
308 	/**
309 	 * Failed to get SMSC number from phone.
310 	 */
311 	ERR_GETTING_SMSC,
312 
313 	/** 70 **/
314 	/**
315 	 * Operation aborted.
316 	 */
317 	ERR_ABORTED,
318 	/**
319 	 * Installation data not found.
320 	 */
321 	ERR_INSTALL_NOT_FOUND,
322 	/**
323 	 * Entry is read only.
324 	 */
325 	ERR_READ_ONLY,
326 	/**
327 	 * Network error.
328 	 */
329 	ERR_NETWORK_ERROR,
330 	/**
331 	 * Invalid database version.
332 	 */
333 	ERR_DB_VERSION,
334 	/**
335 	 * Failed to initialize DB driver.
336 	 */
337 	ERR_DB_DRIVER,
338 	/**
339 	 * Failed to configure DB driver.
340 	 */
341 	ERR_DB_CONFIG,
342 	/**
343 	 * Failed to connect to database.
344 	 */
345 	ERR_DB_CONNECT,
346 	/**
347 	 * Database connection timeout.
348 	 */
349 	ERR_DB_TIMEOUT,
350 	/**
351 	 * Error in executing SQL query.
352 	 */
353 	ERR_SQL,
354 	/**
355 	 * The operation cannot be performed.
356 	 */
357 	ERR_INVALID_OPERATION,
358 	/**
359 	 * The type of memory is not available or has been disabled.
360 	 */
361 	ERR_MEMORY_NOT_AVAILABLE,
362 
363 	/**
364 	 * Just marker of highest error code, should not be used.
365 	 */
366 	ERR_LAST_VALUE
367 } GSM_Error;
368 
369 /**
370  * Returns text for error.
371  *
372  * \param e Error code.
373  * \return Text (in current locales) describing error
374  *
375  * \ingroup Error
376  */
377 const char *GSM_ErrorString(GSM_Error e);
378 
379 /**
380  * Returns name for error.
381  *
382  * \param e Error code.
383  * \return Text with error name
384  *
385  * \ingroup Error
386  */
387 const char *GSM_ErrorName(GSM_Error e);
388 #ifdef	__cplusplus
389 }
390 #endif
391 #endif
392 
393 /* Editor configuration
394  * vim: noexpandtab sw=8 ts=8 sts=8 tw=72:
395  */
396