gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Picture SMS-es and long sms support


From: Pawel Kot
Subject: Re: Picture SMS-es and long sms support
Date: Thu, 30 May 2002 13:24:26 +0200 (CEST)

On Thu, 30 May 2002, Pavel Machek wrote:

> This is long sms-es and picture support. [Picture image support is not
> quite complete and quite working, but with small hacks it can be made
> to work.]
>
> Long sms-es is handled in slightly funny way, but I found it cleaner:
> it is now permitted to attempt to send SMS with up to 10K of user
> data. Code detects it and splits message accordingly.

Pavel, I belive the patch is incorrect. Please revert it. See the comments
below.

> +             message[current++]=0x30;     /* SM version. Here 3.0 */
> +             message[current++]=0x06;     /* ID for bitmap, 0x06 is id for 
> screensaver */
> +             message[current++]=0x01;     /* Length for picture part, hi */
> +             message[current++]=0x00;     /* length lo */
> +
> +             /* Set the logo size */
>
> Index: common/gsm-bitmaps.c
> @@ -215,6 +219,7 @@
>  int GSM_EncodeSMSBitmap(GSM_Bitmap *bitmap, char *message)
>  {
>       unsigned short size, current = 0;
> +     int i;
>
>       switch (bitmap->type) {
>       case GSM_OperatorLogo:
> @@ -226,13 +231,40 @@
>               break;
>       case GSM_PictureMessage:
>               dprintf("Picture Image\n");
> -             /* Type of multipart message - picture image */
> -             message[current++] = 0x02;
> -             /* Size of the message */
> -             size = bitmap->size + 4; /* for bitmap the header */
> -             message[current++] = (size & 0xff00) >> 8;
> -             message[current++] = size & 0x00ff;
> -             break;
> +
> +             strcpy(bitmap->text, "");
> +
> +             message[current++] = 0x00;
> +             message[current++] = bitmap->width;
> +             message[current++] = bitmap->height;
> +             message[current++] = 0x01;
> +
> +             memcpy(message+current,bitmap->bitmap,bitmap->size);
> +             current=current+bitmap->size;
> +
> +             if (strlen(bitmap->text)!=0) {
> +                     /* FIXME: unicode length is not as simple as strlen */
> +                     int uni = 0, len;                    /* 0 .. 
> ISO-8859-1, 1 .. Unicode */
> +
> +                     message[current++]=uni;
> +
> +                     /* Length for text part */
> +                     len = strlen(bitmap->text)*(uni + 1);
> +                     message[current++]=0x00;
> +                     message[current++]=len;
> +                     if (uni)
> +                             EncodeUnicode 
> (message+current,bitmap->text,strlen(bitmap->text));
> +                     else
> +                             
> memcpy(message+current,bitmap->text,strlen(bitmap->text));
> +                     current += len;
> +             }
> +             return current;

Incorrect. You should create the SMS part in gsm-sms.c. Here you should
only encore the bitmap. All other things belong (headers, text encoding)
belong to libsms. This way you duplicate the code.

>       { 0x06, "\x05\x04\x15\x81\x00\x00" }, /* Ringtones */
>       { 0x06, "\x05\x04\x15\x82\x00\x00" }, /* Operator logos */
>       { 0x06, "\x05\x04\x15\x83\x00\x00" }, /* Caller logos */
> -     { 0x06, "\x05\x04\x15\x8a\x00\x00" }, /* Multipart Message */
> +     { 0x0B, "\x05\x04\x15\x8a\x00\x00\x00\x03\xce\x03\x01" }, /* Multipart 
> Message */

This is plain wrong. The second number of the udh_data is the length of
the UDH part. "\x00\x03\xce\x03\x01" does NOT belong to UDH.

>       { 0x04, "\x03\x01\x00\x00" },         /* Voice Messages */
>       { 0x04, "\x03\x01\x01\x00" },         /* Fax Messages */
>       { 0x04, "\x03\x01\x02\x00" },         /* Email Messages */

These are incorrect, but it's my fault. I'll correct them.

> +API GSM_Error SendLongSMS(GSM_Data *data, GSM_Statemachine *state)
> +{
> +     int i, count;
> +     GSM_SMSMessage LongSMS, *rawsms = &LongSMS;     /* We need local copy 
> for our dirty tricks */
> +     GSM_API_SMS sms;
> +     GSM_Error error = GE_NONE;
> +
> +     LongSMS = *data->RawSMS;
> +     sms = *data->SMS;
> +
> +     DumpRawSMS(rawsms);
> +     count = (rawsms->UserDataLength + 127) / 128;
> +     printf("Will need %d sms-es\n", count);

dprintf.

> +     data->RawData->Data = calloc(10240, 1);

This is ugly, but I can live with this for now.

>       unsigned int Length;
>       union {
>               unsigned char Text[GSM_MAX_SMS_LENGTH];
> +             GSM_Multi Multi;
>               GSM_Bitmap Bitmap;
>               GSM_Ringtone Ringtone;
>       } u;

Multipart message, according to Smart Messaging Specification can contain
of:
 - text and picture (Picture Message),
 - ringtone, profile name, screen saver (Downloadable Profile).


> -     unsigned char UserData[SMS_USER_DATA_LEN];     /* User Data (9.2.3.24), 
> Command Data (9.2.3.21), extened to Nokia Multipart Messages from Smart 
> Messaging Specification 3.0.0 */
> +     unsigned char UserData[10240];                 /* User Data (9.2.3.24), 
> Command Data (9.2.3.21), extened to Nokia Multipart Messages from Smart 
> Messaging Specification 3.0.0 */

Use some define here.

Also you restrict pictire in the Multipart message to just one fized size.
I'm sure that in one year Nokia will release phones supporting the
arbitrary size.

It seems you converted it from mygnokii - I don't won't broken solutions
from mygnokii - even if they work.

pkot
-- 
mailto:address@hidden :: mailto:address@hidden
http://kt.linuxnews.pl/ :: Kernel Traffic po polsku




reply via email to

[Prev in Thread] Current Thread [Next in Thread]