Translation update done using Pootle.
[gammu.git] / include / gammu-message.h
blob6133f8aa98536be2cd79becf844166c0d029ef38
1 /**
2 * \file gammu-message.h
3 * \author Michal Čihař
5 * Message data and functions.
6 */
7 #ifndef __gammu_message_h
8 #define __gammu_message_h
10 #include <gammu-limits.h>
11 #include <gammu-memory.h>
12 #include <gammu-datetime.h>
13 #include <gammu-ringtone.h>
14 #include <gammu-bitmap.h>
15 #include <gammu-wap.h>
16 #include <gammu-calendar.h>
17 #include <gammu-file.h>
18 #include <gammu-debug.h>
20 /**
21 * \defgroup Message Messages
22 * Messages manipulations.
25 /**
26 * \defgroup USSD USSD messages
27 * USSD messages manipulations.
28 * \ingroup Message
31 /**
32 * \defgroup CB CB messages
33 * Cell broadcast messages manipulations.
34 * \ingroup Message
37 /**
38 * \defgroup SMS SMS messages
39 * SMS messages manipulations.
40 * \ingroup Message
43 /**
44 * \defgroup MMS MMS messages
45 * MMS messages manipulations.
46 * \ingroup Message
49 /**
50 * MMS message class.
52 typedef enum {
53 /**
54 * None class specified.
56 GSM_MMS_None = 0,
57 /**
58 * Personal message.
60 GSM_MMS_Personal = 1,
61 /**
62 * Advertisement message.
64 GSM_MMS_Advertisement,
65 /**
66 * Informational message.
68 GSM_MMS_Info,
69 /**
70 * Automatic message class.
72 GSM_MMS_Auto,
73 } GSM_MMS_Class;
75 /**
76 * MMS indicator data.
78 * \ingroup MMS
80 typedef struct {
81 /**
82 * Message address (URL for download).
84 char Address[500];
85 /**
86 * Message title (subject).
88 char Title[200];
89 /**
90 * Message sender.
92 char Sender[200];
93 /**
94 * Message size, if 0 it won't be decoded or was not decoded.
96 size_t MessageSize;
97 /**
98 * Class of a message.
100 GSM_MMS_Class Class;
101 } GSM_MMSIndicator;
104 * Structure for Cell Broadcast messages.
106 * \ingroup CB
108 typedef struct {
110 * Channel number.
112 int Channel;
114 * Message text.
116 char Text[300];
117 } GSM_CBMessage;
120 * Status of USSD message.
122 * \ingroup USSD
124 typedef enum {
126 * Unknown status
128 USSD_Unknown = 1,
130 * No action is needed, maybe network initiated USSD
132 USSD_NoActionNeeded,
134 * Reply is expected
136 USSD_ActionNeeded,
138 * USSD dialog terminated
140 USSD_Terminated,
142 * Another client replied
144 USSD_AnotherClient,
146 * Operation not supported
148 USSD_NotSupported,
150 * Network timeout
152 USSD_Timeout,
153 } GSM_USSDStatus;
156 * Structure for USSD messages.
158 * \ingroup USSD
160 typedef struct {
162 * Message text.
164 unsigned char Text[2 * (GSM_MAX_USSD_LENGTH + 1)];
166 * Message status.
168 GSM_USSDStatus Status;
169 } GSM_USSDMessage;
172 * Status of SMS memory.
174 * \ingroup SMS
176 typedef struct {
178 * Number of unread messages on SIM.
180 int SIMUnRead;
182 * Number of all saved messages (including unread) on SIM.
184 int SIMUsed;
186 * Number of all possible messages on SIM.
188 int SIMSize;
190 * Number of used templates (62xx/63xx/7110/etc.).
192 int TemplatesUsed;
194 * Number of unread messages in phone.
196 int PhoneUnRead;
198 * Number of all saved messages in phone.
200 int PhoneUsed;
202 * Number of all possible messages on phone.
204 int PhoneSize;
205 } GSM_SMSMemoryStatus;
208 * Enum defines format of SMS messages. See GSM 03.40 section 9.2.3.9
210 * \ingroup SMS
212 typedef enum {
213 SMS_FORMAT_Pager = 1,
214 SMS_FORMAT_Fax,
215 SMS_FORMAT_Email,
216 SMS_FORMAT_Text
217 /* Some values not handled here */
218 } GSM_SMSFormat;
221 * Enum defines some the most often used validity lengths for SMS messages
222 * for relative validity format. See GSM 03.40 section 9.2.3.12.1 - it gives
223 * more values.
225 * \ingroup SMS
227 typedef enum {
228 SMS_VALID_1_Hour = 0x0b,
229 SMS_VALID_6_Hours = 0x47,
230 SMS_VALID_1_Day = 0xa7,
231 SMS_VALID_3_Days = 0xa9,
232 SMS_VALID_1_Week = 0xad,
233 SMS_VALID_Max_Time = 0xff
234 } GSM_ValidityPeriod;
237 * Enum defines format of validity period for SMS messages.
238 * See GSM 03.40 section 9.2.3.12
240 * \ingroup SMS
242 typedef enum {
243 SMS_Validity_NotAvailable = 1,
244 SMS_Validity_RelativeFormat
245 /* Specification gives also other possibilities */
246 } GSM_ValidityPeriodFormat;
249 * Structure for validity of SMS messages
251 * \ingroup SMS
253 typedef struct {
254 GSM_ValidityPeriodFormat Format;
256 * Value defines period for relative format
258 GSM_ValidityPeriod Relative;
259 } GSM_SMSValidity;
262 * Structure for SMSC (SMS Center) information.
264 * \ingroup SMS
266 typedef struct {
268 * Number of the SMSC on SIM
270 int Location;
272 * Name of the SMSC
274 unsigned char Name[(GSM_MAX_SMSC_NAME_LENGTH + 1) * 2];
276 * SMSC phone number.
278 unsigned char Number[(GSM_MAX_NUMBER_LENGTH + 1) * 2];
280 * Validity of SMS messages.
282 GSM_SMSValidity Validity;
284 * Format of sent SMS messages.
286 GSM_SMSFormat Format;
288 * Default recipient number. In old DCT3 ignored
290 unsigned char DefaultNumber[(GSM_MAX_NUMBER_LENGTH + 1) * 2];
291 } GSM_SMSC;
294 * Status of SMS message.
296 * \ingroup SMS
298 typedef enum {
299 SMS_Sent = 1,
300 SMS_UnSent,
301 SMS_Read,
302 SMS_UnRead
303 } GSM_SMS_State;
306 * Coding type of SMS.
308 * \ingroup SMS
310 typedef enum {
312 * Unicode
314 SMS_Coding_Unicode_No_Compression = 1,
315 SMS_Coding_Unicode_Compression,
317 * Default GSM alphabet.
319 SMS_Coding_Default_No_Compression,
320 SMS_Coding_Default_Compression,
322 * 8-bit.
324 SMS_Coding_8bit
325 } GSM_Coding_Type;
328 * Converts SMS coding to string.
330 * \return Pointer to static string, NULL on failure.
332 const char *GSM_SMSCodingToString(GSM_Coding_Type type);
335 * Converts SMS coding to type.
337 GSM_Coding_Type GSM_StringToSMSCoding(const char *s);
340 * Types of UDH (User Data Header).
342 * \ingroup SMS
344 typedef enum {
345 UDH_NoUDH = 1,
347 * Linked SMS.
349 UDH_ConcatenatedMessages,
351 * Linked SMS with 16 bit reference.
353 UDH_ConcatenatedMessages16bit,
354 UDH_DisableVoice,
355 UDH_DisableFax,
356 UDH_DisableEmail,
357 UDH_EnableVoice,
358 UDH_EnableFax,
359 UDH_EnableEmail,
360 UDH_VoidSMS,
361 UDH_NokiaRingtone,
362 UDH_NokiaRingtoneLong,
363 UDH_NokiaOperatorLogo,
364 UDH_NokiaOperatorLogoLong,
365 UDH_NokiaCallerLogo,
366 UDH_NokiaWAP,
367 UDH_NokiaWAPLong,
368 UDH_NokiaCalendarLong,
369 UDH_NokiaProfileLong,
370 UDH_NokiaPhonebookLong,
371 UDH_UserUDH,
372 UDH_MMSIndicatorLong
373 } GSM_UDH;
376 * Structure for User Data Header.
378 * \ingroup SMS
380 typedef struct {
382 * UDH type.
384 GSM_UDH Type;
386 * UDH length.
388 int Length;
390 * UDH text.
392 unsigned char Text[GSM_MAX_UDH_LENGTH];
394 * 8-bit ID, when required (-1 otherwise).
396 int ID8bit;
398 * 16-bit ID, when required (-1 otherwise).
400 int ID16bit;
402 * Number of current part.
404 int PartNumber;
406 * Total number of parts.
408 int AllParts;
409 } GSM_UDHHeader;
412 * TP-Message-Type-Indicator. See GSM 03.40 section 9.2.3.1.
414 * \ingroup SMS
416 typedef enum {
418 * SMS in Inbox.
420 SMS_Deliver = 1,
422 * Delivery Report
424 SMS_Status_Report,
426 * SMS for sending or in Outbox
428 SMS_Submit
429 /* specification gives more */
430 } GSM_SMSMessageType;
433 * SMS message data.
435 * \ingroup SMS
437 typedef struct {
439 * Message to be replaced.
441 unsigned char ReplaceMessage;
443 * Whether to reject duplicates.
445 gboolean RejectDuplicates;
447 * UDH (User Data Header)
449 GSM_UDHHeader UDH;
451 * Sender or recipient number.
453 unsigned char Number[(GSM_MAX_NUMBER_LENGTH + 1) * 2];
455 unsigned char
456 OtherNumbers[GSM_SMS_OTHER_NUMBERS][(GSM_MAX_NUMBER_LENGTH + 1) * 2];
457 int OtherNumbersNum;
460 * SMSC (SMS Center)
462 GSM_SMSC SMSC;
464 * For saved SMS: where exactly it's saved (SIM/phone)
466 GSM_MemoryType Memory;
468 * For saved SMS: location of SMS in memory.
470 int Location;
472 * For saved SMS: number of folder, where SMS is saved
474 int Folder;
476 * For saved SMS: whether SMS is really in Inbox.
478 gboolean InboxFolder;
480 * Length of the SMS message.
482 int Length;
484 * Status (read/unread/...) of SMS message.
486 GSM_SMS_State State;
488 * Name in Nokia with SMS memory (6210/7110, etc.) Ignored in other.
490 unsigned char Name[(GSM_MAX_SMS_NAME_LENGTH + 1) * 2];
492 * Text for SMS.
494 unsigned char Text[(GSM_MAX_SMS_LENGTH + 1) * 2];
496 * Type of message.
498 GSM_SMSMessageType PDU;
500 * Type of coding.
502 GSM_Coding_Type Coding;
504 * Date and time, when SMS was saved or sent
506 GSM_DateTime DateTime;
508 * Date of SMSC response in DeliveryReport messages.
510 GSM_DateTime SMSCTime;
512 * In delivery reports: status.
514 unsigned char DeliveryStatus;
516 * Indicates whether "Reply via same center" is set.
518 gboolean ReplyViaSameSMSC;
520 * SMS class (0 is flash SMS, 1 is normal one).
522 signed char Class;
524 * Message reference.
526 unsigned char MessageReference;
527 } GSM_SMSMessage;
529 /* In layouts are saved locations for some SMS part. Below are listed
530 * specs, which describe them
532 * \ingroup SMS
534 typedef struct {
536 * TP-User-Data. GSM 03.40 section 9.2.3.24.
538 unsigned char Text;
540 * - In SMS-Deliver: TP-Originating-Address. GSM 03.40 section 9.2.3.7.
541 * - In SMS-Submit: TP-Destination-Address. GSM 03.40 section 9.2.3.8.
542 * - In SMS-Status-Report: TP-Recipient-Address. GSM 03.40 section 9.2.3.14.
544 unsigned char Number;
546 * SMSC number
548 unsigned char SMSCNumber;
550 * TP-Data-Coding-Scheme. GSM 03.40 section 9.2.3.10.
551 * Contains alphabet type, SMS class (and some others)
553 unsigned char TPDCS;
555 * - For SMS-Submit: TP-Validity-Period. GSM 03.40 section 9.2.3.12.
556 * - For SMS-Status-Report: TP-Discharge Time. GSM 03.40 section 9.2.3.13.
558 unsigned char DateTime;
560 * TP-Service-Centre-Time-Stamp in SMS-Status-Report. GSM 03.40 section 9.2.3.11.
562 unsigned char SMSCTime;
564 * TP-Status in SMS-Status-Report. GSM 03.40 section 9.2.3.15.
566 unsigned char TPStatus;
568 * TP-User-Data-Length. GSM 03.40 section 9.2.3.16.
570 unsigned char TPUDL;
572 * TP-Validity Period in SMS-Submit. GSM 03.40 section 9.2.3.12.
574 unsigned char TPVP;
576 * Byte contains in SMS-Deliver:
577 * - TP-Message-Type-Indicator (2 bits) GSM 03.40 section 9.2.3.1
578 * - TP-More-Messages-To-Send (1 bit). GSM 03.40 section 9.2.3.2
579 * - TP-Reply-Path (1 bit). GSM 03.40 section 9.2.3.17
580 * - TP-User-Data-Header-Indicator (1 bit). GSM 03.40 section 9.2.3.23
581 * - TP-Status-Report-Indicator (1 bit). GSM 03.40 section 9.2.3.4
583 * Byte contains in SMS-Submit:
584 * - TP-Message-Type-Indicator (2 bits) GSM 03.40 section 9.2.3.1
585 * - TP-Reject-Duplicates (1 bit). GSM 03.40 section
586 * - TP-Validity-Period-Format (2 bits).GSM 03.40 section 9.2.3.3
587 * - TP-Reply-Path (1 bit). GSM 03.40 section 9.2.3.17
588 * - TP-User-Data-Header-Indicator (1 bit). GSM 03.40 section 9.2.3.23
589 * - TP-Status-Report-Request (1 bit). GSM 03.40 section 9.2.3.5
591 unsigned char firstbyte;
593 * TP-Message Reference in SMS-Submit. GSM 03.40 section 9.2.3.6
595 unsigned char TPMR;
597 * TP-Protocol-Identifier. GSM 03.40 section 9.2.3.9
599 unsigned char TPPID;
600 } GSM_SMSMessageLayout;
603 * Decodes PDU data.
605 * \param di Debug information structure.
606 * \param SMS Pointer where to store parsed message.
607 * \param buffer PDU data.
608 * \param length Length of PDU data.
609 * \param final_pos Optional pointer where end position will be stored.
610 * \param SMSC Whether PDU includes SMSC data.
612 * \ingroup SMS
614 GSM_Error GSM_DecodePDUFrame(GSM_Debug_Info *di, GSM_SMSMessage *SMS,
615 const unsigned char *buffer, size_t length,
616 size_t *final_pos, gboolean SMSC);
619 * Decodes SMS frame.
621 * \ingroup SMS
623 GSM_Error GSM_DecodeSMSFrame(GSM_Debug_Info * di, GSM_SMSMessage * SMS,
624 unsigned char *buffer,
625 GSM_SMSMessageLayout Layout);
628 * Finds out coding type based on TPDCS header byte as defined by GSM
629 * 03.38.
631 GSM_Coding_Type GSM_GetMessageCoding(GSM_Debug_Info * di, const char TPDCS);
634 * Encodes SMS frame.
636 * \ingroup SMS
638 GSM_Error GSM_EncodeSMSFrame(GSM_Debug_Info * di, GSM_SMSMessage * SMS,
639 unsigned char *buffer, GSM_SMSMessageLayout Layout,
640 int *length, gboolean clear);
643 * Decodes SMS frame for status report.
645 * \ingroup SMS
647 GSM_Error GSM_DecodeSMSFrameStatusReportData(GSM_Debug_Info * di,
648 GSM_SMSMessage * SMS,
649 unsigned char *buffer,
650 GSM_SMSMessageLayout Layout);
653 * Decodes SMS frame in textual representation.
655 * \ingroup SMS
657 GSM_Error GSM_DecodeSMSFrameText(GSM_Debug_Info * di, GSM_SMSMessage * SMS,
658 unsigned char *buffer,
659 GSM_SMSMessageLayout Layout);
662 * Decodes UDH header.
664 * \ingroup SMS
666 void GSM_DecodeUDHHeader(GSM_Debug_Info * di, GSM_UDHHeader * UDH);
669 * Encodes UDH header.
671 * \ingroup SMS
673 void GSM_EncodeUDHHeader(GSM_Debug_Info * di, GSM_UDHHeader * UDH);
676 * Sets default content for SMS except for changing locations.
677 * Use this for clearing structure while keeping location of message.
679 * \param SMS Pointer to structure which should be cleaned up.
681 * \ingroup SMS
683 void GSM_SetDefaultReceivedSMSData(GSM_SMSMessage * SMS);
686 * Sets default content for SMS. Use this for clearing structure.
688 * \param SMS Pointer to structure which should be cleaned up.
690 * \ingroup SMS
692 void GSM_SetDefaultSMSData(GSM_SMSMessage * SMS);
695 * Information about SMS folder.
697 * \ingroup SMS
699 typedef struct {
701 * Whether it is inbox.
703 gboolean InboxFolder;
705 * Whether it is outbox.
707 gboolean OutboxFolder;
709 * Where exactly it's saved.
711 GSM_MemoryType Memory;
713 * Name of the folder
715 unsigned char Name[(GSM_MAX_SMS_FOLDER_NAME_LEN + 1) * 2];
716 } GSM_OneSMSFolder;
719 * List of SMS folders.
721 * \ingroup SMS
723 typedef struct {
725 * Array of structures holding information about each folder.
727 GSM_OneSMSFolder Folder[GSM_MAX_SMS_FOLDERS];
729 * Number of SMS folders.
731 int Number;
732 } GSM_SMSFolders;
735 * Siemens OTA data.
737 * \ingroup SMS
739 typedef struct {
740 unsigned long SequenceID;
741 unsigned int PacketsNum;
742 unsigned int PacketNum;
743 unsigned long AllDataLen;
745 unsigned char DataType[10];
746 unsigned char DataName[40];
747 unsigned int DataLen;
748 unsigned char Data[140];
749 } GSM_SiemensOTASMSInfo;
752 * Decodes Siemens OTA data.
754 * \ingroup SMS
756 gboolean GSM_DecodeSiemensOTASMS(GSM_Debug_Info * di,
757 GSM_SiemensOTASMSInfo * Info,
758 GSM_SMSMessage * SMS);
761 * Multiple SMS messages, used for Smart Messaging 3.0/EMS.
763 * \ingroup SMS
765 typedef struct {
767 * Number of messages.
769 int Number;
771 * Array of SMSes.
773 GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS];
774 } GSM_MultiSMSMessage;
777 * Information about MMS folder.
779 * \ingroup MMS
781 typedef struct {
783 * Whether it is really inbox.
785 gboolean InboxFolder;
787 * Name for MMS folder.
789 char Name[(GSM_MAX_MMS_FOLDER_NAME_LEN + 1) * 2];
790 } GSM_OneMMSFolder;
793 * List of MMS folders.
795 * \ingroup MMS
797 typedef struct {
799 * Number of MMS folders.
801 unsigned char Number;
803 * Array of structures holding information about each folder.
805 GSM_OneMMSFolder Folder[GSM_MAX_MMS_FOLDERS];
806 } GSM_MMSFolders;
809 * Layout for submit message.
811 * \ingroup SMS
813 extern GSM_SMSMessageLayout PHONE_SMSSubmit;
816 * Layout for deliver message.
818 * \ingroup SMS
820 extern GSM_SMSMessageLayout PHONE_SMSDeliver;
823 * Layout for status report message.
825 * \ingroup SMS
827 extern GSM_SMSMessageLayout PHONE_SMSStatusReport;
830 * ID during packing SMS for Smart Messaging 3.0, EMS and other
832 * \ingroup SMS
834 typedef enum {
836 * 1 text SMS.
838 SMS_Text = 1,
840 * Contacenated SMS, when longer than 1 SMS.
842 SMS_ConcatenatedTextLong,
844 * Contacenated SMS, auto Default/Unicode coding.
846 SMS_ConcatenatedAutoTextLong,
847 SMS_ConcatenatedTextLong16bit,
848 SMS_ConcatenatedAutoTextLong16bit,
850 * Nokia profile = Name, Ringtone, ScreenSaver
852 SMS_NokiaProfileLong,
854 * Nokia Picture Image + (text)
856 SMS_NokiaPictureImageLong,
858 * Nokia screen saver + (text)
860 SMS_NokiaScreenSaverLong,
862 * Nokia ringtone - old SM2.0 format, 1 SMS
864 SMS_NokiaRingtone,
866 * Nokia ringtone contacenated, when very long
868 SMS_NokiaRingtoneLong,
870 * Nokia 72x14 operator logo, 1 SMS
872 SMS_NokiaOperatorLogo,
874 * Nokia 72x14 op logo or 78x21 in 2 SMS
876 SMS_NokiaOperatorLogoLong,
878 * Nokia 72x14 caller logo, 1 SMS
880 SMS_NokiaCallerLogo,
882 * Nokia WAP bookmark in 1 or 2 SMS
884 SMS_NokiaWAPBookmarkLong,
886 * Nokia WAP settings in 2 SMS
888 SMS_NokiaWAPSettingsLong,
890 * Nokia MMS settings in 2 SMS
892 SMS_NokiaMMSSettingsLong,
894 * Nokia VCARD 1.0 - only name and default number
896 SMS_NokiaVCARD10Long,
898 * Nokia VCARD 2.1 - all numbers + text
900 SMS_NokiaVCARD21Long,
902 * Nokia VCALENDAR 1.0 - can be in few sms
904 SMS_NokiaVCALENDAR10Long,
905 SMS_NokiaVTODOLong,
906 SMS_VCARD10Long,
907 SMS_VCARD21Long,
908 SMS_DisableVoice,
909 SMS_DisableFax,
910 SMS_DisableEmail,
911 SMS_EnableVoice,
912 SMS_EnableFax,
913 SMS_EnableEmail,
914 SMS_VoidSMS,
916 * IMelody 1.0
918 SMS_EMSSound10,
920 * IMelody 1.2
922 SMS_EMSSound12,
924 * IMelody without header - SonyEricsson extension
926 SMS_EMSSonyEricssonSound,
928 * IMelody 1.0 with UPI.
930 SMS_EMSSound10Long,
932 * IMelody 1.2 with UPI.
934 SMS_EMSSound12Long,
936 * IMelody without header with UPI.
938 SMS_EMSSonyEricssonSoundLong,
939 SMS_EMSPredefinedSound,
940 SMS_EMSPredefinedAnimation,
941 SMS_EMSAnimation,
943 * Fixed bitmap of size 16x16 or 32x32.
945 SMS_EMSFixedBitmap,
946 SMS_EMSVariableBitmap,
947 SMS_EMSVariableBitmapLong,
949 * MMS message indicator.
951 SMS_MMSIndicatorLong,
952 SMS_WAPIndicatorLong,
954 * Variable bitmap with black and white colors
956 SMS_AlcatelMonoBitmapLong,
958 * Variable animation with black and white colors
960 SMS_AlcatelMonoAnimationLong,
961 SMS_AlcatelSMSTemplateName,
963 * Siemens OTA
965 SMS_SiemensFile
966 } EncodeMultiPartSMSID;
969 * Entry of multipart SMS.
971 * \ingroup SMS
973 typedef struct {
974 EncodeMultiPartSMSID ID;
976 int Number;
977 GSM_Ringtone *Ringtone;
978 GSM_MultiBitmap *Bitmap;
979 GSM_WAPBookmark *Bookmark;
980 GSM_WAPSettings *Settings;
981 GSM_MMSIndicator *MMSIndicator;
982 GSM_MemoryEntry *Phonebook;
983 GSM_CalendarEntry *Calendar;
984 GSM_ToDoEntry *ToDo;
985 GSM_File *File;
986 gboolean Protected;
988 unsigned char *Buffer;
989 gboolean Left;
990 gboolean Right;
991 gboolean Center;
992 gboolean Large;
993 gboolean Small;
994 gboolean Bold;
995 gboolean Italic;
996 gboolean Underlined;
997 gboolean Strikethrough;
999 /* Return values */
1000 int RingtoneNotes;
1001 } GSM_MultiPartSMSEntry;
1004 * Multipart SMS information.
1006 * \ingroup SMS
1008 typedef struct {
1009 int EntriesNum;
1010 gboolean UnicodeCoding;
1011 int Class;
1012 unsigned char ReplaceMessage;
1013 gboolean Unknown;
1014 GSM_MultiPartSMSEntry Entries[GSM_MAX_MULTI_SMS];
1015 } GSM_MultiPartSMSInfo;
1018 * Encodes SMS frame according to layout.
1020 * \return Error code.
1022 * \ingroup SMS
1024 GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine * s, GSM_SMSMessage * SMS,
1025 unsigned char *buffer,
1026 GSM_SMSMessageLayout Layout, int *length,
1027 gboolean clear);
1030 * Encodes multi part SMS from "readable" format.
1032 * \return Error code.
1034 * \ingroup SMS
1036 GSM_Error GSM_EncodeMultiPartSMS(GSM_Debug_Info * di,
1037 GSM_MultiPartSMSInfo * Info,
1038 GSM_MultiSMSMessage * SMS);
1041 * Decodes multi part SMS to "readable" format.
1043 * \ingroup SMS
1045 gboolean GSM_DecodeMultiPartSMS(GSM_Debug_Info * di,
1046 GSM_MultiPartSMSInfo * Info,
1047 GSM_MultiSMSMessage * SMS, gboolean ems);
1050 * Clears @ref GSM_MultiPartSMSInfo to default values.
1052 * \ingroup SMS
1054 void GSM_ClearMultiPartSMSInfo(GSM_MultiPartSMSInfo * Info);
1057 * Frees any allocated structures inside @ref GSM_MultiPartSMSInfo.
1059 * \ingroup SMS
1061 void GSM_FreeMultiPartSMSInfo(GSM_MultiPartSMSInfo * Info);
1064 * Links SMS messages according to IDs.
1066 * \return Error code.
1068 * \ingroup SMS
1070 GSM_Error GSM_LinkSMS(GSM_Debug_Info * di,
1071 GSM_MultiSMSMessage ** INPUT,
1072 GSM_MultiSMSMessage ** OUTPUT, gboolean ems);
1075 * MMS address type.
1077 * \ingroup MMS
1079 typedef enum {
1080 MMSADDRESS_PHONE,
1081 MMSADDRESS_UNKNOWN
1082 } MMSAddressType;
1085 * MMS entry.
1087 * \ingroup MMS
1089 typedef struct {
1090 GSM_File File;
1092 * CT in Unicode
1094 unsigned char ContentType[400];
1096 * Smil ID in Unicode
1098 unsigned char SMIL[400];
1099 } GSM_EncodedMultiPartMMSEntry;
1102 * MMS part.
1104 * \ingroup MMS
1106 typedef struct {
1107 int EntriesNum;
1110 * in Unicode
1112 unsigned char Source[200];
1113 MMSAddressType SourceType;
1115 * in Unicode
1117 unsigned char Destination[200];
1118 MMSAddressType DestinationType;
1120 * in Unicode
1122 unsigned char CC[200];
1123 MMSAddressType CCType;
1126 * in Unicode
1128 unsigned char Subject[200];
1130 * CT in Unicode
1132 unsigned char ContentType[400];
1134 * no Unicode
1136 unsigned char MSGType[50];
1138 gboolean DateTimeAvailable;
1139 GSM_DateTime DateTime;
1141 gboolean MMSReportAvailable;
1142 gboolean MMSReport;
1144 * Subparts.
1146 GSM_EncodedMultiPartMMSEntry Entries[GSM_MAX_MULTI_MMS];
1147 } GSM_EncodedMultiPartMMSInfo;
1150 * Decodes MMS data.
1152 * \ingroup MMS
1154 GSM_Error GSM_DecodeMMSFileToMultiPart(GSM_Debug_Info * di, GSM_File * file,
1155 GSM_EncodedMultiPartMMSInfo * info);
1158 * Clears MMS data, used to initialize structure.
1160 * \ingroup MMS
1162 GSM_Error GSM_ClearMMSMultiPart(GSM_EncodedMultiPartMMSInfo * info);
1165 * Gets SMS Service Center number and SMS settings.
1167 * \param s State machine pointer.
1168 * \param[in,out] smsc SMSC structure, should contain location.
1170 * \return Error code.
1172 * \ingroup SMS
1174 GSM_Error GSM_GetSMSC(GSM_StateMachine * s, GSM_SMSC * smsc);
1177 * Sets SMS Service Center number and SMS settings.
1179 * \param s State machine pointer.
1180 * \param[in] smsc SMSC structure.
1182 * \return Error code.
1184 * \ingroup SMS
1186 GSM_Error GSM_SetSMSC(GSM_StateMachine * s, GSM_SMSC * smsc);
1189 * Gets information about SMS memory (read/unread/size of memory for
1190 * both SIM and phone).
1192 * \param s State machine pointer.
1193 * \param[out] status Pointer to SMS status structure.
1195 * \return Error code.
1197 * \ingroup SMS
1199 GSM_Error GSM_GetSMSStatus(GSM_StateMachine * s, GSM_SMSMemoryStatus * status);
1202 * Reads SMS message.
1204 * \param s State machine pointer.
1205 * \param[in,out] sms SMS message data read from phone, location and
1206 * folder should be set.
1208 * \return Error code.
1210 * \ingroup SMS
1212 GSM_Error GSM_GetSMS(GSM_StateMachine * s, GSM_MultiSMSMessage * sms);
1215 * Reads next (or first if start set) SMS message. This might be
1216 * faster for some phones than using \ref GSM_GetSMS for each message.
1218 * Please note that this commend does not have to mark message as read
1219 * in phone. To do so, you have to call \ref GSM_GetSMS.
1221 * \param s State machine pointer.
1222 * \param[in,out] sms SMS message data read from phone, for subsequent
1223 * reads, location and folder might be used by phone driver to determine
1224 * reading state.
1225 * \param[in] start Whether we start reading from beginning.
1227 * \return Error code.
1229 * \ingroup SMS
1231 GSM_Error GSM_GetNextSMS(GSM_StateMachine * s, GSM_MultiSMSMessage * sms,
1232 gboolean start);
1234 * Sets SMS.
1236 * \param s State machine pointer.
1237 * \param[in] sms SMS message data.
1239 * \return Error code.
1241 * \ingroup SMS
1243 GSM_Error GSM_SetSMS(GSM_StateMachine * s, GSM_SMSMessage * sms);
1246 * Adds SMS to specified folder.
1248 * \param s State machine pointer.
1249 * \param[in,out] sms SMS message data, location will be updated.
1251 * \return Error code.
1253 * \ingroup SMS
1255 GSM_Error GSM_AddSMS(GSM_StateMachine * s, GSM_SMSMessage * sms);
1258 * Deletes SMS.
1260 * \param s State machine pointer.
1261 * \param[in] sms SMS structure with SMS location and folder.
1263 * \return Error code.
1265 * \ingroup SMS
1267 GSM_Error GSM_DeleteSMS(GSM_StateMachine * s, GSM_SMSMessage * sms);
1270 * Sends SMS.
1272 * \param s State machine pointer.
1273 * \param[in] sms SMS structure with SMS data to send.
1275 * \return Error code.
1277 * \ingroup SMS
1279 GSM_Error GSM_SendSMS(GSM_StateMachine * s, GSM_SMSMessage * sms);
1282 * Sends SMS already saved in phone.
1284 * \param s State machine pointer.
1285 * \param[in] Folder Folder, where message is stored.
1286 * \param[in] Location Location, where message is stored.
1288 * \return Error code.
1290 * \ingroup SMS
1292 GSM_Error GSM_SendSavedSMS(GSM_StateMachine * s, int Folder, int Location);
1295 * Configures fast SMS sending.
1297 * \param s State machine pointer.
1298 * \param[in] enable Whether to enable notifications.
1300 * \return Error code.
1302 * \ingroup SMS
1304 GSM_Error GSM_SetFastSMSSending(GSM_StateMachine * s, gboolean enable);
1307 * Enable/disable notification on incoming SMS.
1309 * \param s State machine pointer.
1310 * \param[in] enable Whether to enable notifications.
1312 * \return Error code.
1314 * \ingroup SMS
1316 GSM_Error GSM_SetIncomingSMS(GSM_StateMachine * s, gboolean enable);
1319 * Gets network information from phone.
1321 * \param s State machine pointer.
1322 * \param[in] enable Whether to enable notifications.
1324 * \return Error code.
1326 * \ingroup CB
1328 GSM_Error GSM_SetIncomingCB(GSM_StateMachine * s, gboolean enable);
1331 * Returns SMS folders information.
1333 * \param s State machine pointer.
1334 * \param[out] folders folders Pointer to folders structure, which will be
1335 * filled in.
1337 * \return Error code.
1339 * \ingroup SMS
1341 GSM_Error GSM_GetSMSFolders(GSM_StateMachine * s, GSM_SMSFolders * folders);
1344 * Creates SMS folder.
1346 * \param s State machine pointer.
1347 * \param[in] name Name of SMS folder which should be created.
1349 * \return Error code.
1351 * \ingroup SMS
1353 GSM_Error GSM_AddSMSFolder(GSM_StateMachine * s, unsigned char *name);
1356 * Deletes SMS folder.
1358 * \param s State machine pointer.
1359 * \param[in] ID ID of SMS folder to delete.
1361 * \return Error code.
1363 * \ingroup SMS
1365 GSM_Error GSM_DeleteSMSFolder(GSM_StateMachine * s, int ID);
1368 * Lists MMS folders.
1370 * \param s State machine pointer.
1371 * \param folders Pointer to structure, whehe folder information will be
1372 * stored.
1374 * \return Error code.
1376 * \ingroup MMS
1378 GSM_Error GSM_GetMMSFolders(GSM_StateMachine * s, GSM_MMSFolders * folders);
1381 * Retrieves next part of MMS file information.
1383 * \param s State machine pointer.
1384 * \param[in,out] FileID File ID will be stored here, might be
1385 * used for consequent reads.
1386 * \param[in,out] MMSFolder MMS folder ID will be stored here, might be
1387 * used for consequent reads.
1388 * \param[in] start Whether to start reading.
1390 * \return Error code.
1392 * \ingroup MMS
1394 GSM_Error GSM_GetNextMMSFileInfo(GSM_StateMachine * s, unsigned char *FileID,
1395 int *MMSFolder, gboolean start);
1397 * Activates/deactivates noticing about incoming USSDs (UnStructured Supplementary Services).
1399 * \param s State machine pointer.
1400 * \param[in] enable Whether to enable notifications.
1402 * \return Error code.
1404 * \ingroup USSD
1406 GSM_Error GSM_SetIncomingUSSD(GSM_StateMachine * s, gboolean enable);
1409 * Calculates number of messages and free chars needed for text.
1411 * \param di Debug settings.
1412 * \param[in] MessageBuffer Actual message text in unicode.
1413 * \param[in] UDHType UDH type.
1414 * \param[in] Coding GSM Encoding type.
1415 * \param[out] SMSNum Number of messages needed to store the text.
1416 * \param[out] CharsLeft Number of free chars in the message.
1418 * \ingroup SMS
1420 void GSM_SMSCounter(GSM_Debug_Info *di, unsigned char *MessageBuffer,
1421 GSM_UDH UDHType, GSM_Coding_Type Coding, int *SMSNum, size_t *CharsLeft);
1423 #endif
1425 /* Editor configuration
1426 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: