Update: orig2001_12_04_22_45 -> orig2001_12_14_20_46
[gnokii.git] / include / gsm-sms.h
index 3ff3ba2..3cde6f3 100644 (file)
 
   Include file for SMS library.
 
-  $Log$
-  Revision 1.1.1.1  2001/11/25 21:59:21  short
-  :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
-
-  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_
@@ -62,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 ***/
 
@@ -201,12 +174,12 @@ typedef struct {
 /* Validity of SMS Messages. */
 
 typedef enum {
-        SMS_V1H   = 0x0b,
-        SMS_V6H   = 0x47,
-        SMS_V24H  = 0xa7,
-        SMS_V72H  = 0xa9,
-        SMS_V1W   = 0xad,
-        SMS_VMax  = 0xff
+       SMS_V1H   = 0x0b,
+       SMS_V6H   = 0x47,
+       SMS_V24H  = 0xa7,
+       SMS_V72H  = 0xa9,
+       SMS_V1W   = 0xad,
+       SMS_VMax  = 0xff
 } SMS_ValidityPeriod;
 
 typedef struct {
@@ -233,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. */
@@ -306,7 +290,7 @@ typedef enum {
        GMT_F19 = 0xB9,
        GMT_F20 = 0xC1 /* 20th CUSTOM FOLDER in 6210/7110 */
 } SMS_MemoryType;
-        
+
 /* Define datatype for SMS messages, describes precisely GSM Spec 03.40 */
 typedef struct {
        /* Specification fields */
@@ -330,19 +314,57 @@ 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) */
 
        /* Other fields */
-        SMS_MemoryType MemoryType;                     /* memoryType (for 6210/7110: folder indicator */
+       SMS_MemoryType MemoryType;                     /* memoryType (for 6210/7110: folder indicator */
        SMS_MessageStatus Status;                      /* Status of the message: sent/read or unsent/unread */
 
 //     SMS_CommandType Command;                       /* Command Type - 8 bits (9.2.3.19); FIXME: use it!!!! */
 //     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 */
@@ -377,11 +399,13 @@ typedef struct {
 
 extern int EncodePDUSMS(GSM_SMSMessage *SMS, char *frame);
 extern GSM_Error DecodePDUSMS(unsigned char *message, GSM_SMSMessage *SMS, int MessageLength);
+
 /* Do not use these yet */
 extern GSM_Error EncodeTextSMS();
 extern GSM_Error DecodeTextSMS(unsigned char *message, GSM_SMSMessage *SMS);
 
-/* FIXME: make this static */
+/* We really do need this in the other code */
 extern char *GetBCDNumber(u8 *Number);
+extern int SemiOctetPack(char *Number, unsigned char *Output, SMS_NumberType type);
 
 #endif /* __gnokii_sms_h_ */