:pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Dec 4 22:45 CET 2001
authorshort <>
Wed, 5 Dec 2001 03:17:04 +0000 (03:17 +0000)
committershort <>
Wed, 5 Dec 2001 03:17:04 +0000 (03:17 +0000)
23 files changed:
common/devices/unixserial.c
common/gsm-sms.c
common/gsm-statemachine.c
common/phones/nk2110.c
common/phones/nk6100.c
common/phones/nk7110.c
gnokii/gnokii.c
include/gsm-sms.h
packaging/make_dist
smsd/ChangeLog
smsd/Makefile
smsd/db.c
smsd/lowlevel.c
smsd/smsd.c
xgnokii/xgnokii.c
xgnokii/xgnokii.h
xgnokii/xgnokii_contacts.c
xgnokii/xgnokii_contacts.h
xgnokii/xgnokii_logos.c
xgnokii/xgnokii_lowlevel.c
xgnokii/xgnokii_lowlevel.h
xgnokii/xgnokii_sms.c
xgnokii/xgnokii_xkeyb.c

index e9dcb17..916ba4a 100644 (file)
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
   $Log$
-  Revision 1.1.1.2  2001/11/27 22:01:15  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
+  Revision 1.1.1.3  2001/12/05 03:16:40  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Dec  4 22:45 CET 2001
+
+  Revision 1.12  2001/11/29 17:54:56  pkot
+  Cleanup. Removed cvs logs.
 
   Revision 1.11  2001/11/27 12:19:01  pkot
   Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
@@ -262,11 +265,8 @@ void serial_changespeed(int __fd, int __speed)
 #ifndef SGTTY
        tcgetattr(__fd, &t);
 
-       // This is not needed! We set up the speed via cfsetspeed
-       //  t.c_cflag &= ~CBAUD;
-       //  t.c_cflag |= speed;
        if (cfsetspeed(&t, speed) == -1)
-               dprintf(_("Serial port speed setting failed\n"));
+               dprintf("Serial port speed setting failed\n");
 
        tcsetattr(__fd, TCSADRAIN, &t);
 #else
index 114643d..a06c3c5 100644 (file)
 
   Library for parsing and creating Short Messages (SMS).
 
-  $Log$
-  Revision 1.1.1.2  2001/11/27 22:01:13  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
-
-  Revision 1.14  2001/11/27 12:19:00  pkot
-  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
-
-  Revision 1.13  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.12  2001/11/22 17:56:53  pkot
-  smslib update. sms sending
-
-  Revision 1.11  2001/11/20 16:22:22  pkot
-  First attempt to read Picture Messages. They should appear when you enable DEBUG. Nokia seems to break own standards. :/ (Markus Plail)
-
-  Revision 1.10  2001/11/19 13:09:40  pkot
-  Begin work on sms sending
-
-  Revision 1.9  2001/11/18 00:54:32  pkot
-  Bugfixes. I18n of the user responses. UDH support in libsms. Business Card UDH Type
-
-  Revision 1.8  2001/11/17 20:19:29  pkot
-  smslib cleanups, fixes and debugging
-
-  Revision 1.7  2001/11/15 12:15:04  pkot
-  smslib updates. begin work on sms in 6100 series
-
-  Revision 1.6  2001/11/14 18:21:19  pkot
-  Fixing some problems with UDH and Unicode, but still doesn't work yet :-(
-
-  Revision 1.5  2001/11/14 14:26:18  pkot
-  Changed offset of DCS field to the right value in 6210/7110
-
-  Revision 1.4  2001/11/14 11:26:18  pkot
-  Getting SMS in 6210/7110 does finally work in some cases :)
-
-  Revision 1.3  2001/11/13 16:12:20  pkot
-  Preparing libsms to get to work. 6210/7110 SMS and SMS Folder updates
-
-  Revision 1.2  2001/11/09 14:25:04  pkot
-  DEBUG cleanups
-
-  Revision 1.1  2001/11/08 16:23:21  pkot
-  New version of libsms. Not functional yet, but it reasonably stable API.
-
-  Revision 1.1  2001/07/09 23:06:26  pkot
-  Moved sms.* files from my hard disk to CVS
-
 */
 
 #include <stdlib.h>
 #include "gsm-encoding.h"
 #include "gsm-bitmaps.h"
 
+SMSMessage_PhoneLayout layout;
+static SMSMessage_Layout llayout;
+
 struct udh_data {
        unsigned int length;
        char *header;
 };
 
-/* Number of header specific octets in SMS header (before data) */
-static unsigned short DataOffset[] = {
-       4, /* SMS Deliver */
-       3, /* SMS Deliver Report */
-       5, /* SMS Submit */
-       3, /* SMS Submit Report */
-       3, /* SMS Command */
-       3  /* SMS Status Report */
-};
-
 /* User data headers */
 static struct udh_data headers[] = {
        { 0x00, "" },
@@ -309,22 +252,32 @@ static GSM_Error EncodeSMSSubmitHeader(GSM_SMSMessage *SMS, char *frame)
        GSM_Error error = GE_NONE;
 
        /* Standard Header: */
-       memcpy(frame, "\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa9\x00\x00\x00\x00\x00\x00", 24);
+       memcpy(frame + llayout.UserDataHeader, "\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa9\x00\x00\x00\x00\x00\x00", 24);
 
        /* Reply Path */
-       if (SMS->ReplyViaSameSMSC) frame[0] |= 0x80;
+       if (llayout.ReplyViaSameSMSC > -1) {
+               if (SMS->ReplyViaSameSMSC) frame[llayout.ReplyViaSameSMSC] |= 0x80;
+       }
 
        /* User Data Header Indicator */
-       if (SMS->UDH_No) frame[0] |= 0x40;
+       if (llayout.UserDataHeader > -1) {
+               if (SMS->UDH_No) frame[llayout.UserDataHeader] |= 0x40;
+       }
 
        /* Status (Delivery) Report Request */
-       if (SMS->ReportStatus) frame[0] |= 0x20;
+       if (llayout.Report > -1) {
+               if (SMS->Report) frame[llayout.Report] |= 0x20;
+       }
 
        /* Validity Period Format: mask - 0x00, 0x10, 0x08, 0x18 */
-       frame[0] |= ((SMS->Validity.VPF & 0x03) << 3);
+       if (llayout.Validity > -1) {
+               frame[llayout.Validity] |= ((SMS->Validity.VPF & 0x03) << 3);
+       }
 
        /* Reject Duplicates */
-       if (SMS->RejectDuplicates) frame[0] |= 0x04;
+       if (llayout.RejectDuplicates > -1) {
+               if (SMS->RejectDuplicates) frame[llayout.RejectDuplicates] |= 0x04;
+       }
 
        /* Message Type is already set */
 
@@ -334,29 +287,35 @@ static GSM_Error EncodeSMSSubmitHeader(GSM_SMSMessage *SMS, char *frame)
        /* Protocol Identifier */
        /* FIXME: allow to change this in better way.
           currently only 0x5f == `Return Call Message' is used */
-       if (SMS->PID) frame[3] = SMS->PID;
+       if (llayout.PID > -1) {
+               if (SMS->PID) frame[llayout.PID] = SMS->PID;
+       }
 
        /* Data Coding Scheme */
-       switch (SMS->DCS.Type) {
-       case SMS_GeneralDataCoding:
-               if (SMS->DCS.u.General.Compressed) frame[4] |= 0x20;
-               if (SMS->DCS.u.General.Class) frame[4] |= (0x10 | (SMS->DCS.u.General.Class - 1));
-               frame[4] |= ((SMS->DCS.u.General.Alphabet & 0x03) << 2);
-               break;
-       case SMS_MessageWaiting:
-               if (SMS->DCS.u.MessageWaiting.Discard) frame[4] |= 0xc0;
-               else if (SMS->DCS.u.MessageWaiting.Alphabet == SMS_UCS2) frame[4] |= 0xe0;
-               else frame[4] |= 0xd0;
-               if (SMS->DCS.u.MessageWaiting.Active) frame[4] |= 0x80;
-               frame[4] |= (SMS->DCS.u.MessageWaiting.Type & 0x03);
-               break;
-       default:
-               dprintf("Wrong Data Coding Scheme (DCS) format\n");
-               return GE_SMSWRONGFORMAT;
+       if (llayout.DataCodingScheme > -1) {
+               switch (SMS->DCS.Type) {
+               case SMS_GeneralDataCoding:
+                       if (SMS->DCS.u.General.Compressed) frame[llayout.DataCodingScheme] |= 0x20;
+                       if (SMS->DCS.u.General.Class) frame[llayout.DataCodingScheme] |= (0x10 | (SMS->DCS.u.General.Class - 1));
+                       frame[llayout.DataCodingScheme] |= ((SMS->DCS.u.General.Alphabet & 0x03) << 2);
+                       break;
+               case SMS_MessageWaiting:
+                       if (SMS->DCS.u.MessageWaiting.Discard) frame[llayout.DataCodingScheme] |= 0xc0;
+                       else if (SMS->DCS.u.MessageWaiting.Alphabet == SMS_UCS2) frame[llayout.DataCodingScheme] |= 0xe0;
+                       else frame[llayout.DataCodingScheme] |= 0xd0;
+                       if (SMS->DCS.u.MessageWaiting.Active) frame[llayout.DataCodingScheme] |= 0x80;
+                       frame[llayout.DataCodingScheme] |= (SMS->DCS.u.MessageWaiting.Type & 0x03);
+                       break;
+               default:
+                       dprintf("Wrong Data Coding Scheme (DCS) format\n");
+                       return GE_SMSWRONGFORMAT;
+               }
        }
 
        /* Destination Address */
-       frame[5] = SemiOctetPack(SMS->RemoteNumber.number, frame + 6, SMS->RemoteNumber.type);
+       if (llayout.RemoteNumber > -1) {
+               frame[llayout.RemoteNumber] = SemiOctetPack(SMS->RemoteNumber.number, frame + llayout.RemoteNumber + 1, SMS->RemoteNumber.type);
+       }
 
        /* Validity Period */
        switch (SMS->Validity.VPF) {
@@ -383,7 +342,6 @@ static GSM_Error EncodeSMSHeader(GSM_SMSMessage *SMS, char *frame)
    (for sending or saving in Outbox) message */
 {
        /* Set SMS type */
-       frame[12] |= (SMS->Type >> 1);
        switch (SMS->Type) {
        case SMS_Submit: /* we send SMS or save it in Outbox */
                return EncodeSMSSubmitHeader(SMS, frame);
@@ -402,16 +360,35 @@ int EncodePDUSMS(GSM_SMSMessage *SMS, char *message)
        GSM_Error error = GE_NONE;
        int i;
 
-       dprintf("Sending SMS to %s via message center %s\n", SMS->RemoteNumber.number, SMS->MessageCenter.Number);
+       switch (SMS->Type) {
+       case SMS_Submit:
+               llayout = layout.Submit;
+               dprintf("Sending SMS to %s via message center %s\n", SMS->RemoteNumber.number, SMS->MessageCenter.Number);
+               break;
+       case SMS_Deliver:
+               llayout = layout.Deliver;
+               dprintf("Saving SMS to Inbox\n");
+               break;
+       case SMS_Picture:
+               llayout = layout.Picture;
+               dprintf("Sending Picture Message\n");
+               break;
+       case SMS_Delivery_Report:
+       default:
+               dprintf("Not supported message type: %d\n", SMS->Type);
+               return GE_NOTSUPPORTED;
+       }
 
        /* SMSC number */
-       dprintf("%d %s\n", SMS->MessageCenter.Type, SMS->MessageCenter.Number);
-       message[0] = SemiOctetPack(SMS->MessageCenter.Number, message + 1, SMS->MessageCenter.Type);
-       if (message[0] % 2) message[0]++;
-       message[0] = message[0] / 2 + 1;
+       if (llayout.MessageCenter > -1) {
+               dprintf("%d %s\n", SMS->MessageCenter.Type, SMS->MessageCenter.Number);
+               message[llayout.MessageCenter] = SemiOctetPack(SMS->MessageCenter.Number, message + llayout.MessageCenter + 1, SMS->MessageCenter.Type);
+               if (message[llayout.MessageCenter] % 2) message[llayout.MessageCenter]++;
+               message[llayout.MessageCenter] = message[llayout.MessageCenter] / 2 + 1;
+       }
 
        /* Common Header */
-       error = EncodeSMSHeader(SMS, message + 12);
+       error = EncodeSMSHeader(SMS, message);
        if (error != GE_NONE) return error;
 
        /* User Data Header - if present */
@@ -422,9 +399,9 @@ int EncodePDUSMS(GSM_SMSMessage *SMS, char *message)
        SMS->UDH_Length = 0;
 
        /* User Data */
-       EncodeData(SMS, message + 14, message + 36 + SMS->UDH_Length);
-       message[16] = SMS->Length;
-       return SMS->Length + 35;
+       EncodeData(SMS, message + llayout.DataCodingScheme, message + llayout.UserData + SMS->UDH_Length);
+       message[llayout.Length] = SMS->Length;
+       return SMS->Length + llayout.UserData - 1;
 }
 
 /* This function does simple SMS encoding - no PDU coding */
@@ -664,6 +641,7 @@ static GSM_Error DecodeUDH(char *message, GSM_SMSMessage *SMS)
                case 0x07: // UDH Source Indicator
                        break;
                default:
+                       dprintf("Not supported UDH\n");
                        break;
                }
                length -= (udh_length + 2);
@@ -678,60 +656,80 @@ static GSM_Error DecodeUDH(char *message, GSM_SMSMessage *SMS)
 static GSM_Error DecodeSMSHeader(unsigned char *message, GSM_SMSMessage *SMS)
 {
        /* Short Message Type */
-       switch (SMS->Type = message[2]) {
+       SMS->Type = message[layout.Type];
+       switch (SMS->Type) {
        case SMS_Deliver:
+               llayout = layout.Deliver;
                dprintf("Mobile Terminated message:\n");
                break;
        case SMS_Delivery_Report:
+               llayout = layout.DeliveryReport;
                dprintf("Delivery Report:\n");
-               UnpackDateTime(message + 34 + DataOffset[SMS->Type], &(SMS->SMSCTime));
-               dprintf("\tDelivery date: %s\n", PrintDateTime(message + 34 + DataOffset[SMS->Type]));
                break;
        case SMS_Submit:
+               llayout = layout.Submit;
                dprintf("Mobile Originated message:\n");
                break;
-       default:
-               dprintf("Not supported message type:\n");
+       case SMS_Picture:
+               llayout = layout.Picture;
+               dprintf("Picture Message:\n");
                break;
+       default:
+               dprintf("Not supported message type: %d\n", SMS->Type);
+               return GE_NOTSUPPORTED;
+       }
+
+       if (!llayout.IsSupported) return GE_NOTSUPPORTED;
+
+       /* Delivery date */
+       if (llayout.Time > -1) {
+               UnpackDateTime(message + llayout.Time, &(SMS->SMSCTime));
+               dprintf("\tDelivery date: %s\n", PrintDateTime(message + llayout.Time));
        }
 
        /* Short Message location in memory */
-       SMS->Number = message[1];
-       dprintf("\tLocation: %d\n", SMS->Number);
+       if (llayout.Number > -1) {
+               SMS->Number = message[llayout.Number];
+               dprintf("\tLocation: %d\n", SMS->Number);
+       }
 
        /* Short Message Center */
-       strcpy(SMS->MessageCenter.Number, GetBCDNumber(message + 3));
-       dprintf("\tSMS center number: %s\n", SMS->MessageCenter.Number);
-       SMS->ReplyViaSameSMSC = false;
-       if (SMS->RemoteNumber.number[0] == 0 && (message[6] & 0x80)) {
-               SMS->ReplyViaSameSMSC = true;
+       if (llayout.MessageCenter > -1) {
+               strcpy(SMS->MessageCenter.Number, GetBCDNumber(message + llayout.MessageCenter));
+               dprintf("\tSMS center number: %s\n", SMS->MessageCenter.Number);
+               SMS->ReplyViaSameSMSC = false;
+               if (SMS->RemoteNumber.number[0] == 0 && (message[llayout.ReplyViaSameSMSC] & 0x80)) {
+                       SMS->ReplyViaSameSMSC = true;
+               }
        }
 
        /* Remote number */
-       message[15+DataOffset[SMS->Type]] = ((message[15+DataOffset[SMS->Type]])+1)/2+1;
-       dprintf("\tRemote number (recipient or sender): %s\n", GetBCDNumber(message + 15 + DataOffset[SMS->Type]));
-       strcpy(SMS->RemoteNumber.number, GetBCDNumber(message + 15 + DataOffset[SMS->Type]));
-
-       UnpackDateTime(message + 27 + DataOffset[SMS->Type], &(SMS->Time));
-       dprintf("\tDate: %s\n", PrintDateTime(message + 27 + DataOffset[SMS->Type]));
+       if (llayout.RemoteNumber > -1) {
+               message[llayout.RemoteNumber] = ((message[llayout.RemoteNumber])+1)/2+1;
+               strcpy(SMS->RemoteNumber.number, GetBCDNumber(message + llayout.RemoteNumber));
+               dprintf("\tRemote number (recipient or sender): %s\n", SMS->RemoteNumber.number);
+       }
+       
+       /* Sending time */
+       if (llayout.SMSCTime > -1) {
+               UnpackDateTime(message + llayout.SMSCTime, &(SMS->Time));
+               dprintf("\tDate: %s\n", PrintDateTime(message + llayout.SMSCTime));
+       }
 
        /* Message length */
-       SMS->Length = message[14+DataOffset[SMS->Type]];
+       if (llayout.Length > -1)
+               SMS->Length = message[llayout.Length];
 
        /* Data Coding Scheme */
-       if (SMS->Type != SMS_Delivery_Report && SMS->Type != SMS_Picture)
-               SMS->DCS.Type = message[13 + DataOffset[SMS->Type]];
-       else
-               SMS->DCS.Type = 0;
+       if (llayout.DataCodingScheme > -1)
+               SMS->DCS.Type = message[llayout.DataCodingScheme];
 
        /* User Data Header */
-       if (message[15] & 0x40) { /* UDH header available */
-               dprintf("UDH found\n");
-               DecodeUDH(message + 34 + DataOffset[SMS->Type], SMS);
-       } else {                    /* No UDH */
-               dprintf("No UDH\n");
-               SMS->UDH_No = 0;
-       }
+       if (llayout.UserDataHeader > -1)
+               if (message[llayout.UserDataHeader] & 0x40) { /* UDH header available */
+                       dprintf("UDH found\n");
+                       DecodeUDH(message + llayout.UserData, SMS);
+               }
 
        return GE_NONE;
 }
@@ -743,31 +741,29 @@ GSM_Error DecodePDUSMS(unsigned char *message, GSM_SMSMessage *SMS, int MessageL
 {
        int size;
        GSM_Bitmap bitmap;
+       GSM_Error error;
 
-       DecodeSMSHeader(message, SMS);
+       error = DecodeSMSHeader(message, SMS);
+       if (error != GE_NONE) return error;
        switch (SMS->Type) {
        case SMS_Delivery_Report:
-               SMSStatus(message[17], SMS);
+               if (llayout.UserData > -1) SMSStatus(message[llayout.UserData], SMS);
                break;
        case SMS_Picture:
-               dprintf("Picture!!!\n");
-               GSM_ReadSMSBitmap(SMS_Picture, message + 41, NULL, &bitmap);
+               GSM_ReadSMSBitmap(SMS_Picture, message + llayout.UserData, NULL, &bitmap);
                GSM_PrintBitmap(&bitmap);
-               size = MessageLength - 45 - bitmap.size;
-               SMS->Length = message[45 + bitmap.size];
-               printf("%d %d %d\n", SMS->Length, bitmap.size, size);
-               DecodeData(message + 46 + bitmap.size,
+               size = MessageLength - llayout.UserData - 4 - bitmap.size;
+               SMS->Length = message[llayout.UserData + 4 + bitmap.size];
+               DecodeData(message + llayout.UserData + 5 + bitmap.size,
                           (unsigned char *)&(SMS->MessageText),
                           SMS->Length, size, 0, SMS->DCS);
                SMS->MessageText[SMS->Length] = 0;
                break;
        default:
                size = MessageLength -
-                          34 -                    /* Header Length */
-                          DataOffset[SMS->Type] - /* offset */
-                          SMS->UDH_Length -       /* UDH Length */
-                          5;                      /* checksum */
-               DecodeData(message + 34 + DataOffset[SMS->Type] + SMS->UDH_Length,
+                       llayout.UserData + 1 - /* Header Length */
+                       SMS->UDH_Length;       /* UDH Length */
+               DecodeData(message + llayout.UserData + SMS->UDH_Length,
                           (unsigned char *)&(SMS->MessageText),
                           SMS->Length, size, SMS->UDH_Length, SMS->DCS);
                /* Just in case */
index 6d77726..c8638e4 100644 (file)
 
   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:01  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.7  2001/11/17 20:16:42  pkot
-  Cleanup
-
-  Revision 1.6  2001/11/08 16:49:19  pkot
-  Cleanups
-
-  Revision 1.5  2001/09/09 21:45:49  machek
-  Cleanups from Ladislav Michl <ladis@psi.cz>:
-
-  *) do *not* internationalize debug messages
-
-  *) some whitespace fixes, do not use //
-
-  *) break is unneccessary after return
-
-  Revision 1.4  2001/07/27 00:02:20  pkot
-  Generic AT support for the new structure (Manfred Jonsson)
-
-  Revision 1.3  2001/06/10 11:26:56  machek
-  Warn if Link.Loop is not defined.
-
-  Revision 1.2  2001/05/07 14:01:51  machek
-  Warn when phone functions are missing, but do not segfault.
-
-  Revision 1.1  2001/03/21 23:36:04  chris
-  Added the statemachine
-  This will break gnokii --identify and --monitor except for 6210/7110
-
-
 */
 
 #include "gsm-common.h"
index bee7093..15e528a 100644 (file)
 
   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.12  2001/10/21 22:23:56  machek
-  Use symbolic constants instead of numbers
-
-  At least detect when we get other message than we asked for
-
-  Provide option to passively wait for sms-es
-
-  Revision 1.11  2001/08/20 23:27:37  pkot
-  Add hardware shakehand to the link layer (Manfred Jonsson)
-
-  Revision 1.10  2001/07/17 22:46:27  pkot
-  Removed warning when compiling with --enable-debug (Pawel Kot)
-
-  Revision 1.9  2001/06/17 16:42:59  machek
-  Created another level of error message (ddprintf), fixed code not to
-  exit on error condition. Now it is actualy usable on my Philips Velo.
-
-  Revision 1.8  2001/06/16 10:00:41  machek
-  Implement timeouts on waiting for SMS.
-
-  Revision 1.7  2001/06/10 23:49:49  pkot
-  Small fixes to hide compilation warnings and allow gnokii.c to compile
-
-  Revision 1.6  2001/06/10 11:28:00  machek
-  Convert GetSMS/DeleteSMS to new structure.
-
-  Revision 1.5  2001/06/06 09:05:56  machek
-  Convert Grab/Release display to new structure.
-
-  Revision 1.4  2001/05/09 20:18:46  machek
-  Cleaned up code a bit. Made it use device_() interface. Reworked delay
-  system; now it is 4 times faster. 5 times faster if you hold * key on
-  phone (?!).
-
-  Revision 1.3  2001/05/07 14:13:03  machek
-  nokia-2110 module converted to suit new API better. --identify now works.
-
-  Revision 1.2  2001/04/27 16:00:01  machek
-  Better error messages.
-
-  Revision 1.1  2001/04/25 12:54:47  machek
-  Partly converted nokia 2110 to "new" form, and moved it to phone
-  directory.
-
-
   Notice that this code was (partly) converted to "new" structure, but it 
   does not have code for bus separated. I think that separating it would
   be waste of effort...                                        --pavel
@@ -694,7 +632,7 @@ SigHandler(int status)
 //      dprintf("(%x)", b, Index);
                if (!Index && b != MYID && b != 0xf8 && b != 0x00) /* MYID is code of computer */ {
                        /* something strange goes from phone. Just ignore it */
-                       ddprintf( "Get [%02X %c]\n", b, b >= 0x20 ? b : '.' );
+                       ddprintf("Get [%02X %c]\n", b, b >= 0x20 ? b : '.' );
                        continue;
                } else {
                        pkt[Index++] = b;
@@ -705,7 +643,7 @@ SigHandler(int status)
                        }
                        if(Index >= Length) {
                                if((pkt[0] == MYID || pkt[0]==0xf8) && pkt[1] == 0x00) /* packet from phone */ {
-                                       ddprintf( _("Phone: ") );
+                                       ddprintf("Phone: ");
                                        for( j = 0; j < Length; j++ ) {
                                                b = pkt[j];
                                                ddprintf( "[%02X %c]", b, b >= 0x20 ? b : '.' );
index c4dda5a..582367e 100644 (file)
@@ -1,4 +1,5 @@
 /*
+
   $Id$
 
   G N O K I I
   This file provides functions specific to the 6100 series. 
   See README for more details on supported mobile phones.
 
-  $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:12  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.8  2001/11/17 20:19:29  pkot
-  smslib cleanups, fixes and debugging
-
-  Revision 1.7  2001/11/17 16:44:07  pkot
-  Cleanup. Reading SMS for 6100 series. Not that it has some bugs more and does not support UDH yet
-
-  Revision 1.6  2001/11/15 12:15:04  pkot
-  smslib updates. begin work on sms in 6100 series
-
-  Revision 1.5  2001/11/15 12:12:34  pkot
-  7110 and 6110 series phones introduce as Nokia
-
-  Revision 1.4  2001/11/15 12:04:06  pkot
-  Faster initialization for 6100 series (don't check for dlr3 cable)
-
-  Revision 1.3  2001/08/17 00:01:53  pkot
-  Fixed a typo in 6100.c (me)
-
-  Revision 1.2  2001/08/09 12:34:34  pkot
-  3330 and 6250 support - I have no idea if it does work (mygnokii)
-
-  Revision 1.1  2001/07/09 23:55:35  pkot
-  Initial support for 6100 series in the new structure (me)
-
 */
 
 #include <string.h>
 
 /* Some globals */
 
+static const SMSMessage_Layout nk6100_deliver = {
+       true,
+       0, 11, 0, 0, 6, 0, 0, -1, 23, 22, 0, 20,
+       8, true, 24, true, 36, -1,
+       5, 4,
+       43, true
+};
+
+static const SMSMessage_Layout nk6100_submit = {
+       true,
+       -1, 20, 20, 20, 6, 21, 22, -1, 24, 23, 20, 20,
+       8, true, 25, true, 37, -1,
+       -1, -1,
+       44, true
+};
+
+static const SMSMessage_Layout nk6100_delivery_report = {
+       true,
+       0, 0, 0, 0, 6, 0, 0, 0, 22, 21, -1, 20,
+       8, true, 24, true, 35, 42,
+       5, 4,
+       22, true
+};
+
+static const SMSMessage_Layout nk6100_picture = {
+       false,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       0, true, 0, true, 0, 0,
+       0, 0,
+       0, true
+};
+
+static SMSMessage_PhoneLayout nk6100_layout;
+
 static unsigned char MagicBytes[4] = { 0x00, 0x00, 0x00, 0x00 };
 
 static GSM_IncomingFunctionType IncomingFunctions[] = {
@@ -134,6 +141,14 @@ static GSM_Error Initialise(GSM_Statemachine *state)
        /* Copy in the phone info */
        memcpy(&(state->Phone), &phone_nokia_6100, sizeof(GSM_Phone));
 
+       /* SMS Layout */
+       nk6100_layout.Type = 7;
+       nk6100_layout.Deliver = nk6100_deliver;
+       nk6100_layout.Submit = nk6100_submit;
+       nk6100_layout.DeliveryReport = nk6100_delivery_report;
+       nk6100_layout.Picture = nk6100_picture;
+       layout = nk6100_layout;
+
        switch (state->Link.ConnectionType) {
        case GCT_Serial:
                err = FBUS_Initialise(&(state->Link), state, 0);
@@ -324,16 +339,16 @@ static GSM_Error IncomingPhoneInfo(int messagetype, unsigned char *message, int
        }
 
        dprintf("Message: Mobile phone identification received:\n");
-       dprintf("   IMEI: %s\n", data->Imei);
-       dprintf("   Model: %s\n", data->Model);
-       dprintf("   Production Code: %s\n", message + 31);
-       dprintf("   HW: %s\n", message + 39);
-       dprintf("   Firmware: %s\n", message + 44);
+       dprintf("\tIMEI: %s\n", data->Imei);
+       dprintf("\tModel: %s\n", data->Model);
+       dprintf("\tProduction Code: %s\n", message + 31);
+       dprintf("\tHW: %s\n", message + 39);
+       dprintf("\tFirmware: %s\n", message + 44);
        
        /* These bytes are probably the source of the "Accessory not connected"
           messages on the phone when trying to emulate NCDS... I hope....
           UPDATE: of course, now we have the authentication algorithm. */
-       dprintf(_("   Magic bytes: %02x %02x %02x %02x\n"), message[50], message[51], message[52], message[53]);
+       dprintf("\tMagic bytes: %02x %02x %02x %02x\n", message[50], message[51], message[52], message[53]);
        
        MagicBytes[0] = message[50];
        MagicBytes[1] = message[51];
@@ -447,29 +462,8 @@ static GSM_Error IncomingSMS(int messagetype, unsigned char *message, int length
 
                memset(data->SMSMessage, 0, sizeof(GSM_SMSMessage));
 
-               /* These offsets are 6210/7110 series specific */
                /* Short Message status */
-               data->SMSMessage->Status = message[4];
-               dprintf("\tStatus: ");
-               switch (data->SMSMessage->Status) {
-               case SMS_Read:
-                       dprintf("READ\n");
-                       break;
-               case SMS_Unread:
-                       dprintf("UNREAD\n");
-                       break;
-               case SMS_Sent:
-                       dprintf("SENT\n");
-                       break;
-               case SMS_Unsent:
-                       dprintf("UNSENT\n");
-                       break;
-               default:
-                       dprintf("UNKNOWN\n");
-                       break;
-               }
-
-               DecodePDUSMS(message + 5, data->SMSMessage, length);
+               DecodePDUSMS(message, data->SMSMessage, length);
 
                 break;
        /* read sms failed */
index eb6331f..af77996 100644 (file)
@@ -7,7 +7,8 @@
   A Linux/Unix toolset and driver for Nokia mobile phones.
 
   Copyright (C) 2000 Hugh Blemings & Pavel Janík ml.
-  Copytight (C) 2000 Chris Kemp
+  Copyright (C) 2000 Chris Kemp
+  Copyright (C) 2001 Markus Plail, Pawe³ Kot
 
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
 
   The various routines are called P7110_(whatever).
 
-  $Log$
-  Revision 1.1.1.2  2001/11/27 22:01:19  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
-
-  Revision 1.28  2001/11/27 12:25:01  pkot
-  Cleanup
-
-  Revision 1.27  2001/11/22 17:56:53  pkot
-  smslib update. sms sending
-
-  Revision 1.26  2001/11/19 17:09:59  pkot
-  Bugfixes
-
-  Revision 1.25  2001/11/19 16:24:31  pkot
-  Grrrr... I should have check if I have fixed this typo
-
-  Revision 1.24  2001/11/19 15:53:16  pkot
-  Typos
-
-  Revision 1.23  2001/11/19 13:46:42  pkot
-  reading unread SMS in 6210 from Inbox. Folder updates (Markus Plail)
-
-  Revision 1.22  2001/11/17 20:18:32  pkot
-  Added dau9p connection type for 6210/7110
-
-  Revision 1.21  2001/11/17 16:44:07  pkot
-  Cleanup. Reading SMS for 6100 series. Not that it has some bugs more and does not support UDH yet
-
-  Revision 1.20  2001/11/15 12:15:04  pkot
-  smslib updates. begin work on sms in 6100 series
-
-  Revision 1.19  2001/11/15 12:12:34  pkot
-  7110 and 6110 series phones introduce as Nokia
-
-  Revision 1.18  2001/11/15 12:04:06  pkot
-  Faster initialization for 6100 series (don't check for dlr3 cable)
-
-  Revision 1.17  2001/11/14 10:48:03  pkot
-  6210/7110 debug cleanups
-
-  Revision 1.16  2001/11/13 16:12:21  pkot
-  Preparing libsms to get to work. 6210/7110 SMS and SMS Folder updates
-
-  Revision 1.15  2001/11/08 16:47:48  pkot
-  Start fiddling with 7110 and SMS
-
-  Revision 1.14  2001/09/09 21:45:49  machek
-  Cleanups from Ladislav Michl <ladis@psi.cz>:
-
-  *) do *not* internationalize debug messages
-
-  *) some whitespace fixes, do not use //
-
-  *) break is unneccessary after return
-
-  Revision 1.13  2001/08/16 23:59:32  pkot
-  Fixed (hopefully) timezone mismash (Sheldon Hearn)
-
-  Revision 1.12  2001/08/09 12:34:34  pkot
-  3330 and 6250 support - I have no idea if it does work (mygnokii)
-
-  Revision 1.11  2001/07/05 10:54:53  pkot
-  Solaris 2.7 fixes - should be harmless for other OSes (Michael Wiedmann)
-
-  Revision 1.10  2001/06/27 23:52:49  pkot
-  7110/6210 updates (Marian Jancar)
-
-  Revision 1.9  2001/06/10 23:49:49  pkot
-  Small fixes to hide compilation warnings and allow gnokii.c to compile
-
-  Revision 1.8  2001/05/24 20:47:30  chris
-  More updating of 7110 code and some of xgnokii_lowlevel changed over.
-
-  Revision 1.7  2001/05/07 16:24:04  pkot
-  DLR-3P temporary fix. How should I do it better?
-
-  Revision 1.6  2001/03/23 13:40:24  chris
-  Pavel's patch and a few fixes.
-
-  Revision 1.5  2001/03/22 16:17:06  chris
-  Tidy-ups and fixed gnokii/Makefile and gnokii/ChangeLog which I somehow corrupted.
-
-  Revision 1.4  2001/03/21 23:36:06  chris
-  Added the statemachine
-  This will break gnokii --identify and --monitor except for 6210/7110
-
-  Revision 1.3  2001/03/13 01:24:03  pkot
-  Code cleanup - no warnings during compilation
-
-  Revision 1.2  2001/03/13 01:23:18  pkot
-  Windows updates (Manfred Jonsson)
-
-  Revision 1.1  2001/02/21 19:57:07  chris
-  More fiddling with the directory layout
-
-  Revision 1.1  2001/02/16 14:29:53  chris
-  Restructure of common/.  Fixed a problem in fbus-phonet.c
-  Lots of dprintfs for Marcin
-  Any size xpm can now be loaded (eg for 7110 startup logos)
-  nk7110 code detects 7110/6210 and alters startup logo size to suit
-  Moved Marcin's extended phonebook code into gnokii.c
-
-  Revision 1.7  2001/02/06 21:15:35  chris
-  Preliminary irda support for 7110 etc.  Not well tested!
-
-  Revision 1.6  2001/02/03 23:56:15  chris
-  Start of work on irda support (now we just need fbus-irda.c!)
-  Proper unicode support in 7110 code (from pkot)
-
-  Revision 1.5  2001/02/01 15:17:31  pkot
-  Fixed --identify and added Manfred's manufacturer patch
-
-  Revision 1.4  2001/01/29 17:14:42  chris
-  dprintf now in misc.h (and fiddling with 7110 code)
-
-  Revision 1.3  2001/01/23 15:32:41  chris
-  Pavel's 'break' and 'static' corrections.
-  Work on logos for 7110.
-
-  Revision 1.2  2001/01/17 02:54:54  chris
-  More 7110 work.  Use with care! (eg it is not possible to delete phonebook entries)
-  I can now edit my phonebook in xgnokii but it is 'work in progress'.
-
-  Revision 1.1  2001/01/14 22:46:59  chris
-  Preliminary 7110 support (dlr9 only) and the beginnings of a new structure
-
 */
 
 #include <string.h>
 
 /* Some globals */
 
+static const SMSMessage_Layout nk7110_deliver = {
+       true,
+       0, 21, 0, 0, 7, 0, 0, -1, 24, 23, 0, 21,
+       9, true, 25, true, 37, -1,
+       5, 4,
+       44, true
+};
+
+static const SMSMessage_Layout nk7110_submit = {
+       true,
+       -1, 18, 18, 18, -1, 19, 20, -1, 22, 21, 18, 18,
+       6, true, 23, true, -1, -1,
+       -1, -1,
+       42, true
+};
+
+static const SMSMessage_Layout nk7110_delivery_report = {
+       true,
+       0, 0, 0, 0, 7, 0, 0, 0, 23, 22, -1, 21,
+       9, true, 24, true, 36, 43,
+       5, 4,
+       23, true
+};
+
+static const SMSMessage_Layout nk7110_picture = {
+       true,
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+       9, true, 22, true, 34, -1,
+       0, 0,
+       47, true
+};
+
+static SMSMessage_PhoneLayout nk7110_layout;
+
 static GSM_IncomingFunctionType P7110_IncomingFunctions[] = {
        { P7110_MSG_FOLDER,     P7110_IncomingFolder },
        { P7110_MSG_SMS,        P7110_IncomingSMS },
@@ -182,7 +91,7 @@ GSM_Phone phone_nokia_7110 = {
        PGEN_IncomingDefault,
         /* Mobile phone information */
        {
-               "7110|6210|6250", /* Supported models */
+               "7110|6210|6250",      /* Supported models */
                7,                     /* Max RF Level */
                0,                     /* Min RF Level */
                GRF_Percentage,        /* RF level units */
@@ -190,9 +99,9 @@ GSM_Phone phone_nokia_7110 = {
                0,                     /* Min Battery Level */
                GBU_Percentage,        /* Battery level units */
                GDT_DateTime,          /* Have date/time support */
-               GDT_TimeOnly,            /* Alarm supports time only */
+               GDT_TimeOnly,          /* Alarm supports time only */
                1,                     /* Alarms available - FIXME */
-               60, 96,                /* Startup logo size - 7110 is fixed at init*/
+               60, 96,                /* Startup logo size - 7110 is fixed at init */
                21, 78,                /* Op logo size */
                14, 72                 /* Caller logo size */
        },
@@ -268,6 +177,14 @@ static GSM_Error P7110_Initialise(GSM_Statemachine *state)
        /* Copy in the phone info */
        memcpy(&(state->Phone), &phone_nokia_7110, sizeof(GSM_Phone));
 
+       /* SMS Layout */
+       nk7110_layout.Type = 8; /* Locate the Type of the mesage field */
+       nk7110_layout.Deliver = nk7110_deliver;
+       nk7110_layout.Submit = nk7110_submit;
+       nk7110_layout.DeliveryReport = nk7110_delivery_report;
+       nk7110_layout.Picture = nk7110_picture;
+       layout = nk7110_layout;
+
        dprintf("Connecting\n");
        while (!connected) {
                switch (state->Link.ConnectionType) {
@@ -762,12 +679,11 @@ static GSM_Error P7110_IncomingFolder(int messagetype, unsigned char *message, i
                memset(data->SMSMessage, 0, sizeof(GSM_SMSMessage));
 
                /* Number of SMS in folder */
-               data->SMSMessage->Number = message[7]; 
+               data->SMSMessage->Number = message[7];
 
                /* MessageType/FolderID */
                data->SMSMessage->MemoryType = message[5];
 
-               /* These offsets are 6210/7110 series specific */
                /* Short Message status */
                data->SMSMessage->Status = message[4];
                dprintf("\tStatus: ");
@@ -798,7 +714,7 @@ static GSM_Error P7110_IncomingFolder(int messagetype, unsigned char *message, i
                }
                if (found==false && data->SMSMessage->Status != SMS_Unread) return GE_INVALIDSMSLOCATION;
 
-               DecodePDUSMS(message + 6, data->SMSMessage, length);
+               DecodePDUSMS(message, data->SMSMessage, length);
 
                 break;
 
@@ -906,6 +822,7 @@ static GSM_Error P7110_GetSMSFolderStatus(GSM_Data *data, GSM_Statemachine *stat
 
 static GSM_Error P7110_SendSMS(GSM_Data *data, GSM_Statemachine *state)
 {
+       GSM_Error e;
        unsigned char req[256] = {FBUS_FRAME_HEADER, 0x01, 0x02, 0x00};
        int length, i;
 
@@ -914,15 +831,19 @@ static GSM_Error P7110_SendSMS(GSM_Data *data, GSM_Statemachine *state)
                P7110_GetSMSCenter(data, state);
        }
 
-       length = EncodePDUSMS(data->SMSMessage, req + 6);
+       length = EncodePDUSMS(data->SMSMessage, req);
        if (!length) return GE_SMSWRONGFORMAT;
        dprintf("Sending SMS...(%d)\n", length);
-       for (i = 0; i < length + 6; i++) {
+       for (i = 0; i < length; i++) {
                dprintf("%02x ", req[i]);
        }
        dprintf("\n");
-       if (SM_SendMessage(state, length+6, 0x02, req) != GE_NONE) return GE_NOTREADY;
-       return SM_Block(state, data, 0x02);
+       if (SM_SendMessage(state, length, 0x02, req) != GE_NONE) return GE_NOTREADY;
+       while (1) {
+               e = SM_Block(state, data, 0x02);
+               if (e == GE_SMSSENDOK || e == GE_SMSSENDFAILED) break;
+       }
+       return e;
 }
 
 static GSM_Error P7110_IncomingSMS(int messagetype, unsigned char *message, int length, GSM_Data *data)
index 23b75eb..9a562e5 100644 (file)
   WARNING: this code is the test tool. Well, our test tool is now
   really powerful and useful :-)
 
-  $Log$
-  Revision 1.1.1.2  2001/11/27 22:01:25  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
-
-  Revision 1.152  2001/11/27 12:23:11  pkot
-  Specifying SMSC number in --sendsms works again
-
-  Revision 1.151  2001/11/22 17:56:53  pkot
-  smslib update. sms sending
-
-  Revision 1.150  2001/11/20 16:22:22  pkot
-  First attempt to read Picture Messages. They should appear when you enable DEBUG. Nokia seems to break own standards. :/ (Markus Plail)
-
-  Revision 1.149  2001/11/19 16:00:15  pkot
-  Another typo
-
-  Revision 1.148  2001/11/19 13:46:43  pkot
-  reading unread SMS in 6210 from Inbox. Folder updates (Markus Plail)
-
-  Revision 1.147  2001/11/18 00:54:32  pkot
-  Bugfixes. I18n of the user responses. UDH support in libsms. Business Card UDH Type
-
-  Revision 1.146  2001/11/17 20:18:33  pkot
-  Added dau9p connection type for 6210/7110
-
-  Revision 1.145  2001/11/14 10:46:12  pkot
-  Small cleanup with __unices__
-
-  Revision 1.144  2001/11/08 16:34:19  pkot
-  Updates to work with new libsms
-
-  Revision 1.143  2001/09/14 13:30:07  pkot
-  Fixed bugs introduced during 0.3.3 merge
-
-  Revision 1.142  2001/09/14 13:02:03  pkot
-  Gnokii calendar changes from 0.3.3
-
-  Revision 1.141  2001/09/14 12:53:00  pkot
-  New preview logos.
-  Localization fixes.
-  Set valid operator on logos xgnokii screen.
-
-  Revision 1.140  2001/07/27 00:02:21  pkot
-  Generic AT support for the new structure (Manfred Jonsson)
-
-  Revision 1.139  2001/07/01 23:16:45  pkot
-  Fixed a typo in gnokii.c avoiding saving logo (Jan Havelka)
-
-  Revision 1.138  2001/06/28 00:28:45  pkot
-  Small docs updates (Pawel Kot)
-
-  Revision 1.137  2001/06/27 23:52:50  pkot
-  7110/6210 updates (Marian Jancar)
-
-  Revision 1.136  2001/06/10 23:49:49  pkot
-  Small fixes to hide compilation warnings and allow gnokii.c to compile
-
-  Revision 1.135  2001/06/10 11:42:26  machek
-  Cleanup: some formating, made Statemachine global, converted to new
-  structure w.r.t. SMS-es
-
-  Revision 1.134  2001/05/24 20:47:30  chris
-  More updating of 7110 code and some of xgnokii_lowlevel changed over.
-
-  Revision 1.133  2001/04/23 17:20:01  pkot
-  Added possibility for viewing logos (currently nol and ngg) on console (Bartek Klepacz)
-
-  Revision 1.132  2001/03/21 23:36:06  chris
-  Added the statemachine
-  This will break gnokii --identify and --monitor except for 6210/7110
-
-  Revision 1.131  2001/03/19 23:43:46  pkot
-  Solaris / BSD '#if defined' cleanup
-
-  Revision 1.130  2001/03/13 01:23:18  pkot
-  Windows updates (Manfred Jonsson)
-
-  Revision 1.129  2001/03/13 01:21:39  pkot
-  *BSD updates (Bert Driehuis)
-
-  Revision 1.128  2001/03/08 00:49:06  pkot
-  Fixed bug (introduced by me) in getmemory function. Now gnokii.c should compile
-
-  Revision 1.127  2001/03/08 00:18:13  pkot
-  Fixed writephonebook once again. Someone kick me please...
-
-  Revision 1.126  2001/03/07 21:46:12  pkot
-  Fixed writephonebook patch
-
-  Revision 1.125  2001/03/06 22:19:14  pkot
-  Cleanups and fixes in gnokii.c:
-   - reindenting
-   - fixed bug reported by Gabriele Zappi
-   - fixed small bugs introduced by Pavel Machek
-
-  Revision 1.124  2001/02/28 21:42:00  machek
-  Possibility to force overwrite in --getsms (-F). Possibility to get
-  multiple files (use --getsms -f xyzzy%d), cleanup.
-
-  Revision 1.123  2001/02/20 21:55:11  pkot
-  Small #include updates
-
-  Revision 1.122  2001/02/16 14:29:53  chris
-  Restructure of common/.  Fixed a problem in fbus-phonet.c
-  Lots of dprintfs for Marcin
-  Any size xpm can now be loaded (eg for 7110 startup logos)
-  nk7110 code detects 7110/6210 and alters startup logo size to suit
-  Moved Marcin's extended phonebook code into gnokii.c
-
-  Revision 1.121  2001/02/06 21:15:35  chris
-  Preliminary irda support for 7110 etc.  Not well tested!
-
-  Revision 1.120  2001/02/06 08:13:32  pkot
-  One more include in gnokii.c needed
-
-  Revision 1.119  2001/02/05 12:29:37  pkot
-  Changes needed to let unicode work
-
-  Revision 1.118  2001/02/01 15:17:33  pkot
-  Fixed --identify and added Manfred's manufacturer patch
-
-  Revision 1.117  2001/01/31 23:45:27  pkot
-  --identify should work ok now
-
-  Revision 1.116  2001/01/24 20:19:55  machek
-  Do not retry identification, if it is not implemented, it is bad idea.
-
-  Revision 1.115  2001/01/22 01:25:10  hugh
-  Tweaks for 3810 series, datacalls seem to be broken so need to do
-  some more debugging...
-
-  Revision 1.114  2001/01/17 02:54:55  chris
-  More 7110 work.  Use with care! (eg it is not possible to delete phonebook entries)
-  I can now edit my phonebook in xgnokii but it is 'work in progress'.
-
-  Revision 1.113  2001/01/15 17:00:49  pkot
-  Initial keypress sequence support. Disable compilation warning
-
-  Revision 1.112  2001/01/12 14:09:13  pkot
-  More cleanups. This time mainly in the code.
-
-  Revision 1.111  2001/01/10 16:32:18  pkot
-  Documentation updates.
-  FreeBSD fix for 3810 code.
-  Added possibility for deleting SMS just after reading it in gnokii.
-  2110 code updates.
-  Many cleanups.
-
-  Revision 1.110  2001/01/08 15:11:37  pkot
-  Documentation updates.
-  Fixed some bugs and removed FIXMEs.
-  We need to move some stuff from configure.in to aclocal.m4
-
-  Revision 1.109  2000/12/29 15:39:07  pkot
-  Reverted a change in fbus-3810.c which broke compling with --enable-debug.
-  Small fixes in gnokii.c
-
-  Revision 1.108  2000/12/19 16:18:16  pkot
-  configure script updates and added shared function for configfile reading
-
-  
 */
 
 #include "misc.h"
@@ -298,29 +137,30 @@ char *GetProfileVibrationString(int code)
        }
 }
 
+void short_version(void)
+{
+       fprintf(stderr, _("GNOKII Version %s\n"), VERSION);
+}
+
 /* This function shows the copyright and some informations usefull for
    debugging. */
-
-int version(void)
+void version(void)
 {
-       fprintf(stdout, _("GNOKII Version %s\n"
-                         "Copyright (C) Hugh Blemings <hugh@blemings.org>, 1999, 2000\n"
+       fprintf(stderr, _("Copyright (C) Hugh Blemings <hugh@blemings.org>, 1999, 2000\n"
                          "Copyright (C) Pavel Janík ml. <Pavel.Janik@suse.cz>, 1999, 2000\n"
                          "Copyright (C) Pavel Machek <pavel@ucw.cz>, 2001\n"
                          "Copyright (C) Pawe³ Kot <pkot@linuxnews.pl>, 2001\n"
                          "gnokii is free software, covered by the GNU General Public License, and you are\n"
                          "welcome to change it and/or distribute copies of it under certain conditions.\n"
                          "There is absolutely no warranty for gnokii.  See GPL for details.\n"
-                         "Built %s %s for %s on %s \n"), VERSION, __TIME__, __DATE__, model, Port);
-       return 0;
+                         "Built %s %s for %s on %s \n"), __TIME__, __DATE__, model, Port);
 }
 
 /* The function usage is only informative - it prints this program's usage and
    command-line options. */
-
 int usage(void)
 {
-       fprintf(stdout, _("   usage: gnokii [--help|--monitor|--version]\n"
+       fprintf(stderr, _("   usage: gnokii [--help|--monitor|--version]\n"
                          "          gnokii --getmemory memory_type start [end]\n"
                          "          gnokii --writephonebook [-i]\n"
                          "          gnokii --getspeeddial number\n"
@@ -362,7 +202,7 @@ int usage(void)
                          "          gnokii --keysequence\n"
                ));
 #ifdef SECURITY
-       fprintf(stdout, _(
+       fprintf(stderr, _(
                "          gnokii --entersecuritycode PIN|PIN2|PUK|PUK2\n"
                "          gnokii --getsecuritycodestatus\n"
                ));
@@ -384,7 +224,7 @@ void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame))
 
        GSM_DataClear(&data);
 
-       if (!strcasecmp(Connection, "dau9p"))    connection = GCT_DAU9P;
+       if (!strcasecmp(Connection, "dau9p"))    connection = GCT_DAU9P; /* Use only with 6210/7110 for faster connection with such cable */
        if (!strcasecmp(Connection, "infrared")) connection = GCT_Infrared;
        if (!strcasecmp(Connection, "irda"))     connection = GCT_Irda;
 
@@ -451,18 +291,18 @@ int main(int argc, char *argv[])
        static struct option long_options[] =
        {
                /* FIXME: these comments are nice, but they would be more usefull as docs for the user */
-               // Display usage.
+               /* Display usage. */
                { "help",               no_argument,       NULL, OPT_HELP },
 
-               // Display version and build information.
+               /* Display version and build information. */
                { "version",            no_argument,       NULL, OPT_VERSION },
 
-               // Monitor mode
+               /* Monitor mode */
                { "monitor",            no_argument,       NULL, OPT_MONITOR },
 
 #ifdef SECURITY
 
-               // Enter Security Code mode
+               /* Enter Security Code mode */
                { "entersecuritycode",  required_argument, NULL, OPT_ENTERSECURITYCODE },
 
                // Get Security Code status
@@ -625,6 +465,9 @@ int main(int argc, char *argv[])
                exit(-1);
        }
 
+       /* Introduce yourself */
+       short_version();
+
        /* Handle command line arguments. */
        c = getopt_long(argc, argv, "", long_options, NULL);
        if (c == -1)            /* No argument given - we should display usage. */
@@ -640,7 +483,8 @@ int main(int argc, char *argv[])
        case OPT_HELP:
                usage();
        case OPT_VERSION:
-               return version();
+               version();
+               exit(0);
        }
        
        /* We have to build an array of the arguments which will be passed to the
@@ -833,6 +677,7 @@ int sendsms(int argc, char *argv[])
        SMS.Validity.VPF = SMS_RelativeFormat;
        SMS.Validity.u.Relative = 4320; /* 4320 minutes == 72 hours */
        SMS.UDH_No = 0;
+       SMS.Report = false;
 
        strcpy(SMS.RemoteNumber.number, argv[0]);
        if (SMS.RemoteNumber.number[0] == '+') SMS.RemoteNumber.type = SMS_International;
@@ -865,7 +710,7 @@ int sendsms(int argc, char *argv[])
                        }
                        break;
                case 'r': /* request for delivery report */
-                       SMS.Type = SMS_Delivery_Report;
+                       SMS.Report = true;
                        break;
                case 'C': /* class Message */
                        switch (*optarg) {
@@ -1168,7 +1013,7 @@ int getsms(int argc, char *argv[])
                                mode = 0;
                        case 'f':
                                if (optarg) {
-                                       dprintf("Saving into %s\n", optarg);
+                                       fprintf(stderr, _("Saving into %s\n"), optarg);
                                        strncpy(filename, optarg, 64);
                                        if (strlen(optarg) > 63) {
                                                fprintf(stderr, _("Filename too long - will be truncated to 63 characters.\n"));
@@ -1256,8 +1101,8 @@ int getsms(int argc, char *argv[])
                                switch (message.UDH[0].Type) {
                                case SMS_OpLogo:
                                        fprintf(stdout, _("GSM operator logo for %s (%s) network.\n"), bitmap.netcode, GSM_GetNetworkName(bitmap.netcode));
-                                       if (!strcmp(message.RemoteNumber.number, "+998000005") && !strcmp(message.MessageCenter.Number, "+886935074443")) dprintf(_("Saved by Logo Express\n"));
-                                       if (!strcmp(message.RemoteNumber.number, "+998000002") || !strcmp(message.RemoteNumber.number, "+998000003")) dprintf(_("Saved by Operator Logo Uploader by Thomas Kessler\n"));
+                                       if (!strcmp(message.RemoteNumber.number, "+998000005") && !strcmp(message.MessageCenter.Number, "+886935074443")) fprintf(stdout, _("Saved by Logo Express\n"));
+                                       if (!strcmp(message.RemoteNumber.number, "+998000002") || !strcmp(message.RemoteNumber.number, "+998000003")) fprintf(stdout, _("Saved by Operator Logo Uploader by Thomas Kessler\n"));
                                        offset = 3;
                                case SMS_CallerIDLogo:
                                        fprintf(stdout, ("Logo:\n"));
@@ -1268,7 +1113,7 @@ int getsms(int argc, char *argv[])
                                                error = GE_NONE;
                                                if ((stat(filename, &buf) == 0)) {
                                                        fprintf(stdout, _("File %s exists.\n"), filename);
-                                                       fprintf(stderr, _("Overwrite? (yes/no) "));
+                                                       fprintf(stdout, _("Overwrite? (yes/no) "));
                                                        GetLine(stdin, ans, 4);
                                                        if (!strcmp(ans, _("yes"))) {
                                                                error = GSM_SaveBitmapFile(filename, &bitmap);
index 9174502..e99344a 100644 (file)
 
   Include file for SMS library.
 
-  $Log$
-  Revision 1.1.1.2  2001/11/27 22:01:27  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 22:58 CET 2001
-
-  Revision 1.7  2001/11/27 12:19:01  pkot
-  Cleanup, indentation, ANSI complaint preprocesor symbols (Jan Kratochvil, me)
-
-  Revision 1.6  2001/11/22 17:56:53  pkot
-  smslib update. sms sending
-
-  Revision 1.5  2001/11/20 16:22:23  pkot
-  First attempt to read Picture Messages. They should appear when you enable DEBUG. Nokia seems to break own standards. :/ (Markus Plail)
-
-  Revision 1.4  2001/11/19 13:09:40  pkot
-  Begin work on sms sending
-
-  Revision 1.3  2001/11/18 00:54:32  pkot
-  Bugfixes. I18n of the user responses. UDH support in libsms. Business Card UDH Type
-
-  Revision 1.2  2001/11/13 16:12:21  pkot
-  Preparing libsms to get to work. 6210/7110 SMS and SMS Folder updates
-
-  Revision 1.1  2001/11/08 16:23:20  pkot
-  New version of libsms. Not functional yet, but it reasonably stable API.
-
-  Revision 1.1  2001/07/09 23:06:26  pkot
-  Moved sms.* files from my hard disk to CVS
-
-
 */
 
 #ifndef __gnokii_sms_h_
@@ -65,8 +36,7 @@
 #define SMS_MAX_ADDRESS_LENGTH      (40)
 
 /* FIXME: what value should be here? (Pawel Kot) */
-//#define GSM_MAX_USER_DATA_HEADER_LENGTH (10)
-#define SMS_MAX_UDH_HEADER_NUMBER 10
+#define SMS_MAX_UDH_NUMBER 10
 
 /*** MEMORY INFO ***/
 
@@ -236,11 +206,22 @@ typedef enum {
 
 /*** MESSAGE CENTER ***/
 
+typedef enum {
+       SMS_FText   = 0x00, /* Plain text message. */
+       SMS_FFax    = 0x22, /* Fax message. */
+       SMS_FVoice  = 0x24, /* Voice mail message. */
+       SMS_FERMES  = 0x25, /* ERMES message. */
+       SMS_FPaging = 0x26, /* Paging. */
+       SMS_FUCI    = 0x2d, /* Email message in 8110i. */
+       SMS_FEmail  = 0x32, /* Email message. */
+       SMS_FX400   = 0x31  /* X.400 message. */
+} SMS_MessageFormat;
+
 typedef struct {
        int                     No;                                     /* Number of the SMSC in the phone memory. */
        SMS_NumberType          Type;
        char                    Name[GSM_MAX_SMS_CENTER_NAME_LENGTH];   /* Name of the SMSC. */
-       SMS_IndicationType      Format;                                 /* SMS is sent as text/fax/paging/email. */
+       SMS_MessageFormat       Format;                                 /* SMS is sent as text/fax/paging/email. */
        SMS_ValidityPeriod      Validity;                               /* Validity of SMS Message. */
        char                    Number[GSM_MAX_SMS_CENTER_LENGTH];      /* Number of the SMSC. */
        char                    Recipient[GSM_MAX_SMS_CENTER_LENGTH];   /* Number of the default recipient. */
@@ -333,7 +314,7 @@ typedef struct {
   
        unsigned short UDH_No;                         /* Number of presend UDHs */
        unsigned int UDH_Length;                       /* Length of the whole UDH */
-       SMS_UDHInfo UDH[SMS_MAX_UDH_HEADER_NUMBER];    /* User Data Header Indicator & User Data Header (9.2.3.23 & 9.2.3.24) */
+       SMS_UDHInfo UDH[SMS_MAX_UDH_NUMBER];           /* User Data Header Indicator & User Data Header (9.2.3.23 & 9.2.3.24) */
 
        SMS_DateTime SMSCTime;                         /* Service Centre Time Stamp (9.2.3.11) */
        SMS_DateTime Time;                             /* Discharge Time (9.2.3.13) */
@@ -346,6 +327,44 @@ typedef struct {
 //     unsigned char Parameter[???];                  /* Parameter Indicator (9.2.3.27); FIXME: how to use it??? */
 } GSM_SMSMessage;
 
+/* Define the layout of the SMS message header */
+typedef struct {
+       bool IsSupported;
+       short MoreMessages;
+       short ReplyViaSameSMSC;
+       short RejectDuplicates;
+       short Report;
+       short Number;
+       short Reference;
+       short PID;
+       short ReportStatus;
+       short Length;
+       short DataCodingScheme;
+       short Validity;
+       short UserDataHeader;
+       short MessageCenter;
+       bool IsMessageCenterCoded;
+       short RemoteNumber;
+       bool IsRemoteNumberCoded;
+       short SMSCTime;
+       short Time;
+       short MemoryType;
+       short Status;
+       short UserData;
+       bool IsUserDataCoded;
+} SMSMessage_Layout;
+
+/* Define set of SMS Headers for the phone series */
+typedef struct {
+       unsigned short Type;
+       SMSMessage_Layout Deliver;
+       SMSMessage_Layout Submit;
+       SMSMessage_Layout DeliveryReport;
+       SMSMessage_Layout Picture;
+} SMSMessage_PhoneLayout;
+
+extern SMSMessage_PhoneLayout layout;
+
 /*** FOLDERS ***/
 
 /* Maximal number of SMS folders */
index 614d028..dabbd24 100755 (executable)
@@ -21,6 +21,7 @@ cp -r ../../gnokii /tmp/gnokii-${VERSION}
 
 # Some files and directories in CVS are useless
 rm -rf /tmp/gnokii-${VERSION}/xkeyb
+rm -rf /tmp/gnokii-${VERSION}/xlogo*
 
 (
    cd /tmp/gnokii-${VERSION}
index 18e4e6f..0edf8be 100644 (file)
@@ -1,3 +1,7 @@
 * Fri 02 Feb 2001 Jan Derfinak <ja@mail.upjs.sk>
 - Fixed smsd to new capability code.
-.
+
+* Mon Dec  3 2001 Pawel Kot <pkot@linuxnews.pl>
+- Updated to the new libsms.
+- Be more friendly to the other postgresql includes and libraries locations.
+- Use libgnokii.so.
index 62d5561..7d737dc 100644 (file)
@@ -1,8 +1,9 @@
 #
-# Makefile for the xGNOKII tool suite.
+# Makefile for the smsd.
 #
 # Copyright (C) 1999 Hugh Blemings & Pavel Janík ml. & Jan Derfinak
 #               2000 Karel Zak
+# $Id$
 #
 
 TOPDIR=..
@@ -12,10 +13,18 @@ CFLAGS += $(PTHREAD_CFLAGS) \
          `glib-config --cflags`
 
 LDFLAGS += $(PTHREAD_LIBS) \
-          `glib-config --libs` -lpq
+          `glib-config --libs`
 
 LDFLAGS += -L$(TOPDIR) -lgnokii
 
+# Change this according to your system
+# FIXME: detect it in configure
+CFLAGS += -I/usr/include/pgsql
+# CFLAGS += -I/usr/include/psql
+LDFLAGS += -L/usr/lib/pgsql -lpq
+# LDFLAGS += -L/usr/lib/psql -lpq
+# LDFLAGS += -lpq
+
 ifdef XPM_LIBS
     LDFLAGS +=$(XPM_LIBS)
 endif
index 4468b3f..8d553b2 100644 (file)
--- a/smsd/db.c
+++ b/smsd/db.c
@@ -15,7 +15,7 @@
 
 #include <string.h>
 #include <glib.h>
-#include <pgsql/libpq-fe.h>
+#include <libpq-fe.h>
 #include "db.h"
 #include "smsd.h"
 #include "gsm-common.h"
@@ -71,7 +71,7 @@ gint DB_InsertSMS (const GSM_SMSMessage * const data)
   buf = g_string_sized_new (128);
   g_string_sprintf (buf, "INSERT INTO inbox VALUES ('%s',
                     '%02d-%02d-%02d %02d:%02d:%02d+01', 'now', '%s', 'f')",
-                    data->Sender, data->Time.Year + 2000, data->Time.Month,
+                    data->RemoteNumber.number, data->Time.Year + 2000, data->Time.Month,
                     data->Time.Day, data->Time.Hour, data->Time.Minute,
                     data->Time.Second, data->MessageText);
   res = PQexec(connIn, buf->str);
@@ -121,15 +121,20 @@ void DB_Look (void)
     GSM_SMSMessage sms;
     
     sms.MessageCenter.No = 1;
-    sms.Type = GST_MO;
-    sms.Class = -1;
-    sms.Compression = false;
-    sms.EightBit = false;
-    sms.Validity = 4320;
-    sms.UDHType = GSM_NoUDH;
-    
-    strncpy (sms.Destination, PQgetvalue (res1, i, 1), GSM_MAX_DESTINATION_LENGTH + 1);
-    sms.Destination[GSM_MAX_DESTINATION_LENGTH] = '\0';
+    sms.Type = SMS_Submit;
+    sms.DCS.Type = SMS_GeneralDataCoding;
+    sms.DCS.u.General.Compressed = false;
+    sms.DCS.u.General.Alphabet = SMS_DefaultAlphabet;
+    sms.DCS.u.General.Class = 0;
+    sms.Validity.VPF = SMS_RelativeFormat;
+    sms.Validity.u.Relative = 4320; /* 4320 minutes == 72 hours */
+    sms.UDH_No = 0;
+    sms.Report = false;
+
+    strncpy (sms.RemoteNumber.number, PQgetvalue (res1, i, 1), GSM_MAX_DESTINATION_LENGTH + 1);
+    sms.RemoteNumber.number[GSM_MAX_DESTINATION_LENGTH] = '\0';
+    if (sms.RemoteNumber.number[0] == '+') sms.RemoteNumber.type = SMS_International;
+    else sms.RemoteNumber.type = SMS_Unknown;
     
     strncpy (sms.MessageText, PQgetvalue (res1, i, 2), GSM_MAX_SMS_LENGTH + 1);
     sms.MessageText[GSM_MAX_SMS_LENGTH] = '\0';
index 8a665f3..ea1c394 100644 (file)
   $Id$
   
   $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:23  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
+  Revision 1.1.1.2  2001/12/05 03:16:54  short
+  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Dec  4 22:45 CET 2001
+
+  Revision 1.5  2001/12/03 15:34:54  pkot
+  Update to libsms and new structure
 
   Revision 1.4  2001/05/30 14:36:47  pkot
   Fix smsd to use StateMachine and let it compile.
 #include "misc.h"
 #include "gsm-common.h"
 #include "gsm-api.h"
-#include "fbus-6110.h"
-#include "fbus-3810.h"
+#include "phones/nk7110.h"
+#include "phones/nk6100.h"
+#include "phones/nk3110.h"
+#include "phones/nk2110.h"
 #include "smsd.h"
 #include "lowlevel.h"
 
@@ -221,7 +226,7 @@ static void RefreshSMS (const gint number)
   {
     msg = g_malloc (sizeof (GSM_SMSMessage));
     msg->MemoryType = GMT_SM;
-    msg->Location = ++i;
+    msg->Number = ++i;
 
     if ((error = GSM->GetSMSMessage (msg)) == GE_NONE)
     {
@@ -304,7 +309,7 @@ gint (*DoAction[])(gpointer) = {
 
 void *Connect (void *a)
 {
-  GSM_SMSStatus SMSStatus = {0, 0};
+  GSM_SMSMemoryStatus SMSStatus = {0, 0};
   PhoneEvent *event;
   GSM_Error error;
 
@@ -326,7 +331,7 @@ void *Connect (void *a)
 
     if (GSM->GetSMSStatus (&SMSStatus) == GE_NONE)
     {
-      if (phoneMonitor.sms.unRead != SMSStatus.UnRead ||
+      if (phoneMonitor.sms.unRead != SMSStatus.Unread ||
           phoneMonitor.sms.number != SMSStatus.Number)
       {
         phoneMonitor.working = TRUE;
@@ -334,7 +339,7 @@ void *Connect (void *a)
         phoneMonitor.working = FALSE;
       }
 
-      phoneMonitor.sms.unRead = SMSStatus.UnRead;
+      phoneMonitor.sms.unRead = SMSStatus.Unread;
     }
 
     while ((event = RemoveEvent ()) != NULL)
index 396253f..ba18ace 100644 (file)
 
 #include "gsm-common.h"
 #include "gsm-api.h"
-#include "fbus-6110.h"
-#include "fbus-3810.h"
+#include "phones/nk7110.h"
+#include "phones/nk6100.h"
+#include "phones/nk3110.h"
+#include "phones/nk2110.h"
 #include "cfgreader.h"
 #include "smsd.h"
 #include "lowlevel.h"
@@ -175,9 +177,9 @@ static void ReadSMS (gpointer d, gpointer userData)
   GSM_SMSMessage *data = (GSM_SMSMessage *) d;
   PhoneEvent *e;
   
-  if (data->Type == GST_MT || data->Type == GST_DR)
+  if (data->Type == SMS_Deliver || data->Type == SMS_Delivery_Report)
   {
-    if (data->Type == GST_DR)
+    if (data->Type == SMS_Delivery_Report)
     {
 #ifdef XDEBUG
       g_print ("Report\n");
index 8375be4..ecfe668 100644 (file)
 
   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:26  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.39  2001/11/08 16:34:20  pkot
-  Updates to work with new libsms
-
-  Revision 1.38  2001/09/14 13:14:03  pkot
-  Xgnokii WM fixes (Martin Lucina)
-
-  Revision 1.37  2001/06/27 23:52:52  pkot
-  7110/6210 updates (Marian Jancar)
-
-  Revision 1.36  2001/06/20 21:27:36  pkot
-  IrDA patch (Marian Jancar)
-
-  Revision 1.35  2001/05/24 20:47:30  chris
-  More updating of 7110 code and some of xgnokii_lowlevel changed over.
-
-  Revision 1.34  2001/03/23 08:24:56  ja
-  New preview for 6210 in xgnokii's logos module.
-
-  Revision 1.33  2001/03/19 23:43:47  pkot
-  Solaris/BSD '#if defined' cleanup
-
-  Revision 1.32  2001/03/13 01:21:39  pkot
-  *BSD updates (Bert Driehuis)
-
-  Revision 1.31  2001/03/05 10:42:02  ja
-  Pavel Machek's vcard and finegrained indicators patch.
-
-  Revision 1.30  2001/01/29 15:22:20  machek
-  Use integer as bitfield instead of struct of int:1.
-
-  Be able to read phonebook saved in gnokii format from xgnokii.
-
-  Revision 1.29  2001/01/15 21:10:20  ja
-  Better status reporting in xgnokii, fixed phone capabilities detection in xgnokii.
-
-  Revision 1.28  2000/12/20 11:49:25  ja
-  Bringing back to life smsd. It was broken after last Pawel update.
-
-  Revision 1.27  2000/12/19 16:18:21  pkot
-  configure script updates and added shared function for configfile reading
-
-  
 */
 
 #include <stdlib.h>  /* for getenv */
@@ -85,7 +39,7 @@
 #include "gsm-api.h"
 #include "cfgreader.h"
 #include "phones/nk7110.h"
-#include "phones/nk6110.h"
+#include "phones/nk6100.h"
 #include "phones/nk3110.h"
 #include "phones/nk2110.h"
 #include "xgnokii.h"
@@ -195,7 +149,7 @@ typedef struct {
   GtkWidget *number;
   GtkWidget *format;
   GtkWidget *validity;
-  GSM_MessageCenter smsSetting[MAX_SMS_CENTER];
+  SMS_MessageCenter smsSetting[MAX_SMS_CENTER];
 } SMSWidgets;
 
 typedef struct {
@@ -223,7 +177,7 @@ static struct ConfigDialogData
   GtkWidget *help;
 } configDialogData;
 
-static GSM_MessageCenter tempMessageSettings;
+static SMS_MessageCenter tempMessageSettings;
 
 
 static inline void Help1 (GtkWidget *w, gpointer data)
@@ -584,32 +538,32 @@ static void ParseSMSCenters (void)
 
     switch (configDialogData.sms.smsSetting[i].Format)
     {
-      case GSMF_Text:
+    case SMS_FText:
         row[2] = g_strdup (_("Text"));
         break;
 
-    case GSMF_Paging:
+    case SMS_FPaging:
         row[2] = g_strdup (_("Paging"));
         break;
 
-    case GSMF_Fax:
+    case SMS_FFax:
         row[2] = g_strdup (_("Fax"));
         break;
 
-    case GSMF_Email:
-    case GSMF_UCI:
+    case SMS_FEmail:
+    case SMS_FUCI:
         row[2] = g_strdup (_("E-Mail"));
         break;
 
-    case GSMF_ERMES:
+    case SMS_FERMES:
         row[2] = g_strdup (_("ERMES"));
         break;
 
-    case GSMF_X400:
+    case SMS_FX400:
         row[2] = g_strdup (_("X.400"));
         break;
 
-    case GSMF_Voice:
+    case SMS_FVoice:
         row[2] = g_strdup (_("Voice"));
         break;
 
@@ -620,27 +574,27 @@ static void ParseSMSCenters (void)
 
     switch (configDialogData.sms.smsSetting[i].Validity)
     {
-      case GSMV_1_Hour:
+      case SMS_V1H:
         row[3] = g_strdup (_("1 h"));
         break;
 
-      case GSMV_6_Hours:
+      case SMS_V6H:
         row[3] = g_strdup (_("6 h"));
         break;
 
-      case GSMV_24_Hours:
+      case SMS_V24H:
         row[3] = g_strdup (_("24 h"));
         break;
 
-      case GSMV_72_Hours:
+      case SMS_V72H:
         row[3] = g_strdup (_("72 h"));
         break;
 
-      case GSMV_1_Week:
+      case SMS_V1W:
         row[3] = g_strdup (_("1 week"));
         break;
 
-      case GSMV_Max_Time:
+      case SMS_VMax:
         row[3] = g_strdup (_("Max. time"));
         break;
 
@@ -1490,28 +1444,28 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data)
     item = gtk_menu_item_new_with_label (_("Text"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetFormat),
-                        (gpointer) GSMF_Text);
+                        (gpointer) SMS_FText);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
     item = gtk_menu_item_new_with_label (_("Fax"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetFormat),
-                        (gpointer) GSMF_Fax);
+                        (gpointer) SMS_FFax);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
     item = gtk_menu_item_new_with_label (_("Paging"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetFormat),
-                        (gpointer) GSMF_Paging);
+                        (gpointer) SMS_FPaging);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
     item = gtk_menu_item_new_with_label (_("E-Mail"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetFormat),
-                        (gpointer) GSMF_Email);
+                        (gpointer) SMS_FEmail);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
@@ -1534,42 +1488,42 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data)
     item = gtk_menu_item_new_with_label (_("Max. Time"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetValidity),
-                        (gpointer) GSMV_Max_Time);
+                        (gpointer) SMS_VMax);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
     item = gtk_menu_item_new_with_label (_("1 h"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetValidity),
-                        (gpointer) GSMV_1_Hour);
+                        (gpointer) SMS_V1H);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
     item = gtk_menu_item_new_with_label (_("6 h"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetValidity),
-                        (gpointer) GSMV_6_Hours);
+                        (gpointer) SMS_V6H);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
     item = gtk_menu_item_new_with_label (_("24 h"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetValidity),
-                        (gpointer) GSMV_24_Hours);
+                        (gpointer) SMS_V24H);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
     item = gtk_menu_item_new_with_label (_("72 h"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetValidity),
-                        (gpointer) GSMV_72_Hours);
+                        (gpointer) SMS_V72H);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
     item = gtk_menu_item_new_with_label (_("1 week"));
     gtk_signal_connect (GTK_OBJECT (item), "activate",
                         GTK_SIGNAL_FUNC(SetValidity),
-                        (gpointer) GSMV_1_Week);
+                        (gpointer) SMS_V1W);
     gtk_widget_show (item);
     gtk_menu_append (GTK_MENU (menu), item);
 
@@ -1589,22 +1543,22 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data)
   switch (configDialogData.sms.smsSetting
           [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Format)
   {
-    case GSMF_Text:
+    case SMS_FText:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.format),
                                    0);
       break;
 
-    case GSMF_Paging:
+    case SMS_FPaging:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.format),
                                    2);
       break;
 
-    case GSMF_Fax:
+    case SMS_FFax:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.format),
                                    1);
       break;
 
-    case GSMF_Email:
+    case SMS_FEmail:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.format),
                                    3);
       break;
@@ -1617,32 +1571,32 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data)
   switch (configDialogData.sms.smsSetting
           [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Validity)
   {
-    case GSMV_1_Hour:
+    case SMS_V1H:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity),
                                    1);
       break;
 
-    case GSMV_6_Hours:
+    case SMS_V6H:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity),
                                    2);
       break;
 
-    case GSMV_24_Hours:
+    case SMS_V24H:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity),
                                    3);
       break;
 
-    case GSMV_72_Hours:
+    case SMS_V72H:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity),
                                    4);
       break;
 
-    case GSMV_1_Week:
+    case SMS_V1W:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity),
                                    5);
       break;
 
-    case GSMV_Max_Time:
+    case SMS_VMax:
       gtk_option_menu_set_history (GTK_OPTION_MENU (configDialogData.sms.validity),
                                    0);
       break;
@@ -2439,23 +2393,8 @@ static void ReadConfig (void)
   
 #ifndef WIN32
   xgnokiiConfig.xgnokiidir = DefaultXGnokiiDir;
-
-  if (strstr(FB38_Information.Models, xgnokiiConfig.model) != NULL)
-  {
-    max_phonebook_number_length = 30;
-    max_phonebook_sim_number_length = 30;
-  }
-  else 
 #endif
-  if (strstr(FB61_Information.Models, xgnokiiConfig.model) != NULL)
-  {
-    max_phonebook_number_length = FB61_MAX_PHONEBOOK_NUMBER_LENGTH;
-    max_phonebook_sim_number_length = FB61_MAX_PHONEBOOK_NUMBER_LENGTH;
-  }
-  else
-  {
-    max_phonebook_number_length = max_phonebook_sim_number_length = GSM_MAX_PHONEBOOK_NUMBER_LENGTH;
-  }
+  max_phonebook_number_length = max_phonebook_sim_number_length = GSM_MAX_PHONEBOOK_NUMBER_LENGTH;
 
   xgnokiiConfig.callerGroups[0] = xgnokiiConfig.callerGroups[1] =
   xgnokiiConfig.callerGroups[2] = xgnokiiConfig.callerGroups[3] =
index d1ed2ec..f8445b7 100644 (file)
@@ -47,7 +47,7 @@ typedef struct {
   gchar *maxSIMLen;  /* Max length of names on SIM card */
   gchar *maxPhoneLen;/* Max length of names in phone */
   gchar *locale;
-  GSM_MessageCenter smsSetting[MAX_SMS_CENTER];
+  SMS_MessageCenter smsSetting[MAX_SMS_CENTER];
   UserInf user;
   gchar *callerGroups[6];
   gint   smsSets:4;
index c34d5f7..6baacfc 100644 (file)
@@ -1,5 +1,7 @@
 /*
 
+  $Id$
+  
   X G N O K I I
 
   A Linux/Unix GUI for Nokia mobile phones.
@@ -8,37 +10,6 @@
 
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
-  $Id$
-  
-  $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:28  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.31  2001/11/14 10:46:12  pkot
-  Small cleanup with __unices__
-
-  Revision 1.30  2001/09/14 13:14:04  pkot
-  Xgnokii WM fixes (Martin Lucina)
-
-  Revision 1.29  2001/03/23 08:24:56  ja
-  New preview for 6210 in xgnokii's logos module.
-
-  Revision 1.28  2001/03/19 23:43:47  pkot
-  Solaris/BSD '#if defined' cleanup
-
-  Revision 1.27  2001/03/13 01:21:39  pkot
-  *BSD updates (Bert Driehuis)
-
-  Revision 1.26  2001/03/05 10:42:03  ja
-  Pavel Machek's vcard and finegrained indicators patch.
-
-  Revision 1.25  2001/02/12 15:13:46  chris
-  Fixed my bug in xgnokii_contacts.c and added <string.h> to tekram.c
-
-  Revision 1.24  2001/02/02 08:09:57  ja
-  New dialogs for 6210/7110 in xgnokii. Fixed the smsd for new capabilty code.
-
-  
 */
 
 
@@ -1921,7 +1892,7 @@ static GtkWidget *CreateSaveQuestionDialog (GtkSignalFunc SaveFunc,
 static void OkExtPbkDialog (GtkWidget *w, gpointer data) {
 
   ExtPbkDialog *d=(ExtPbkDialog*)data;
-  GSM_NumberType numtype;
+  SMS_NumberType numtype;
   gint i, found=999;
   gchar *chars;
 
@@ -2711,7 +2682,7 @@ static bool ParseLine (GSM_PhonebookEntry *entry, gint *num, gchar *buf)
         return FALSE;
       if (i >= len)
         return FALSE;
-      entry->SubEntries[entry->SubEntriesCount].NumberType=(GSM_NumberType)strtol (s_num, &endptr, 10);
+      entry->SubEntries[entry->SubEntriesCount].NumberType=(SMS_NumberType)strtol (s_num, &endptr, 10);
       if (s_num == endptr)
         return FALSE;
       buf += (i + 1);
index 59f5c7c..7ce2616 100644 (file)
@@ -1,5 +1,7 @@
 /*
 
+  $Id$
+  
   X G N O K I I
 
   A Linux/Unix GUI for Nokia mobile phones.
@@ -8,16 +10,6 @@
 
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
-  $Id$
-  
-  $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:28  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.12  2001/02/02 08:09:57  ja
-  New dialogs for 6210/7110 in xgnokii. Fixed the smsd for new capabilty code.
-
-  
 */
 
 #ifndef XGNOKII_CONTACTS_H
index 0d2a90b..cc221ac 100644 (file)
@@ -1,6 +1,6 @@
 /*
 
-   $Id$
+  $Id$
    
   X G N O K I I
 
 
   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:31  short
-   :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-   Revision 1.9  2001/09/14 12:53:00  pkot
-   New preview logos.
-   Localization fixes.
-   Set valid operator on logos xgnokii screen.
-
-   Revision 1.8  2001/05/24 20:47:31  chris
-   More updating of 7110 code and some of xgnokii_lowlevel changed over.
-
-   Revision 1.7  2001/03/23 08:24:56  ja
-   New preview for 6210 in xgnokii's logos module.
-
-         
 */
           
 #include <stdio.h>
index af0791f..a606d73 100644 (file)
 
   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:33  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.19  2001/09/14 13:09:26  pkot
-  Xgnokii calendar updates
-
-  Revision 1.18  2001/06/20 21:27:36  pkot
-  IrDA patch (Martin Jancar)
-
-  Revision 1.17  2001/06/10 11:40:06  machek
-  xgnokii converted to new structure w.r.t. SMS messages.
-
-  Revision 1.16  2001/05/24 20:47:31  chris
-  More updating of 7110 code and some of xgnokii_lowlevel changed over.
-
-  Revision 1.15  2001/03/23 08:24:57  ja
-  New preview for 6210 in xgnokii's logos module.
-
-  Revision 1.14  2001/03/21 23:36:09  chris
-  Added the statemachine
-  This will break gnokii --identify and --monitor except for 6210/7110
-
-  Revision 1.13  2001/03/05 10:42:03  ja
-  Pavel Machek's vcard and finegrained indicators patch.
-
-  Revision 1.12  2001/02/02 08:09:57  ja
-  New dialogs for 6210/7110 in xgnokii. Fixed the smsd for new capabilty code.
-
-  Revision 1.11  2001/01/29 15:22:20  machek
-  Use integer as bitfield instead of struct of int:1.
-
-  Be able to read phonebook saved in gnokii format from xgnokii.
-
-  Revision 1.10  2001/01/17 02:54:56  chris
-  More 7110 work.  Use with care! (eg it is not possible to delete phonebook entries)
-  I can now edit my phonebook in xgnokii but it is 'work in progress'.
-
-  Revision 1.9  2001/01/15 21:10:20  ja
-  Better status reporting in xgnokii, fixed phone capabilities detection in xgnokii.
-
-  
 */
 
 #include <unistd.h>
@@ -61,8 +19,8 @@
 #include "misc.h"
 #include "gsm-common.h"
 #include "gsm-api.h"
-#include "fbus-6110.h"
-#include "fbus-3810.h"
+//#include "6110.h"
+//#include "fbus-3810.h"
 #include "xgnokii_lowlevel.h"
 #include "xgnokii.h"
 #include "gsm-statemachine.h"
@@ -310,7 +268,7 @@ static void RefreshSMS (const gint number)
     GSM_DataClear(&gdat);
     msg = g_malloc (sizeof (GSM_SMSMessage));
     msg->MemoryType = GMT_SM;
-    msg->Location = ++i;
+    msg->Number = ++i;
     gdat.SMSMessage = msg;
 
     if ((error = SM_Functions(GOP_GetSMS, &gdat, &statemachine)) == GE_NONE)
@@ -856,13 +814,14 @@ static gint A_SetAlarm (gpointer data)
 
 static gint A_SendKeyStroke (gpointer data)
 {
-  gchar *buf = (gchar *) data;
+  /*  gchar *buf = (gchar *) data;*/
 
-  if (buf) 
+  /* This is wrong. FIX IT */
+  /*  if (buf) 
   {
     FB61_TX_SendMessage(0x07, 0x0c, buf);
     g_free (buf);
-  }
+    }*/
 
   return (0);
 }
@@ -970,7 +929,7 @@ void *GUI_Connect (void *a)
   GSM_BatteryUnits batt_units = GBU_Percentage;
 
   GSM_DateTime Alarm;
-  GSM_SMSStatus SMSStatus = {0, 0};
+  GSM_SMSMemoryStatus SMSStatus = {0, 0};
   gchar number[INCALL_NUMBER_LENGTH];
   PhoneEvent *event;
   GSM_Error error;
@@ -1033,7 +992,7 @@ void *GUI_Connect (void *a)
 
     if (SM_Functions(GOP_GetSMSStatus,&data,&statemachine) == GE_NONE)
     {
-      if (phoneMonitor.sms.unRead != SMSStatus.UnRead ||
+      if (phoneMonitor.sms.unRead != SMSStatus.Unread ||
           phoneMonitor.sms.number != SMSStatus.Number)
       {
         phoneMonitor.working = _("Refreshing SMSes...");
@@ -1041,7 +1000,7 @@ void *GUI_Connect (void *a)
         phoneMonitor.working = NULL;
       }
 
-      phoneMonitor.sms.unRead = SMSStatus.UnRead;
+      phoneMonitor.sms.unRead = SMSStatus.Unread;
     }
 
     if (SM_Functions(GOP_GetIncomingCallNr,&data,&statemachine) == GE_NONE)
index 8f848dd..bf49e28 100644 (file)
 
   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:31  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  Revision 1.9  2001/09/14 13:09:26  pkot
-  Xgnokii calendar updates
-
-  Revision 1.8  2001/02/02 08:09:57  ja
-  New dialogs for 6210/7110 in xgnokii. Fixed the smsd for new capabilty code.
-
-  Revision 1.7  2001/01/29 15:22:22  machek
-  Use integer as bitfield instead of struct of int:1.
-
-  Be able to read phonebook saved in gnokii format from xgnokii.
-
-  Revision 1.6  2001/01/17 02:54:57  chris
-  More 7110 work.  Use with care! (eg it is not possible to delete phonebook entries)
-  I can now edit my phonebook in xgnokii but it is 'work in progress'.
-
-  Revision 1.5  2001/01/15 21:10:20  ja
-  Better status reporting in xgnokii, fixed phone capabilities detection in xgnokii.
-
-  
 */
 
 #ifndef XGNOKII_LOWLEVEL_H
@@ -98,7 +75,7 @@ typedef struct {
 } D_SMSMessage;
 
 typedef struct {
-  GSM_MessageCenter *center;
+  SMS_MessageCenter *center;
   GSM_Error status;
 } D_SMSCenter;
 
index 39c2e40..b310434 100644 (file)
@@ -1,5 +1,7 @@
 /*
 
+  $Id$
+
   X G N O K I I
 
   A Linux/Unix GUI for Nokia mobile phones.
@@ -8,9 +10,6 @@
 
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
-  Last modification: Sun Apr 30 2000
-  Modified by Jan Derfinak
-
 */
 #include <unistd.h>
 #include <locale.h>
@@ -210,9 +209,9 @@ static void InsertInboxElement (gpointer d, gpointer userData)
 {
   GSM_SMSMessage *data = (GSM_SMSMessage *) d;
   MessagePointers *msgPtrs;
-  GSM_DateTime *dt;
+  SMS_DateTime *dt;
 
-  if (data->Type == GST_MT || data->Type == GST_DR)
+  if (data->Type == SMS_Deliver || data->Type == SMS_Delivery_Report)
   {
 /*    if (data->Type == GST_MT && data->UDHType == GSM_ConcatenatedMessages)
     {
@@ -231,7 +230,7 @@ static void InsertInboxElement (gpointer d, gpointer userData)
     {
       gchar *row[4];
 
-      if (data->Type == GST_DR)
+      if (data->Type == SMS_Delivery_Report)
       {
         row[0] = g_strdup (_("report"));
         dt = &(data->SMSCTime);
@@ -257,19 +256,19 @@ static void InsertInboxElement (gpointer d, gpointer userData)
                                   dt->Day, dt->Month, dt->Year,
                                   dt->Hour, dt->Minute, dt->Second);
 
-      row[2] = GUI_GetName (data->Sender);
+      row[2] = GUI_GetName (data->RemoteNumber.number);
       if (row[2] == NULL)
-        row[2] = data->Sender;
+        row[2] = data->RemoteNumber.number;
       row[3] = data->MessageText;
 
       gtk_clist_append (GTK_CLIST (SMS.smsClist), row);
       msgPtrs = (MessagePointers *) g_malloc (sizeof (MessagePointers));
       msgPtrs->count = msgPtrs->number = 1;
-      msgPtrs->validity = data->Validity;
-      msgPtrs->class = data->Class;
-      strcpy (msgPtrs->sender, data->Sender);
+      msgPtrs->validity = data->Validity.u.Relative;
+      //      msgPtrs->class = data->Class;
+      strcpy (msgPtrs->sender, data->RemoteNumber.number);
       msgPtrs->msgPtr = (gint *) g_malloc (sizeof (gint));
-      *(msgPtrs->msgPtr) = data->MessageNumber;
+      *(msgPtrs->msgPtr) = (int)data->Number;
       gtk_clist_set_row_data_full (GTK_CLIST (SMS.smsClist), SMS.row_i++,
                                    msgPtrs, DestroyMsgPtrs);
       g_free (row[0]);
@@ -298,7 +297,7 @@ static void InsertOutboxElement (gpointer d, gpointer userData)
   GSM_SMSMessage *data = (GSM_SMSMessage *) d;
   MessagePointers *msgPtrs;
 
-  if (data->Type == GST_MO)
+  if (data->Type == SMS_Submit)
   {
     gchar *row[4];
 
@@ -313,11 +312,11 @@ static void InsertOutboxElement (gpointer d, gpointer userData)
     gtk_clist_append( GTK_CLIST (SMS.smsClist), row);
     msgPtrs = (MessagePointers *) g_malloc (sizeof (MessagePointers));
     msgPtrs->count = msgPtrs->number = 1;
-    msgPtrs->validity = data->Validity;
-    msgPtrs->class = data->Class;
-    strcpy (msgPtrs->sender, data->Sender);
+    msgPtrs->validity = data->Validity.u.Relative;
+    //    msgPtrs->class = data->Class;
+    strcpy (msgPtrs->sender, data->RemoteNumber.number);
     msgPtrs->msgPtr = (gint *) g_malloc (sizeof (gint));
-    *(msgPtrs->msgPtr) = data->MessageNumber;
+    *(msgPtrs->msgPtr) = (int)data->Number;
     gtk_clist_set_row_data_full (GTK_CLIST (SMS.smsClist), SMS.row_i++,
                                  msgPtrs, DestroyMsgPtrs);
     g_free (row[0]);
@@ -423,13 +422,15 @@ static void OkDeleteSMSDialog (GtkWidget *widget, gpointer data)
     sel = sel->next;
     for (count = 0; count < ((MessagePointers *) gtk_clist_get_row_data (GTK_CLIST (SMS.smsClist), row))->count; count++)
     {
+      int number;
       message = (GSM_SMSMessage *) g_malloc (sizeof (GSM_SMSMessage));
-      message->Location = *(((MessagePointers *) gtk_clist_get_row_data (GTK_CLIST (SMS.smsClist), row))->msgPtr + count);
-      if (message->Location == -1)
+      number = *(((MessagePointers *) gtk_clist_get_row_data (GTK_CLIST (SMS.smsClist), row))->msgPtr + count);
+      if (number == -1)
       {
         g_free (message);
         continue;
       }
+      message->Number = number;
       message->MemoryType = GMT_SM;
 
       e = (PhoneEvent *) g_malloc (sizeof (PhoneEvent));
@@ -916,7 +917,7 @@ static gint SendSMSCore (GSM_SMSMessage *sms)
 
 #ifdef XDEBUG
   g_print ("Address: %s\nText: %s\nDelivery report: %d\nSMS Center: %d\n",
-           sms->Destination,
+           sms->RemoteNumber.number,
            sms->MessageText,
            GTK_TOGGLE_BUTTON (sendSMS.report)->active,
            sendSMS.center);
@@ -928,13 +929,13 @@ static gint SendSMSCore (GSM_SMSMessage *sms)
   if (error != GE_SMSSENDOK)
   {
     gchar *buf = g_strdup_printf (_("SMS send to %s failed\n(error=%d)"),
-                                  sms->Destination, error);
+                                  sms->RemoteNumber.number, error);
     gtk_label_set_text (GTK_LABEL(errorDialog.text), buf);
     gtk_widget_show (errorDialog.dialog);
     g_free (buf);
   }
   else
-    g_print ("Message sent to: %s\n", sms->Destination);
+    g_print ("Message sent to: %s\n", sms->RemoteNumber.number);
 
   return (error);
 }
@@ -944,7 +945,7 @@ static void SendSMS (void)
 {
   GSM_SMSMessage sms;
   AddressPar aps;
-  char udh[GSM_MAX_USER_DATA_HEADER_LENGTH];
+  char udh[256];
   GSList *r;
   gchar *text, *number;
   gchar **addresses;
@@ -983,23 +984,28 @@ static void SendSMS (void)
     sms.MessageCenter.No = 0;
 
     if (GTK_TOGGLE_BUTTON (sendSMS.report)->active)
-      sms.Type = GST_DR;
+      sms.Report = true;
     else
-      sms.Type = GST_MO;
+      sms.Report = false;
+    sms.Type = SMS_Submit;
 
-    sms.Class = -1;
-    sms.Compression = false;
-    sms.EightBit = false;
-    sms.Validity = sms.MessageCenter.Validity;
+    sms.DCS.Type = SMS_GeneralDataCoding;
+    sms.DCS.u.General.Compressed = false;
+    sms.DCS.u.General.Alphabet = SMS_DefaultAlphabet;
+    sms.DCS.u.General.Class = 0;
+    sms.MessageCenter.No = 1;
+    sms.Validity.VPF = SMS_RelativeFormat;
+    sms.Validity.u.Relative = sms.MessageCenter.Validity; /* 4320 minutes == 72 hours */
+    sms.UDH_No = 0;
 
-    strncpy (sms.Destination, number, GSM_MAX_DESTINATION_LENGTH + 1);
-    sms.Destination[GSM_MAX_DESTINATION_LENGTH] = '\0';
+    strncpy (sms.RemoteNumber.number, number, GSM_MAX_DESTINATION_LENGTH + 1);
+    sms.RemoteNumber.number[GSM_MAX_DESTINATION_LENGTH] = '\0';
 
     if (l > GSM_MAX_SMS_LENGTH)
     {
       if (longSMS)
       {
-        sms.UDHType = GSM_ConcatenatedMessages;
+        sms.UDH[0].Type = SMS_ConcatenatedMessages;
         nr_msg = ((l - 1) / 153) + 1;
         udh[0] = 0x05; // UDH length
         udh[1] = 0x00; // concatenated messages (IEI)
@@ -1013,12 +1019,12 @@ static void SendSMS (void)
         {
           udh[5] = j + 1;
 
-          memcpy(sms.UDH,udh,offset);
-          strncpy (sms.MessageText, text + (j * 153), 153);
+          memcpy(sms.MessageText,udh,offset);
+          strncpy (sms.MessageText+offset, text + (j * 153), 153);
           sms.MessageText[153] = '\0';
 
           buf = g_strdup_printf (_("Sending SMS to %s (%d/%d) ...\n"),
-                                 sms.Destination, j + 1, nr_msg);
+                                 sms.RemoteNumber.number, j + 1, nr_msg);
           gtk_label_set_text (GTK_LABEL (infoDialog.text), buf);
           gtk_widget_show_now (infoDialog.dialog);
           g_free (buf);
@@ -1039,7 +1045,7 @@ static void SendSMS (void)
       }
       else
       {
-        sms.UDHType = GSM_NoUDH;
+        sms.UDH_Length = 0;
         nr_msg = ((l - 1) / 153) + 1;
         if (nr_msg > 99) // We have place only for 99 messages in header.
           nr_msg = 99;
@@ -1055,7 +1061,7 @@ static void SendSMS (void)
           sms.MessageText[160] = '\0';
 
           buf = g_strdup_printf (_("Sending SMS to %s (%d/%d) ...\n"),
-                                 sms.Destination, j + 1, nr_msg);
+                                 sms.RemoteNumber.number, j + 1, nr_msg);
           gtk_label_set_text (GTK_LABEL (infoDialog.text), buf);
           gtk_widget_show_now (infoDialog.dialog);
           g_free (buf);
@@ -1077,11 +1083,11 @@ static void SendSMS (void)
     }
     else
     {
-      sms.UDHType = GSM_NoUDH;
+      sms.UDH_Length = 0;
       strncpy (sms.MessageText, text, GSM_MAX_SMS_LENGTH + 1);
       sms.MessageText[GSM_MAX_SMS_LENGTH] = '\0';
 
-      buf = g_strdup_printf (_("Sending SMS to %s ...\n"), sms.Destination);
+      buf = g_strdup_printf (_("Sending SMS to %s ...\n"), sms.RemoteNumber.number);
       gtk_label_set_text (GTK_LABEL (infoDialog.text), buf);
       gtk_widget_show_now (infoDialog.dialog);
       g_free (buf);
@@ -1360,7 +1366,7 @@ static void ForwardSMS (void)
 /*
 static inline gint CompareSMSMessageLocation (gconstpointer a, gconstpointer b)
 {
-  return !(((GSM_SMSMessage *) a)->Location == ((GSM_SMSMessage *) b)->Location);
+  return !(((GSM_SMSMessage *) a)->Number == ((GSM_SMSMessage *) b)->Number);
 }
 */
 
@@ -1392,7 +1398,7 @@ static void ReplySMS (void)
 
   gtk_text_thaw (GTK_TEXT (sendSMS.smsSendText));
 
-  //msg.Location = *(((MessagePointers *) gtk_clist_get_row_data(GTK_CLIST (SMS.smsClist),
+  //msg.Number = *(((MessagePointers *) gtk_clist_get_row_data(GTK_CLIST (SMS.smsClist),
   //               GPOINTER_TO_INT (GTK_CLIST (SMS.smsClist)->selection->data)))->msgPtr);
 
   //r = g_slist_find_custom (SMS.messages, &msg, CompareSMSMessageLocation);
index 42fc7f8..817d5c7 100644 (file)
@@ -1,5 +1,7 @@
 /*
 
+  $Id$
+
   X G N O K I I
 
   A Linux/Unix GUI for Nokia mobile phones.
 
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
-  Last modification: Sun May 14 2000
-  Modified by Jan Derfinak
-
 */
 
 #include <string.h>
 #include <gtk/gtk.h>
 #include "misc.h"
-#include "fbus-6110.h"
+#include "links/fbus.h"
 #include "xgnokii_common.h"
 #include "xgnokii.h"
 #include "xgnokii_lowlevel.h"
@@ -190,7 +189,7 @@ void GUI_ShowXkeyb (void)
 
 static gint ButtonEvent (GtkWidget *widget, GdkEventButton *event)
 {
-  unsigned char req[] = {FB61_FRAME_HEADER, 0x42, 0x01, 0x00, 0x01};
+  unsigned char req[] = {FBUS_FRAME_HEADER, 0x42, 0x01, 0x00, 0x01};
   register gint i = 0;
 
   if (button == NULL)