gnokii-users
[Top][All Lists]
Advanced

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

EMS picture support


From: Pavel Machek
Subject: EMS picture support
Date: Tue, 21 May 2002 11:01:23 +0200
User-agent: Mutt/1.3.28i

Hi!

This is first attempt at EMS picture support. It seems to work for
me. Commited.
                                                                        Pavel
Index: common/gsm-bitmaps.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/gsm-bitmaps.c,v
retrieving revision 1.20
diff -u -u -r1.20 gsm-bitmaps.c
--- common/gsm-bitmaps.c        20 May 2002 21:57:15 -0000      1.20
+++ common/gsm-bitmaps.c        21 May 2002 08:46:00 -0000
@@ -57,6 +57,7 @@
 {
        switch (bmp->type) {
        case GSM_StartupLogo:  bmp->bitmap[((y/8)*bmp->width)+x] |= 1 << (y%8); 
break;
+       case GSM_EMSPicture:
        case GSM_OperatorLogo:
        case GSM_CallerLogo:   bmp->bitmap[(y*bmp->width+x)/8] |= 1 << 
(7-((y*bmp->width+x)%8)); break;
                               /* Testing only! */      
@@ -68,6 +69,7 @@
 {
        switch (bmp->type) {
        case GSM_StartupLogo:  bmp->bitmap[((y/8)*bmp->width)+x] &= ~(1 << 
(y%8)); break;
+       case GSM_EMSPicture:
        case GSM_OperatorLogo:
        case GSM_CallerLogo:   bmp->bitmap[(y*bmp->width+x)/8] &= ~(1 << 
(7-((y*bmp->width+x)%8))); break;
                               /* Testing only! */      
@@ -238,6 +240,10 @@
                        fprintf(stderr, "EMS needs bitmap size 8, 16, 24, ... 
\n");
                        return GE_NOTSUPPORTED;
                }
+               message[current++] = bitmap->width/8*bitmap->height+5;
+               message[current++] = 0x12;      /* Picture code */
+               message[current++] = bitmap->width/8*bitmap->height+3; /* 
Picture size */;
+               message[current++] = 0;               /* Position in text this 
picture is at */
                message[current++] = bitmap->width/8; /* Horizontal size / 8 */
                message[current++] = bitmap->height;
                break;
Index: common/gsm-filetypes.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/gsm-filetypes.c,v
retrieving revision 1.27
diff -u -u -r1.27 gsm-filetypes.c
--- common/gsm-filetypes.c      20 May 2002 18:30:11 -0000      1.27
+++ common/gsm-filetypes.c      21 May 2002 08:46:10 -0000
@@ -576,11 +576,18 @@
 
        /* All xpms are loaded as startup logos - but can be resized later */
 
-       bitmap->type = GSM_StartupLogo;
-
-       bitmap->height = image.height;
-       bitmap->width = image.width;
-       bitmap->size = ((bitmap->height / 8) + (bitmap->height % 8 > 0)) * 
bitmap->width;
+       switch (bitmap->type) {
+       case GSM_EMSPicture:
+               bitmap->height = image.height;
+               bitmap->width = image.width;
+               bitmap->size = ((bitmap->width + 7) / 8) * bitmap->height;
+               break;
+       default:
+               bitmap->height = image.height;
+               bitmap->width = image.width;
+               bitmap->size = ((bitmap->height / 8) + (bitmap->height % 8 > 
0)) * bitmap->width;
+               break;
+       }
 
        if (bitmap->size > GSM_MAX_BITMAP_SIZE) {
                fprintf(stdout, "Bitmap too large\n");
Index: common/gsm-sms.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/gsm-sms.c,v
retrieving revision 1.63
diff -u -u -r1.63 gsm-sms.c
--- common/gsm-sms.c    20 May 2002 09:27:17 -0000      1.63
+++ common/gsm-sms.c    21 May 2002 08:46:20 -0000
@@ -66,7 +68,7 @@
        { 0x04, "\x03\x01\x00\x00" },         /* Voice Messages */
        { 0x04, "\x03\x01\x01\x00" },         /* Fax Messages */
        { 0x04, "\x03\x01\x02\x00" },         /* Email Messages */
-       { 0x00, "" }
+       { 0x00, "" },
 };
 
 
@@ -980,8 +982,6 @@
        unsigned char pos;
 
        pos = UDH[0];
-       dprintf("Encoding UDH. (%d, %d).\n", type, pos);
-       type = 3;
 
        switch (type) {
        case SMS_NoUDH:
@@ -997,7 +997,6 @@
        case SMS_ConcatenatedMessages:
                dprintf("Adding ConcatMsg header\n");
        case SMS_OpLogo:
-               dprintf("Adding OpLogo header\n");
        case SMS_CallerIDLogo:
        case SMS_Ringtone:
        case SMS_MultipartMessage:
@@ -1134,7 +1133,12 @@
        /* Bitmap coding */
        if (bitmap_index != -1) {
                rawsms->UDHIndicator = 1;
-               error = EncodeUDH(rawsms, sms->UserData[0].u.Bitmap.type, 
message);
+               error = GE_NONE;
+               switch (sms->UserData[0].u.Bitmap.type) {
+               case GSM_OperatorLogo: error = EncodeUDH(rawsms, SMS_OpLogo, 
message); break;
+               case GSM_EMSPicture:
+               case GSM_EMSAnimation: break;   /* We'll construct headers in 
EncodeSMSBitmap */
+               }
                if (error != GE_NONE) return error;
 
 #ifdef BITMAP_SUPPORT
Index: gnokii/gnokii.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii.c,v
retrieving revision 1.238
diff -u -u -r1.238 gnokii.c
--- gnokii/gnokii.c     20 May 2002 19:26:56 -0000      1.238
+++ gnokii/gnokii.c     21 May 2002 08:47:24 -0000
@@ -1414,6 +1414,7 @@
        }
 
        sms.UserData[0].Type = SMS_BitmapData;
+       GSM_NullBitmap(&sms.UserData[0].u.Bitmap, info);
 
        /* The second argument is the destination, ie the phone number of 
recipient. */
        memset(&sms.Remote.Number, 0, sizeof(sms.Remote.Number));

-- 
(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



reply via email to

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