Released under the terms of the GNU GPL, see file COPYING for more details.
$Log$
- Revision 1.1.1.1 2001/11/25 21:59:09 short
- :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
- Revision 1.5 2001/11/19 13:03:18 pkot
- nk3110.c cleanup
+ Revision 1.1.1.2 2002/04/03 00:08:07 short
+ Found in "gnokii-working" directory, some November-patches version
Revision 1.4 2001/09/09 21:45:49 machek
Cleanups from Ladislav Michl <ladis@psi.cz>:
/* FIXME - win32 stuff! */
-/* FIXME - when sending an AT command while another one is still in */
-/* progress, the old command is aborted and the new ignored. */
-/* the result is _one_ error message from the phone. */
-
/* Some globals */
-/* FIXME - if we use more than one phone these should be part of */
-/* a statemachine. */
-
+static GSM_Link *glink;
static GSM_Statemachine *statemachine;
static int binlength = 0;
static char reply_buf[1024];
static int reply_buf_pos = 0;
+
static int xwrite(unsigned char *d, int len)
{
int res;
if (reply_buf_pos >= binlength) {
if (((reply_buf_pos > 3) && (!strncmp(reply_buf+reply_buf_pos-4, "OK\r\n", 4)))
|| ((reply_buf_pos > 6) && (!strncmp(reply_buf+reply_buf_pos-7, "ERROR\r\n", 7)))) {
- SM_IncomingFunction(statemachine, statemachine->LastMsgType, reply_buf, reply_buf_pos);
+ SM_IncomingFunction(statemachine, 1, reply_buf, reply_buf_pos);
reply_buf_pos = 0;
binlength = 0;
return;
}
-bool ATBUS_OpenSerial(int hw_handshake, char *device)
+bool ATBUS_OpenSerial(int hw_handshake)
{
int result;
- result = device_open(device, false, false, hw_handshake, GCT_Serial);
+ result = device_open(glink->PortDevice, false, false, hw_handshake, GCT_Serial);
if (!result) {
perror(_("Couldn't open ATBUS device"));
return (false);
setvbuf(stderr, NULL, _IONBF, 0);
/* 'Copy in' the global structures */
+ glink = &(state->Link);
statemachine = state;
/* Fill in the link functions */
- state->Link.Loop = &ATBUS_Loop;
- state->Link.SendMessage = &AT_SendMessage;
+ glink->Loop = &ATBUS_Loop;
+ glink->SendMessage = &AT_SendMessage;
- if (state->Link.ConnectionType == GCT_Serial) {
- if (!ATBUS_OpenSerial(hw_handshake, state->Link.PortDevice))
+ if (glink->ConnectionType == GCT_Serial) {
+ if (!ATBUS_OpenSerial(hw_handshake))
return GE_DEVICEOPENFAILED;
} else {
fprintf(stderr, "Device not supported by ATBUS");