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:11 short
- :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
- Revision 1.16 2001/11/23 22:07:44 machek
- Fix SMS receiving to work, again. Unfortunately, it is not possible to
- reuse much of gsm-sms.c...
-
- Revision 1.15 2001/11/15 12:10:57 pkot
- Removed a warning from 2110 compilation
-
- Revision 1.14 2001/11/09 13:49:12 pkot
- Pavel! You haven't implemented slave_process() function!
-
- Revision 1.13 2001/11/09 13:17:11 pkot
- Update 2110 to a new libsms api
+ Revision 1.1.1.3 2002/04/03 00:08:09 short
+ Found in "gnokii-working" directory, some November-patches version
Revision 1.12 2001/10/21 22:23:56 machek
Use symbolic constants instead of numbers
#include "mbus-2110.h"
#include "phones/nokia.h"
#include "device.h"
-#include "gsm-sms.h"
#include <string.h>
#include <stdlib.h>
PacketOK = false;
pkt[1] = command;
pkt[2] = 1; /* == LM_SMS_MEM_TYPE_DEFAULT or LM_SMS_MEM_TYPE_SIM or LM_SMS_MEM_TYPE_ME */
- pkt[3] = message->Number;
+ pkt[3] = message->Location;
+ message->MessageNumber = message->Location;
SendCommand(pkt, LM_SMS_COMMAND, sizeof(pkt));
msleep_poll(300); /* We have to keep acknowledning phone's data */
eprintf("Something is very wrong with SMS\n");
return GE_BUSY; /* FIXME */
}
- if ((SMSData[2]) && (SMSData[2] != message->Number)) {
- eprintf("Wanted message @%d, got message at @%d!\n", message->Number, SMSData[2]);
+ if ((SMSData[2]) && (SMSData[2] != message->Location)) {
+ eprintf("Wanted message @%d, got message at @%d!\n", message->Location, SMSData[2]);
return GE_BUSY;
}
return (GE_NONE);
static GSM_Error
DecodeIncomingSMS(GSM_SMSMessage *m)
{
- GSM_Error error;
- int len, i;
-
- error = GE_NONE;
-/* Should be moved to gsm-sms.c */
-
+ int i, len;
ddprintf("Status: " );
switch (SMSData[3]) {
- case 7: m->Type = SMS_Submit; /* m->Status = GSS_NOTSENTREAD; */ ddprintf("not sent\n"); break;
- case 5: m->Type = SMS_Submit; /* m->Status = GSS_SENTREAD; */ ddprintf("sent\n"); break;
- case 3: m->Type = SMS_Deliver; /* m->Status = GSS_NOTSENTREAD; */ ddprintf("not read\n"); break;
- case 1: m->Type = SMS_Deliver; /* m->Status = GSS_SENTREAD; */ ddprintf("read\n"); break;
+ case 7: m->Type = GST_MO; m->Status = GSS_NOTSENTREAD; ddprintf("not sent\n"); break;
+ case 5: m->Type = GST_MO; m->Status = GSS_SENTREAD; ddprintf("sent\n"); break;
+ case 3: m->Type = GST_MT; m->Status = GSS_NOTSENTREAD; ddprintf("not read\n"); break;
+ case 1: m->Type = GST_MT; m->Status = GSS_SENTREAD; ddprintf("read\n"); break;
}
- UnpackDateTime(SMSData+7, &m->Time);
+ /* Date is at SMSData[7]; this code is copied from fbus-6110.c*/
+ {
+ int offset = -32 + 7;
+ m->Time.Year=10*(SMSData[32+offset]&0x0f)+(SMSData[32+offset]>>4);
+ m->Time.Month=10*(SMSData[33+offset]&0x0f)+(SMSData[33+offset]>>4);
+ m->Time.Day=10*(SMSData[34+offset]&0x0f)+(SMSData[34+offset]>>4);
+ m->Time.Hour=10*(SMSData[35+offset]&0x0f)+(SMSData[35+offset]>>4);
+ m->Time.Minute=10*(SMSData[36+offset]&0x0f)+(SMSData[36+offset]>>4);
+ m->Time.Second=10*(SMSData[37+offset]&0x0f)+(SMSData[37+offset]>>4);
+ m->Time.Timezone=(10*(SMSData[38+offset]&0x07)+(SMSData[38+offset]>>4))/4;
+ }
- m->Length = len = SMSData[14];
+ len = SMSData[14];
ddprintf("%d bytes: ", len );
for (i = 0; i<len; i++)
ddprintf("%c", SMSData[15+i]);
if (len>160)
eprintf("Magic not allowed\n");
- memset(m->MessageText, 0, 161);
+ memset(m->MessageText, 0, sizeof(m->MessageText));
strncpy(m->MessageText, (void *) &SMSData[15], len);
-
+ m->MessageTextLength = len; /* we currently do not support UDH & 8-bit so it is simple */
+ m->EightBit = false;
ddprintf("Text is %s\n", m->MessageText);
- /*
- Originator address is at 15+i,
- followed by message center addres (?)
- */
+ /* Originator address is at 15+i,
+ followed by message center addres (?) */
{
char *s = (char *) &SMSData[15+i]; /* We discard volatile. Make compiler quiet. */
- strcpy(m->RemoteNumber.number, s);
+ strcpy(m->Sender, s);
s+=strlen(s)+1;
strcpy(m->MessageCenter.Number, s);
ddprintf("Sender = %s, MessageCenter = %s\n", m->Sender, m->MessageCenter.Name);
m->MessageCenter.No = 0;
strcpy(m->MessageCenter.Name, "(unknown)");
- m->UDH_No = 0;
-
- return error;
+ m->UDHPresent = false;
+ return GE_NONE;
}
static GSM_Error
GetSMSMessage(GSM_SMSMessage *m)
{
- if (m->Number > 10)
+ if (m->Location > 10)
return GE_INVALIDSMSLOCATION;
if (SMS(m, LM_SMS_READ_STORED_DATA) != GE_NONE)
static GSM_Error
SendSMSMessage(GSM_SMSMessage *m)
{
- if (m->Number > 10)
+ if (m->Location > 10)
return GE_INVALIDSMSLOCATION;
if (SMSData[0] != 0x0b) {
return ((PacketData[4] & 0xf) != 0);
/* Make all but last fragment "secret" */
- default: dprintf("Unknown response %dx\n", PacketData[3]);
+ default: dprintf("Unknown response %x\n", (unsigned int)PacketData[3]);
return 0;
}
}
eprintf("Bad reply trying to reserve SMS-es\n");
if (SMSData[0] != LM_SMS_PP_RESERVE_COMPLETE)
eprintf("Not okay trying to reserve SMS-es (%d)\n", SMSData[0]);
- return GE_NONE;
+
}
static GSM_Error SMS_Slave(GSM_Statemachine *sm)
eprintf("New message indicated @%d\n", SMSData[2]);
msleep_poll(200);
memset(&m, 0, sizeof(m));
- m.Number = SMSData[2];
+ m.Location = SMSData[2];
m.MemoryType = GMT_ME;
if (GetSMSMessage(&m) != GE_NONE)
eprintf("Could not find promissed message?\n");
-#if 0
else
- slave_process(&m, SMSData[2]);
-#endif
+ /*slave_process(&m, SMSData[2])*/;
}
break;
default:
}
static GSM_Error
-GetSMSStatus(GSM_SMSMemoryStatus *Status)
+GetSMSStatus(GSM_SMSStatus *Status)
{
- Status->Unread = 0;
- Status->Number = 5;
+ Status->UnRead = 0;
+ Status->Used = 0;
+ Status->Slots = 5;
return GE_NONE;
}
NULL,
NULL,
NULL,
- NULL,
SendRLPFrame,
NULL,
EnableDisplayOutput,