author | zautrix <zautrix> | 2004-10-05 11:13:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 11:13:51 (UTC) |
commit | 50ab40e1e02ad7c65c17a78d08116a808b1257aa (patch) (side-by-side diff) | |
tree | 0d1939e2297fa7bbd8e1f2030f154463854164c6 /gammu/emb/common/service/gsmdata.c | |
parent | cf8616f64f20e5448d4ff644f7cc15750cf3f85f (diff) | |
download | kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.zip kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.tar.gz kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.tar.bz2 |
updated to latest gammu version
Diffstat (limited to 'gammu/emb/common/service/gsmdata.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/service/gsmdata.c | 124 |
1 files changed, 101 insertions, 23 deletions
diff --git a/gammu/emb/common/service/gsmdata.c b/gammu/emb/common/service/gsmdata.c index 94e9b7b..9303b57 100644 --- a/gammu/emb/common/service/gsmdata.c +++ b/gammu/emb/common/service/gsmdata.c @@ -246,13 +246,15 @@ void NOKIA_EncodeWAPMMSSettingsSMSText(unsigned char *Buffer, int *Length, GSM_W } /* http://forum.nokia.com: OTA Settings 7.0 */ +/* first it used default/ISO coding */ +/* Joergen Thomsen changed to UTF8 */ void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark) { unsigned char buffer[100]; - bool UnicodeCoding = false; - EncodeUTF8QuotedPrintable(buffer,bookmark->Title); - if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; +// bool UnicodeCoding = false; +// EncodeUTF8QuotedPrintable(buffer,bookmark->Title); +// if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; Buffer[(*Length)++] = 0x01; //Push ID Buffer[(*Length)++] = 0x06; //PDU Type (push) @@ -265,34 +267,110 @@ void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPB strcpy(Buffer+(*Length),"\x81\xEA"); (*Length)=(*Length)+2; //charset UTF-8 short int. + /* removed by Joergen Thomsen */ /* Block from sniffs. UNKNOWN */ - if (!UnicodeCoding) { - Buffer[(*Length)++] = 0x00; - Buffer[(*Length)++] = 0x01; - } else { - strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); - (*Length)=(*Length)+4; - } - Buffer[(*Length)++] = 0x00; +// if (!UnicodeCoding) { +// Buffer[(*Length)++] = 0x00; +// Buffer[(*Length)++] = 0x01; +// } else { +// strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); +// (*Length)=(*Length)+4; +// } +// Buffer[(*Length)++] = 0x00; + + /* added by Joergen Thomsen */ + Buffer[(*Length)++] = 0x01; // Version WBXML 1.1 + Buffer[(*Length)++] = 0x01; // Unknown public identifier + Buffer[(*Length)++] = 0x6A; // charset UTF-8 + Buffer[(*Length)++] = 0x00; // string table length Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content /* URL */ Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK Buffer[(*Length)++] = 0x01; //END PARMeter - if (!UnicodeCoding) { - /* TITLE */ - AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); - /* URL */ - AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); - } else { - /* TITLE */ - AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); - /* URL */ - AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); + + /* removed by Joergen Thomsen */ +// if (!UnicodeCoding) { +// /* TITLE */ +// AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); +// /* URL */ +// AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); +// } else { +// /* TITLE */ +// AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); +// /* URL */ +// AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); +// } + + /* added by Joergen Thomsen */ + /* TITLE */ + EncodeUTF8(buffer, bookmark->Title); + AddWAPSMSParameterText(Buffer, Length, 0x15, buffer, strlen(buffer)); + /* URL */ + EncodeUTF8(buffer, bookmark->Address); + AddWAPSMSParameterText(Buffer, Length, 0x17, buffer, strlen(buffer)); + + Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC) + Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC-LIST) +} + +void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, int *Length, char *Text, char *URL) +{ + int i; + + Buffer[(*Length)++] = 0x01; //Push ID + Buffer[(*Length)++] = 0x06; //PDU Type (push) + Buffer[(*Length)++] = 28; //Headers length (content type + headers) + strcpy(Buffer+(*Length),"\x1F\x23"); + (*Length)=(*Length)+2; //Value length + strcpy(Buffer+(*Length),"application/vnd.wap.sic"); + (*Length)=(*Length)+23; //MIME-Type + Buffer[(*Length)++] = 0x00; //end inline string + strcpy(Buffer+(*Length),"\x81\xEA"); + (*Length)=(*Length)+2; //charset UTF-8 short int. + + Buffer[(*Length)++] = 0x02; // WBXML 1.2 + Buffer[(*Length)++] = 0x05; // SI 1.0 Public Identifier + Buffer[(*Length)++] = 0x6A; // charset UTF-8 + Buffer[(*Length)++] = 0x00; // string table length + Buffer[(*Length)++] = 0x45; // SI with content + Buffer[(*Length)++] = 0xC6; // indication with content and attributes + Buffer[(*Length)++] = 0x0B; // address + Buffer[(*Length)++] = 0x03; // Inline string + for (i=0;i<(int)strlen(URL);i++) { + Buffer[(*Length)++] = URL[i];//Text } - Buffer[(*Length)++] = 0x01; //END PARMeter - Buffer[(*Length)++] = 0x01; //END PARMeter + Buffer[(*Length)++] = 0x00; // END Inline string + +#ifdef XXX + Buffer[(*Length)++] = 0x0A; // created... + Buffer[(*Length)++] = 0xC3; // OPAQUE + Buffer[(*Length)++] = 0x07; // length + Buffer[(*Length)++] = 0x19; // year + Buffer[(*Length)++] = 0x80; // year + Buffer[(*Length)++] = 0x21; // month + Buffer[(*Length)++] = 0x12; // .. + Buffer[(*Length)++] = 0x00; // .. + Buffer[(*Length)++] = 0x00; // .. + Buffer[(*Length)++] = 0x00; // .. + Buffer[(*Length)++] = 0x10; // expires + Buffer[(*Length)++] = 0xC3; // OPAQUE + Buffer[(*Length)++] = 0x04; // length + Buffer[(*Length)++] = 0x20; // year + Buffer[(*Length)++] = 0x10; // year + Buffer[(*Length)++] = 0x06; // month + Buffer[(*Length)++] = 0x25; // day +#endif + + Buffer[(*Length)++] = 0x01; // END (indication) + Buffer[(*Length)++] = 0x03; // Inline string + for (i=0;i<(int)strlen(Text);i++) { + Buffer[(*Length)++] = Text[i]; //Text + } + Buffer[(*Length)++] = 0x00; // END Inline string + Buffer[(*Length)++] = 0x01; // END (indication) + Buffer[(*Length)++] = 0x01; // END (SI) } void GSM_EncodeMMSFile(GSM_EncodeMultiPartMMSInfo *Info, unsigned char *Buffer, int *Length) |