7 A Linux/Unix toolset and driver for Nokia mobile phones.
9 Copyright (C) 2001 Pawe³ Kot <pkot@linuxnews.pl>
11 Released under the terms of the GNU GPL, see file COPYING for more details.
13 Include file for SMS library.
16 Revision 1.1.1.6 2002/04/03 00:08:20 short
17 Found in "gnokii-working" directory, some November-patches version
19 Revision 1.1 2001/11/08 16:23:20 pkot
20 New version of libsms. Not functional yet, but it reasonably stable API.
22 Revision 1.1 2001/07/09 23:06:26 pkot
23 Moved sms.* files from my hard disk to CVS
28 #ifndef __gnokii_sms_h_
29 #define __gnokii_sms_h_
32 #include "gsm-error.h"
34 /* Maximum length of SMS center name */
36 #define GSM_MAX_SMS_CENTER_NAME_LENGTH (20)
38 /* Limits of SMS messages. */
40 #define GSM_MAX_SMS_CENTER_LENGTH (40)
41 #define GSM_MAX_SENDER_LENGTH (40)
42 #define GSM_MAX_DESTINATION_LENGTH (40)
44 #define GSM_MAX_SMS_LENGTH (160)
45 #define GSM_MAX_8BIT_SMS_LENGTH (140)
47 #define SMS_MAX_ADDRESS_LENGTH (40)
49 /* FIXME: what value should be here? (Pawel Kot) */
50 //#define GSM_MAX_USER_DATA_HEADER_LENGTH (10)
51 #define SMS_MAX_UDH_HEADER_NUMBER 10
56 int Unread; /* Number of unread messages */
57 int Number; /* Number of all messages */
58 } GSM_SMSMemoryStatus;
60 /*** DATE AND TIME ***/
63 int Year; /* The complete year specification - e.g. 1999. Y2K :-) */
64 int Month; /* January = 1 */
69 int Timezone; /* The difference between local time and GMT */
72 /*** USER DATA HEADER ***/
74 /* types of User Data Header */
77 SMS_ConcatenatedMessages = 0x01,
79 SMS_CallerIDLogo = 0x03,
81 SMS_VoiceMessage = 0x05,
82 SMS_FaxMessage = 0x06,
83 SMS_EmailMessage = 0x07,
84 SMS_OtherMessage = 0x08,
92 unsigned short ReferenceNumber;
93 unsigned short MaximumNumber;
94 unsigned short CurrentNumber;
95 } ConcatenatedShortMessage; /* SMS_ConcatenatedMessages */
98 unsigned short MessageCount;
99 } SpecialSMSMessageIndication; /* SMS_VoiceMessage, SMS_FaxMessage, SMS_EmailMessage, SMS_OtherMessage */
103 } Logo; /* SMS_OpLogo, SMS_CallerIDLogo */
106 } Ringtone; /* SMS_Ringtone */
111 SMS_PID, /* Set Protocol Identifier to `Return Call Message' */
112 SMS_DCS, /* Set Data Coding Scheme "to indicate the type of message waiting and whether there are some messages or no messages" */
113 SMS_UDH /* Use User Data Header - Special SMS Message Indication; the maximium level of information, may not be supported by all phones */
114 } SMS_MessageWaitingType;
116 /*** DATA CODING SCHEME ***/
119 SMS_GeneralDataCoding,
121 } SMS_DataCodingSchemeType;
124 SMS_DefaultAlphabet = 0x00,
130 SMS_VoiceMail = 0x00,
135 } SMS_IndicationType;
138 SMS_DataCodingSchemeType Type;
141 unsigned short Class; /* 0 - no class
147 SMS_AlphabetType Alphabet;
151 SMS_AlphabetType Alphabet; /* ucs16 not supported */
153 SMS_IndicationType Type;
156 } SMS_DataCodingScheme;
158 /*** VALIDITY PERIOD ***/
161 SMS_NoValidityPeriod = 0x00,
162 SMS_EnhancedFormat = 0x01,
163 SMS_RelativeFormat = 0x02,
164 SMS_AbsoluteFormat = 0x03
165 } SMS_ValidityPeriodFormat;
168 SMS_EnhancedNoValidityPeriod = 0x00,
169 SMS_EnhancedRelativeFormat = 0x01,
170 SMS_EnhancedRelativeSeconds = 0x02, /* Only one ocetet more is used */
171 SMS_EnhancedRelativeSemiOctet = 0x03 /* 3 octets contain relative time in hours, minutes and seconds in semi-octet representation */
172 } SMS_EnhancedValidityPeriodType;
175 bool extension; /* we need to set it to 0 at the moment; FIXME: how to handle `1' here? */
177 SMS_EnhancedValidityPeriodType type;
179 unsigned short relative;
180 unsigned short seconds;
183 } SMS_EnhancedValidityPeriod;
185 /* Validity of SMS Messages. */
194 } SMS_ValidityPeriod;
197 SMS_ValidityPeriodFormat VPF;
199 SMS_EnhancedValidityPeriod Enhanced;
200 SMS_ValidityPeriod Relative; /* 8 bit */
201 SMS_DateTime Absolute;
203 } SMS_MessageValidity;
206 /*** MESSAGE CENTER ***/
209 int No; /* Number of the SMSC in the phone memory. */
210 char Name[GSM_MAX_SMS_CENTER_NAME_LENGTH]; /* Name of the SMSC. */
211 SMS_IndicationType Format; /* SMS is sent as text/fax/paging/email. */
212 SMS_ValidityPeriod Validity; /* Validity of SMS Message. */
213 char Number[GSM_MAX_SMS_CENTER_LENGTH]; /* Number of the SMSC. */
214 char Recipient[GSM_MAX_SMS_CENTER_LENGTH]; /* Number of the default recipient. */
218 /*** SHORT MESSAGE CORE ***/
220 /* This data-type is used to specify the type of the number. See the official
221 GSM specification 03.40, version 6.1.0, section 9.1.2.5, page 35-37. */
223 SMS_Unknown = 0x81, /* Unknown number */
224 SMS_International = 0x91, /* International number */
225 SMS_National = 0xa1, /* National number */
226 SMS_Network = 0xb1, /* Network specific number */
227 SMS_Subscriber = 0xc1, /* Subscriber number */
228 SMS_Alphanumeric = 0xd0, /* Alphanumeric number */
229 SMS_Abbreviated = 0xe1 /* Abbreviated number */
234 char number[SMS_MAX_ADDRESS_LENGTH];
237 typedef enum { /* Bits meaning */
238 SMS_Deliver = 0x00, /* 00 0 First 2 digits are taken from */
239 SMS_Delivery_Report = 0x01, /* 00 1 GSM 03.40 version 6.1.0 Release 1997 */
240 SMS_Submit = 0x02, /* 01 0 */
241 SMS_Submit_Report = 0x03, /* 01 1 */
242 SMS_Command = 0x04, /* 10 0 mark a report */
243 SMS_Status_Report = 0x05, /* 10 1 Section 9.2.3.1; 3rd digit is to */
247 SMS_Enquiry = 0x00, /* Enquiry relating to previosly submitted short message; sets SRR to 1 */
248 SMS_CancelStatusReport = 0x01, /* Cancel Status Report Request relating to previously submitted short message; sets SRR to 0 */
249 SMS_DeleteSM = 0x02, /* Delete previousle submitted Short Message; sets SRR to 0 */
250 SMS_EnableStatusReport = 0x03 /* Enable Status Report Request relating to previously submitted short message; sets SRR to 0 */
254 SMS_CommandType Type;
255 } SMS_MessageCommand;
257 /* Datatype for SMS status */
269 /* Define datatype for SMS messages, describes precisely GSM Spec 03.40 */
271 /* Specification fields */
272 SMS_MessageType Type; /* Message Type Indicator - 2 bits (9.2.3.1) */
273 bool MoreMessages; /* More Messages to Send (9.2.3.2) */
274 bool ReplyViaSameSMSC; /* Reply Path (9.2.3.17) - `Reply via same centre' in the phone */
275 bool RejectDuplicates; /* Reject Duplicates (9.2.3.25) */
276 bool Report; /* Status Report (9.2.3.4, 9.2.3.5 & 9.2.3.26) - `Delivery reports' in the phone */
278 unsigned short Number; /* Message Number - 8 bits (9.2.3.18) */
279 unsigned short Reference; /* Message Reference - 8 bit (9.2.3.6) */
280 unsigned short PID; /* Protocol Identifier - 8 bit (9.2.3.9) */
281 unsigned short ReportStatus; /* Status - 8 bit (9.2.3.15), Failure Cause (9.2.3.22) */
282 unsigned short Length; /* User Data Length (9.2.3.16), Command Data Length (9.2.3.20) */
284 SMS_MessageCenter MessageCenter; /* SMSC Address (9.2.3.7, 9.2.3.8, 9.2.3.14) */
285 SMS_Number RemoteNumber; /* Origination, destination, Recipient Address (9.2.3.7, 9.2.3.8, 9.2.3.14) */
286 unsigned char MessageText[GSM_MAX_SMS_LENGTH]; /* User Data (9.2.3.24), Command Data (9.2.3.21) */
287 SMS_DataCodingScheme DCS; /* Data Coding Scheme (9.2.3.10) */
288 SMS_MessageValidity Validity; /* Validity Period Format & Validity Period (9.2.3.3 & 9.2.3.12) - `Message validity' in the phone */
290 unsigned short UDH_No; /* Number of presend UDHs */
291 SMS_UDHInfo UDH[SMS_MAX_UDH_HEADER_NUMBER]; /* User Data Header Indicator & User Data Header (9.2.3.23 & 9.2.3.24) */
293 SMS_DateTime SMSCTime; /* Service Centre Time Stamp (9.2.3.11) */
294 SMS_DateTime Time; /* Discharge Time (9.2.3.13) */
297 SMS_MemoryType MemoryType; /* memoryType (for 6210/7110: folder indicator */
298 SMS_MessageStatus Status; /* Status of the message: sent/read or unsent/unread */
300 // SMS_CommandType Command; /* Command Type - 8 bits (9.2.3.19); FIXME: use it!!!! */
301 // unsigned char Parameter[???]; /* Parameter Indicator (9.2.3.27); FIXME: how to use it??? */
304 extern GSM_Error EncodePDUSMS(GSM_SMSMessage *SMS, char *frame);
305 extern GSM_Error DecodePDUSMS(unsigned char *message, GSM_SMSMessage *SMS, int MessageLength);
306 extern GSM_Error EncodeTextSMS();
307 extern GSM_Error DecodeTextSMS(unsigned char *message, GSM_SMSMessage *SMS);
311 /* Maximal number of SMS folders */
312 #define MAX_SMS_FOLDERS 24
314 /* Datatype for SMS folders ins 6210/7110 */
316 char Name[15]; /* Name for SMS folder */
317 bool SMSData; /* if folder contains sender, SMSC number and sending date */
318 u8 locations[160]; /* locations of SMS messages in that folder (6210 specific) */
319 u8 number; /* number of SMS messages in that folder*/
320 u8 FolderID; /* ID od fthe current folder */
324 SMS_Folder Folder[MAX_SMS_FOLDERS];
325 u8 FoldersID[MAX_SMS_FOLDERS]; /* ID specific for this folder and phone. */
326 /* Used in internal functions. Do not use it. */
327 u8 number; /* number of SMS folders */
330 /*** CELL BROADCAST ***/
332 #define GSM_MAX_CB_MESSAGE (160)
334 /* Define datatype for Cell Broadcast message */
336 int Channel; /* channel number */
337 char Message[GSM_MAX_CB_MESSAGE + 1];
341 #endif /* __gnokii_sms_h_ */