5 #include "../../gsmcomon.h"
6 #include "../gsmlogo.h"
10 #include "../gsmring.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 * Structure 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 messages 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 * Number of possible 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
;
481 /* How should editor hadle tabs in this file? Add editor commands here.
482 * vim: noexpandtab sw=8 ts=8 sts=8: