summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/gsmcomon.h
blob: e067955ee32d0293b8ac3a16319d3a0ef561d571 (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
/* (c) 2002-2004 by Marcin Wiacek & Michal Cihar */

#ifndef __gsm_comon_h
#define __gsm_comon_h

#include <stdio.h>
#ifndef WIN32
#  include <unistd.h>
#endif

#include "config.h"
#include "misc/misc.h"
#include "misc/cfg.h"

#define MAX_MANUFACTURER_LENGTH		50
#define MAX_MODEL_LENGTH		50
#define MAX_VERSION_LENGTH		50
#define MAX_VERSION_DATE_LENGTH		50
#define	MAX_IMEI_LENGTH			20
#define PHONE_MAXSMSINFOLDER		200
#define GSM_MAX_NUMBER_LENGTH		50
#define GSM_MAXCALENDARTODONOTES	300

/* GSM_Error is used to notify about errors */
typedef enum {
/* 1*/	ERR_NONE=1,
	ERR_DEVICEOPENERROR,		/* Error during opening device */
	ERR_DEVICELOCKED,		/* Device locked */
	ERR_DEVICENOTEXIST,
	ERR_DEVICEBUSY,
	ERR_DEVICENOPERMISSION,
	ERR_DEVICENODRIVER,
	ERR_DEVICENOTWORK,
	ERR_DEVICEDTRRTSERROR,		/* Error during setting DTR/RTS in device */
/*10*/	ERR_DEVICECHANGESPEEDERROR,	/* Error during changing speed in device */
	ERR_DEVICEWRITEERROR,		/* Error during writing device */
	ERR_DEVICEREADERROR,		/* Error during reading device */
	ERR_DEVICEPARITYERROR,		/* Can't set parity on device */
	ERR_TIMEOUT,			/* Command timed out */
	ERR_FRAMENOTREQUESTED,		/* Frame handled, but not requested in this moment */
	ERR_UNKNOWNRESPONSE,		/* Response not handled by gammu */
	ERR_UNKNOWNFRAME,		/* Frame not handled by gammu */
	ERR_UNKNOWNCONNECTIONTYPESTRING,/* Unknown connection type given by user */
	ERR_UNKNOWNMODELSTRING,		/* Unknown model given by user */
/*20*/	ERR_SOURCENOTAVAILABLE,		/* Some functions not compiled in your OS */
	ERR_NOTSUPPORTED,		/* Not supported by phone */
	ERR_EMPTY,			/* Empty phonebook entry, ... */
	ERR_SECURITYERROR,		/* Not allowed */
	ERR_INVALIDLOCATION,		/* Too high or too low location... */
	ERR_NOTIMPLEMENTED,		/* Function not implemented */
	ERR_FULL,			/* Memory is full */
	ERR_UNKNOWN,
	ERR_CANTOPENFILE, 		/* Error during opening file */
	ERR_MOREMEMORY,			/* More memory required */
/*30*/	ERR_PERMISSION,			/* No permission */
	ERR_EMPTYSMSC,			/* SMSC number is empty */
	ERR_INSIDEPHONEMENU,		/* Inside phone menu - can't make something */
	ERR_NOTCONNECTED,		/* Phone NOT connected - can't make something */
	ERR_WORKINPROGRESS,		/* Work in progress */
	ERR_PHONEOFF,			/* Phone is disabled and connected to charger */
	ERR_FILENOTSUPPORTED,		/* File format not supported by Gammu */
	ERR_BUG,                  	/* Found bug in implementation or phone */
    	ERR_CANCELED,                 	/* Action was canceled by user */
	ERR_NEEDANOTHERANSWER,   	/* Inside Gammu: phone module need to send another answer frame */
/*40*/	ERR_OTHERCONNECTIONREQUIRED,
	ERR_WRONGCRC,
	ERR_INVALIDDATETIME,		/* Invalid date/time */
	ERR_MEMORY,			/* Phone memory error, maybe it is read only */
	ERR_INVALIDDATA,		/* Invalid data */
	ERR_FILEALREADYEXIST		/* File with specified name already exist */
} GSM_Error;

extern GSM_Error NoneFunction		(void);
extern GSM_Error NotImplementedFunction	(void);
extern GSM_Error NotSupportedFunction	(void);

#define NONEFUNCTION 	(void *) NoneFunction
#define NOTIMPLEMENTED 	(void *) NotImplementedFunction
#define NOTSUPPORTED 	(void *) NotSupportedFunction

unsigned char *GetMsg 		(INI_Section *cfg, unsigned char *default_string);
unsigned char *print_error	(GSM_Error e, FILE *df, INI_Section *cfg);

GSM_Error GSM_SetDebugFile(char *info, Debug_Info *privdi);

const char *GetGammuLocalePath(void);
const char *GetGammuVersion(void);

#endif

/* How should editor hadle tabs in this file? Add editor commands here.
 * vim: noexpandtab sw=8 ts=8 sts=8:
 */