[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Picture SMS-es and long sms support
From: |
Pavel Machek |
Subject: |
Re: Picture SMS-es and long sms support |
Date: |
Fri, 31 May 2002 21:30:48 +0200 |
User-agent: |
Mutt/1.3.28i |
Hi!
> > 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.
You are right it is ugly as hell.
...
> > + 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.
Okay, I see this should not be here. However, I can't see any code in
gsm-sms.c which would generate similar header. Code in EncodeData()
uses DCS to differentiate between normal and unicode, and this one
adds flag inline.
Should I turn this code into function and move it into gsm-sms.c?
> > { 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.
Sorry about that. What kind of header is "\x00\x03\xce\x03\x01"?
Should I emit in gsm-sms.c or in gsm-bitmaps?
> > +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.
Right, and DumpRawSMS needs to be commented out
> > 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).
I wonder how this is best handled... It is possible to have long SMS
with just text, also?
Old code looked like a mess to me; is generating long message, then
splicing it up (like I'm doing) reasonable?
> > - 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.
Actually, I believe I'm not guilty with this one. The code does not
depend on "one fixed size", AFAICS.
> It seems you converted it from mygnokii - I don't won't broken solutions
> from mygnokii - even if they work.
I tried to clean it up, but it looks I did poor job. I'll fix it up
some more.
Pavel
--
(about SSSCA) "I don't say this lightly. However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa