N7110_SetAlarm,
N6110_DialVoice,
N6110_DialData,
- N6110_GetIncomingCallNr,\r
+ N6110_GetIncomingCallNr,
N6110_GetNetworkInfo,
N7110_GetCalendarNote,
N7110_WriteCalendarNote,
"",
"6210|6250|7110", /* Supported models in FBUS over Irda sockets */
"",
+ "",
5, /* Max RF Level */
0, /* Min RF Level */
GRF_Arbitrary, /* RF level units */
}
CurrentSMSFoldersCount=1000;
- CurrentSMSMessage=NULL;
return (GE_NONE);
}
void N7110_ReplyGetMemoryStatus(u16 MessageLength, u8 *MessageBuffer, u8 MessageType)
{
+#ifdef DEBUG
+ fprintf(stdout, _("Message: Memory status received:\n"));
+#endif
+
if (CurrentMemoryStatus && CurrentMemoryStatusError == GE_BUSY) {
/* first Loc. (MessageBuffer[10]<<8) + MessageBuffer[11]; */
CurrentMemoryStatus->Free = (MessageBuffer[14]<<8) + MessageBuffer[15];
CurrentMemoryStatusError = GE_NONE;
#ifdef DEBUG
- fprintf(stdout, _("Message: Memory status received:\n"));
-
fprintf(stdout, _(" Memory Type: %s\n"), N7110_MemoryType_String[MessageBuffer[5]]);
fprintf(stdout, _(" Used: %d\n"), CurrentMemoryStatus->Used);
fprintf(stdout, _(" Free: %d\n"), CurrentMemoryStatus->Free);
return GE_INVALIDCALNOTELOCATION;
req[4] = CurrentCalendarNotesInfo.Location[CalendarNote->Location-1]>>8;
- req[5] = CurrentCalendarNotesInfo.Location[CalendarNote->Location-1]&0xff;\r
+ req[5] = CurrentCalendarNotesInfo.Location[CalendarNote->Location-1]&0xff;
CurrentCalendarNote = CalendarNote;
/* We have to get current year. It's NOT written in frame for Birthday */
return NULL_SendMessageSequence(10, &CurrentSMSStatusError, 5, 0x14, req);
}
-void N7110_ReplyGetMemoryLocation(u16 MessageLength, u8 *MessageBuffer, u8 MessageType)
+void N7110_DecodePhonebookFrame(GSM_PhonebookEntry *entry,u8 *MessageBuffer,u16 MessageLength)
{
- int i, count, blocks, blockcount;
-#ifdef DEBUG
- int j;
-#endif
+ int blockcount=0;
unsigned char *pBlock;
-
- CurrentPhonebookEntry->Empty = true;
- CurrentPhonebookEntry->Group = 5; /* 5 = no group as 6110 */
- CurrentPhonebookEntry->Name[0] = '\0';
- CurrentPhonebookEntry->Number[0] = '\0';
- CurrentPhonebookEntry->SubEntriesCount = 0;
+ int length=0;
#ifdef DEBUG
- fprintf(stdout, _("Message: Phonebook entry received:\n"));
-#endif
-
- if( MessageBuffer[6] == 0x0f ) // not found
- {
-#ifdef DEBUG
- fprintf(stdout, _(" Error %i\n"),MessageBuffer[10]);
- switch (MessageBuffer[10]) {
- case 0x34:fprintf(stdout,_(" Invalid phonebook location\n"));break;
- case 0x3b:fprintf(stdout,_(" Speed dial not assigned\n"));break;
- default :fprintf(stdout,_(" Unknown.Please report\n"));break;
- }
+ int j;
#endif
- switch (MessageBuffer[10]) {
- case 0x34:CurrentPhonebookError = GE_INVALIDPHBOOKLOCATION;break;
- case 0x3b:CurrentPhonebookError = GE_INVALIDSPEEDDIALLOCATION;break;
- default :CurrentPhonebookError = GE_UNKNOWN;
- }
- CurrentSpeedDialError=GE_INVALIDSPEEDDIALLOCATION;
-
- } else {
-
- CurrentPhonebookEntry->Location=MessageBuffer[13];
-
- count = MessageBuffer[9];
- blocks = MessageBuffer[17];
- blockcount = 0;
- CurrentPhonebookEntry->SubEntriesCount = blocks - 1;
+ pBlock = &MessageBuffer[0];
-#ifdef DEBUG
- fprintf(stdout, _(" Blocks: %d\n"),blocks);
-#endif /* DEBUG */
-
- pBlock = &MessageBuffer[18];
-
- for( i = 0; i < blocks; i++ )
- {
- GSM_SubPhonebookEntry* pEntry = &CurrentPhonebookEntry->SubEntries[blockcount];
+ while (length!=MessageLength) {
+ GSM_SubPhonebookEntry* pEntry = &entry->SubEntries[blockcount];
#ifdef DEBUG
- fprintf(stdout,_(" "));
- for (j=5;j<(pBlock[3]-6)+5;j++) fprintf(stdout,_("%02x "),pBlock[j]);
- fprintf(stdout,_("\n"));
+ fprintf(stdout,_(" "));
+ for (j=5;j<(pBlock[3]-6)+5;j++) fprintf(stdout,_("%02x "),pBlock[j]);
+ fprintf(stdout,_("\n"));
#endif
- switch( pBlock[0] ) {
- case N7110_ENTRYTYPE_SPEEDDIAL:
+ switch( pBlock[0] ) {
+ case N7110_ENTRYTYPE_SPEEDDIAL:
- CurrentSpeedDialEntry->MemoryType = GMT_SM;
- if (pBlock[4]==0x02) CurrentSpeedDialEntry->MemoryType = GMT_ME;
+ CurrentSpeedDialEntry->MemoryType = GMT_SM;
+ if (pBlock[4]==0x02) CurrentSpeedDialEntry->MemoryType = GMT_ME;
- CurrentSpeedDialEntry->Location = pBlock[7]+pBlock[6]*256;
+ CurrentSpeedDialEntry->Location = pBlock[7]+pBlock[6]*256;
#ifdef DEBUG
- fprintf(stdout, _(" Speed dial\n"));
- fprintf(stdout, _(" Location: %d\n"), CurrentSpeedDialEntry->Location);
- fprintf(stdout, _(" MemoryType: %i\n"), CurrentSpeedDialEntry->MemoryType);
- fprintf(stdout, _(" Number: %d\n"), CurrentSpeedDialEntry->Number);
+ fprintf(stdout, _(" Speed dial\n"));
+ fprintf(stdout, _(" Location: %d\n"), CurrentSpeedDialEntry->Location);
+ fprintf(stdout, _(" MemoryType: %i\n"), CurrentSpeedDialEntry->MemoryType);
+ fprintf(stdout, _(" Number: %d\n"), CurrentSpeedDialEntry->Number);
#endif /* DEBUG */
- CurrentSpeedDialError=GE_NONE;
- break;
+ CurrentSpeedDialError=GE_NONE;
+ break;
- case N7110_ENTRYTYPE_NAME:
- DecodeUnicode (CurrentPhonebookEntry->Name, pBlock+6, pBlock[5]/2);
- if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY)
- strncpy(CurrentGetBitmap->text,CurrentPhonebookEntry->Name,sizeof(CurrentGetBitmap->text));
- CurrentPhonebookEntry->Empty = false;
+ case N7110_ENTRYTYPE_NAME:
+ DecodeUnicode (entry->Name, pBlock+6, pBlock[5]/2);
+ if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY)
+ strncpy(CurrentGetBitmap->text,entry->Name,sizeof(CurrentGetBitmap->text));
+ entry->Empty = false;
#ifdef DEBUG
- fprintf(stdout, _(" Name:\n"));
- fprintf(stdout, _(" Name: %s\n"), CurrentPhonebookEntry->Name);
+ fprintf(stdout, _(" Name:\n"));
+ fprintf(stdout, _(" Name: %s\n"), entry->Name);
#endif /* DEBUG */
- break;
+ break;
- case N7110_ENTRYTYPE_NUMBER:
- pEntry->EntryType = pBlock[0];
- pEntry->NumberType = pBlock[5];
- pEntry->BlockNumber = pBlock[4];
-
- DecodeUnicode (pEntry->data.Number, pBlock+10, pBlock[9]/2);
-
-#ifdef DEBUG
- fprintf(stdout, _(" Number:\n"));
- fprintf(stdout, _(" Type: %d (%02x)\n"),
- pEntry->NumberType,
- pEntry->NumberType);
- fprintf(stdout, _(" Number: %s\n"),
- pEntry->data.Number);
-#endif /* DEBUG */
- if( pEntry->EntryType == GSM_Number &&
- ((pEntry->NumberType == GSM_General &&
- !strcmp(CurrentPhonebookEntry->Number,""))
- || pEntry->NumberType == GSM_SIM)) {
- strcpy( CurrentPhonebookEntry->Number, pEntry->data.Number );
- *pEntry->data.Number = 0;
- } else
- blockcount++;
- break;
- case N7110_ENTRYTYPE_DATE:
- pEntry->EntryType = pBlock[0];
- pEntry->NumberType = pBlock[5];
- pEntry->BlockNumber = pBlock[4];
- DecodeDateTime(pBlock+6, &pEntry->data.Date);
-#ifdef DEBUG
- fprintf(stdout, _(" Date:\n"));
- fprintf(stdout, _(" Date: %02u.%02u.%04u\n"), pEntry->data.Date.Day,
- pEntry->data.Date.Month, pEntry->data.Date.Year );
- fprintf(stdout, _(" Time: %02u:%02u:%02u\n"), pEntry->data.Date.Hour,
- pEntry->data.Date.Minute, pEntry->data.Date.Second);
+ case N7110_ENTRYTYPE_NUMBER:
+ pEntry->EntryType = pBlock[0];
+ pEntry->NumberType = pBlock[5];
+ pEntry->BlockNumber = pBlock[4];
+
+ DecodeUnicode (pEntry->data.Number, pBlock+10, pBlock[9]/2);
+
+#ifdef DEBUG
+ fprintf(stdout, _(" Number:\n"));
+ fprintf(stdout, _(" Type: %d (%02x)\n"),pEntry->NumberType,pEntry->NumberType);
+ fprintf(stdout, _(" Number: %s\n"),pEntry->data.Number);
#endif /* DEBUG */
+ if( pEntry->EntryType == GSM_Number &&
+ ((pEntry->NumberType == GSM_General && !strcmp(entry->Number,""))
+ || pEntry->NumberType == GSM_SIM)) {
+ strcpy( entry->Number, pEntry->data.Number );
+ *pEntry->data.Number = 0;
+ } else
blockcount++;
- break;
- case N7110_ENTRYTYPE_NOTE:
- case N7110_ENTRYTYPE_POSTAL:
- case N7110_ENTRYTYPE_EMAIL:
- pEntry->EntryType = pBlock[0];
- pEntry->NumberType = 0;
- pEntry->BlockNumber = pBlock[4];
+ break;
+ case N7110_ENTRYTYPE_DATE:
+ pEntry->EntryType = pBlock[0];
+ pEntry->NumberType = pBlock[5];
+ pEntry->BlockNumber = pBlock[4];
+ DecodeDateTime(pBlock+6, &pEntry->data.Date);
+#ifdef DEBUG
+ fprintf(stdout, _(" Date:\n"));
+ fprintf(stdout, _(" Date: %02u.%02u.%04u\n"), pEntry->data.Date.Day,
+ pEntry->data.Date.Month, pEntry->data.Date.Year );
+ fprintf(stdout, _(" Time: %02u:%02u:%02u\n"), pEntry->data.Date.Hour,
+ pEntry->data.Date.Minute, pEntry->data.Date.Second);
+#endif /* DEBUG */
+ blockcount++;
+ break;
+ case N7110_ENTRYTYPE_NOTE:
+ case N7110_ENTRYTYPE_POSTAL:
+ case N7110_ENTRYTYPE_EMAIL:
+ pEntry->EntryType = pBlock[0];
+ pEntry->NumberType = 0;
+ pEntry->BlockNumber = pBlock[4];
- DecodeUnicode (pEntry->data.Number, pBlock+6, pBlock[5]/2);
+ DecodeUnicode (pEntry->data.Number, pBlock+6, pBlock[5]/2);
#ifdef DEBUG
- fprintf(stdout, _(" Email or note or postal:\n"));
- fprintf(stdout, _(" Type: %d (%02x)\n"),
- pEntry->EntryType,
- pEntry->EntryType);
- fprintf(stdout, _(" Text: %s\n"),
- pEntry->data.Number);
+ fprintf(stdout, _(" Email or note or postal:\n"));
+ fprintf(stdout, _(" Type: %d (%02x)\n"),pEntry->EntryType,pEntry->EntryType);
+ fprintf(stdout, _(" Text: %s\n"),pEntry->data.Number);
#endif /* DEBUG */
- blockcount++;
- break;
- case N7110_ENTRYTYPE_GROUP:
- CurrentPhonebookEntry->Group = pBlock[5]-1; /* 0 = family as for 6110 */
- if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY)
- CurrentGetBitmap->number = CurrentPhonebookEntry->Group;
+ blockcount++;
+ break;
+ case N7110_ENTRYTYPE_GROUP:
+ entry->Group = pBlock[5]-1; /* 0 = family as for 6110 */
+ if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY)
+ CurrentGetBitmap->number = entry->Group;
#ifdef DEBUG
- fprintf(stdout, _(" Group: %d\n"), CurrentPhonebookEntry->Group);
+ fprintf(stdout, _(" Group: %d\n"), entry->Group);
#endif /* DEBUG */
- break;
- case N7110_ENTRYTYPE_RINGTONE:
- if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY)
- CurrentGetBitmap->ringtone = pBlock[5];
+ break;
+ case N7110_ENTRYTYPE_RINGTONE:
+ if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY)
+ CurrentGetBitmap->ringtone = pBlock[5];
#ifdef DEBUG
- fprintf(stdout, _(" Group ringtone number %d received.\n"), pBlock[5]);
+ fprintf(stdout, _(" Group ringtone number %d received.\n"), pBlock[5]);
#endif /* DEBUG */
- break;
- case N7110_ENTRYTYPE_LOGOON:
- if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY)
- CurrentGetBitmap->enabled = pBlock[5];
+ break;
+ case N7110_ENTRYTYPE_LOGOON:
+ if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY)
+ CurrentGetBitmap->enabled = pBlock[5];
#ifdef DEBUG
- fprintf(stdout, _(" Logo enabled = %d received.\n"), pBlock[5]);
+ fprintf(stdout, _(" Logo enabled = %d received.\n"), pBlock[5]);
#endif /* DEBUG */
- break;
- case N7110_ENTRYTYPE_GROUPLOGO:
+ break;
+ case N7110_ENTRYTYPE_GROUPLOGO:
#ifdef DEBUG
- fprintf(stdout, _(" Caller group logo received.\n"));
+ fprintf(stdout, _(" Caller group logo received.\n"));
#endif /* DEBUG */
- if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY) {
- CurrentGetBitmap->width = pBlock[5];
- CurrentGetBitmap->height= pBlock[6];
- CurrentGetBitmap->size = pBlock[9];
- if (CurrentGetBitmap->size > sizeof(CurrentGetBitmap->bitmap))
- CurrentGetBitmap->size = CurrentGetBitmap->size;
- memcpy(CurrentGetBitmap->bitmap,pBlock+10,CurrentGetBitmap->size);
- }
- break;
+ if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY) {
+ CurrentGetBitmap->width = pBlock[5];
+ CurrentGetBitmap->height= pBlock[6];
+ CurrentGetBitmap->size = pBlock[9];
+ if (CurrentGetBitmap->size > sizeof(CurrentGetBitmap->bitmap))
+ CurrentGetBitmap->size = CurrentGetBitmap->size;
+ memcpy(CurrentGetBitmap->bitmap,pBlock+10,CurrentGetBitmap->size);
+ }
+ break;
- default:
+ default:
#ifdef DEBUG
- fprintf(stdout, _(" Unknown Entry Code (%u) received.\n"), pBlock[0] );
+ fprintf(stdout, _(" Unknown Entry Code (%u) received.\n"), pBlock[0] );
#endif /* DEBUG */
- break;
- }
+ break;
+ }
#ifdef DEBUG
- fprintf(stdout, _(" Blocksize was: %d (%02x)\n"), (int) pBlock[3], pBlock[3]);
+ fprintf(stdout, _(" Blocksize was: %d (%02x)\n"), (int) pBlock[3], pBlock[3]);
#endif
- pBlock = &pBlock[(int) pBlock[3]];
+ length=length+pBlock[3];
+
+ pBlock = &pBlock[(int) pBlock[3]];
+ }
+
+ entry->SubEntriesCount = blockcount;
+
+#ifdef DEBUG
+ fprintf(stdout, _(" SubBlocks: %d\n"),entry->SubEntriesCount);
+#endif /* DEBUG */
+}
+
+void N7110_ReplyGetMemoryLocation(u16 MessageLength, u8 *MessageBuffer, u8 MessageType)
+{
+
+ CurrentPhonebookEntry->Empty = true;
+ CurrentPhonebookEntry->Group = 5; /* 5 = no group as 6110 */
+ CurrentPhonebookEntry->Name[0] = '\0';
+ CurrentPhonebookEntry->Number[0] = '\0';
+ CurrentPhonebookEntry->SubEntriesCount = 0;
+
+#ifdef DEBUG
+ fprintf(stdout, _("Message: Phonebook entry received:\n"));
+#endif
+
+ if( MessageBuffer[6] == 0x0f ) // not found
+ {
+#ifdef DEBUG
+ fprintf(stdout, _(" Error %i\n"),MessageBuffer[10]);
+ switch (MessageBuffer[10]) {
+ case 0x34:fprintf(stdout,_(" Invalid phonebook location\n"));break;
+ case 0x3b:fprintf(stdout,_(" Speed dial not assigned\n"));break;
+ default :fprintf(stdout,_(" Unknown.Please report\n"));break;
}
+#endif
+ switch (MessageBuffer[10]) {
+ case 0x34:CurrentPhonebookError = GE_INVALIDPHBOOKLOCATION;break;
+ case 0x3b:CurrentPhonebookError = GE_INVALIDSPEEDDIALLOCATION;break;
+ default :CurrentPhonebookError = GE_UNKNOWN;
+ }
+ CurrentSpeedDialError=GE_INVALIDSPEEDDIALLOCATION;
+
+ } else {
+ CurrentPhonebookEntry->Location=MessageBuffer[13]+MessageBuffer[12]*256;
+
+#ifdef DEBUG
+ fprintf(stdout,_(" Location: %i\n"),CurrentPhonebookEntry->Location);
+#endif
+
+ N7110_DecodePhonebookFrame(CurrentPhonebookEntry,MessageBuffer+18,MessageLength-18);
- CurrentPhonebookEntry->SubEntriesCount = blockcount;
CurrentPhonebookError = GE_NONE;
}
}
int N7110_PackPBKBlock(int id, int size, int no, unsigned char *buf, unsigned char *block)
{
#ifdef DEBUG
- fprintf(stdout,_("Adding block id:%i,length:%i\n"),no+1,size+6);
+ fprintf(stdout,_("Adding block id:%i,number:%i,length:%i\n"),id,no+1,size+6);
#endif
*(block++) = id;
return (size + 6);
}
-int N7110_MakePhonebookFrame(unsigned char *req, GSM_PhonebookEntry entry, int *block)
+int N7110_EncodePhonebookFrame(unsigned char *req, GSM_PhonebookEntry entry, int *block2)
{
- int count=0, len, i;
+ int count=0, len, i, block=0;
char string[500];
- *block=0;
-
/* Name */
len = strlen(entry.Name);
string[0] = len * 2; // Length ot the string (without Termination)
EncodeUnicode((string + 1), entry.Name, len);
string[len * 2 + 1] = 0; // Terminating 0
- count += N7110_PackPBKBlock(N7110_ENTRYTYPE_NAME, len * 2 + 2, *block++, string, req + count);
+ count += N7110_PackPBKBlock(N7110_ENTRYTYPE_NAME, len * 2 + 2, block++, string, req + count);
if (*entry.Number) {
len = strlen(entry.Number);
string[4] = len * 2; // length (without Termination)
EncodeUnicode((string + 5), entry.Number, len);
string[len * 2 + 5] = 0; // Terminating 0
- count += N7110_PackPBKBlock(N7110_ENTRYTYPE_NUMBER, len * 2 + 6, *block++, string, req + count);
+ count += N7110_PackPBKBlock(N7110_ENTRYTYPE_NUMBER, len * 2 + 6, block++, string, req + count);
}
/* Rest of the subentries */
string[0] = len * 2; // length (without Termination)
EncodeUnicode((string + 1), entry.SubEntries[i].data.Number, len);
string[len * 2 + 1] = 0; // Terminating 0
- count += N7110_PackPBKBlock(entry.SubEntries[i].EntryType, len * 2 + 2, *block++, string, req + count);
+ count += N7110_PackPBKBlock(entry.SubEntries[i].EntryType, len * 2 + 2, block++, string, req + count);
} else {
string[0] = entry.SubEntries[i].NumberType;
string[1] = string[2] = string[3] = 0;
string[4] = len * 2; //length (without Termination)
EncodeUnicode((string + 5), entry.SubEntries[i].data.Number, len);
string[len * 2 + 5] = 0; // Terminating 0
- count += N7110_PackPBKBlock(N7110_ENTRYTYPE_NUMBER, len * 2 + 6, *block++, string, req + count);
+ count += N7110_PackPBKBlock(N7110_ENTRYTYPE_NUMBER, len * 2 + 6, block++, string, req + count);
}
}
/* Group */
string[0] = entry.Group + 1;
string[1] = 0;
- count += N7110_PackPBKBlock(N7110_ENTRYTYPE_GROUP, 2, *block++, string, req + count);
+ count += N7110_PackPBKBlock(N7110_ENTRYTYPE_GROUP, 2, block++, string, req + count);
}
+ *block2=block;
+
return count;
}
req[12] = (entry->Location >> 8);
req[13] = entry->Location & 0xff;
- // If we had a file that contain data in entry style like from 6110
- // we can import this too :)
- // no SubEntries in SIM (besides Name, Number, and Group)
- if (entry->MemoryType == GMT_SM) entry->SubEntriesCount = 0;
+// if (entry->MemoryType == GMT_SM) entry->SubEntriesCount = 0;
- count=count+N7110_MakePhonebookFrame(req+18, *entry, &blocks);
+ count=count+N7110_EncodePhonebookFrame(req+18, *entry, &blocks);
req[17]=blocks;
0x05, /* mem location low*/
0x00, /* mem location high*/
0x00, 0x00
- };
+ };
- req[12] = (entry->Location >> 8);
- req[13] = entry->Location & 0xff;
- req[14] = N7110_GetMemoryType(entry->MemoryType);
+ req[12] = (entry->Location >> 8);
+ req[13] = entry->Location & 0xff;
+ req[14] = N7110_GetMemoryType(entry->MemoryType);
#ifdef DEBUG
- fprintf(stdout, _("Deleting phonebook entry at location %d...\n"),entry->Location);
+ fprintf(stdout, _("Deleting phonebook entry at location %d...\n"),entry->Location);
#endif
return NULL_SendMessageSequence(50, &CurrentPhonebookError, 18, 0x03, req);
string[1] = 0;
count += N7110_PackPBKBlock(N7110_ENTRYTYPE_GROUP, 2, block++, string, req + count);
+ /* Name */
+ if (*bitmap->text) {
+ i = strlen(bitmap->text);
+ string[0] = i * 2 + 2;
+ EncodeUnicode((string + 1), bitmap->text, i);
+ string[i * 2 + 1] = 0; // Terminating 0
+ count += N7110_PackPBKBlock(N7110_ENTRYTYPE_NAME, i * 2 + 2, block++, string, req + count);
+ }
+
/* Logo */
string[0] = bitmap->width;
string[1] = bitmap->height;
memcpy(string + 5, bitmap->bitmap, bitmap->size);
count += N7110_PackPBKBlock(N7110_ENTRYTYPE_GROUPLOGO, bitmap->size + 5, block++, string, req + count);
- /* Name */
- if (*bitmap->text) {
- i = strlen(bitmap->text);
- string[0] = i * 2;
- EncodeUnicode((string + 1), bitmap->text, i);
- count += N7110_PackPBKBlock(N7110_ENTRYTYPE_NAME, i * 2 + 1, block++, string, req + count);
- }
-
req[17] = block; //number of blocks
return NULL_SendMessageSequence
/* set logo */
if (strcmp(Bitmap->netcode,"000 00")) {
reqOp[5] = 0x01; // Logo enabled
- EncodeNetworkCode(reqOp+5, Bitmap->netcode);
- reqOp[11] = 8+(Bitmap->width*Bitmap->height+7)/8;
+ EncodeNetworkCode(reqOp+6, Bitmap->netcode);
+ reqOp[11] = 8+GSM_GetBitmapSize(Bitmap);
reqOp[12]=Bitmap->width;
reqOp[13]=Bitmap->height;
- reqOp[15]=(Bitmap->width*Bitmap->height+7)/8;
+ reqOp[15]=GSM_GetBitmapSize(Bitmap);
memcpy(reqOp+count,Bitmap->bitmap,Bitmap->size);
count += Bitmap->size;
} else {
if (NULL_SendMessageSequence (50, &CurrentGetBitmapError, 7, 0x14, req2)!=GE_NONE) break;
if (PictureImageNum==Bitmap->number+1) break;
}
- if (CurrentGetBitmapError!=GE_NONE) {
+ if (PictureImageNum!=Bitmap->number+1) {
req4[5]=0x21;
req4[6]=0;
req4[7]=0;
req4[6]=PictureImageIndex/256;
req4[7]=PictureImageIndex%256;
}
- count=7;
- for (i=0;i<38;i++) req4[count++]=0x00;
+
+ /* Cleaning */
+ for (i=0;i<36;i++) req4[i+9]=0;
+
+ count=8;
+ if (strlen(Bitmap->text)==0) {
+ count+=2 ;req4[count]=0x0c;
+ count+=2 ;req4[count]=0x0d;
+ count+=2 ;req4[count]=0x0e;
+ count+=2 ;req4[count]=0x0f;
+ count+=2 ;req4[count]=0x10;
+ count+=2 ;req4[count]=0x11;
+ count+=23;req4[count]=0x02;
+ count++ ;req4[count]=0x01;
+ count+=2;
+ } else {
+ count+=2 ;req4[count]=0x54;
+ count++ ;req4[count]=0xd4;
+ count++ ;req4[count]=0x0d;
+ count+=2 ;req4[count]=0x0e;
+ count+=2 ;req4[count]=0x0f;
+ count+=2 ;req4[count]=0x10;
+ count+=2 ;req4[count]=0x11;
+ count+=21;req4[count]=0x01;
+ count+=3 ;req4[count]=0x01;
+ count+=2;
+ }
+
+ req4[count++]=0x01;
req4[count++]=Bitmap->width;
req4[count++]=Bitmap->height;
req4[count++]=Bitmap->size/256;
req4[count++]=Bitmap->size%256;
- memcpy(reqOp+count,Bitmap->bitmap,Bitmap->size);
+ memcpy(req4+count,Bitmap->bitmap,Bitmap->size);
count += Bitmap->size;
- req4[count++]=0x00;
+
+ if (strlen(Bitmap->text)!=0) {
+ req4[count] = strlen(Bitmap->text);
+ GSM_PackSevenBitsToEight(0, Bitmap->text, req4+count+1);
+ count=count+req4[count];
+ } else {
+ req4[count++]=0x00;
+ }
req4[count++]=0x00;
CurrentSetBitmapError = GE_BUSY;
if (strcmp(model,"NSE-5") == 0) return 0x74; //first 0x74 //7110
if (strcmp(model,"NPE-3") == 0) return 0x89; //first is 0x89; //6210
+ if (strcmp(model,"NHM-3") == 0) return 0x89; //quess for 6250
return 0;
}
/* Info from Till Toenshoff [till@uni.de]
- One improvement - for looping you can use an alternative header\r
- normal\r
- 0x02, 0xFC, 0x09, 0x00, 0x0A, 0x01\r
-\r
- loop\r
- 0x02, 0xFC, 0x09, 0x00, 0x05, 0xLL, 0x0A, 0x01\r
-\r
- LL=0x01-0x10\r
-\r
- 0x01=loop once\r
- [...]\r
- 0x10=loop infinite\r
+ One improvement - for looping you can use an alternative header
+ normal
+ 0x02, 0xFC, 0x09, 0x00, 0x0A, 0x01
+
+ loop
+ 0x02, 0xFC, 0x09, 0x00, 0x05, 0xLL, 0x0A, 0x01
+
+ LL=0x01-0x10
+
+ 0x01=loop once
+ [...]
+ 0x10=loop infinite
*/
char tail[] = {0x40, 0x7D, 0x40, 0x5C, 0x0A, 0xFE, 0x40,
0x20, 0x40, 0x7D, 0x40, 0x37, 0x0A, 0xFE,
GSM_Error N7110_SetBinRingTone(GSM_BinRingtone *ringtone)
{
- unsigned char req[500] = { N6110_FRAME_HEADER, 0x1f, 0x00, 0x00 };
+ unsigned char req[1000] = { N6110_FRAME_HEADER, 0x1f, 0x00, 0x00 };
GSM_NetworkInfo NetworkInfo;
memcpy(req+35,ringtone->frame+i,ringtone->length-i);
- Protocol->SendMessage(35+ringtone->length-i, 0x1f, req); \r
+ Protocol->SendMessage(35+ringtone->length-i, 0x1f, req);
GSM->GetNetworkInfo(&NetworkInfo); //need to make something
GSM_GetNetworkName(CurrentGetBitmap->netcode));
#endif
+ CurrentGetBitmap->type=GSM_7110OperatorLogo;
if (MessageBuffer[4] == 0x02) { /* logo present */
count = 7;
count += MessageBuffer[count]; /* skip network info */
- CurrentGetBitmap->size=MessageBuffer[count++]; /* is too large */
+ count ++;
CurrentGetBitmap->width=MessageBuffer[count++]; /* 78 */
CurrentGetBitmap->height=MessageBuffer[count++]; /* 21 */
count+=4;
- CurrentGetBitmap->size=(CurrentGetBitmap->height*CurrentGetBitmap->width+7)/8; /* packed size */
- if (CurrentGetBitmap->size > sizeof(CurrentGetBitmap->bitmap))
- CurrentGetBitmap->size=sizeof(CurrentGetBitmap->bitmap);
+ CurrentGetBitmap->size=GSM_GetBitmapSize(CurrentGetBitmap); /* packed size */
memcpy(CurrentGetBitmap->bitmap,MessageBuffer+count,CurrentGetBitmap->size);
} else {
CurrentGetBitmap->width=78;
CurrentGetBitmap->height=21;
- CurrentGetBitmap->size=(CurrentGetBitmap->height*CurrentGetBitmap->width+7)/8; /* packed size */
+ CurrentGetBitmap->size=GSM_GetBitmapSize(CurrentGetBitmap); /* packed size */
memset(CurrentGetBitmap->bitmap,0,CurrentGetBitmap->size);
}
CurrentGetBitmapError=GE_NONE;
CurrentGetBitmap->width=MessageBuffer[47];
CurrentGetBitmap->height=MessageBuffer[48];
- CurrentGetBitmap->size=CurrentGetBitmap->height*CurrentGetBitmap->width/8;
+ CurrentGetBitmap->size=GSM_GetBitmapSize(CurrentGetBitmap);
memcpy(CurrentGetBitmap->bitmap,MessageBuffer+51,CurrentGetBitmap->size);
CurrentSMSMessageError = GE_NONE;
break;
}
-
+ case 0x51:
+#ifdef DEBUG
+ fprintf(stdout, _("Message: Picture Image saved OK\n"));
+ fprintf(stdout, _(" folder : %02x\n"),MessageBuffer[4]);
+ fprintf(stdout, _(" location: %02x\n"),MessageBuffer[5]*256+MessageBuffer[6]);
+#endif /* DEBUG */
+ CurrentSetBitmapError=GE_NONE;
+ break;
+
case 0x97:
#ifdef DEBUG
/* Make sure we are expecting a startup logo */
if (CurrentGetBitmap && CurrentGetBitmapError == GE_BUSY) {
CurrentGetBitmap->height=MessageBuffer[13]; /* 96 */
- CurrentGetBitmap->width=MessageBuffer[17]; /* 60 */
- CurrentGetBitmap->size=(CurrentGetBitmap->height+7)/8*CurrentGetBitmap->width; /* unpacked size */
+ CurrentGetBitmap->width=MessageBuffer[17]; /* 60/65 */
+ CurrentGetBitmap->type=GSM_7110StartupLogo;
+ if (CurrentGetBitmap->width==60) CurrentGetBitmap->type=GSM_6210StartupLogo;
+ CurrentGetBitmap->size=GSM_GetBitmapSize(CurrentGetBitmap); /* unpacked size */
if (CurrentGetBitmap->size > sizeof(CurrentGetBitmap->bitmap))
CurrentGetBitmap->size=sizeof(CurrentGetBitmap->bitmap);
memcpy(CurrentGetBitmap->bitmap,MessageBuffer+22,CurrentGetBitmap->size);