Gammu internals  1.38.0
gsmmulti.h File Reference
#include <gammu-message.h>
Include dependency graph for gsmmulti.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SM30_ISOTEXT   0 /* ISO 8859-1 text */
 
#define SM30_UNICODETEXT   1
 
#define SM30_OTA   2
 
#define SM30_RINGTONE   3
 
#define SM30_PROFILENAME   4
 
#define SM30_SCREENSAVER   6
 
#define ALCATELTDD_PICTURE   4
 
#define ALCATELTDD_ANIMATION   5
 
#define ALCATELTDD_SMSTEMPLATE   6
 

Functions

GSM_Error GSM_AddSMS_Text_UDH (GSM_Debug_Info *di, GSM_MultiSMSMessage *SMS, GSM_Coding_Type Coding, char *Buffer, size_t BufferLen, gboolean UDH, size_t *UsedText, size_t *CopiedText, size_t *CopiedSMSText)
 
void GSM_MakeMultiPartSMS (GSM_Debug_Info *di, GSM_MultiSMSMessage *SMS, unsigned char *MessageBuffer, size_t MessageLength, GSM_UDH UDHType, GSM_Coding_Type Coding, int Class, unsigned char RejectDuplicates)
 
void GSM_Find_Free_Used_SMS2 (GSM_Debug_Info *di, GSM_Coding_Type Coding, GSM_SMSMessage *SMS, size_t *UsedText, size_t *FreeText, size_t *FreeBytes)
 
unsigned char GSM_MakeSMSIDFromTime (void)
 
gboolean GSM_DecodeMMSIndication (GSM_Debug_Info *di, GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS)
 

Macro Definition Documentation

§ ALCATELTDD_ANIMATION

#define ALCATELTDD_ANIMATION   5

Definition at line 26 of file gsmmulti.h.

Referenced by GSM_EncodeMultiPartSMS().

§ ALCATELTDD_PICTURE

#define ALCATELTDD_PICTURE   4

Definition at line 25 of file gsmmulti.h.

Referenced by GSM_EncodeMultiPartSMS().

§ ALCATELTDD_SMSTEMPLATE

#define ALCATELTDD_SMSTEMPLATE   6

Definition at line 27 of file gsmmulti.h.

Referenced by GSM_EncodeMultiPartSMS().

§ SM30_ISOTEXT

#define SM30_ISOTEXT   0 /* ISO 8859-1 text */

Definition at line 16 of file gsmmulti.h.

Referenced by GSM_DecodeNokiaProfile(), and GSM_EncodeSMS30MultiPartSMS().

§ SM30_OTA

#define SM30_OTA   2

Definition at line 18 of file gsmmulti.h.

Referenced by GSM_DecodeNokiaProfile(), and GSM_EncodeSMS30MultiPartSMS().

§ SM30_PROFILENAME

#define SM30_PROFILENAME   4

Definition at line 20 of file gsmmulti.h.

Referenced by GSM_DecodeNokiaProfile(), and GSM_EncodeSMS30MultiPartSMS().

§ SM30_RINGTONE

#define SM30_RINGTONE   3

Definition at line 19 of file gsmmulti.h.

Referenced by GSM_DecodeNokiaProfile(), and GSM_EncodeSMS30MultiPartSMS().

§ SM30_SCREENSAVER

#define SM30_SCREENSAVER   6

Definition at line 22 of file gsmmulti.h.

Referenced by GSM_DecodeNokiaProfile(), and GSM_EncodeSMS30MultiPartSMS().

§ SM30_UNICODETEXT

#define SM30_UNICODETEXT   1

Definition at line 17 of file gsmmulti.h.

Referenced by GSM_DecodeNokiaProfile(), and GSM_EncodeSMS30MultiPartSMS().

Function Documentation

§ GSM_AddSMS_Text_UDH()

GSM_Error GSM_AddSMS_Text_UDH ( GSM_Debug_Info di,
GSM_MultiSMSMessage SMS,
GSM_Coding_Type  Coding,
char *  Buffer,
size_t  BufferLen,
gboolean  UDH,
size_t *  UsedText,
size_t *  CopiedText,
size_t *  CopiedSMSText 
)

Definition at line 212 of file gsmmulti.c.

References AlignSegmentForContent(), ERR_NONE, FindDefaultAlphabetLen(), GSM_Find_Free_Used_SMS2(), GSM_UDHHeader::Length, GSM_SMSMessage::Length, GSM_MultiSMSMessage::Number, smfprintf(), GSM_MultiSMSMessage::SMS, SMS_Coding_8bit, SMS_Coding_Default_No_Compression, SMS_Coding_Unicode_No_Compression, GSM_UDHHeader::Text, GSM_SMSMessage::Text, GSM_UDHHeader::Type, GSM_SMSMessage::UDH, UDH_UserUDH, and UnicodeLength().

Referenced by GSM_EncodeEMSMultiPartSMS(), and GSM_MakeMultiPartSMS().

221 {
222  size_t FreeText=0,FreeBytes=0,Copy,i,j;
223 
224  smfprintf(di, "Checking used: ");
226  di, Coding, &(SMS->SMS[SMS->Number]),
227  UsedText, &FreeText, &FreeBytes
228  );
229 
230  if (UDH) {
231  smfprintf(di, "Adding UDH\n");
232  if (FreeBytes - BufferLen <= 0) {
233  smfprintf(di, "Going to the new SMS\n");
234  SMS->Number++;
236  di, Coding, &(SMS->SMS[SMS->Number]),
237  UsedText, &FreeText, &FreeBytes
238  );
239  }
240  if (SMS->SMS[SMS->Number].UDH.Length == 0) {
241  SMS->SMS[SMS->Number].UDH.Length = 1;
242  SMS->SMS[SMS->Number].UDH.Text[0] = 0x00;
243  }
244  memcpy(SMS->SMS[SMS->Number].UDH.Text+SMS->SMS[SMS->Number].UDH.Length,Buffer,BufferLen);
245  SMS->SMS[SMS->Number].UDH.Length += BufferLen;
246  SMS->SMS[SMS->Number].UDH.Text[0] += BufferLen;
247  SMS->SMS[SMS->Number].UDH.Type = UDH_UserUDH;
248  smfprintf(di, "UDH added %ld\n", (long)BufferLen);
249  } else {
250  smfprintf(di, "Adding text\n");
251  if (FreeText == 0) {
252  smfprintf(di, "Going to the new SMS\n");
253  SMS->Number++;
255  di, Coding, &(SMS->SMS[SMS->Number]),
256  UsedText, &FreeText, &FreeBytes
257  );
258  }
259 
260  Copy = FreeText;
261  smfprintf(di, "Copy %ld (max %ld)\n", (long)Copy, (long)BufferLen);
262  if (BufferLen < Copy) {
263  Copy = BufferLen;
264  }
265 
266  switch (Coding) {
268  FindDefaultAlphabetLen(Buffer,&i,&j,FreeText);
269  smfprintf(di, "Defalt text, length %ld %ld\n", (long)i, (long)j);
270  SMS->SMS[SMS->Number].Text[UnicodeLength(SMS->SMS[SMS->Number].Text)*2+i*2] = 0;
271  SMS->SMS[SMS->Number].Text[UnicodeLength(SMS->SMS[SMS->Number].Text)*2+i*2+1] = 0;
272  memcpy(SMS->SMS[SMS->Number].Text+UnicodeLength(SMS->SMS[SMS->Number].Text)*2,Buffer,i*2);
273  *CopiedText = i;
274  *CopiedSMSText = j;
275  SMS->SMS[SMS->Number].Length += i;
276  break;
278  AlignSegmentForContent(di, &Copy, Buffer, BufferLen);
279  SMS->SMS[SMS->Number].Text[UnicodeLength(SMS->SMS[SMS->Number].Text)*2+Copy*2] = 0;
280  SMS->SMS[SMS->Number].Text[UnicodeLength(SMS->SMS[SMS->Number].Text)*2+Copy*2+1] = 0;
281  memcpy(SMS->SMS[SMS->Number].Text+UnicodeLength(SMS->SMS[SMS->Number].Text)*2,Buffer,Copy*2);
282  *CopiedText = *CopiedSMSText = Copy;
283  SMS->SMS[SMS->Number].Length += Copy;
284  break;
285  case SMS_Coding_8bit:
286  memcpy(SMS->SMS[SMS->Number].Text+SMS->SMS[SMS->Number].Length,Buffer,Copy);
287  SMS->SMS[SMS->Number].Length += Copy;
288  *CopiedText = *CopiedSMSText = Copy;
289  break;
290  default:
291  break;
292  }
293  smfprintf(di, "Text added\n");
294  }
295 
296  smfprintf(di, "Checking at the end: ");
298  di, Coding, &(SMS->SMS[SMS->Number]),
299  UsedText, &FreeText, &FreeBytes
300  );
301 
302  return ERR_NONE;
303 }
unsigned char Text[(GSM_MAX_SMS_LENGTH+1) *2]
void FindDefaultAlphabetLen(const unsigned char *src, size_t *srclen, size_t *smslen, size_t maxlen)
Definition: coding.c:914
size_t UnicodeLength(const unsigned char *str)
Definition: coding.c:186
GSM_UDHHeader UDH
int AlignSegmentForContent(GSM_Debug_Info *di, size_t *Copy, char *Buffer, size_t BufferLen)
Definition: gsmmulti.c:197
void GSM_Find_Free_Used_SMS2(GSM_Debug_Info *di, GSM_Coding_Type Coding, GSM_SMSMessage *SMS, size_t *UsedText, size_t *FreeText, size_t *FreeBytes)
Definition: gsmmulti.c:37
unsigned char Text[GSM_MAX_UDH_LENGTH]
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
int smfprintf(GSM_Debug_Info *d, const char *format,...)
Definition: debug.c:240

§ GSM_DecodeMMSIndication()

gboolean GSM_DecodeMMSIndication ( GSM_Debug_Info di,
GSM_MultiPartSMSInfo Info,
GSM_MultiSMSMessage SMS 
)

Decodes long MMS notification SMS.

Definition at line 981 of file gsmmulti.c.

References GSM_MMSIndicator::Address, GSM_MMSIndicator::Class, dbgprintf, DumpMessage(), GSM_MultiPartSMSInfo::Entries, GSM_MultiPartSMSInfo::EntriesNum, FALSE, GSM_MAX_MULTI_SMS, GSM_MAX_SMS_LENGTH, GSM_MMS_Advertisement, GSM_MMS_Auto, GSM_MMS_Info, GSM_MMS_None, GSM_MMS_Personal, GSM_MultiPartSMSEntry::ID, GSM_SMSMessage::Length, GSM_MMSIndicator::MessageSize, GSM_MultiPartSMSEntry::MMSIndicator, GSM_MultiSMSMessage::Number, GSM_MMSIndicator::Sender, GSM_MultiSMSMessage::SMS, SMS_MMSIndicatorLong, GSM_UDHHeader::Text, GSM_SMSMessage::Text, GSM_MMSIndicator::Title, TRUE, GSM_UDHHeader::Type, GSM_SMSMessage::UDH, UDH_MMSIndicatorLong, and UDH_UserUDH.

Referenced by GSM_DecodeEMSMultiPartSMS(), and GSM_DecodeMultiPartSMS().

984 {
985  int i, Length = 0, j;
986  unsigned char Buffer[GSM_MAX_SMS_LENGTH*2*GSM_MAX_MULTI_SMS];
987 
988  /* Concatenate data */
989  for (i = 0; i < SMS->Number; i++) {
990  if (SMS->SMS[i].UDH.Type == UDH_MMSIndicatorLong) {
991  if (SMS->SMS[i].UDH.Text[11] != i+1 ||
992  SMS->SMS[i].UDH.Text[10] != SMS->Number) {
993  return FALSE;
994  }
995  } else if (SMS->SMS[i].UDH.Type != UDH_UserUDH) {
996  return FALSE;
997  }
998  memcpy(Buffer + Length, SMS->SMS[i].Text, SMS->SMS[i].Length);
999  Length = Length + SMS->SMS[i].Length;
1000  }
1001 
1002  dbgprintf(di, "MMS data of length %d:\n", Length);
1003  DumpMessage(di, Buffer, Length);
1004  Info->Entries[0].MMSIndicator = (GSM_MMSIndicator *)malloc(sizeof(GSM_MMSIndicator));
1005  if (Info->Entries[0].MMSIndicator == NULL) {
1006  return FALSE;
1007  }
1008  Info->EntriesNum = 1;
1009  Info->Entries[0].ID = SMS_MMSIndicatorLong;
1010  Info->Entries[0].MMSIndicator->Class = GSM_MMS_None;
1011  Info->Entries[0].MMSIndicator->MessageSize = 0;
1012  Info->Entries[0].MMSIndicator->Title[0] = 0;
1013  Info->Entries[0].MMSIndicator->Sender[0] = 0;
1014  Info->Entries[0].MMSIndicator->Address[0] = 0;
1015 
1016  /* First byte is transaction ID */
1017  /* PUSH */
1018  if (Buffer[1] != 0x06) {
1019  dbgprintf(di, "Unsupported transaction id: 0x%02x\n", Buffer[1]);
1020  return FALSE;
1021  }
1022  /* Process payload */
1023  for (i = 3 + Buffer[2]; i < Length; i++) {
1024  switch(Buffer[i]) {
1025  case 0x8c:
1026  /* Transaction type */
1027  i++;
1028  if (Buffer[i] != 0x82) {
1029  dbgprintf(di, "Unsupported transaction type: 0x%02x\n", Buffer[i]);
1030  return FALSE;
1031  }
1032  break;
1033  case 0x98:
1034  /* Message ID */
1035  while (Buffer[i] != 0 && i < Length) i++;
1036  break;
1037  case 0x8d:
1038  /* MMS version */
1039  i++;
1040  if (Buffer[i] < 0x90 || Buffer[i] > 0x92) {
1041  dbgprintf(di, "Unsupported MMS version: 0x%02x\n", Buffer[i]);
1042  return FALSE;
1043  }
1044  break;
1045  case 0x89:
1046  /* Sender */
1047  i++;
1048  if (Buffer[i] == 0) continue;
1049  if (Buffer[i + 1] == 0x80) {
1050  if (Buffer[i + 2] < 32) {
1051  /* String with length + encoding, we just ignore it for now */
1052  strcpy(Info->Entries[0].MMSIndicator->Sender, Buffer + i + 4);
1053  } else {
1054  strcpy(Info->Entries[0].MMSIndicator->Sender, Buffer + i + 2);
1055  }
1056  }
1057  i += Buffer[i];
1058  break;
1059  case 0x96:
1060  /* Title */
1061  if (Buffer[i + 1] == 0x0a && Buffer[i + 2] == 0xea) {
1062  /* UTF-8 */
1063  strcpy(Info->Entries[0].MMSIndicator->Title, Buffer + i + 3);
1064  i += strlen(Info->Entries[0].MMSIndicator->Title) + 3;
1065  } else {
1066  strcpy(Info->Entries[0].MMSIndicator->Title, Buffer + i + 1);
1067  i += strlen(Info->Entries[0].MMSIndicator->Title) + 1;
1068  }
1069  break;
1070  case 0x8a:
1071  /* Class */
1072  i++;
1073  switch (Buffer[i]) {
1074  case 0x80:
1076  break;
1077  case 0x81:
1079  break;
1080  case 0x82:
1081  Info->Entries[0].MMSIndicator->Class = GSM_MMS_Info;
1082  break;
1083  case 0x83:
1084  Info->Entries[0].MMSIndicator->Class = GSM_MMS_Auto;
1085  break;
1086  default:
1087  dbgprintf(di, "Unsupported MMS class: 0x%02x\n", Buffer[i]);
1088  break;
1089  }
1090  break;
1091  case 0x8e:
1092  /* Message size */
1093  i++;
1094  for (j = i + 1; j < i + 1 + Buffer[i]; j++) {
1095  Info->Entries[0].MMSIndicator->MessageSize = (Info->Entries[0].MMSIndicator->MessageSize << 8) + Buffer[j];
1096  }
1097  i += Buffer[i];
1098  break;
1099  case 0x88:
1100  /* Don't know */
1101  i++;
1102  break;
1103  case 0x81:
1104  /* Don't know */
1105  i++;
1106  i += Buffer[i];
1107  break;
1108  case 0x83:
1109  /* URL */
1110  strcpy(Info->Entries[0].MMSIndicator->Address, Buffer + i + 1);
1111  i += strlen(Info->Entries[0].MMSIndicator->Address) + 1;
1112  break;
1113  case 0x87:
1114  default:
1115  dbgprintf(di, "Unknown MMS tag: 0x%02x\n", Buffer[i]);
1116  break;
1117  }
1118  }
1119 
1120  return TRUE;
1121 }
unsigned char Text[(GSM_MAX_SMS_LENGTH+1) *2]
void DumpMessage(GSM_Debug_Info *d, const unsigned char *message, const size_t messagesize)
Definition: debug.c:314
char Address[500]
Definition: gammu-message.h:90
GSM_MMSIndicator * MMSIndicator
GSM_UDHHeader UDH
GSM_MMS_Class Class
GSM_MultiPartSMSEntry Entries[GSM_MAX_MULTI_SMS]
#define GSM_MAX_SMS_LENGTH
Definition: gammu-limits.h:176
unsigned char Text[GSM_MAX_UDH_LENGTH]
#define FALSE
Definition: gammu-types.h:25
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
char Sender[200]
Definition: gammu-message.h:98
EncodeMultiPartSMSID ID
#define GSM_MAX_MULTI_SMS
Definition: gammu-limits.h:162
#define dbgprintf
Definition: debug.h:72
#define TRUE
Definition: gammu-types.h:28

§ GSM_Find_Free_Used_SMS2()

void GSM_Find_Free_Used_SMS2 ( GSM_Debug_Info di,
GSM_Coding_Type  Coding,
GSM_SMSMessage SMS,
size_t *  UsedText,
size_t *  FreeText,
size_t *  FreeBytes 
)

Definition at line 37 of file gsmmulti.c.

References FindDefaultAlphabetLen(), GSM_MAX_8BIT_SMS_LENGTH, GSM_UDHHeader::Length, GSM_SMSMessage::Length, smfprintf(), SMS_Coding_8bit, SMS_Coding_Default_No_Compression, SMS_Coding_Unicode_No_Compression, GSM_SMSMessage::Text, GSM_SMSMessage::UDH, and UnicodeLength().

Referenced by GSM_AddSMS_Text_UDH(), GSM_EncodeEMSMultiPartSMS(), and GSM_SMSCounter().

38 {
39  size_t UsedBytes = 0;
40 
41  switch (Coding) {
43  FindDefaultAlphabetLen(SMS->Text,&UsedBytes,UsedText,500);
44  UsedBytes = *UsedText * 7 / 8;
45  if (UsedBytes * 8 / 7 != *UsedText) UsedBytes++;
46  *FreeBytes = GSM_MAX_8BIT_SMS_LENGTH - SMS->UDH.Length - UsedBytes;
47  *FreeText = (GSM_MAX_8BIT_SMS_LENGTH - SMS->UDH.Length) * 8 / 7 - *UsedText;
48  break;
50  *UsedText = UnicodeLength(SMS->Text);
51  UsedBytes = *UsedText * 2;
52  *FreeBytes = GSM_MAX_8BIT_SMS_LENGTH - SMS->UDH.Length - UsedBytes;
53  *FreeText = *FreeBytes / 2;
54  break;
55  case SMS_Coding_8bit:
56  *UsedText = UsedBytes = SMS->Length;
57  *FreeBytes = GSM_MAX_8BIT_SMS_LENGTH - SMS->UDH.Length - UsedBytes;
58  *FreeText = *FreeBytes;
59  break;
60  default:
61  break;
62  }
63  smfprintf(di, "UDH len %i, UsedBytes %ld, FreeText %ld, UsedText %ld, FreeBytes %ld\n",
64  SMS->UDH.Length,
65  (long)UsedBytes,
66  (long)*FreeText,
67  (long)*UsedText,
68  (long)*FreeBytes);
69 }
unsigned char Text[(GSM_MAX_SMS_LENGTH+1) *2]
void FindDefaultAlphabetLen(const unsigned char *src, size_t *srclen, size_t *smslen, size_t maxlen)
Definition: coding.c:914
size_t UnicodeLength(const unsigned char *str)
Definition: coding.c:186
GSM_UDHHeader UDH
#define GSM_MAX_8BIT_SMS_LENGTH
Definition: gammu-limits.h:190
int smfprintf(GSM_Debug_Info *d, const char *format,...)
Definition: debug.c:240

§ GSM_MakeMultiPartSMS()

void GSM_MakeMultiPartSMS ( GSM_Debug_Info di,
GSM_MultiSMSMessage SMS,
unsigned char *  MessageBuffer,
size_t  MessageLength,
GSM_UDH  UDHType,
GSM_Coding_Type  Coding,
int  Class,
unsigned char  RejectDuplicates 
)

Definition at line 305 of file gsmmulti.c.

References GSM_UDHHeader::AllParts, GSM_SMSMessage::Class, GSM_SMSMessage::Coding, FALSE, GSM_AddSMS_Text_UDH(), GSM_EncodeUDHHeader(), GSM_GetCurrentDateTime(), GSM_MakeSMSIDFromTime(), GSM_MAX_MULTI_SMS, GSM_SetDefaultSMSData(), GSM_DateTime::Hour, GSM_UDHHeader::ID16bit, GSM_UDHHeader::ID8bit, GSM_MultiSMSMessage::Number, GSM_UDHHeader::PartNumber, GSM_SMSMessage::ReplaceMessage, smfprintf(), GSM_MultiSMSMessage::SMS, SMS_Coding_8bit, GSM_UDHHeader::Type, and GSM_SMSMessage::UDH.

Referenced by GSM_EncodeMultiPartSMS(), and GSM_SMSCounter().

312 {
313  size_t Len,UsedText = 0,CopiedText = 0,CopiedSMSText = 0;
314  int j;
315  unsigned char UDHID;
316  GSM_DateTime Date;
317 
318  Len = 0;
319  while(1) {
320  if (SMS->Number >= GSM_MAX_MULTI_SMS) {
321  break;
322  }
323  GSM_SetDefaultSMSData(&SMS->SMS[SMS->Number]);
324  SMS->SMS[SMS->Number].Class = Class;
325  SMS->SMS[SMS->Number].Coding = Coding;
326 
327  SMS->SMS[SMS->Number].UDH.Type = UDHType;
328  GSM_EncodeUDHHeader(di, &SMS->SMS[SMS->Number].UDH);
329 
330  if (Coding == SMS_Coding_8bit) {
331  GSM_AddSMS_Text_UDH(di, SMS,Coding,MessageBuffer+Len,MessageLength - Len,FALSE,&UsedText,&CopiedText,&CopiedSMSText);
332  } else {
333  GSM_AddSMS_Text_UDH(di, SMS,Coding,MessageBuffer+Len*2,MessageLength - Len,FALSE,&UsedText,&CopiedText,&CopiedSMSText);
334  }
335  Len += CopiedText;
336  smfprintf(di, "%ld %ld\n", (long)Len, (long)MessageLength);
337  SMS->Number++;
338  if (Len == MessageLength) break;
339  }
340 
341  UDHID = GSM_MakeSMSIDFromTime();
342  GSM_GetCurrentDateTime (&Date);
343  for (j=0;j<SMS->Number;j++) {
344  SMS->SMS[j].UDH.Type = UDHType;
345  SMS->SMS[j].UDH.ID8bit = UDHID;
346  SMS->SMS[j].UDH.ID16bit = UDHID + 256 * Date.Hour;
347  SMS->SMS[j].UDH.PartNumber = j+1;
348  SMS->SMS[j].UDH.AllParts = SMS->Number;
349  GSM_EncodeUDHHeader(di, &SMS->SMS[j].UDH);
350  }
351  if (SMS->Number == 1) SMS->SMS[0].ReplaceMessage = ReplaceMessage;
352 }
GSM_Error GSM_AddSMS_Text_UDH(GSM_Debug_Info *di, GSM_MultiSMSMessage *SMS, GSM_Coding_Type Coding, char *Buffer, size_t BufferLen, gboolean UDH, size_t *UsedText, size_t *CopiedText, size_t *CopiedSMSText)
Definition: gsmmulti.c:212
unsigned char ReplaceMessage
signed char Class
void GSM_SetDefaultSMSData(GSM_SMSMessage *SMS)
Definition: gsmsms.c:1129
GSM_UDHHeader UDH
GSM_Coding_Type Coding
#define FALSE
Definition: gammu-types.h:25
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
#define GSM_MAX_MULTI_SMS
Definition: gammu-limits.h:162
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
Definition: misc.c:184
int smfprintf(GSM_Debug_Info *d, const char *format,...)
Definition: debug.c:240
void GSM_EncodeUDHHeader(GSM_Debug_Info *di, GSM_UDHHeader *UDH)
Definition: gsmsms.c:1151
unsigned char GSM_MakeSMSIDFromTime(void)
Definition: gsmmulti.c:21

§ GSM_MakeSMSIDFromTime()

unsigned char GSM_MakeSMSIDFromTime ( void  )

Definition at line 21 of file gsmmulti.c.

References GSM_GetCurrentDateTime(), GSM_DateTime::Minute, and GSM_DateTime::Second.

Referenced by GSM_EncodeAlcatelMultiPartSMS(), GSM_EncodeEMSMultiPartSMS(), and GSM_MakeMultiPartSMS().

22 {
23  GSM_DateTime Date;
24  unsigned char retval;
25 
26  GSM_GetCurrentDateTime (&Date);
27  retval = Date.Second;
28  switch (Date.Minute/10) {
29  case 2: case 7: retval = retval + 60; break;
30  case 4: case 8: retval = retval + 120; break;
31  case 9: case 5: case 0: retval = retval + 180; break;
32  }
33  retval += Date.Minute/10;
34  return retval;
35 }
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
Definition: misc.c:184