5 #include "../gsmcomon.h"
12 /* --------------------- Some general definitions ------------------------- */
14 #define GSM_MAX_UDH_LENGTH 140
15 #define GSM_MAX_SMS_LENGTH 160
16 #define GSM_MAX_8BIT_SMS_LENGTH 140
18 /* -------------------- Cell Broadcast ------------------------------------ */
21 * Define datatype for Cell Broadcast message.
34 /* ------------------------ SMS status ------------------------------------ */
37 * Status of SMS memory.
41 * Number of unread messages in SIM.
45 * Number of all used messages in SIM.
49 * Number of all possible messafes on SIM.
53 * Number of unread messages in phone.
57 * Number of all used messages in phone.
61 * Number of all possible messages on phone.
65 * Number of used templates (62xx/63xx/7110/etc.).
68 } GSM_SMSMemoryStatus
;
70 /* --------------------- SMS Center --------------------------------------- */
73 * SMS Messages sent as...
83 * Length of validity for SMS messages.
95 * Format of validity perion.
98 GSM_NoValidityPeriod
= 1,
101 } GSM_ValidityPeriodFormat
;
104 * Validity of SMS message.
107 GSM_ValidityPeriodFormat VPF
;
108 GSM_ValidityPeriod Relative
;
111 #define GSM_MAX_SMSC_NAME_LENGTH 30
114 * Structure for SMSC (SMS Center) information.
118 * Number of the SMSC in the phone memory.
124 unsigned char Name
[(GSM_MAX_SMSC_NAME_LENGTH
+1)*2];
126 * Format of sent SMSes.
128 GSM_SMSFormat Format
;
132 GSM_SMSValidity Validity
;
136 unsigned char Number
[(GSM_MAX_NUMBER_LENGTH
+1)*2];
138 * Default recipient number.
140 unsigned char DefaultNumber
[(GSM_MAX_NUMBER_LENGTH
+1)*2];
143 /* --------------------- single SMS --------------------------------------- */
146 * Status of SMS message.
156 * Coding type of SMS.
162 GSM_Coding_Unicode
= 1,
164 * Default GSM aplhabet.
174 * Types of UDH (User Data Header).
181 UDH_ConcatenatedMessages
,
183 * Linked SMS with 16 bit reference.
185 UDH_ConcatenatedMessages16bit
,
194 UDH_NokiaRingtoneLong
,
195 UDH_NokiaOperatorLogo
,
196 UDH_NokiaOperatorLogoLong
,
200 UDH_NokiaCalendarLong
,
201 UDH_NokiaProfileLong
,
202 UDH_NokiaPhonebookLong
,
208 * Structure to hold UDH Header.
222 unsigned char Text
[GSM_MAX_UDH_LENGTH
];
224 * 8-bit ID, when required (-1 otherwise).
228 * 16-bit ID, when required (-1 otherwise).
232 * Number of current part.
236 * Total number of parts.
242 * TP-Message-Type-Indicator, see GSM 03.40 version 6.1.0 Release 1997 Section 9.2.3.1.
250 * Delivery Report received by phone.
254 * Send SMS or save it in Outbox.
258 } GSM_SMSMessageType
;
261 * Maximal length of SMS name.
263 #define GSM_MAX_SMS_NAME_LENGTH 40
274 * UDH (User Defined Header).
278 * Folder, where SMS is saved.
282 * Whether it is really inbox.
286 * Where exactly it's saved
288 GSM_MemoryType Memory
;
290 * Location of SMS in memory.
294 * Length of the SMS message.
298 * Name in Nokia 6210/7110, etc. Ignored in other.
300 unsigned char Name
[(GSM_MAX_SMS_NAME_LENGTH
+1)*2];
302 * Sender or recipient number.
304 unsigned char Number
[(GSM_MAX_NUMBER_LENGTH
+1)*2];
308 unsigned char Text
[(GSM_MAX_SMS_LENGTH
+1)*2];
312 GSM_SMSMessageType PDU
;
316 GSM_Coding_Type Coding
;
318 * Date of reception/response of messages.
320 GSM_DateTime DateTime
;
322 * Date of SMSC response in DeliveryReport messages.
324 GSM_DateTime SMSCTime
;
326 * In delivery reports: status.
328 unsigned char DeliveryStatus
;
330 * Indicates whether "Reply via same center" is set.
332 bool ReplyViaSameSMSC
;
334 * State (read/unread/...) of SMS.
344 unsigned char MessageReference
;
346 * Message to be replaced.
348 unsigned char ReplaceMessage
;
350 * Whether to reject duplicates.
352 bool RejectDuplicates
;
355 /* In layouts are saved locations for some SMS part. Below are listed
356 * specs, which describe them
360 * TP-User-Data. GSM 03.40 section 9.2.3.24.
364 * - In SMS-Deliver: TP-Originating-Address. GSM 03.40 section 9.2.3.7.
365 * - In SMS-Submit: TP-Destination-Address. GSM 03.40 section 9.2.3.8.
366 * - In SMS-Status-Report: TP-Recipient-Address. GSM 03.40 section 9.2.3.14.
368 unsigned char Number
;
372 unsigned char SMSCNumber
;
374 * TP-Data-Coding-Scheme. GSM 03.40 section 9.2.3.10
378 * - For SMS-Submit: TP-Validity-Period. GSM 03.40 section 9.2.3.12.
379 * - For SMS-Status-Report: TP-Discharge Time. GSM 03.40 section 9.2.3.13.
381 unsigned char DateTime
;
383 * TP-Service-Centre-Time-Stamp in SMS-Status-Report. GSM 03.40 section 9.2.3.11.
385 unsigned char SMSCTime
;
387 * TP-Status in SMS-Status-Report. GSM 03.40 section 9.2.3.15.
389 unsigned char TPStatus
;
391 * TP-User-Data-Length. GSM 03.40 section 9.2.3.16.
395 * TP-Validity Period in SMS-Submit. GSM 03.40 section 9.2.3.12.
399 * Byte contains in SMS-Deliver:
400 * - TP-Message-Type-Indicator (2 bits) GSM 03.40 section 9.2.3.1
401 * - TP-More-Messages-To-Send (1 bit). GSM 03.40 section 9.2.3.2
402 * - TP-Reply-Path (1 bit). GSM 03.40 section 9.2.3.17
403 * - TP-User-Data-Header-Indicator (1 bit). GSM 03.40 section 9.2.3.23
404 * - TP-Status-Report-Indicator (1 bit). GSM 03.40 section 9.2.3.4
406 * Byte contains in SMS-Submit:
407 * - TP-Message-Type-Indicator (2 bits) GSM 03.40 section 9.2.3.1
408 * - TP-Reject-Duplicates (1 bit). GSM 03.40 section
409 * - TP-Validity-Period-Format (2 bits).GSM 03.40 section 9.2.3.3
410 * - TP-Reply-Path (1 bit). GSM 03.40 section 9.2.3.17
411 * - TP-User-Data-Header-Indicator (1 bit). GSM 03.40 section 9.2.3.23
412 * - TP-Status-Report-Request (1 bit). GSM 03.40 section 9.2.3.5
414 unsigned char firstbyte
;
416 * TP-Message Reference in SMS-Submit. GSM 03.40 section 9.2.3.6
420 * TP-Protocol-Identifier. GSM 03.40 section 9.2.3.9
423 } GSM_SMSMessageLayout
;
425 GSM_Error
GSM_DecodeSMSFrame(GSM_SMSMessage
*SMS
, unsigned char *buffer
, GSM_SMSMessageLayout Layout
);
426 GSM_Error
GSM_EncodeSMSFrame(GSM_SMSMessage
*SMS
, unsigned char *buffer
, GSM_SMSMessageLayout Layout
, int *length
, bool clear
);
428 GSM_Error
GSM_DecodeSMSFrameStatusReportData (GSM_SMSMessage
*SMS
, unsigned char *buffer
, GSM_SMSMessageLayout Layout
);
429 GSM_Error
GSM_DecodeSMSFrameText (GSM_SMSMessage
*SMS
, unsigned char *buffer
, GSM_SMSMessageLayout Layout
);
431 void GSM_DecodeUDHHeader(GSM_UDHHeader
*UDH
);
432 void GSM_EncodeUDHHeader(GSM_UDHHeader
*UDH
);
434 void GSM_SetDefaultSMSData(GSM_SMSMessage
*SMS
);
436 /* ---------------------- SMS folders ------------------------------------- */
439 * Maximum number of SMS folders.
441 #define GSM_MAX_SMS_FOLDERS 24
443 * Maximal length of SMS folder name.
445 #define GSM_MAX_SMS_FOLDER_NAME_LEN 16
448 * Information about SMS folder.
452 * Whether it is really inbox.
456 * Where exactly it's saved
458 GSM_MemoryType Memory
;
460 * Name for SMS folder.
462 char Name
[(GSM_MAX_SMS_FOLDER_NAME_LEN
+1)*2];
466 * List of SMS folders.
470 * Array of structures holding information about each folder.
472 GSM_OneSMSFolder Folder
[GSM_MAX_SMS_FOLDERS
];
474 * Number of SMS folders.
476 unsigned char Number
;
479 /* ---------------------- multi SMS --------------------------------------- */
481 /* Identifiers for Smart Messaging 3.0 multipart SMS */
483 #define SM30_ISOTEXT 0 /* ISO 8859-1 text */
484 #define SM30_UNICODETEXT 1
486 #define SM30_RINGTONE 3
487 #define SM30_PROFILENAME 4
488 #define SM30_SCREENSAVER 6
490 void GSM_SMSCounter(int MessageLength
,
491 unsigned char *MessageBuffer
,
493 GSM_Coding_Type Coding
,
497 #define MAX_MULTI_SMS 10
500 * Multiple SMS messages, used for Smart Messaging 3.0/EMS.
504 * Sender or recipient number.
506 unsigned char Number
;
510 GSM_SMSMessage SMS
[MAX_MULTI_SMS
];
511 } GSM_MultiSMSMessage
;
513 GSM_Error
GSM_AddSMS_Text_UDH(GSM_MultiSMSMessage
*SMS
,
514 GSM_Coding_Type Coding
,
522 void GSM_MakeMultiPartSMS(GSM_MultiSMSMessage
*SMS
,
523 unsigned char *MessageBuffer
,
526 GSM_Coding_Type Coding
,
528 unsigned char RejectDuplicates
);
531 * ID during packing SMS for Smart Messaging 3.0, EMS and other
539 * Contacenated SMS, when longer than 1 SMS.
541 SMS_ConcatenatedTextLong
,
543 * Contacenated SMS, auto Default/Unicode coding.
545 SMS_ConcatenatedAutoTextLong
,
546 SMS_ConcatenatedTextLong16bit
,
547 SMS_ConcatenatedAutoTextLong16bit
,
549 * Nokia profile = Name, Ringtone, ScreenSaver
551 SMS_NokiaProfileLong
,
553 * Nokia Picture Image + (text)
555 SMS_NokiaPictureImageLong
,
557 * Nokia screen saver + (text)
559 SMS_NokiaScreenSaverLong
,
561 * Nokia ringtone - old SM2.0 format, 1 SMS
565 * Nokia ringtone contacenated, when very long
567 SMS_NokiaRingtoneLong
,
569 * Nokia 72x14 operator logo, 1 SMS
571 SMS_NokiaOperatorLogo
,
573 * Nokia 72x14 op logo or 78x21 in 2 SMS
575 SMS_NokiaOperatorLogoLong
,
577 * Nokia 72x14 caller logo, 1 SMS
581 * Nokia WAP bookmark in 1 or 2 SMS
583 SMS_NokiaWAPBookmarkLong
,
585 * Nokia WAP settings in 2 SMS
587 SMS_NokiaWAPSettingsLong
,
589 * Nokia MMS settings in 2 SMS
591 SMS_NokiaMMSSettingsLong
,
593 * Nokia VCARD 1.0 - only name and default number
595 SMS_NokiaVCARD10Long
,
597 * Nokia VCARD 2.1 - all numbers + text
599 SMS_NokiaVCARD21Long
,
601 * Nokia VCALENDAR 1.0 - can be in few sms
603 SMS_NokiaVCALENDAR10Long
,
623 * IMelody without header - SonyEricsson extension
625 SMS_EMSSonyEricssonSound
,
627 * IMelody 1.0 with UPI.
631 * IMelody 1.2 with UPI.
635 * IMelody without header with UPI.
637 SMS_EMSSonyEricssonSoundLong
,
638 SMS_EMSPredefinedSound
,
639 SMS_EMSPredefinedAnimation
,
642 * Fixed bitmap of size 16x16 or 32x32.
645 SMS_EMSVariableBitmap
,
646 SMS_EMSVariableBitmapLong
,
648 } EncodeMultiPartSMSID
;
651 EncodeMultiPartSMSID ID
;
654 GSM_Ringtone
*Ringtone
;
655 GSM_MultiBitmap
*Bitmap
;
656 GSM_WAPBookmark
*Bookmark
;
657 GSM_WAPSettings
*Settings
;
658 GSM_MMSIndicator
*MMSIndicator
;
659 GSM_MemoryEntry
*Phonebook
;
660 GSM_CalendarEntry
*Calendar
;
664 unsigned char *Buffer
;
677 } EncodeMultiPartSMSEntry
;
681 EncodeMultiPartSMSEntry Entries
[MAX_MULTI_SMS
];
685 unsigned char ReplaceMessage
;
686 } GSM_EncodeMultiPartSMSInfo
;
688 GSM_Error
GSM_EncodeMultiPartSMS (GSM_EncodeMultiPartSMSInfo
*Info
, GSM_MultiSMSMessage
*SMS
);
689 bool GSM_DecodeMultiPartSMS (GSM_EncodeMultiPartSMSInfo
*Info
, GSM_MultiSMSMessage
*SMS
);
690 void GSM_ClearMultiPartSMSInfo (GSM_EncodeMultiPartSMSInfo
*Info
);
692 GSM_Error
GSM_SortSMS(GSM_MultiSMSMessage
*INPUT
[200], GSM_MultiSMSMessage
*OUTPUT
[200]);
694 #endif /* __gsm_sms_h */
696 /* How should editor hadle tabs in this file? Add editor commands here.
697 * vim: noexpandtab sw=8 ts=8 sts=8: