http://marcin-wiacek.fkn.pl/english/zips/mygnokii.tar.gz
[gnokii.git] / include / data / at-emulator.h
1 /*
2
3   $Id$
4
5   G N O K I I
6
7   A Linux/Unix toolset and driver for Nokia mobile phones.
8
9   Released under the terms of the GNU GPL, see file COPYING for more details.
10         
11   Header file for AT emulator code.
12
13 */
14
15 #ifndef __data_at_emulator_h
16 #define __data_at_emulator_h
17
18         /* Prototypes */
19 bool    ATEM_Initialise(int read_fd, int write_fd, char *model, char *port);
20 void    ATEM_HandleIncomingData(char *buffer, int length);
21 void    ATEM_InitRegisters(void);
22 void    ATEM_StringOut(char *buffer);
23 void    ATEM_ParseAT(char *cmd_buffer);
24 void    ATEM_ParseSMS(char *cmd_buffer);
25 void    ATEM_ParseDIR(char *cmd_buffer);
26 bool    ATEM_CommandPlusC(char **buf);
27 bool    ATEM_CommandPlusG(char **buf);
28 int             ATEM_GetNum(char **p);
29 void    ATEM_ModemResult(int code);
30 void    ATEM_CallPassup(char c);
31
32         /* Global variables */
33 bool    ATEM_Initialised;
34
35         /* Definition of modem result codes - these are returned to "terminal"
36        numerically or as a string depending on the setting of S12 */
37
38         /* FIX ME - Numeric values for everything except OK and ERROR 
39            are guesses as I've not got an AT reference handy.   HAB */
40
41 #define         MR_OK                   (0)
42 #define         MR_ERROR                (4)
43 #define         MR_NOCARRIER    (5)
44 #define         MR_CARRIER              (2)
45 #define         MR_CONNECT              (3)
46 #define         MR_RING                 (6)
47
48         /* All defines and prototypes from here down are specific to 
49            the at-emulator code and so are #ifdef out if __at_emulator_c isn't 
50            defined. */
51 #ifdef  __data_at_emulator_c
52
53
54 #define MAX_CMD_BUFFERS (2)
55 #define CMD_BUFFER_LENGTH (100)
56
57         /* Definition of some special Registers of AT-Emulator, pinched in
58            part from ISDN driver in Linux kernel */
59 #define REG_RINGATA   0
60 #define REG_RINGCNT   1
61 #define REG_ESC       2
62 #define REG_CR        3
63 #define REG_LF        4
64 #define REG_BS        5
65 #define S35           6
66
67 #define REG_RESP     12
68 #define BIT_RESP      1
69 #define REG_RESPNUM  12
70 #define BIT_RESPNUM   2
71 #define REG_ECHO     12
72 #define BIT_ECHO      4
73 #define REG_DCD      12
74 #define BIT_DCD       8
75 #define REG_CTS      12
76 #define BIT_CTS      16
77 #define REG_DTRR     12
78 #define BIT_DTRR     32
79 #define REG_DSR      12
80 #define BIT_DSR      64
81 #define REG_CPPP     12
82 #define BIT_CPPP    128
83
84
85 #define MAX_MODEM_REGISTERS     20
86
87 /* Message format definitions */
88 #define PDU_MODE      0
89 #define TEXT_MODE     1
90 #define INTERACT_MODE 2
91
92 #endif  /* __data_at_emulator_c */
93
94 #endif  /* __data_at_emulator_h */
95
96
97