author | zautrix <zautrix> | 2004-10-05 11:13:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 11:13:51 (UTC) |
commit | 50ab40e1e02ad7c65c17a78d08116a808b1257aa (patch) (unidiff) | |
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 | |||
@@ -247,11 +247,13 @@ void NOKIA_EncodeWAPMMSSettingsSMSText(unsigned char *Buffer, int *Length, GSM_W | |||
247 | 247 | ||
248 | /* http://forum.nokia.com: OTA Settings 7.0 */ | 248 | /* http://forum.nokia.com: OTA Settings 7.0 */ |
249 | /* first it used default/ISO coding */ | ||
250 | /* Joergen Thomsen changed to UTF8 */ | ||
249 | void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark) | 251 | void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark) |
250 | { | 252 | { |
251 | unsigned charbuffer[100]; | 253 | unsigned charbuffer[100]; |
252 | bool UnicodeCoding = false; | ||
253 | 254 | ||
254 | EncodeUTF8QuotedPrintable(buffer,bookmark->Title); | 255 | // bool UnicodeCoding = false; |
255 | if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; | 256 | //EncodeUTF8QuotedPrintable(buffer,bookmark->Title); |
257 | //if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; | ||
256 | 258 | ||
257 | Buffer[(*Length)++] = 0x01; //Push ID | 259 | Buffer[(*Length)++] = 0x01; //Push ID |
@@ -266,13 +268,20 @@ void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPB | |||
266 | (*Length)=(*Length)+2; //charset UTF-8 short int. | 268 | (*Length)=(*Length)+2; //charset UTF-8 short int. |
267 | 269 | ||
270 | /* removed by Joergen Thomsen */ | ||
268 | /* Block from sniffs. UNKNOWN */ | 271 | /* Block from sniffs. UNKNOWN */ |
269 | if (!UnicodeCoding) { | 272 | //if (!UnicodeCoding) { |
270 | Buffer[(*Length)++] = 0x00; | 273 | // Buffer[(*Length)++] = 0x00; |
271 | Buffer[(*Length)++] = 0x01; | 274 | // Buffer[(*Length)++] = 0x01; |
272 | } else { | 275 | //} else { |
273 | strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); | 276 | // strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); |
274 | (*Length)=(*Length)+4; | 277 | // (*Length)=(*Length)+4; |
275 | } | 278 | //} |
276 | Buffer[(*Length)++] = 0x00; | 279 | //Buffer[(*Length)++] = 0x00; |
280 | |||
281 | /* added by Joergen Thomsen */ | ||
282 | Buffer[(*Length)++] = 0x01; // Version WBXML 1.1 | ||
283 | Buffer[(*Length)++] = 0x01; // Unknown public identifier | ||
284 | Buffer[(*Length)++] = 0x6A; // charset UTF-8 | ||
285 | Buffer[(*Length)++] = 0x00; // string table length | ||
277 | 286 | ||
278 | Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content | 287 | Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content |
@@ -281,17 +290,86 @@ void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPB | |||
281 | Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK | 290 | Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK |
282 | Buffer[(*Length)++] = 0x01; //END PARMeter | 291 | Buffer[(*Length)++] = 0x01; //END PARMeter |
283 | if (!UnicodeCoding) { | 292 | |
284 | /* TITLE */ | 293 | /* removed by Joergen Thomsen */ |
285 | AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); | 294 | // if (!UnicodeCoding) { |
286 | /* URL */ | 295 | // /* TITLE */ |
287 | AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); | 296 | // AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); |
288 | } else { | 297 | // /* URL */ |
289 | /* TITLE */ | 298 | // AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); |
290 | AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); | 299 | // } else { |
291 | /* URL */ | 300 | // /* TITLE */ |
292 | AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); | 301 | // AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); |
302 | // /* URL */ | ||
303 | // AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); | ||
304 | // } | ||
305 | |||
306 | /* added by Joergen Thomsen */ | ||
307 | /* TITLE */ | ||
308 | EncodeUTF8(buffer, bookmark->Title); | ||
309 | AddWAPSMSParameterText(Buffer, Length, 0x15, buffer, strlen(buffer)); | ||
310 | /* URL */ | ||
311 | EncodeUTF8(buffer, bookmark->Address); | ||
312 | AddWAPSMSParameterText(Buffer, Length, 0x17, buffer, strlen(buffer)); | ||
313 | |||
314 | Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC) | ||
315 | Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC-LIST) | ||
316 | } | ||
317 | |||
318 | void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, int *Length, char *Text, char *URL) | ||
319 | { | ||
320 | int i; | ||
321 | |||
322 | Buffer[(*Length)++] = 0x01; //Push ID | ||
323 | Buffer[(*Length)++] = 0x06; //PDU Type (push) | ||
324 | Buffer[(*Length)++] = 28; //Headers length (content type + headers) | ||
325 | strcpy(Buffer+(*Length),"\x1F\x23"); | ||
326 | (*Length)=(*Length)+2; //Value length | ||
327 | strcpy(Buffer+(*Length),"application/vnd.wap.sic"); | ||
328 | (*Length)=(*Length)+23; //MIME-Type | ||
329 | Buffer[(*Length)++] = 0x00; //end inline string | ||
330 | strcpy(Buffer+(*Length),"\x81\xEA"); | ||
331 | (*Length)=(*Length)+2; //charset UTF-8 short int. | ||
332 | |||
333 | Buffer[(*Length)++] = 0x02; // WBXML 1.2 | ||
334 | Buffer[(*Length)++] = 0x05; // SI 1.0 Public Identifier | ||
335 | Buffer[(*Length)++] = 0x6A; // charset UTF-8 | ||
336 | Buffer[(*Length)++] = 0x00; // string table length | ||
337 | Buffer[(*Length)++] = 0x45; // SI with content | ||
338 | Buffer[(*Length)++] = 0xC6; // indication with content and attributes | ||
339 | Buffer[(*Length)++] = 0x0B;// address | ||
340 | Buffer[(*Length)++] = 0x03; // Inline string | ||
341 | for (i=0;i<(int)strlen(URL);i++) { | ||
342 | Buffer[(*Length)++] = URL[i];//Text | ||
293 | } | 343 | } |
294 | Buffer[(*Length)++] = 0x01; //END PARMeter | 344 | Buffer[(*Length)++] = 0x00; // END Inline string |
295 | Buffer[(*Length)++] = 0x01; //END PARMeter | 345 | |
346 | #ifdef XXX | ||
347 | Buffer[(*Length)++] = 0x0A;// created... | ||
348 | Buffer[(*Length)++] = 0xC3;// OPAQUE | ||
349 | Buffer[(*Length)++] = 0x07;// length | ||
350 | Buffer[(*Length)++] = 0x19;// year | ||
351 | Buffer[(*Length)++] = 0x80;// year | ||
352 | Buffer[(*Length)++] = 0x21;// month | ||
353 | Buffer[(*Length)++] = 0x12;// .. | ||
354 | Buffer[(*Length)++] = 0x00;// .. | ||
355 | Buffer[(*Length)++] = 0x00;// .. | ||
356 | Buffer[(*Length)++] = 0x00;// .. | ||
357 | Buffer[(*Length)++] = 0x10;// expires | ||
358 | Buffer[(*Length)++] = 0xC3;// OPAQUE | ||
359 | Buffer[(*Length)++] = 0x04;// length | ||
360 | Buffer[(*Length)++] = 0x20;// year | ||
361 | Buffer[(*Length)++] = 0x10;// year | ||
362 | Buffer[(*Length)++] = 0x06;// month | ||
363 | Buffer[(*Length)++] = 0x25;// day | ||
364 | #endif | ||
365 | |||
366 | Buffer[(*Length)++] = 0x01; // END (indication) | ||
367 | Buffer[(*Length)++] = 0x03; // Inline string | ||
368 | for (i=0;i<(int)strlen(Text);i++) { | ||
369 | Buffer[(*Length)++] = Text[i];//Text | ||
370 | } | ||
371 | Buffer[(*Length)++] = 0x00; // END Inline string | ||
372 | Buffer[(*Length)++] = 0x01; // END (indication) | ||
373 | Buffer[(*Length)++] = 0x01; // END (SI) | ||
296 | } | 374 | } |
297 | 375 | ||