Gammu API  1.32.90
SMS messages

Data Structures

struct  GSM_SMSMemoryStatus
struct  GSM_SMSValidity
struct  GSM_SMSC
struct  GSM_UDHHeader
struct  GSM_SMSMessage
struct  GSM_OneSMSFolder
struct  GSM_SMSFolders
struct  GSM_SiemensOTASMSInfo
struct  GSM_MultiSMSMessage
struct  GSM_MultiPartSMSEntry
struct  GSM_MultiPartSMSInfo

Enumerations

enum  GSM_SMSFormat { SMS_FORMAT_Pager = 1, SMS_FORMAT_Fax, SMS_FORMAT_Email, SMS_FORMAT_Text }
enum  GSM_ValidityPeriod {
  SMS_VALID_1_Hour = 0x0b, SMS_VALID_6_Hours = 0x47, SMS_VALID_1_Day = 0xa7, SMS_VALID_3_Days = 0xa9,
  SMS_VALID_1_Week = 0xad, SMS_VALID_Max_Time = 0xff
}
enum  GSM_ValidityPeriodFormat { SMS_Validity_NotAvailable = 1, SMS_Validity_RelativeFormat }
enum  GSM_SMS_State { SMS_Sent = 1, SMS_UnSent, SMS_Read, SMS_UnRead }
enum  GSM_Coding_Type {
  SMS_Coding_Unicode_No_Compression = 1, SMS_Coding_Unicode_Compression, SMS_Coding_Default_No_Compression, SMS_Coding_Default_Compression,
  SMS_Coding_8bit
}
enum  GSM_UDH {
  UDH_NoUDH = 1, UDH_ConcatenatedMessages, UDH_ConcatenatedMessages16bit, UDH_DisableVoice,
  UDH_DisableFax, UDH_DisableEmail, UDH_EnableVoice, UDH_EnableFax,
  UDH_EnableEmail, UDH_VoidSMS, UDH_NokiaRingtone, UDH_NokiaRingtoneLong,
  UDH_NokiaOperatorLogo, UDH_NokiaOperatorLogoLong, UDH_NokiaCallerLogo, UDH_NokiaWAP,
  UDH_NokiaWAPLong, UDH_NokiaCalendarLong, UDH_NokiaProfileLong, UDH_NokiaPhonebookLong,
  UDH_UserUDH, UDH_MMSIndicatorLong
}
enum  GSM_SMSMessageType { SMS_Deliver = 1, SMS_Status_Report, SMS_Submit }
enum  EncodeMultiPartSMSID {
  SMS_Text = 1, SMS_ConcatenatedTextLong, SMS_ConcatenatedAutoTextLong, SMS_ConcatenatedTextLong16bit,
  SMS_ConcatenatedAutoTextLong16bit, SMS_NokiaProfileLong, SMS_NokiaPictureImageLong, SMS_NokiaScreenSaverLong,
  SMS_NokiaRingtone, SMS_NokiaRingtoneLong, SMS_NokiaOperatorLogo, SMS_NokiaOperatorLogoLong,
  SMS_NokiaCallerLogo, SMS_NokiaWAPBookmarkLong, SMS_NokiaWAPSettingsLong, SMS_NokiaMMSSettingsLong,
  SMS_NokiaVCARD10Long, SMS_NokiaVCARD21Long, SMS_NokiaVCALENDAR10Long, SMS_NokiaVTODOLong,
  SMS_VCARD10Long, SMS_VCARD21Long, SMS_DisableVoice, SMS_DisableFax,
  SMS_DisableEmail, SMS_EnableVoice, SMS_EnableFax, SMS_EnableEmail,
  SMS_VoidSMS, SMS_EMSSound10, SMS_EMSSound12, SMS_EMSSonyEricssonSound,
  SMS_EMSSound10Long, SMS_EMSSound12Long, SMS_EMSSonyEricssonSoundLong, SMS_EMSPredefinedSound,
  SMS_EMSPredefinedAnimation, SMS_EMSAnimation, SMS_EMSFixedBitmap, SMS_EMSVariableBitmap,
  SMS_EMSVariableBitmapLong, SMS_MMSIndicatorLong, SMS_WAPIndicatorLong, SMS_AlcatelMonoBitmapLong,
  SMS_AlcatelMonoAnimationLong, SMS_AlcatelSMSTemplateName, SMS_SiemensFile
}

Functions

GSM_Error GSM_DecodePDUFrame (GSM_Debug_Info *di, GSM_SMSMessage *SMS, const unsigned char *buffer, size_t length, size_t *final_pos, gboolean SMSC)
GSM_Error GSM_DecodeSMSFrame (GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout)
GSM_Error GSM_EncodeSMSFrame (GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, gboolean clear)
GSM_Error GSM_DecodeSMSFrameStatusReportData (GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout)
GSM_Error GSM_DecodeSMSFrameText (GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout)
void GSM_DecodeUDHHeader (GSM_Debug_Info *di, GSM_UDHHeader *UDH)
void GSM_EncodeUDHHeader (GSM_Debug_Info *di, GSM_UDHHeader *UDH)
void GSM_SetDefaultReceivedSMSData (GSM_SMSMessage *SMS)
void GSM_SetDefaultSMSData (GSM_SMSMessage *SMS)
gboolean GSM_DecodeSiemensOTASMS (GSM_Debug_Info *di, GSM_SiemensOTASMSInfo *Info, GSM_SMSMessage *SMS)
GSM_Error PHONE_EncodeSMSFrame (GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, gboolean clear)
GSM_Error GSM_EncodeMultiPartSMS (GSM_Debug_Info *di, GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS)
gboolean GSM_DecodeMultiPartSMS (GSM_Debug_Info *di, GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS, gboolean ems)
void GSM_ClearMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info)
void GSM_FreeMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info)
GSM_Error GSM_LinkSMS (GSM_Debug_Info *di, GSM_MultiSMSMessage **INPUT, GSM_MultiSMSMessage **OUTPUT, gboolean ems)
GSM_Error GSM_GetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_Error GSM_SetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_Error GSM_GetSMSStatus (GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
GSM_Error GSM_GetSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
GSM_Error GSM_GetNextSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start)
GSM_Error GSM_SetSMS (GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error GSM_AddSMS (GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error GSM_DeleteSMS (GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error GSM_SendSMS (GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error GSM_SendSavedSMS (GSM_StateMachine *s, int Folder, int Location)
GSM_Error GSM_SetFastSMSSending (GSM_StateMachine *s, gboolean enable)
GSM_Error GSM_SetIncomingSMS (GSM_StateMachine *s, gboolean enable)
GSM_Error GSM_GetSMSFolders (GSM_StateMachine *s, GSM_SMSFolders *folders)
GSM_Error GSM_AddSMSFolder (GSM_StateMachine *s, unsigned char *name)
GSM_Error GSM_DeleteSMSFolder (GSM_StateMachine *s, int ID)
void GSM_SMSCounter (GSM_Debug_Info *di, unsigned char *MessageBuffer, GSM_UDH UDHType, GSM_Coding_Type Coding, int *SMSNum, size_t *CharsLeft)

Variables

GSM_SMSMessageLayout PHONE_SMSSubmit
GSM_SMSMessageLayout PHONE_SMSDeliver
GSM_SMSMessageLayout PHONE_SMSStatusReport

Detailed Description

SMS messages manipulations.

Enumeration Type Documentation

ID during packing SMS for Smart Messaging 3.0, EMS and other

Enumerator:
SMS_Text 

1 text SMS.

SMS_ConcatenatedTextLong 

Contacenated SMS, when longer than 1 SMS.

SMS_ConcatenatedAutoTextLong 

Contacenated SMS, auto Default/Unicode coding.

SMS_ConcatenatedTextLong16bit 
SMS_ConcatenatedAutoTextLong16bit 
SMS_NokiaProfileLong 

Nokia profile = Name, Ringtone, ScreenSaver

SMS_NokiaPictureImageLong 

Nokia Picture Image + (text)

SMS_NokiaScreenSaverLong 

Nokia screen saver + (text)

SMS_NokiaRingtone 

Nokia ringtone - old SM2.0 format, 1 SMS

SMS_NokiaRingtoneLong 

Nokia ringtone contacenated, when very long

SMS_NokiaOperatorLogo 

Nokia 72x14 operator logo, 1 SMS

SMS_NokiaOperatorLogoLong 

Nokia 72x14 op logo or 78x21 in 2 SMS

SMS_NokiaCallerLogo 

Nokia 72x14 caller logo, 1 SMS

SMS_NokiaWAPBookmarkLong 

Nokia WAP bookmark in 1 or 2 SMS

SMS_NokiaWAPSettingsLong 

Nokia WAP settings in 2 SMS

SMS_NokiaMMSSettingsLong 

Nokia MMS settings in 2 SMS

SMS_NokiaVCARD10Long 

Nokia VCARD 1.0 - only name and default number

SMS_NokiaVCARD21Long 

Nokia VCARD 2.1 - all numbers + text

SMS_NokiaVCALENDAR10Long 

Nokia VCALENDAR 1.0 - can be in few sms

SMS_NokiaVTODOLong 
SMS_VCARD10Long 
SMS_VCARD21Long 
SMS_DisableVoice 
SMS_DisableFax 
SMS_DisableEmail 
SMS_EnableVoice 
SMS_EnableFax 
SMS_EnableEmail 
SMS_VoidSMS 
SMS_EMSSound10 

IMelody 1.0

SMS_EMSSound12 

IMelody 1.2

SMS_EMSSonyEricssonSound 

IMelody without header - SonyEricsson extension

SMS_EMSSound10Long 

IMelody 1.0 with UPI.

SMS_EMSSound12Long 

IMelody 1.2 with UPI.

SMS_EMSSonyEricssonSoundLong 

IMelody without header with UPI.

SMS_EMSPredefinedSound 
SMS_EMSPredefinedAnimation 
SMS_EMSAnimation 
SMS_EMSFixedBitmap 

Fixed bitmap of size 16x16 or 32x32.

SMS_EMSVariableBitmap 
SMS_EMSVariableBitmapLong 
SMS_MMSIndicatorLong 

MMS message indicator.

SMS_WAPIndicatorLong 
SMS_AlcatelMonoBitmapLong 

Variable bitmap with black and white colors

SMS_AlcatelMonoAnimationLong 

Variable animation with black and white colors

SMS_AlcatelSMSTemplateName 
SMS_SiemensFile 

Siemens OTA

Definition at line 834 of file gammu-message.h.

Coding type of SMS.

Enumerator:
SMS_Coding_Unicode_No_Compression 

Unicode

SMS_Coding_Unicode_Compression 
SMS_Coding_Default_No_Compression 

Default GSM alphabet.

SMS_Coding_Default_Compression 
SMS_Coding_8bit 

8-bit.

Definition at line 310 of file gammu-message.h.

Status of SMS message.

Enumerator:
SMS_Sent 
SMS_UnSent 
SMS_Read 
SMS_UnRead 

Definition at line 298 of file gammu-message.h.

Enum defines format of SMS messages. See GSM 03.40 section 9.2.3.9

Enumerator:
SMS_FORMAT_Pager 
SMS_FORMAT_Fax 
SMS_FORMAT_Email 
SMS_FORMAT_Text 

Definition at line 212 of file gammu-message.h.

{
/* Some values not handled here */

TP-Message-Type-Indicator. See GSM 03.40 section 9.2.3.1.

Enumerator:
SMS_Deliver 

SMS in Inbox.

SMS_Status_Report 

Delivery Report

SMS_Submit 

SMS for sending or in Outbox

Definition at line 416 of file gammu-message.h.

{
/* specification gives more */
enum GSM_UDH

Types of UDH (User Data Header).

Enumerator:
UDH_NoUDH 
UDH_ConcatenatedMessages 

Linked SMS.

UDH_ConcatenatedMessages16bit 

Linked SMS with 16 bit reference.

UDH_DisableVoice 
UDH_DisableFax 
UDH_DisableEmail 
UDH_EnableVoice 
UDH_EnableFax 
UDH_EnableEmail 
UDH_VoidSMS 
UDH_NokiaRingtone 
UDH_NokiaRingtoneLong 
UDH_NokiaOperatorLogo 
UDH_NokiaOperatorLogoLong 
UDH_NokiaCallerLogo 
UDH_NokiaWAP 
UDH_NokiaWAPLong 
UDH_NokiaCalendarLong 
UDH_NokiaProfileLong 
UDH_NokiaPhonebookLong 
UDH_UserUDH 
UDH_MMSIndicatorLong 

Definition at line 344 of file gammu-message.h.

Enum defines some the most often used validity lengths for SMS messages for relative validity format. See GSM 03.40 section 9.2.3.12.1 - it gives more values.

Enumerator:
SMS_VALID_1_Hour 
SMS_VALID_6_Hours 
SMS_VALID_1_Day 
SMS_VALID_3_Days 
SMS_VALID_1_Week 
SMS_VALID_Max_Time 

Definition at line 227 of file gammu-message.h.

Enum defines format of validity period for SMS messages. See GSM 03.40 section 9.2.3.12

Enumerator:
SMS_Validity_NotAvailable 
SMS_Validity_RelativeFormat 

Definition at line 242 of file gammu-message.h.

{
/* Specification gives also other possibilities */

Function Documentation

GSM_Error GSM_AddSMS ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Adds SMS to specified folder.

Parameters
sState machine pointer.
[in,out]smsSMS message data, location will be updated.
Returns
Error code.
GSM_Error GSM_AddSMSFolder ( GSM_StateMachine s,
unsigned char *  name 
)

Creates SMS folder.

Parameters
sState machine pointer.
[in]nameName of SMS folder which should be created.
Returns
Error code.
void GSM_ClearMultiPartSMSInfo ( GSM_MultiPartSMSInfo Info)

Clears GSM_MultiPartSMSInfo to default values.

gboolean GSM_DecodeMultiPartSMS ( GSM_Debug_Info di,
GSM_MultiPartSMSInfo Info,
GSM_MultiSMSMessage SMS,
gboolean  ems 
)

Decodes multi part SMS to "readable" format.

GSM_Error GSM_DecodePDUFrame ( GSM_Debug_Info di,
GSM_SMSMessage SMS,
const unsigned char *  buffer,
size_t  length,
size_t *  final_pos,
gboolean  SMSC 
)

Decodes PDU data.

Parameters
diDebug information structure.
SMSPointer where to store parsed message.
bufferPDU data.
lengthLength of PDU data.
final_posOptional pointer where end position will be stored.
SMSCWhether PDU includes SMSC data.
gboolean GSM_DecodeSiemensOTASMS ( GSM_Debug_Info di,
GSM_SiemensOTASMSInfo Info,
GSM_SMSMessage SMS 
)

Decodes Siemens OTA data.

GSM_Error GSM_DecodeSMSFrame ( GSM_Debug_Info di,
GSM_SMSMessage SMS,
unsigned char *  buffer,
GSM_SMSMessageLayout  Layout 
)

Decodes SMS frame.

GSM_Error GSM_DecodeSMSFrameStatusReportData ( GSM_Debug_Info di,
GSM_SMSMessage SMS,
unsigned char *  buffer,
GSM_SMSMessageLayout  Layout 
)

Decodes SMS frame for status report.

GSM_Error GSM_DecodeSMSFrameText ( GSM_Debug_Info di,
GSM_SMSMessage SMS,
unsigned char *  buffer,
GSM_SMSMessageLayout  Layout 
)

Decodes SMS frame in textual representation.

void GSM_DecodeUDHHeader ( GSM_Debug_Info di,
GSM_UDHHeader UDH 
)

Decodes UDH header.

GSM_Error GSM_DeleteSMS ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Deletes SMS.

Parameters
sState machine pointer.
[in]smsSMS structure with SMS location and folder.
Returns
Error code.
GSM_Error GSM_DeleteSMSFolder ( GSM_StateMachine s,
int  ID 
)

Deletes SMS folder.

Parameters
sState machine pointer.
[in]IDID of SMS folder to delete.
Returns
Error code.
GSM_Error GSM_EncodeMultiPartSMS ( GSM_Debug_Info di,
GSM_MultiPartSMSInfo Info,
GSM_MultiSMSMessage SMS 
)

Encodes multi part SMS from "readable" format.

Returns
Error code.
GSM_Error GSM_EncodeSMSFrame ( GSM_Debug_Info di,
GSM_SMSMessage SMS,
unsigned char *  buffer,
GSM_SMSMessageLayout  Layout,
int *  length,
gboolean  clear 
)

Encodes SMS frame.

void GSM_EncodeUDHHeader ( GSM_Debug_Info di,
GSM_UDHHeader UDH 
)

Encodes UDH header.

void GSM_FreeMultiPartSMSInfo ( GSM_MultiPartSMSInfo Info)

Frees any allocated structures inside GSM_MultiPartSMSInfo.

GSM_Error GSM_GetNextSMS ( GSM_StateMachine s,
GSM_MultiSMSMessage sms,
gboolean  start 
)

Reads next (or first if start set) SMS message. This might be faster for some phones than using GSM_GetSMS for each message.

Please note that this commend does not have to mark message as read in phone. To do so, you have to call GSM_GetSMS.

Parameters
sState machine pointer.
[in,out]smsSMS message data read from phone, for subsequent reads, location and folder might be used by phone driver to determine reading state.
[in]startWhether we start reading from beginning.
Returns
Error code.
GSM_Error GSM_GetSMS ( GSM_StateMachine s,
GSM_MultiSMSMessage sms 
)

Reads SMS message.

Parameters
sState machine pointer.
[in,out]smsSMS message data read from phone, location and folder should be set.
Returns
Error code.
GSM_Error GSM_GetSMSC ( GSM_StateMachine s,
GSM_SMSC smsc 
)

Gets SMS Service Center number and SMS settings.

Parameters
sState machine pointer.
[in,out]smscSMSC structure, should contain location.
Returns
Error code.
GSM_Error GSM_GetSMSFolders ( GSM_StateMachine s,
GSM_SMSFolders folders 
)

Returns SMS folders information.

Parameters
sState machine pointer.
[out]foldersfolders Pointer to folders structure, which will be filled in.
Returns
Error code.
GSM_Error GSM_GetSMSStatus ( GSM_StateMachine s,
GSM_SMSMemoryStatus status 
)

Gets information about SMS memory (read/unread/size of memory for both SIM and phone).

Parameters
sState machine pointer.
[out]statusPointer to SMS status structure.
Returns
Error code.
GSM_Error GSM_LinkSMS ( GSM_Debug_Info di,
GSM_MultiSMSMessage **  INPUT,
GSM_MultiSMSMessage **  OUTPUT,
gboolean  ems 
)

Links SMS messages according to IDs.

Returns
Error code.
GSM_Error GSM_SendSavedSMS ( GSM_StateMachine s,
int  Folder,
int  Location 
)

Sends SMS already saved in phone.

Parameters
sState machine pointer.
[in]FolderFolder, where message is stored.
[in]LocationLocation, where message is stored.
Returns
Error code.
GSM_Error GSM_SendSMS ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Sends SMS.

Parameters
sState machine pointer.
[in]smsSMS structure with SMS data to send.
Returns
Error code.
void GSM_SetDefaultReceivedSMSData ( GSM_SMSMessage SMS)

Sets default content for SMS except for changing locations. Use this for clearing structure while keeping location of message.

Parameters
SMSPointer to structure which should be cleaned up.
void GSM_SetDefaultSMSData ( GSM_SMSMessage SMS)

Sets default content for SMS. Use this for clearing structure.

Parameters
SMSPointer to structure which should be cleaned up.
GSM_Error GSM_SetFastSMSSending ( GSM_StateMachine s,
gboolean  enable 
)

Configures fast SMS sending.

Parameters
sState machine pointer.
[in]enableWhether to enable notifications.
Returns
Error code.
GSM_Error GSM_SetIncomingSMS ( GSM_StateMachine s,
gboolean  enable 
)

Enable/disable notification on incoming SMS.

Parameters
sState machine pointer.
[in]enableWhether to enable notifications.
Returns
Error code.
GSM_Error GSM_SetSMS ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Sets SMS.

Parameters
sState machine pointer.
[in]smsSMS message data.
Returns
Error code.
GSM_Error GSM_SetSMSC ( GSM_StateMachine s,
GSM_SMSC smsc 
)

Sets SMS Service Center number and SMS settings.

Parameters
sState machine pointer.
[in]smscSMSC structure.
Returns
Error code.
void GSM_SMSCounter ( GSM_Debug_Info di,
unsigned char *  MessageBuffer,
GSM_UDH  UDHType,
GSM_Coding_Type  Coding,
int *  SMSNum,
size_t *  CharsLeft 
)

Calculates number of messages and free chars needed for text.

Parameters
diDebug settings.
[in]MessageBufferActual message text in unicode.
[in]UDHTypeUDH type.
[in]CodingGSM Encoding type.
[out]SMSNumNumber of messages needed to store the text.
[out]CharsLeftNumber of free chars in the message.
GSM_Error PHONE_EncodeSMSFrame ( GSM_StateMachine s,
GSM_SMSMessage SMS,
unsigned char *  buffer,
GSM_SMSMessageLayout  Layout,
int *  length,
gboolean  clear 
)

Encodes SMS frame according to layout.

Returns
Error code.

Variable Documentation

GSM_SMSMessageLayout PHONE_SMSDeliver

Layout for deliver message.

GSM_SMSMessageLayout PHONE_SMSStatusReport

Layout for status report message.

GSM_SMSMessageLayout PHONE_SMSSubmit

Layout for submit message.