*/
-#include "config.h"
-
#define __data_at_emulator_c
extern bool CommandMode;
extern int ConnectCount;
-static char ModelName[80]; /* This seems to be needed to avoid seg-faults */
-static char PortName[80];
+char ModelName[80]; /* This seems to be needed to avoid seg-faults */
+char PortName[80];
/* Local variables */
-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) */
+int PtyRDFD; /* File descriptor for reading and writing to/from */
+int PtyWRFD; /* pty interface - only different in debug mode. */
-static void ATEM_ParseAT(char *cmd_buffer);
+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) */
/* Current command parser */
-static void (*Parser)(char *);
+void (*Parser)(char *);
//void (*Parser)(char *) = ATEM_ParseAT; /* Current command parser */
-static GSM_MemoryType SMSType;
-static int SMSNumber;
-
-static void ATEM_InitRegisters(void);
+GSM_MemoryType SMSType;
+int SMSNumber;
/* If initialised in debug mode, stdin/out is used instead
of ptys for interface. */
}
/* Initialise the "registers" used by the virtual modem. */
-static void ATEM_InitRegisters(void)
+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. */
-static void ATEM_ParseAT(char *cmd_buffer)
+void ATEM_ParseAT(char *cmd_buffer)
{
char *buf;
char number[30];
return;
}
-static void ATEM_ParseDIR(char *cmd_buffer);
-
/* Parser for SMS interactive mode */
-static void ATEM_ParseSMS(char *buff)
+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. */
-static void ATEM_ParseDIR(char *buff)
+void ATEM_ParseDIR(char *buff)
{
switch (toupper(*buff)) {
case 'P':
/* Handle AT+C commands, this is a quick hack together at this
stage. */
-static bool ATEM_CommandPlusC(char **buf)
+bool ATEM_CommandPlusC(char **buf)
{
float rflevel;
GSM_RFUnits rfunits = GRF_CSQ;
switch (**buf) {
case '=':
buf[0]++;
- index = atoi(*buf);
+ sscanf(*buf, "%d", &index);
buf[0] += strlen(*buf);
error = ATEM_ReadSMS(index, SMSType, &message);
}
/* AT+G commands. Some of these responses are a bit tongue in cheek... */
-static bool ATEM_CommandPlusG(char **buf)
+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. */
-static int ATEM_GetNum(char **p)
+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. */
-static void ATEM_StringOut(char *buffer)
+void ATEM_StringOut(char *buffer)
{
int count = 0;
char out_char;