-rw-r--r-- | gammu/emb/common/service/sms/gsmmulti.c | 5 | ||||
-rw-r--r-- | gammu/emb/common/service/sms/gsmmulti.h | 11 | ||||
-rw-r--r-- | gammu/emb/common/service/sms/gsmsms.c | 5 | ||||
-rw-r--r-- | gammu/emb/common/service/sms/gsmsms.h | 5 |
4 files changed, 23 insertions, 3 deletions
diff --git a/gammu/emb/common/service/sms/gsmmulti.c b/gammu/emb/common/service/sms/gsmmulti.c index 6c1cdcd..bdb5ee9 100644 --- a/gammu/emb/common/service/sms/gsmmulti.c +++ b/gammu/emb/common/service/sms/gsmmulti.c @@ -442,96 +442,101 @@ GSM_Error GSM_EncodeMultiPartSMS(GSM_MultiPartSMSInfo *Info, return GSM_EncodeEMSMultiPartSMS(Info,SMS,UDH_ConcatenatedMessages); } } return GSM_EncodeEMSMultiPartSMS(Info,SMS,UDH_ConcatenatedMessages16bit); } return error; } if (Info->EntriesNum != 1) return ERR_UNKNOWN; switch (Info->Entries[0].ID) { case SMS_AlcatelMonoBitmapLong: Buffer[0] = Info->Entries[0].Bitmap->Bitmap[0].BitmapWidth; Buffer[1] = Info->Entries[0].Bitmap->Bitmap[0].BitmapHeight; PHONE_EncodeBitmap(GSM_AlcatelBMMIPicture, Buffer+2, &Info->Entries[0].Bitmap->Bitmap[0]); Length = PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[0].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[0].BitmapHeight)+2; return GSM_EncodeAlcatelMultiPartSMS(SMS,Buffer,Length,Info->Entries[0].Bitmap->Bitmap[0].Text,ALCATELTDD_PICTURE); case SMS_AlcatelMonoAnimationLong: /* Number of sequence words */ Buffer[0] = (Info->Entries[0].Bitmap->Number+1) % 256; Buffer[1] = (Info->Entries[0].Bitmap->Number+1) / 256; /* Picture display time 1 second (1 = 100ms) */ Buffer[2] = 10 % 256; Buffer[3] = 10 / 256 + 0xF0; Length = 4; j = 0; /* Offsets to bitmaps */ for (i=0;i<Info->Entries[0].Bitmap->Number;i++) { Buffer[Length++] = (4+j+Info->Entries[0].Bitmap->Number*2) % 256; Buffer[Length++] = (4+j+Info->Entries[0].Bitmap->Number*2) / 256; j += PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight)+2; } /* Bitmaps */ for (i=0;i<Info->Entries[0].Bitmap->Number;i++) { Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth; Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight; PHONE_EncodeBitmap(GSM_AlcatelBMMIPicture, Buffer+Length, &Info->Entries[0].Bitmap->Bitmap[i]); Length += PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight); } return GSM_EncodeAlcatelMultiPartSMS(SMS,Buffer,Length,Info->Entries[0].Bitmap->Bitmap[0].Text,ALCATELTDD_ANIMATION); case SMS_MMSIndicatorLong: Class = 1; UDH = UDH_MMSIndicatorLong; GSM_EncodeMMSIndicatorSMSText(Buffer,&Length,*Info->Entries[0].MMSIndicator); break; + case SMS_WAPIndicatorLong: + Class = 1; + UDH = UDH_MMSIndicatorLong; + GSM_EncodeWAPIndicatorSMSText(Buffer,&Length,Info->Entries[0].MMSIndicator->Title,Info->Entries[0].MMSIndicator->Address); + break; case SMS_NokiaRingtoneLong: case SMS_NokiaRingtone: UDH = UDH_NokiaRingtone; Class = 1; /* 7 = length of UDH_NokiaRingtone UDH header */ Length = GSM_MAX_8BIT_SMS_LENGTH-7; Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); if (Info->Entries[0].ID == SMS_NokiaRingtone) break; if (Info->Entries[0].RingtoneNotes != Info->Entries[0].Ringtone->NoteTone.NrCommands) { UDH = UDH_NokiaRingtoneLong; Length = (GSM_MAX_8BIT_SMS_LENGTH-12)*3; Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); } break; case SMS_NokiaOperatorLogoLong: if (Info->Entries[0].Bitmap->Bitmap[0].BitmapWidth > 72 || Info->Entries[0].Bitmap->Bitmap[0].BitmapHeight > 14) { UDH = UDH_NokiaOperatorLogoLong; Class = 1; NOKIA_EncodeNetworkCode(Buffer, Info->Entries[0].Bitmap->Bitmap[0].NetworkCode); Length = Length + 3; NOKIA_CopyBitmap(GSM_Nokia7110OperatorLogo, &Info->Entries[0].Bitmap->Bitmap[0], Buffer, &Length); break; } case SMS_NokiaOperatorLogo: UDH = UDH_NokiaOperatorLogo; Class = 1; NOKIA_EncodeNetworkCode(Buffer, Info->Entries[0].Bitmap->Bitmap[0].NetworkCode); Length = Length + 3; NOKIA_CopyBitmap(GSM_NokiaOperatorLogo, &Info->Entries[0].Bitmap->Bitmap[0], Buffer, &Length); break; case SMS_NokiaCallerLogo: UDH = UDH_NokiaCallerLogo; Class = 1; NOKIA_CopyBitmap(GSM_NokiaCallerLogo, &Info->Entries[0].Bitmap->Bitmap[0], Buffer, &Length); break; case SMS_NokiaProfileLong: case SMS_NokiaPictureImageLong: case SMS_NokiaScreenSaverLong: Class = 1; UDH = UDH_NokiaProfileLong; GSM_EncodeSMS30MultiPartSMS(Info,Buffer,&Length); break; case SMS_NokiaWAPBookmarkLong: Class = 1; NOKIA_EncodeWAPBookmarkSMSText(Buffer,&Length,Info->Entries[0].Bookmark); /* 7 = length of UDH_NokiaWAP UDH header */ if (Length>(GSM_MAX_8BIT_SMS_LENGTH-7)) { UDH=UDH_NokiaWAPLong; diff --git a/gammu/emb/common/service/sms/gsmmulti.h b/gammu/emb/common/service/sms/gsmmulti.h index c672261..3f70d81 100644 --- a/gammu/emb/common/service/sms/gsmmulti.h +++ b/gammu/emb/common/service/sms/gsmmulti.h @@ -1,53 +1,57 @@ /* (c) 2002-2004 by Marcin Wiacek */ #ifndef __gsm_multi_h #define __gsm_multi_h +#if defined(_MSC_VER) && defined(__cplusplus) + extern "C" { +#endif + #include "../../gsmcomon.h" #include "../gsmlogo.h" #include "../gsmcal.h" #include "../gsmpbk.h" #include "../gsmdata.h" #include "../gsmring.h" #include "gsmsms.h" /* ---------------------- multi SMS --------------------------------------- */ /* Identifiers for Smart Messaging 3.0 multipart SMS */ #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 /* Identifiers for Alcatel Terminal Data Download */ #define ALCATELTDD_PICTURE 4 #define ALCATELTDD_ANIMATION 5 #define ALCATELTDD_SMSTEMPLATE 6 void GSM_SMSCounter(int MessageLength, unsigned char *MessageBuffer, GSM_UDH UDHType, GSM_Coding_Type Coding, int *SMSNum, int *CharsLeft); #define MAX_MULTI_SMS 10 /** * Multiple SMS messages, used for Smart Messaging 3.0/EMS. */ typedef struct { /** * Sender or recipient number. */ unsigned char Number; /** * Array of SMSes. */ GSM_SMSMessage SMS[MAX_MULTI_SMS]; } GSM_MultiSMSMessage; @@ -127,145 +131,150 @@ typedef enum { */ SMS_NokiaWAPBookmarkLong, /** * Nokia WAP settings in 2 SMS */ SMS_NokiaWAPSettingsLong, /** * Nokia MMS settings in 2 SMS */ SMS_NokiaMMSSettingsLong, /** * Nokia VCARD 1.0 - only name and default number */ SMS_NokiaVCARD10Long, /** * Nokia VCARD 2.1 - all numbers + text */ SMS_NokiaVCARD21Long, /** * Nokia VCALENDAR 1.0 - can be in few sms */ SMS_NokiaVCALENDAR10Long, SMS_NokiaVTODOLong, SMS_VCARD10Long, SMS_VCARD21Long, SMS_DisableVoice, SMS_DisableFax, SMS_DisableEmail, SMS_EnableVoice, SMS_EnableFax, SMS_EnableEmail, SMS_VoidSMS, /** * IMelody 1.0 */ SMS_EMSSound10, /** * IMelody 1.2 */ SMS_EMSSound12, /** * IMelody without header - SonyEricsson extension */ SMS_EMSSonyEricssonSound, /** * IMelody 1.0 with UPI. */ SMS_EMSSound10Long, - /*** + /** * IMelody 1.2 with UPI. */ SMS_EMSSound12Long, /** * IMelody without header with UPI. */ SMS_EMSSonyEricssonSoundLong, SMS_EMSPredefinedSound, SMS_EMSPredefinedAnimation, SMS_EMSAnimation, /** * Fixed bitmap of size 16x16 or 32x32. */ SMS_EMSFixedBitmap, SMS_EMSVariableBitmap, SMS_EMSVariableBitmapLong, SMS_MMSIndicatorLong, + SMS_WAPIndicatorLong, /** * Variable bitmap with black and white colors */ SMS_AlcatelMonoBitmapLong, /** * Variable animation with black and white colors */ SMS_AlcatelMonoAnimationLong, SMS_AlcatelSMSTemplateName } EncodeMultiPartSMSID; typedef struct { EncodeMultiPartSMSID ID; int Number; GSM_Ringtone *Ringtone; GSM_MultiBitmap *Bitmap; GSM_WAPBookmark *Bookmark; GSM_WAPSettings *Settings; GSM_MMSIndicator *MMSIndicator; GSM_MemoryEntry *Phonebook; GSM_CalendarEntry *Calendar; GSM_ToDoEntry *ToDo; bool Protected; unsigned char *Buffer; bool Left; bool Right; bool Center; bool Large; bool Small; bool Bold; bool Italic; bool Underlined; bool Strikethrough; /* Return values */ int RingtoneNotes; } MultiPartSMSEntry; typedef struct { MultiPartSMSEntry Entries[MAX_MULTI_SMS]; int EntriesNum; bool UnicodeCoding; int Class; unsigned char ReplaceMessage; bool Unknown; } GSM_MultiPartSMSInfo; /** * Encodes multi part SMS from "readable" format. */ GSM_Error GSM_EncodeMultiPartSMS (GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS); /** * Decodes multi part SMS to "readable" format. */ bool GSM_DecodeMultiPartSMS (GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SMS, bool ems); /** * Clears @ref GSM_MultiPartSMSInfo to default values. */ void GSM_ClearMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); /** * Frees any allocated structures inside @ref GSM_MultiPartSMSInfo. */ void GSM_FreeMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); /** * Links SMS messages according to IDs. */ GSM_Error GSM_LinkSMS(GSM_MultiSMSMessage **INPUT, GSM_MultiSMSMessage **OUTPUT, bool ems); +#if defined(_MSC_VER) && defined(__cplusplus) + } +#endif + #endif /* How should editor hadle tabs in this file? Add editor commands here. * vim: noexpandtab sw=8 ts=8 sts=8: */ diff --git a/gammu/emb/common/service/sms/gsmsms.c b/gammu/emb/common/service/sms/gsmsms.c index 9920835..feceba4 100644 --- a/gammu/emb/common/service/sms/gsmsms.c +++ b/gammu/emb/common/service/sms/gsmsms.c @@ -1,50 +1,53 @@ /* (c) 2001-2004 by Marcin Wiacek */ -/* based on some work from Pawel Kot, others and Gnokii */ +/* Based on some Pawel Kot and others work from Gnokii (www.gnokii.org) + * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot + * GNU GPL version 2 or later + */ #include <ctype.h> #include <string.h> #include <time.h> #include "../../gsmcomon.h" #include "../../misc/coding/coding.h" #include "../gsmcal.h" #include "../gsmpbk.h" #include "../gsmlogo.h" #include "../gsmring.h" #include "../gsmdata.h" #include "../gsmnet.h" #include "gsmsms.h" /* User data headers */ static GSM_UDHHeader UDHHeaders[] = { /* See GSM 03.40 section 9.2.3.24.1 * 1 byte 0x00 * 1 byte 0x03 * 1 byte 0x01: unique ID for message series * 1 byte 0x00: how many SMS in sequence * 1 byte 0x00: number of current SMS in sequence */ { UDH_ConcatenatedMessages, 0x05, "\x00\x03\x01\x00\x00",2,-1,4,3}, /* See GSM 03.40 section 9.2.3.24.2 for voice, fax and email messages */ { UDH_DisableVoice, 0x04, "\x01\x02\x00\x00",-1,-1,-1,-1}, { UDH_DisableFax, 0x04, "\x01\x02\x01\x00",-1,-1,-1,-1}, { UDH_DisableEmail, 0x04, "\x01\x02\x02\x00",-1,-1,-1,-1}, { UDH_EnableVoice, 0x04, "\x01\x02\x00\x01",-1,-1,-1,-1}, { UDH_EnableFax, 0x04, "\x01\x02\x01\x01",-1,-1,-1,-1}, { UDH_EnableEmail, 0x04, "\x01\x02\x02\x01",-1,-1,-1,-1}, /* When send such SMS to some phones, they don't display anything, * only beep and enable vibra/light */ { UDH_VoidSMS, 0x08, "\x01\x02\x02\x01\x01\x02\x02\x00",-1,-1,-1,-1}, /* Nokia Smart Messaging (short version) UDH * General format : * 1 byte 0x05 : IEI application port addressing scheme, 16 bit address * 1 byte 0x04 : IEI length * 2 bytes : destination address : high & low byte * 2 bytes 0x00 0x00 : originator address : high & low byte */ { UDH_NokiaRingtone, 0x06, "\x05\x04\x15\x81\x00\x00",-1,-1,-1,-1}, { UDH_NokiaOperatorLogo, 0x06, "\x05\x04\x15\x82\x00\x00",-1,-1,-1,-1}, { UDH_NokiaCallerLogo, 0x06, "\x05\x04\x15\x83\x00\x00",-1,-1,-1,-1}, { UDH_NokiaWAP, 0x06, "\x05\x04\xc3\x4f\x00\x00",-1,-1,-1,-1}, diff --git a/gammu/emb/common/service/sms/gsmsms.h b/gammu/emb/common/service/sms/gsmsms.h index d87ff60..0b950d3 100644 --- a/gammu/emb/common/service/sms/gsmsms.h +++ b/gammu/emb/common/service/sms/gsmsms.h @@ -1,50 +1,53 @@ /* (c) 2001-2004 by Marcin Wiacek */ -/* based on some work from Pawel Kot, others and Gnokii */ +/* Based on some Pawel Kot and others work from Gnokii (www.gnokii.org) + * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot + * GNU GPL version 2 or later + */ #ifndef __gsm_sms_h #define __gsm_sms_h #include "../../gsmcomon.h" #include "../gsmlogo.h" #include "../gsmcal.h" #include "../gsmpbk.h" #include "../gsmdata.h" #include "../gsmring.h" /* --------------------- Some general definitions ------------------------- */ #define GSM_MAX_UDH_LENGTH 140 #define GSM_MAX_SMS_LENGTH 160 #define GSM_MAX_8BIT_SMS_LENGTH 140 /* -------------------- Cell Broadcast ------------------------------------ */ /** * Structure for Cell Broadcast messages. */ typedef struct { /** * Message text. */ char Text[300]; /** * Channel number. */ int Channel; } GSM_CBMessage; /* ------------------------ SMS status ------------------------------------ */ /** * Status of SMS memory. */ typedef struct { /** * Number of unread messages on SIM. */ int SIMUnRead; /** * Number of all saved messages (including unread) on SIM. */ int SIMUsed; /** |