Gammu internals  1.38.0
gammu-message.h File Reference
#include <gammu-limits.h>
#include <gammu-memory.h>
#include <gammu-datetime.h>
#include <gammu-ringtone.h>
#include <gammu-bitmap.h>
#include <gammu-wap.h>
#include <gammu-calendar.h>
#include <gammu-file.h>
#include <gammu-debug.h>
Include dependency graph for gammu-message.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GSM_MMSIndicator
 
struct  GSM_CBMessage
 
struct  GSM_USSDMessage
 
struct  GSM_SMSMemoryStatus
 
struct  GSM_SMSValidity
 
struct  GSM_SMSC
 
struct  GSM_UDHHeader
 
struct  GSM_SMSMessage
 
struct  GSM_SMSMessageLayout
 
struct  GSM_OneSMSFolder
 
struct  GSM_SMSFolders
 
struct  GSM_SiemensOTASMSInfo
 
struct  GSM_MultiSMSMessage
 
struct  GSM_OneMMSFolder
 
struct  GSM_MMSFolders
 
struct  GSM_MultiPartSMSEntry
 
struct  GSM_MultiPartSMSInfo
 
struct  GSM_EncodedMultiPartMMSEntry
 
struct  GSM_EncodedMultiPartMMSInfo
 

Enumerations

enum  GSM_MMS_Class {
  GSM_MMS_None = 0, GSM_MMS_Personal = 1, GSM_MMS_Advertisement, GSM_MMS_Info,
  GSM_MMS_Auto, GSM_MMS_INVALID
}
 
enum  GSM_USSDStatus {
  USSD_Unknown = 1, USSD_NoActionNeeded, USSD_ActionNeeded, USSD_Terminated,
  USSD_AnotherClient, USSD_NotSupported, USSD_Timeout
}
 
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
}
 
enum  MMSAddressType { MMSADDRESS_PHONE, MMSADDRESS_UNKNOWN }
 

Functions

const char * GSM_SMSCodingToString (GSM_Coding_Type type)
 
GSM_Coding_Type GSM_StringToSMSCoding (const char *s)
 
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_Coding_Type GSM_GetMessageCoding (GSM_Debug_Info *di, const char TPDCS)
 
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_DecodeMMSFileToMultiPart (GSM_Debug_Info *di, GSM_File *file, GSM_EncodedMultiPartMMSInfo *info)
 
GSM_Error GSM_ClearMMSMultiPart (GSM_EncodedMultiPartMMSInfo *info)
 
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_SetIncomingCB (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)
 
GSM_Error GSM_GetMMSFolders (GSM_StateMachine *s, GSM_MMSFolders *folders)
 
GSM_Error GSM_GetNextMMSFileInfo (GSM_StateMachine *s, unsigned char *FileID, int *MMSFolder, gboolean start)
 
GSM_Error GSM_SetIncomingUSSD (GSM_StateMachine *s, gboolean enable)
 
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

Author
Michal Čihař

Message data and functions.

Definition in file gammu-message.h.

Enumeration Type Documentation

§ GSM_MMS_Class

MMS message class.

Enumerator
GSM_MMS_None 

None class specified.

GSM_MMS_Personal 

Personal message.

GSM_MMS_Advertisement 

Advertisement message.

GSM_MMS_Info 

Informational message.

GSM_MMS_Auto 

Automatic message class.

GSM_MMS_INVALID 

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

Function Documentation

§ GSM_GetMessageCoding()

GSM_Coding_Type GSM_GetMessageCoding ( GSM_Debug_Info di,
const char  TPDCS 
)

Finds out coding type based on TPDCS header byte as defined by GSM 03.38.

Definition at line 261 of file gsmsms.c.

References smfprintf(), SMS_Coding_8bit, SMS_Coding_Default_Compression, SMS_Coding_Default_No_Compression, SMS_Coding_Unicode_Compression, and SMS_Coding_Unicode_No_Compression.

Referenced by GSM_DecodePDUFrame(), and GSM_DecodeSMSFrame().

261  {
262 
263  /* GSM 03.40 section 9.2.3.10 (TP-Data-Coding-Scheme) and GSM 03.38 section 4 */
264  if ((TPDCS & 0xC0) == 0 || (TPDCS & 0xC0) == 0x40) {
265  /* 0x40 is marked for automatic deletion, we ignore that bit */
266  /* bits 7..4 set to 00xx */
267  if ((TPDCS & 0xC) == 0xC) {
268  smfprintf(di, "WARNING: reserved alphabet value in TPDCS\n");
269  } else {
270  if (TPDCS == 0) {
272  }
273  if ((TPDCS & 0x2C) == 0x00) {
275  }
276  if ((TPDCS & 0x2C) == 0x20) {
278  }
279  if ((TPDCS & 0x2C) == 0x08) {
281  }
282  if ((TPDCS & 0x2C) == 0x28) {
284  }
285  }
286  } else if ((TPDCS & 0xF0) >= 0x40 &&
287  (TPDCS & 0xF0) <= 0xB0) {
288  /* bits 7..4 set to 0100 ... 1011 */
289  smfprintf(di, "WARNING: reserved coding group in TPDCS\n");
290  } else if (((TPDCS & 0xF0) == 0xC0) ||
291  ((TPDCS & 0xF0) == 0xD0)) {
292  /* bits 7..4 set to 1100 or 1101 */
293  if ((TPDCS & 4) == 4) {
294  smfprintf(di, "WARNING: set reserved bit 2 in TPDCS\n");
295  } else {
297  }
298  } else if ((TPDCS & 0xF0) == 0xE0) {
299  /* bits 7..4 set to 1110 */
300  if ((TPDCS & 4) == 4) {
301  smfprintf(di, "WARNING: set reserved bit 2 in TPDCS\n");
302  } else {
304  }
305  } else if ((TPDCS & 0xF0) == 0xF0) {
306  /* bits 7..4 set to 1111 */
307  if ((TPDCS & 8) == 8) {
308  smfprintf(di, "WARNING: set reserved bit 3 in TPDCS\n");
309  } else {
310  if ((TPDCS & 4) == 0) return SMS_Coding_Default_No_Compression;
311  }
312  }
313  return SMS_Coding_8bit;
314 }
int smfprintf(GSM_Debug_Info *d, const char *format,...)
Definition: debug.c:240

§ GSM_SMSCodingToString()

const char* GSM_SMSCodingToString ( GSM_Coding_Type  type)

Converts SMS coding to string.

Returns
Pointer to static string, NULL on failure.

Definition at line 1284 of file gsmsms.c.

References SMS_Coding_8bit, SMS_Coding_Default_Compression, SMS_Coding_Default_No_Compression, SMS_Coding_Unicode_Compression, and SMS_Coding_Unicode_No_Compression.

1285 {
1286  switch (type) {
1288  return "Unicode_No_Compression";
1290  return "Unicode_Compression";
1292  return "Default_No_Compression";
1294  return "Default_Compression";
1295  case SMS_Coding_8bit:
1296  return "8bit";
1297  }
1298 
1299  return NULL;
1300 }

§ GSM_StringToSMSCoding()

GSM_Coding_Type GSM_StringToSMSCoding ( const char *  s)

Converts SMS coding to type.

Definition at line 1260 of file gsmsms.c.

References SMS_Coding_8bit, SMS_Coding_Default_Compression, SMS_Coding_Default_No_Compression, SMS_Coding_Unicode_Compression, and SMS_Coding_Unicode_No_Compression.

1261 {
1262  /* Maintain those without compression for backward compatibility */
1263  if (s == NULL) {
1265  } else if (strcmp("Unicode", s) == 0) {
1267  } else if (strcmp("Unicode_No_Compression", s) == 0) {
1269  } else if (strcmp("Unicode_Compression", s) == 0) {
1271  } else if (strcmp("Default", s) == 0) {
1273  } else if (strcmp("Default_No_Compression", s) == 0) {
1275  } else if (strcmp("Default_Compression", s) == 0) {
1277  } else if (strcmp("8bit", s) == 0) {
1278  return SMS_Coding_8bit;
1279  }
1280 
1281  return 0;
1282 }