http://marcin-wiacek.fkn.pl/english/zips/mygnokii.tar.gz
[gnokii.git] / common / newmodules / n7110.c
index 78bffaf..cec428e 100644 (file)
@@ -78,7 +78,7 @@ GSM_Functions N7110_Functions = {
   N7110_SetAlarm,
   N6110_DialVoice,
   N6110_DialData,
-  N6110_GetIncomingCallNr,
+  N6110_GetIncomingCallNr,\r
   N6110_GetNetworkInfo,
   N7110_GetCalendarNote,
   N7110_WriteCalendarNote,
@@ -130,6 +130,7 @@ GSM_Information N7110_Information = {
   "",
   "6210|6250|7110", /* Supported models in FBUS over Irda sockets */
   "",
+  "",
   5,                     /* Max RF Level */
   0,                     /* Min RF Level */
   GRF_Arbitrary,         /* RF level units */
@@ -1156,7 +1157,7 @@ GSM_Error N7110_GetCalendarNote(GSM_CalendarNote *CalendarNote)
     return GE_INVALIDCALNOTELOCATION;
   
   req[4] = CurrentCalendarNotesInfo.Location[CalendarNote->Location-1]>>8;
-  req[5] = CurrentCalendarNotesInfo.Location[CalendarNote->Location-1]&0xff;
+  req[5] = CurrentCalendarNotesInfo.Location[CalendarNote->Location-1]&0xff;\r
   CurrentCalendarNote = CalendarNote;
 
   /* We have to get current year. It's NOT written in frame for Birthday */
@@ -2460,14 +2461,14 @@ GSM_Error N7110_DeletePhonebookLocation(GSM_PhonebookEntry *entry)
     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);
@@ -2689,7 +2690,7 @@ GSM_Error N7110_SetBitmap(GSM_Bitmap *Bitmap)
       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;
@@ -2698,15 +2699,49 @@ GSM_Error N7110_SetBitmap(GSM_Bitmap *Bitmap)
       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;
@@ -2854,6 +2889,7 @@ int ReturnBinRingLocation()
 
   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;
 }
@@ -2886,18 +2922,18 @@ GSM_Error N7110_SetRingTone(GSM_Ringtone *ringtone, int *maxlength)
 
   /* Info from Till Toenshoff [till@uni.de]
 
-     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
+     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
   */
   char tail[] = {0x40, 0x7D, 0x40, 0x5C, 0x0A, 0xFE, 0x40,
                  0x20, 0x40, 0x7D, 0x40, 0x37, 0x0A, 0xFE,
@@ -3081,7 +3117,7 @@ GSM_Error N7110_SetBinRingTone(GSM_BinRingtone *ringtone)
 
   memcpy(req+35,ringtone->frame+i,ringtone->length-i);
 
-  Protocol->SendMessage(35+ringtone->length-i, 0x1f, req);  
+  Protocol->SendMessage(35+ringtone->length-i, 0x1f, req);  \r
 
   GSM->GetNetworkInfo(&NetworkInfo); //need to make something    
   
@@ -3324,7 +3360,15 @@ void N7110_Dispatch0x14Message(u16 MessageLength, u8 *MessageBuffer, u8 MessageT
       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