summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/service/sms/gsmmulti.c
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/service/sms/gsmmulti.c') (more/less context) (show whitespace changes)
-rw-r--r--gammu/emb/common/service/sms/gsmmulti.c5
1 files changed, 5 insertions, 0 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
@@ -394,192 +394,197 @@ GSM_Error GSM_EncodeMultiPartSMS(GSM_MultiPartSMSInfo *Info,
switch (Info->Entries[i].ID) {
case SMS_EMSPredefinedAnimation:
case SMS_EMSPredefinedSound:
case SMS_EMSSound10:
case SMS_EMSSound12:
case SMS_EMSSonyEricssonSound:
case SMS_EMSSound10Long:
case SMS_EMSSound12Long:
case SMS_EMSSonyEricssonSoundLong:
case SMS_EMSFixedBitmap:
case SMS_EMSVariableBitmap:
case SMS_EMSAnimation:
case SMS_EMSVariableBitmapLong:
EMS = true;
break;
case SMS_ConcatenatedTextLong:
case SMS_ConcatenatedTextLong16bit:
/* This covers situation, when somebody will call function
* with two or more SMS_Concatenated.... entries only.
* It will be still only linked sms, but functions below
* will pack only first entry according to own limits.
* We redirect to EMS functions, because they are more generic
* here and will handle it correctly and produce linked sms
* from all entries
*/
textnum ++;
if (textnum > 1) EMS = true;
if (Info->Entries[i].Left || Info->Entries[i].Right ||
Info->Entries[i].Center || Info->Entries[i].Large ||
Info->Entries[i].Small || Info->Entries[i].Bold ||
Info->Entries[i].Italic || Info->Entries[i].Underlined ||
Info->Entries[i].Strikethrough) {
EMS = true;
}
default:
break;
}
if (EMS) break;
}
if (EMS) {
error=GSM_EncodeEMSMultiPartSMS(Info,SMS,UDH_NoUDH);
if (error != ERR_NONE) return error;
if (SMS->Number != 1) {
SMS->Number = 0;
for (i=0;i<Info->EntriesNum;i++) {
if (Info->Entries[i].ID == SMS_ConcatenatedTextLong16bit) {
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;
} else {
UDH=UDH_NokiaWAP;
}
break;
case SMS_NokiaWAPSettingsLong:
Class = 1;
UDH = UDH_NokiaWAPLong;
NOKIA_EncodeWAPMMSSettingsSMSText(Buffer,&Length,Info->Entries[0].Settings,false);
break;
case SMS_NokiaMMSSettingsLong:
Class = 1;
UDH = UDH_NokiaWAPLong;
NOKIA_EncodeWAPMMSSettingsSMSText(Buffer,&Length,Info->Entries[0].Settings,true);
break;
case SMS_NokiaVCARD10Long:
GSM_EncodeVCARD(Buffer,&Length,Info->Entries[0].Phonebook,true,Nokia_VCard10);
/* is 1 SMS ? 8 = length of ..SCKE2 */
if (Length<=GSM_MAX_SMS_LENGTH-8) {
sprintf(Buffer,"//SCKE2 ");
Length = 8;
GSM_EncodeVCARD(Buffer,&Length,Info->Entries[0].Phonebook,true,Nokia_VCard10);
} else {
/* FIXME: It wasn't checked */
UDH = UDH_NokiaPhonebookLong;
}
Coding = SMS_Coding_Default;
memcpy(Buffer2,Buffer,Length);
EncodeUnicode(Buffer,Buffer2,Length);
break;
case SMS_NokiaVCARD21Long:
GSM_EncodeVCARD(Buffer,&Length,Info->Entries[0].Phonebook,true,Nokia_VCard21);
/* Is 1 SMS ? 12 = length of ..SCKL23F4 */
if (Length<=GSM_MAX_SMS_LENGTH-12) {
sprintf(Buffer,"//SCKL23F4%c%c",13,10);
Length = 12;
GSM_EncodeVCARD(Buffer,&Length,Info->Entries[0].Phonebook,true,Nokia_VCard21);
} else {
UDH = UDH_NokiaPhonebookLong;
/* Here can be also 8 bit coding */
}
Coding = SMS_Coding_Default;
memcpy(Buffer2,Buffer,Length);
EncodeUnicode(Buffer,Buffer2,Length);
break;
case SMS_VCARD10Long:
GSM_EncodeVCARD(Buffer,&Length,Info->Entries[0].Phonebook,true,Nokia_VCard10);
if (Length>GSM_MAX_SMS_LENGTH) UDH = UDH_ConcatenatedMessages;
Coding = SMS_Coding_Default;