summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/nokia/dct3/dct3func.c
Unidiff
Diffstat (limited to 'gammu/emb/common/phone/nokia/dct3/dct3func.c') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/phone/nokia/dct3/dct3func.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.c b/gammu/emb/common/phone/nokia/dct3/dct3func.c
index 17cd0a4..9810a35 100644
--- a/gammu/emb/common/phone/nokia/dct3/dct3func.c
+++ b/gammu/emb/common/phone/nokia/dct3/dct3func.c
@@ -1,18 +1,27 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* resetting DCT4 phones settings (c) by Walek */ 2/* resetting DCT4 phones settings (c) by Walek */
3/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org) 3/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot 4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later 5 * GNU GPL version 2 or later
6 */ 6 */
7/* Due to a problem in the source code management, the names of some of
8 * the authors have unfortunately been lost. We do not mean to belittle
9 * their efforts and hope they will contact us to see their names
10 * properly added to the Copyright notice above.
11 * Having published their contributions under the terms of the GNU
12 * General Public License (GPL) [version 2], the Copyright of these
13 * authors will remain respected by adhering to the license they chose
14 * to publish their code under.
15 */
7 16
8#include <string.h> /* memcpy only */ 17#include <string.h> /* memcpy only */
9#include <stdio.h> 18#include <stdio.h>
10#include <ctype.h> 19#include <ctype.h>
11 20
12#include "../../../gsmstate.h" 21#include "../../../gsmstate.h"
13#include "../../../misc/coding/coding.h" 22#include "../../../misc/coding/coding.h"
14#include "../../../service/sms/gsmsms.h" 23#include "../../../service/sms/gsmsms.h"
15#include "../../pfunc.h" 24#include "../../pfunc.h"
16#include "../nfunc.h" 25#include "../nfunc.h"
17#include "dct3func.h" 26#include "dct3func.h"
18 27
@@ -448,28 +457,28 @@ GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s
448 smprintf(s, "Network info received\n"); 457 smprintf(s, "Network info received\n");
449 smprintf(s, "Status : "); 458 smprintf(s, "Status : ");
450 switch (msg.Buffer[8]) { 459 switch (msg.Buffer[8]) {
451 case 0x01: smprintf(s, "home network"); break; 460 case 0x01: smprintf(s, "home network"); break;
452 case 0x02: smprintf(s, "roaming network"); break; 461 case 0x02: smprintf(s, "roaming network"); break;
453 case 0x03: smprintf(s, "requesting network"); break; 462 case 0x03: smprintf(s, "requesting network"); break;
454 case 0x04: smprintf(s, "not registered in the network");break; 463 case 0x04: smprintf(s, "not registered in the network");break;
455 default : smprintf(s, "unknown"); 464 default : smprintf(s, "unknown");
456 } 465 }
457 smprintf(s, "\n"); 466 smprintf(s, "\n");
458 smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic"); 467 smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic");
459 if (msg.Buffer[8]<0x03) { 468 if (msg.Buffer[8]<0x03) {
460 sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); 469 sprintf(NetInfo.CID, "%02X%02X", msg.Buffer[10], msg.Buffer[11]);
461 smprintf(s, "CID : %s\n", NetInfo.CID); 470 smprintf(s, "CID : %s\n", NetInfo.CID);
462 471
463 sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); 472 sprintf(NetInfo.LAC, "%02X%02X", msg.Buffer[12], msg.Buffer[13]);
464 smprintf(s, "LAC : %s\n", NetInfo.LAC); 473 smprintf(s, "LAC : %s\n", NetInfo.LAC);
465 474
466 NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode); 475 NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode);
467 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); 476 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
468 smprintf(s, "Network name for Gammu : %s ", 477 smprintf(s, "Network name for Gammu : %s ",
469 DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); 478 DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode)));
470 smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); 479 smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode)));
471 480
472 if (msg.Length>18) { 481 if (msg.Length>18) {
473 if (msg.Buffer[18]==0x00) { 482 if (msg.Buffer[18]==0x00) {
474 /* In 6210 name is in "normal" Unicode */ 483 /* In 6210 name is in "normal" Unicode */
475 memcpy(name,msg.Buffer+18,msg.Buffer[17]*2); 484 memcpy(name,msg.Buffer+18,msg.Buffer[17]*2);
@@ -502,26 +511,26 @@ GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s
502 /* In 6210 name is in "normal" Unicode */ 511 /* In 6210 name is in "normal" Unicode */
503 memcpy(Data->NetworkInfo->NetworkName,msg.Buffer+18,msg.Buffer[17]*2); 512 memcpy(Data->NetworkInfo->NetworkName,msg.Buffer+18,msg.Buffer[17]*2);
504 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2] = 0x00; 513 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2] = 0x00;
505 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1] = 0x00; 514 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1] = 0x00;
506 } else { 515 } else {
507 /* In 9210 first 0x00 is cut from Unicode string */ 516 /* In 9210 first 0x00 is cut from Unicode string */
508 Data->NetworkInfo->NetworkName[0] = 0; 517 Data->NetworkInfo->NetworkName[0] = 0;
509 memcpy(Data->NetworkInfo->NetworkName+1,msg.Buffer+18,msg.Buffer[17]*2); 518 memcpy(Data->NetworkInfo->NetworkName+1,msg.Buffer+18,msg.Buffer[17]*2);
510 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1]=0x00; 519 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1]=0x00;
511 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+2]=0x00; 520 Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+2]=0x00;
512 } 521 }
513 NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->NetworkInfo->NetworkCode); 522 NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->NetworkInfo->NetworkCode);
514 sprintf(Data->NetworkInfo->CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); 523 sprintf(Data->NetworkInfo->CID, "%02X%02X", msg.Buffer[10], msg.Buffer[11]);
515 sprintf(Data->NetworkInfo->LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); 524 sprintf(Data->NetworkInfo->LAC, "%02X%02X", msg.Buffer[12], msg.Buffer[13]);
516 } 525 }
517 } 526 }
518 /* 6210/6250/7110 */ 527 /* 6210/6250/7110 */
519 if (Data->RequestID==ID_GetBitmap) { 528 if (Data->RequestID==ID_GetBitmap) {
520 if (msg.Buffer[4]==0x02) { 529 if (msg.Buffer[4]==0x02) {
521 smprintf(s, "Operator logo available\n"); 530 smprintf(s, "Operator logo available\n");
522 count = 7; 531 count = 7;
523 /* skip network info */ 532 /* skip network info */
524 count += msg.Buffer[count]; 533 count += msg.Buffer[count];
525 count ++; 534 count ++;
526 Data->Bitmap->BitmapWidth= msg.Buffer[count++]; 535 Data->Bitmap->BitmapWidth= msg.Buffer[count++];
527 Data->Bitmap->BitmapHeight= msg.Buffer[count++]; 536 Data->Bitmap->BitmapHeight= msg.Buffer[count++];