*/
+#include "config.h"
+
#define __data_at_emulator_c
extern bool CommandMode;
extern int ConnectCount;
-char ModelName[80]; /* This seems to be needed to avoid seg-faults */
-char PortName[80];
+static char ModelName[80]; /* This seems to be needed to avoid seg-faults */
+static char PortName[80];
/* Local variables */
-int PtyRDFD; /* File descriptor for reading and writing to/from */
-int PtyWRFD; /* pty interface - only different in debug mode. */
+extern int PtyRDFD; /* File descriptor for reading and writing to/from */
+extern int PtyWRFD; /* pty interface - only different in debug mode. */
+
+static u8 ModemRegisters[MAX_MODEM_REGISTERS];
+static char CmdBuffer[MAX_CMD_BUFFERS][CMD_BUFFER_LENGTH];
+static int CurrentCmdBuffer;
+static int CurrentCmdBufferIndex;
+static bool VerboseResponse; /* Switch betweek numeric (4) and text responses (ERROR) */
+static char IncomingCallNo;
+static int MessageFormat; /* Message Format (text or pdu) */
-u8 ModemRegisters[MAX_MODEM_REGISTERS];
-char CmdBuffer[MAX_CMD_BUFFERS][CMD_BUFFER_LENGTH];
-int CurrentCmdBuffer;
-int CurrentCmdBufferIndex;
-bool VerboseResponse; /* Switch betweek numeric (4) and text responses (ERROR) */
-char IncomingCallNo;
-int MessageFormat; /* Message Format (text or pdu) */
+static void ATEM_ParseAT(char *cmd_buffer);
/* Current command parser */
-void (*Parser)(char *);
+static void (*Parser)(char *);
//void (*Parser)(char *) = ATEM_ParseAT; /* Current command parser */
-GSM_MemoryType SMSType;
-int SMSNumber;
+static GSM_MemoryType SMSType;
+static int SMSNumber;
+
+static void ATEM_InitRegisters(void);
/* If initialised in debug mode, stdin/out is used instead
of ptys for interface. */
}
/* Initialise the "registers" used by the virtual modem. */
-void ATEM_InitRegisters(void)
+static void ATEM_InitRegisters(void)
{
ModemRegisters[REG_RINGATA] = 0;
}
}
+static void ATEM_StringOut(char *buffer);
/* Handler called when characters received from serial port.
calls state machine code to process it. */
}
}
+static bool ATEM_CommandPlusC(char **buf);
+static bool ATEM_CommandPlusG(char **buf);
+static int ATEM_GetNum(char **p);
+static void ATEM_ParseSMS(char *cmd_buffer);
/* Parser for standard AT commands. cmd_buffer must be null terminated. */
-void ATEM_ParseAT(char *cmd_buffer)
+static void ATEM_ParseAT(char *cmd_buffer)
{
char *buf;
char number[30];
return;
}
+static void ATEM_ParseDIR(char *cmd_buffer);
+
/* Parser for SMS interactive mode */
-void ATEM_ParseSMS(char *buff)
+static void ATEM_ParseSMS(char *buff)
{
if (!strcasecmp(buff, "HELP")) {
ATEM_StringOut(_("\n\rThe following commands work...\n\r"));
}
/* Parser for DIR sub mode of SMS interactive mode. */
-void ATEM_ParseDIR(char *buff)
+static void ATEM_ParseDIR(char *buff)
{
switch (toupper(*buff)) {
case 'P':
/* Handle AT+C commands, this is a quick hack together at this
stage. */
-bool ATEM_CommandPlusC(char **buf)
+static bool ATEM_CommandPlusC(char **buf)
{
float rflevel;
GSM_RFUnits rfunits = GRF_CSQ;
switch (**buf) {
case '=':
buf[0]++;
- sscanf(*buf, "%d", &index);
+ index = atoi(*buf);
buf[0] += strlen(*buf);
error = ATEM_ReadSMS(index, SMSType, &message);
}
/* AT+G commands. Some of these responses are a bit tongue in cheek... */
-bool ATEM_CommandPlusG(char **buf)
+static bool ATEM_CommandPlusG(char **buf)
{
char buffer[MAX_LINE_LENGTH];
/* Get integer from char-pointer, set pointer to end of number
stolen basically verbatim from ISDN code. */
-int ATEM_GetNum(char **p)
+static int ATEM_GetNum(char **p)
{
int v = -1;
/* Write string to virtual modem port, either pty or
STDOUT as appropriate. This function is only used during
command mode - data pump is used when connected. */
-void ATEM_StringOut(char *buffer)
+static void ATEM_StringOut(char *buffer)
{
int count = 0;
char out_char;