[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
EMS Animations: fixing backend
From: |
Pavel Machek |
Subject: |
EMS Animations: fixing backend |
Date: |
Tue, 4 Jun 2002 00:59:04 +0200 |
User-agent: |
Mutt/1.3.28i |
Hi!
Fix support for EMS animations in gsm-bitmaps (gsm-bitmaps is *really*
ugly with its PutPixel methods!). Add -a option for sending animations
(not yet fully functional). Commited.
Pavel
Index: common/gsm-bitmaps.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/gsm-bitmaps.c,v
retrieving revision 1.28
diff -u -u -r1.28 gsm-bitmaps.c
--- common/gsm-bitmaps.c 3 Jun 2002 20:30:45 -0000 1.28
+++ common/gsm-bitmaps.c 3 Jun 2002 22:48:19 -0000
@@ -62,6 +62,8 @@
switch (bmp->type) {
case GSM_StartupLogo: bmp->bitmap[((y/8)*bmp->width)+x] |= 1 << (y%8);
break;
case GSM_EMSPicture:
+ case GSM_EMSAnimation:
+ case GSM_EMSAnimation2:
case GSM_OperatorLogo:
case GSM_CallerLogo: bmp->bitmap[(y*bmp->width+x)/8] |= 1 <<
(7-((y*bmp->width+x)%8)); break;
/* Testing only! */
@@ -74,6 +76,8 @@
switch (bmp->type) {
case GSM_StartupLogo: bmp->bitmap[((y/8)*bmp->width)+x] &= ~(1 <<
(y%8)); break;
case GSM_EMSPicture:
+ case GSM_EMSAnimation:
+ case GSM_EMSAnimation2:
case GSM_OperatorLogo:
case GSM_CallerLogo: bmp->bitmap[(y*bmp->width+x)/8] &= ~(1 <<
(7-((y*bmp->width+x)%8))); break;
/* Testing only! */
@@ -265,15 +276,17 @@
break;
case GSM_EMSAnimation:
dprintf("EMS animation\n");
+ message[current++] = 128+3;
+ message[current++] = 0x0e; /* Animation code */
+ message[current++] = 128+1; /* Picture size */;
+ message[current++] = 0x00; /* Position where to display */
+ case GSM_EMSAnimation2:
+ dprintf("(without header)\n");
if (bitmap->width != 16) {
fprintf(stderr, "EMS animation needs bitmap 16x16 ...
\n");
return GE_NOTSUPPORTED;
}
- message[current++] = bitmap->width/8*bitmap->height+3;
- message[current++] = 0x0e; /* Animation code */
- message[current++] = bitmap->width/8*bitmap->height+1; /*
Picture size */;
break;
- case GSM_EMSAnimation2:
default: /* error */
dprintf("gulp?\n");
break;
Index: common/gsm-sms.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/common/gsm-sms.c,v
retrieving revision 1.87
diff -u -u -r1.87 gsm-sms.c
--- common/gsm-sms.c 3 Jun 2002 20:30:45 -0000 1.87
+++ common/gsm-sms.c 3 Jun 2002 22:48:29 -0000
@@ -1103,16 +1103,19 @@
rawsms->UDHIndicator = 1;
break;
- case SMS_AnimationData:
+ case SMS_AnimationData: {
+ int j;
error = GE_NONE;
- for (i=0; i<4; i++) {
- size =
GSM_EncodeSMSBitmap(&(sms->UserData[i].u.Animation[i]), rawsms->UserData +
rawsms->UserDataLength);
+ for (j=0; j<4; j++) {
+ printf("UserdataLength = %d\n",
rawsms->UserDataLength);
+ size =
GSM_EncodeSMSBitmap(&(sms->UserData[i].u.Animation[j]), rawsms->UserData +
rawsms->UserDataLength);
rawsms->Length += size;
rawsms->UserDataLength += size;
}
rawsms->DCS = 0xf5;
rawsms->UDHIndicator = 1;
break;
+ }
case SMS_PlainText: {
unsigned int length, offset = 0;
Index: gnokii/gnokii.c
===================================================================
RCS file: /cvsroot/gnokii/gnokii/gnokii/gnokii.c,v
retrieving revision 1.246
diff -u -u -r1.246 gnokii.c
--- gnokii/gnokii.c 2 Jun 2002 21:36:44 -0000 1.246
+++ gnokii/gnokii.c 3 Jun 2002 22:49:02 -0000
@@ -457,6 +457,7 @@
{ "picture", required_argument, NULL, '4'},
{ "8bit", 0, NULL, '8'},
{ "imelody", 0, NULL, 'i'},
+ { "animation",required_argument,NULL, 'a'},
{ NULL, 0, NULL, 0}
};
@@ -500,10 +501,36 @@
}
break;
- case '4': /* we send multipart message - picture message */
+ case '4': /* we send multipart message - picture message;
FIXME: This seems not yet implemented */
sms.UDH.Number = 1;
break;
+ case 'a': /* Animation */ {
+ char buf[10240];
+ char *s = buf, *t;
+ strcpy(buf, optarg);
+ sms.UserData[0].Type = SMS_AnimationData;
+ for (i=0; i<4; i++) {
+ error =
GSM_NullBitmap(&sms.UserData[0].u.Animation[i], &State.Phone.Info);
+ sms.UserData[0].u.Animation[i].type = i ?
GSM_EMSAnimation2 : GSM_EMSAnimation;
+ if (error != GE_NONE) {
+ fprintf(stdout, _("Could not null
bitmap: %d (%m)\n"), error);
+ return -1;
+ }
+ t = strchr(s, ';');
+ if (t)
+ *t++ = 0;
+ printf("Loading from %s\n", s);
+ error = GSM_ReadBitmapFile(s,
&sms.UserData[0].u.Animation[i], &State.Phone.Info);
+ if (error != GE_NONE) {
+ fprintf(stdout, _("Could not load
bitmap: %d (%m)\n"), error);
+ return -1;
+ }
+ s = t;
+ }
+ break;
+ }
+
case 'r': /* request for delivery report */
sms.DeliveryReport = true;
break;
--
(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
- EMS Animations: fixing backend,
Pavel Machek <=