-rw-r--r-- | gammu/emb/common/phone/alcatel/alcatel.c | 2 | ||||
-rw-r--r-- | gammu/emb/gammu/depend/nokia/dct3.c | 2 | ||||
-rw-r--r-- | gammu/emb/gammu/depend/nokia/dct3trac/wmx.c | 2 | ||||
-rw-r--r-- | gammu/emb/gammu/depend/nokia/dct4.c | 2 | ||||
-rw-r--r-- | gammu/emb/gammu/depend/siemens/dsiemens.c | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/gammu/emb/common/phone/alcatel/alcatel.c b/gammu/emb/common/phone/alcatel/alcatel.c index b75077f..718d91e 100644 --- a/gammu/emb/common/phone/alcatel/alcatel.c +++ b/gammu/emb/common/phone/alcatel/alcatel.c | |||
@@ -1,155 +1,155 @@ | |||
1 | /* (c) 2002-2004 by Michal Cihar */ | 1 | /* (c) 2002-2004 by Michal Cihar */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * High level functions for communication with Alcatel One Touch 501 and | 4 | * High level functions for communication with Alcatel One Touch 501 and |
5 | * compatible mobile phone. | 5 | * compatible mobile phone. |
6 | * | 6 | * |
7 | * This code implements functions to communicate with Alcatel phones, | 7 | * This code implements functions to communicate with Alcatel phones, |
8 | * currently seem to work: | 8 | * currently seem to work: |
9 | * - BE5 series (501/701) | 9 | * - BE5 series (501/701) |
10 | * - BF5 series (715) | 10 | * - BF5 series (715) |
11 | * - BH4 series (535/735) | 11 | * - BH4 series (535/735) |
12 | * For some functions it uses normal AT mode (not implemented here, look at | 12 | * For some functions it uses normal AT mode (not implemented here, look at |
13 | * ../at/atgen.[ch]) for others it switches into binary mode and initialises | 13 | * ../at/atgen.[ch]) for others it switches into binary mode and initialises |
14 | * underlaying protocol (see ../../protocol/alcatel/alcabus.[ch]) and | 14 | * underlaying protocol (see ../../protocol/alcatel/alcabus.[ch]) and |
15 | * communicates over it. Don't ask me why Alcatel uses such silly thing... | 15 | * communicates over it. Don't ask me why Alcatel uses such silly thing... |
16 | * | 16 | * |
17 | * Notes for future features: | 17 | * Notes for future features: |
18 | * - max phone number length is 61 (BE5) | 18 | * - max phone number length is 61 (BE5) |
19 | * - max name length is 50 (BE5) | 19 | * - max name length is 50 (BE5) |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include "../../gsmstate.h" | 22 | #include "../../gsmstate.h" |
23 | 23 | ||
24 | #ifdef GSM_ENABLE_ALCATEL | 24 | #ifdef GSM_ENABLE_ALCATEL |
25 | #ifdef GSM_ENABLE_ATGEN | 25 | #ifdef GSM_ENABLE_ATGEN |
26 | 26 | ||
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include <time.h> | 28 | #include <time.h> |
29 | 29 | ||
30 | #include "../../gsmcomon.h" | 30 | #include "../../gsmcomon.h" |
31 | #include "../../misc/coding/coding.h" | 31 | #include "../../misc/coding/coding.h" |
32 | #include "../../misc/misc.h" | 32 | #include "../../misc/misc.h" |
33 | #include "../../service/sms/gsmsms.h" | 33 | #include "../../service/sms/gsmsms.h" |
34 | #include "../pfunc.h" | 34 | #include "../pfunc.h" |
35 | #include "alcatel.h" | 35 | #include "alcatel.h" |
36 | 36 | ||
37 | /* Timeout for GSM_WaitFor calls. */ | 37 | /* Timeout for GSM_WaitFor calls. */ |
38 | #define ALCATEL_TIMEOUT 64 | 38 | #define ALCATEL_TIMEOUT 64 |
39 | 39 | ||
40 | /* Some magic numbers for protocol follow */ | 40 | /* Some magic numbers for protocol follow */ |
41 | 41 | ||
42 | /* synchronisation types (for everything except begin transfer): */ | 42 | /* synchronisation types (for everything except begin transfer): */ |
43 | #define ALCATEL_SYNC_TYPE_CALENDAR0x64 | 43 | #define ALCATEL_SYNC_TYPE_CALENDAR0x64 |
44 | #define ALCATEL_SYNC_TYPE_TODO 0x68 | 44 | #define ALCATEL_SYNC_TYPE_TODO 0x68 |
45 | #define ALCATEL_SYNC_TYPE_CONTACTS0x6C | 45 | #define ALCATEL_SYNC_TYPE_CONTACTS0x6C |
46 | 46 | ||
47 | /* synchronisation types (for begin transfer): */ | 47 | /* synchronisation types (for begin transfer): */ |
48 | #define ALCATEL_BEGIN_SYNC_CALENDAR0x00 | 48 | #define ALCATEL_BEGIN_SYNC_CALENDAR0x00 |
49 | #define ALCATEL_BEGIN_SYNC_TODO 0x02 | 49 | #define ALCATEL_BEGIN_SYNC_TODO 0x02 |
50 | #define ALCATEL_BEGIN_SYNC_CONTACTS0x01 | 50 | #define ALCATEL_BEGIN_SYNC_CONTACTS0x01 |
51 | 51 | ||
52 | /* category types */ | 52 | /* category types */ |
53 | #define ALCATEL_LIST_TODO_CAT 0x9B | 53 | #define ALCATEL_LIST_TODO_CAT 0x9B |
54 | #define ALCATEL_LIST_CONTACTS_CAT0x96 | 54 | #define ALCATEL_LIST_CONTACTS_CAT0x96 |
55 | 55 | ||
56 | 56 | ||
57 | /* We need lot of ATGEN functions, because Alcatel is an AT device. */ | 57 | /* We need lot of ATGEN functions, because Alcatel is an AT device. */ |
58 | 58 | ||
59 | extern GSM_Reply_Function ALCATELReplyFunctions[]; | 59 | static GSM_Reply_Function ALCATELReplyFunctions[]; |
60 | extern GSM_Reply_Function ATGENReplyFunctions[]; | 60 | extern GSM_Reply_Function ATGENReplyFunctions[]; |
61 | 61 | ||
62 | extern GSM_Error ATGEN_Initialise (GSM_StateMachine *s); | 62 | extern GSM_Error ATGEN_Initialise (GSM_StateMachine *s); |
63 | extern GSM_Error ATGEN_Terminate (GSM_StateMachine *s); | 63 | extern GSM_Error ATGEN_Terminate (GSM_StateMachine *s); |
64 | extern GSM_Error ATGEN_GetIMEI (GSM_StateMachine *s); | 64 | extern GSM_Error ATGEN_GetIMEI (GSM_StateMachine *s); |
65 | extern GSM_Error ATGEN_GetFirmware (GSM_StateMachine *s); | 65 | extern GSM_Error ATGEN_GetFirmware (GSM_StateMachine *s); |
66 | extern GSM_Error ATGEN_GetModel (GSM_StateMachine *s); | 66 | extern GSM_Error ATGEN_GetModel (GSM_StateMachine *s); |
67 | extern GSM_Error ATGEN_GetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time); | 67 | extern GSM_Error ATGEN_GetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time); |
68 | extern GSM_Error ATGEN_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry); | 68 | extern GSM_Error ATGEN_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry); |
69 | extern GSM_Error ATGEN_GetNextMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, bool start); | 69 | extern GSM_Error ATGEN_GetNextMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, bool start); |
70 | extern GSM_Error ATGEN_SetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry); | 70 | extern GSM_Error ATGEN_SetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry); |
71 | extern GSM_Error ATGEN_AddMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry); | 71 | extern GSM_Error ATGEN_AddMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry); |
72 | extern GSM_Error ATGEN_DeleteMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry); | 72 | extern GSM_Error ATGEN_DeleteMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry); |
73 | extern GSM_Error ATGEN_GetMemoryStatus (GSM_StateMachine *s, GSM_MemoryStatus *Status); | 73 | extern GSM_Error ATGEN_GetMemoryStatus (GSM_StateMachine *s, GSM_MemoryStatus *Status); |
74 | extern GSM_Error ATGEN_GetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc); | 74 | extern GSM_Error ATGEN_GetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc); |
75 | extern GSM_Error ATGEN_SetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc); | 75 | extern GSM_Error ATGEN_SetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc); |
76 | extern GSM_Error ATGEN_GetSMSFolders (GSM_StateMachine *s, GSM_SMSFolders *folders); | 76 | extern GSM_Error ATGEN_GetSMSFolders (GSM_StateMachine *s, GSM_SMSFolders *folders); |
77 | extern GSM_Error ATGEN_GetSMSStatus (GSM_StateMachine *s, GSM_SMSMemoryStatus *status); | 77 | extern GSM_Error ATGEN_GetSMSStatus (GSM_StateMachine *s, GSM_SMSMemoryStatus *status); |
78 | extern GSM_Error ATGEN_GetSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms); | 78 | extern GSM_Error ATGEN_GetSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms); |
79 | extern GSM_Error ATGEN_GetNextSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms, bool start); | 79 | extern GSM_Error ATGEN_GetNextSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms, bool start); |
80 | extern GSM_Error ATGEN_SendSavedSMS (GSM_StateMachine *s, int Folder, int Location); | 80 | extern GSM_Error ATGEN_SendSavedSMS (GSM_StateMachine *s, int Folder, int Location); |
81 | extern GSM_Error ATGEN_SendSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); | 81 | extern GSM_Error ATGEN_SendSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); |
82 | extern GSM_Error ATGEN_DeleteSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); | 82 | extern GSM_Error ATGEN_DeleteSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); |
83 | extern GSM_Error ATGEN_AddSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); | 83 | extern GSM_Error ATGEN_AddSMS (GSM_StateMachine *s, GSM_SMSMessage *sms); |
84 | extern GSM_Error ATGEN_GetBatteryCharge (GSM_StateMachine *s, GSM_BatteryCharge *bat); | 84 | extern GSM_Error ATGEN_GetBatteryCharge (GSM_StateMachine *s, GSM_BatteryCharge *bat); |
85 | extern GSM_Error ATGEN_GetSignalQuality (GSM_StateMachine *s, GSM_SignalQuality *sig); | 85 | extern GSM_Error ATGEN_GetSignalQuality (GSM_StateMachine *s, GSM_SignalQuality *sig); |
86 | extern GSM_Error ATGEN_DialVoice (GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber); | 86 | extern GSM_Error ATGEN_DialVoice (GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber); |
87 | extern GSM_Error ATGEN_AnswerCall (GSM_StateMachine *s, int ID, bool all); | 87 | extern GSM_Error ATGEN_AnswerCall (GSM_StateMachine *s, int ID, bool all); |
88 | extern GSM_Error ATGEN_CancelCall (GSM_StateMachine *s, int ID, bool all); | 88 | extern GSM_Error ATGEN_CancelCall (GSM_StateMachine *s, int ID, bool all); |
89 | extern GSM_Error ATGEN_SetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time); | 89 | extern GSM_Error ATGEN_SetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time); |
90 | extern GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code); | 90 | extern GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code); |
91 | extern GSM_Error ATGEN_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status); | 91 | extern GSM_Error ATGEN_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status); |
92 | extern GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type); | 92 | extern GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type); |
93 | extern GSM_Error ATGEN_SendDTMF (GSM_StateMachine *s, char *sequence); | 93 | extern GSM_Error ATGEN_SendDTMF (GSM_StateMachine *s, char *sequence); |
94 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); | 94 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); |
95 | extern GSM_Error ATGEN_HandleCMSError (GSM_StateMachine *s); | 95 | extern GSM_Error ATGEN_HandleCMSError (GSM_StateMachine *s); |
96 | extern GSM_Error ATGEN_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo); | 96 | extern GSM_Error ATGEN_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo); |
97 | extern GSM_Error ATGEN_Reset (GSM_StateMachine *s, bool hard); | 97 | extern GSM_Error ATGEN_Reset (GSM_StateMachine *s, bool hard); |
98 | extern GSM_Error ATGEN_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, bool Press); | 98 | extern GSM_Error ATGEN_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, bool Press); |
99 | extern GSM_Error ATGEN_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features); | 99 | extern GSM_Error ATGEN_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features); |
100 | extern GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s); | 100 | extern GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s); |
101 | extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type); | 101 | extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type); |
102 | 102 | ||
103 | extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s); | 103 | extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s); |
104 | extern GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable); | 104 | extern GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable); |
105 | extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable); | 105 | extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable); |
106 | extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable); | 106 | extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable); |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Alcatel uses some 8-bit characters in contacts, calendar etc.. This table | 109 | * Alcatel uses some 8-bit characters in contacts, calendar etc.. This table |
110 | * attempts to decode it, it is probably not complete, here are just chars | 110 | * attempts to decode it, it is probably not complete, here are just chars |
111 | * that I found... | 111 | * that I found... |
112 | */ | 112 | */ |
113 | unsigned char GSM_AlcatelAlphabet[] = | 113 | unsigned char GSM_AlcatelAlphabet[] = |
114 | { | 114 | { |
115 | /* in phone unicode description*/ | 115 | /* in phone unicode description*/ |
116 | 0x80, 0x00,0x20, /* empty */ | 116 | 0x80, 0x00,0x20, /* empty */ |
117 | 0x81, 0x00,0x20, /* empty*/ | 117 | 0x81, 0x00,0x20, /* empty*/ |
118 | 0x82, 0x00,0x20, /* empty*/ | 118 | 0x82, 0x00,0x20, /* empty*/ |
119 | 0x83, 0x00,0x20, /* empty*/ | 119 | 0x83, 0x00,0x20, /* empty*/ |
120 | 120 | ||
121 | 0x84, 0x00,0xe7, /* c cedilla*/ | 121 | 0x84, 0x00,0xe7, /* c cedilla*/ |
122 | 0x85, 0x20,0x26, /* ... */ | 122 | 0x85, 0x20,0x26, /* ... */ |
123 | 0x86, 0x03,0xc0, /* pi */ | 123 | 0x86, 0x03,0xc0, /* pi */ |
124 | 0x87, 0x01,0x3e, /* l caron*/ | 124 | 0x87, 0x01,0x3e, /* l caron*/ |
125 | 0x88, 0x00,0xc0, /* A grave*/ | 125 | 0x88, 0x00,0xc0, /* A grave*/ |
126 | 0x89, 0x00,0xc1, /* A acute*/ | 126 | 0x89, 0x00,0xc1, /* A acute*/ |
127 | 0x8a, 0x00,0xc2, /* A circumflex*/ | 127 | 0x8a, 0x00,0xc2, /* A circumflex*/ |
128 | 0x8b, 0x00,0xc3, /* A tilde*/ | 128 | 0x8b, 0x00,0xc3, /* A tilde*/ |
129 | 0x8c, 0x00,0xc8, /* E grave*/ | 129 | 0x8c, 0x00,0xc8, /* E grave*/ |
130 | 0x8d, 0x00,0xca, /* E circumflex*/ | 130 | 0x8d, 0x00,0xca, /* E circumflex*/ |
131 | 0x8e, 0x00,0xcb, /* E diaresis*/ | 131 | 0x8e, 0x00,0xcb, /* E diaresis*/ |
132 | 0x8f, 0x00,0xcc, /* I grave*/ | 132 | 0x8f, 0x00,0xcc, /* I grave*/ |
133 | 0x90, 0x00,0xcd, /* I acute*/ | 133 | 0x90, 0x00,0xcd, /* I acute*/ |
134 | 0x91, 0x00,0xd0, /* ETH */ | 134 | 0x91, 0x00,0xd0, /* ETH */ |
135 | 0x92, 0x00,0xd2, /* O grave*/ | 135 | 0x92, 0x00,0xd2, /* O grave*/ |
136 | 0x93, 0x00,0xd3, /* O acute*/ | 136 | 0x93, 0x00,0xd3, /* O acute*/ |
137 | 0x94, 0x00,0xd4, /* O circumflex*/ | 137 | 0x94, 0x00,0xd4, /* O circumflex*/ |
138 | 0x95, 0x00,0xd5, /* O tilde*/ | 138 | 0x95, 0x00,0xd5, /* O tilde*/ |
139 | 0x96, 0x00,0xd9, /* U grave*/ | 139 | 0x96, 0x00,0xd9, /* U grave*/ |
140 | 0x97, 0x00,0xda, /* U acute*/ | 140 | 0x97, 0x00,0xda, /* U acute*/ |
141 | 0x98, 0x00,0xe1, /* a acute*/ | 141 | 0x98, 0x00,0xe1, /* a acute*/ |
142 | 0x99, 0x00,0xe2, /* a circumflex*/ | 142 | 0x99, 0x00,0xe2, /* a circumflex*/ |
143 | 0x9a, 0x00,0xe3, /* a tilde*/ | 143 | 0x9a, 0x00,0xe3, /* a tilde*/ |
144 | 0x9b, 0x00,0xea, /* e circumflex*/ | 144 | 0x9b, 0x00,0xea, /* e circumflex*/ |
145 | 0x9c, 0x00,0xeb, /* e diaresis*/ | 145 | 0x9c, 0x00,0xeb, /* e diaresis*/ |
146 | 0x9d, 0x00,0xed, /* i acute*/ | 146 | 0x9d, 0x00,0xed, /* i acute*/ |
147 | 0x9e, 0x00,0xee, /* i circumflex*/ | 147 | 0x9e, 0x00,0xee, /* i circumflex*/ |
148 | 0x9f, 0x00,0xef, /* i diaresis*/ | 148 | 0x9f, 0x00,0xef, /* i diaresis*/ |
149 | 0xa0, 0x00,0xf3, /* o acute*/ | 149 | 0xa0, 0x00,0xf3, /* o acute*/ |
150 | 0xa1, 0x00,0xf4, /* o circumflex*/ | 150 | 0xa1, 0x00,0xf4, /* o circumflex*/ |
151 | 0xa2, 0x00,0xf5, /* o tilde*/ | 151 | 0xa2, 0x00,0xf5, /* o tilde*/ |
152 | 0xa3, 0x00,0xfa, /* u acute*/ | 152 | 0xa3, 0x00,0xfa, /* u acute*/ |
153 | 0xa4, 0x00,0xa2, /* cent */ | 153 | 0xa4, 0x00,0xa2, /* cent */ |
154 | 0xa5, 0x00,0x5b, /* [ */ | 154 | 0xa5, 0x00,0x5b, /* [ */ |
155 | 0xa6, 0x01,0x59, /* r caron*/ | 155 | 0xa6, 0x01,0x59, /* r caron*/ |
diff --git a/gammu/emb/gammu/depend/nokia/dct3.c b/gammu/emb/gammu/depend/nokia/dct3.c index b9e47ea..bda7532 100644 --- a/gammu/emb/gammu/depend/nokia/dct3.c +++ b/gammu/emb/gammu/depend/nokia/dct3.c | |||
@@ -1,114 +1,114 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | /* MSID by Walek */ | 2 | /* MSID by Walek */ |
3 | 3 | ||
4 | #include "../../../common/gsmstate.h" | 4 | #include "../../../common/gsmstate.h" |
5 | 5 | ||
6 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 6 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7 | 7 | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | #include <signal.h> | 9 | #include <signal.h> |
10 | 10 | ||
11 | #include "../../../common/misc/coding/coding.h" | 11 | #include "../../../common/misc/coding/coding.h" |
12 | #include "../../../common/gsmcomon.h" | 12 | #include "../../../common/gsmcomon.h" |
13 | #include "../../../common/service/gsmpbk.h" | 13 | #include "../../../common/service/gsmpbk.h" |
14 | #include "../../../common/phone/nokia/dct3/dct3func.h" | 14 | #include "../../../common/phone/nokia/dct3/dct3func.h" |
15 | #include "../../../common/phone/pfunc.h" | 15 | #include "../../../common/phone/pfunc.h" |
16 | #include "../../gammu.h" | 16 | #include "../../gammu.h" |
17 | 17 | ||
18 | extern GSM_Reply_Function UserReplyFunctions3[]; | 18 | static GSM_Reply_Function UserReplyFunctions3[]; |
19 | 19 | ||
20 | /* ------- some usefull functions ----------------------------------------- */ | 20 | /* ------- some usefull functions ----------------------------------------- */ |
21 | 21 | ||
22 | GSM_Error CheckDCT3Only() | 22 | GSM_Error CheckDCT3Only() |
23 | { | 23 | { |
24 | bool found = false; | 24 | bool found = false; |
25 | 25 | ||
26 | /* Checking if phone is DCT3 */ | 26 | /* Checking if phone is DCT3 */ |
27 | #ifdef GSM_ENABLE_NOKIA6110 | 27 | #ifdef GSM_ENABLE_NOKIA6110 |
28 | if (strstr(N6110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | 28 | if (strstr(N6110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; |
29 | #endif | 29 | #endif |
30 | #ifdef GSM_ENABLE_NOKIA7110 | 30 | #ifdef GSM_ENABLE_NOKIA7110 |
31 | if (strstr(N7110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | 31 | if (strstr(N7110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; |
32 | #endif | 32 | #endif |
33 | #ifdef GSM_ENABLE_NOKIA9210 | 33 | #ifdef GSM_ENABLE_NOKIA9210 |
34 | if (strstr(N9210Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | 34 | if (strstr(N9210Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; |
35 | #endif | 35 | #endif |
36 | if (!found) return ERR_NOTSUPPORTED; | 36 | if (!found) return ERR_NOTSUPPORTED; |
37 | 37 | ||
38 | if (s.ConnectionType!=GCT_MBUS2 && s.ConnectionType!=GCT_FBUS2 && | 38 | if (s.ConnectionType!=GCT_MBUS2 && s.ConnectionType!=GCT_FBUS2 && |
39 | s.ConnectionType!=GCT_FBUS2DLR3 && s.ConnectionType!=GCT_FBUS2BLUE && | 39 | s.ConnectionType!=GCT_FBUS2DLR3 && s.ConnectionType!=GCT_FBUS2BLUE && |
40 | s.ConnectionType!=GCT_FBUS2IRDA && s.ConnectionType!=GCT_IRDAPHONET && | 40 | s.ConnectionType!=GCT_FBUS2IRDA && s.ConnectionType!=GCT_IRDAPHONET && |
41 | s.ConnectionType!=GCT_BLUEFBUS2) { | 41 | s.ConnectionType!=GCT_BLUEFBUS2) { |
42 | return ERR_OTHERCONNECTIONREQUIRED; | 42 | return ERR_OTHERCONNECTIONREQUIRED; |
43 | } | 43 | } |
44 | return ERR_NONE; | 44 | return ERR_NONE; |
45 | } | 45 | } |
46 | 46 | ||
47 | static void CheckDCT3() | 47 | static void CheckDCT3() |
48 | { | 48 | { |
49 | GSM_Error error; | 49 | GSM_Error error; |
50 | 50 | ||
51 | error = CheckDCT3Only(); | 51 | error = CheckDCT3Only(); |
52 | switch (error) { | 52 | switch (error) { |
53 | case ERR_NOTSUPPORTED: | 53 | case ERR_NOTSUPPORTED: |
54 | Print_Error(ERR_NOTSUPPORTED); | 54 | Print_Error(ERR_NOTSUPPORTED); |
55 | break; | 55 | break; |
56 | case ERR_OTHERCONNECTIONREQUIRED: | 56 | case ERR_OTHERCONNECTIONREQUIRED: |
57 | printf("Can't do it with current phone protocol\n"); | 57 | printf("Can't do it with current phone protocol\n"); |
58 | GSM_TerminateConnection(&s); | 58 | GSM_TerminateConnection(&s); |
59 | exit(-1); | 59 | exit(-1); |
60 | default: | 60 | default: |
61 | break; | 61 | break; |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | static bool answer_yes3(char *text) | 65 | static bool answer_yes3(char *text) |
66 | { | 66 | { |
67 | int len; | 67 | int len; |
68 | char ans[99]; | 68 | char ans[99]; |
69 | 69 | ||
70 | while (1) { | 70 | while (1) { |
71 | printf("%s (yes/no) ? ",text); | 71 | printf("%s (yes/no) ? ",text); |
72 | len=GetLine(stdin, ans, 99); | 72 | len=GetLine(stdin, ans, 99); |
73 | if (len==-1) exit(-1); | 73 | if (len==-1) exit(-1); |
74 | if (mystrncasecmp(ans, "yes",0)) return true; | 74 | if (mystrncasecmp(ans, "yes",0)) return true; |
75 | if (mystrncasecmp(ans, "no" ,0)) return false; | 75 | if (mystrncasecmp(ans, "no" ,0)) return false; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | /* ------------------- functions ------------------------------------------- */ | 79 | /* ------------------- functions ------------------------------------------- */ |
80 | 80 | ||
81 | static FILE *DCT3T9File; | 81 | static FILE *DCT3T9File; |
82 | 82 | ||
83 | static GSM_Error DCT3_ReplyGetT9(GSM_Protocol_Message msg, GSM_StateMachine *s) | 83 | static GSM_Error DCT3_ReplyGetT9(GSM_Protocol_Message msg, GSM_StateMachine *s) |
84 | { | 84 | { |
85 | int DCT3T9Size; | 85 | int DCT3T9Size; |
86 | 86 | ||
87 | DCT3T9Size = msg.Length - 6; | 87 | DCT3T9Size = msg.Length - 6; |
88 | fwrite(msg.Buffer+6,1,DCT3T9Size,DCT3T9File); | 88 | fwrite(msg.Buffer+6,1,DCT3T9Size,DCT3T9File); |
89 | return ERR_NONE; | 89 | return ERR_NONE; |
90 | } | 90 | } |
91 | 91 | ||
92 | void DCT3GetT9(int argc, char *argv[]) | 92 | void DCT3GetT9(int argc, char *argv[]) |
93 | { | 93 | { |
94 | int i; | 94 | int i; |
95 | unsigned char req[] = {0x00, 0x01, 0xAE, 0x02, 0x00, | 95 | unsigned char req[] = {0x00, 0x01, 0xAE, 0x02, 0x00, |
96 | 0x00};/* Part number */ | 96 | 0x00};/* Part number */ |
97 | 97 | ||
98 | //"00 01 AE 00" gets some control values | 98 | //"00 01 AE 00" gets some control values |
99 | 99 | ||
100 | if (CheckDCT3Only()!=ERR_NONE) return; | 100 | if (CheckDCT3Only()!=ERR_NONE) return; |
101 | 101 | ||
102 | DCT3T9File = fopen("T9", "w"); | 102 | DCT3T9File = fopen("T9", "w"); |
103 | if (DCT3T9File == NULL) return; | 103 | if (DCT3T9File == NULL) return; |
104 | 104 | ||
105 | s.User.UserReplyFunctions=UserReplyFunctions3; | 105 | s.User.UserReplyFunctions=UserReplyFunctions3; |
106 | 106 | ||
107 | for (i=0;i<5;i++) { | 107 | for (i=0;i<5;i++) { |
108 | req[5] = i; | 108 | req[5] = i; |
109 | error=GSM_WaitFor (&s, req, 6, 0x40, 4, ID_User3); | 109 | error=GSM_WaitFor (&s, req, 6, 0x40, 4, ID_User3); |
110 | Print_Error(error); | 110 | Print_Error(error); |
111 | } | 111 | } |
112 | 112 | ||
113 | fclose(DCT3T9File); | 113 | fclose(DCT3T9File); |
114 | } | 114 | } |
diff --git a/gammu/emb/gammu/depend/nokia/dct3trac/wmx.c b/gammu/emb/gammu/depend/nokia/dct3trac/wmx.c index 64eda37..e46d9dd 100644 --- a/gammu/emb/gammu/depend/nokia/dct3trac/wmx.c +++ b/gammu/emb/gammu/depend/nokia/dct3trac/wmx.c | |||
@@ -1,127 +1,127 @@ | |||
1 | /** | 1 | /** |
2 | * Nokia DCT3 Firmware Debug Trace Monitor | 2 | * Nokia DCT3 Firmware Debug Trace Monitor |
3 | * wumpus 2003 -- www.blacksphere.tk | 3 | * wumpus 2003 -- www.blacksphere.tk |
4 | * SIM stuff by The Monty | 4 | * SIM stuff by The Monty |
5 | * | 5 | * |
6 | * Command line arguments: | 6 | * Command line arguments: |
7 | * gammu --nokiadebug v00-0F,20,21 | 7 | * gammu --nokiadebug v00-0F,20,21 |
8 | * (v=verbose) | 8 | * (v=verbose) |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include "../../../../common/gsmstate.h" | 11 | #include "../../../../common/gsmstate.h" |
12 | 12 | ||
13 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 13 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
14 | 14 | ||
15 | #include <string.h> | 15 | #include <string.h> |
16 | #include <signal.h> | 16 | #include <signal.h> |
17 | 17 | ||
18 | #include "../../../../common/misc/coding/coding.h" | 18 | #include "../../../../common/misc/coding/coding.h" |
19 | #include "../../../../common/gsmcomon.h" | 19 | #include "../../../../common/gsmcomon.h" |
20 | #include "../../../../common/gsmstate.h" | 20 | #include "../../../../common/gsmstate.h" |
21 | #include "../../../../common/service/gsmpbk.h" | 21 | #include "../../../../common/service/gsmpbk.h" |
22 | #include "../../../../common/phone/nokia/dct3/dct3func.h" | 22 | #include "../../../../common/phone/nokia/dct3/dct3func.h" |
23 | #include "../../../gammu.h" | 23 | #include "../../../gammu.h" |
24 | #include "../dct3.h" | 24 | #include "../dct3.h" |
25 | #include "wmx.h" | 25 | #include "wmx.h" |
26 | #include "wmx-util.h" | 26 | #include "wmx-util.h" |
27 | #include "wmx-gsm.h" | 27 | #include "wmx-gsm.h" |
28 | #include "wmx-sim.h" | 28 | #include "wmx-sim.h" |
29 | #include "wmx-list.h" | 29 | #include "wmx-list.h" |
30 | 30 | ||
31 | extern GSM_Reply_Function UserReplyFunctionsX[]; | 31 | static GSM_Reply_Function UserReplyFunctionsX[]; |
32 | 32 | ||
33 | /* Global variables suck */ | 33 | /* Global variables suck */ |
34 | GSMDecoder *gsmdec; | 34 | GSMDecoder *gsmdec; |
35 | struct wmx_tracestruct *traces; | 35 | struct wmx_tracestruct *traces; |
36 | 36 | ||
37 | static GSM_Error DCT3_ReplySwitchDebug(GSM_Protocol_Message msg, GSM_StateMachine *s) | 37 | static GSM_Error DCT3_ReplySwitchDebug(GSM_Protocol_Message msg, GSM_StateMachine *s) |
38 | { | 38 | { |
39 | switch(msg.Buffer[2]) { | 39 | switch(msg.Buffer[2]) { |
40 | case 0x70: | 40 | case 0x70: |
41 | printf("Debug Trace Enabled\n"); | 41 | printf("Debug Trace Enabled\n"); |
42 | break; | 42 | break; |
43 | case 0x71: | 43 | case 0x71: |
44 | printf("Debug Trace Disabled\n"); | 44 | printf("Debug Trace Disabled\n"); |
45 | break; | 45 | break; |
46 | } | 46 | } |
47 | return ERR_NONE; | 47 | return ERR_NONE; |
48 | } | 48 | } |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * RPC confirmation/reply | 51 | * RPC confirmation/reply |
52 | */ | 52 | */ |
53 | static GSM_Error DCT3_ReplyRPC(GSM_Protocol_Message msg, GSM_StateMachine *s) | 53 | static GSM_Error DCT3_ReplyRPC(GSM_Protocol_Message msg, GSM_StateMachine *s) |
54 | { | 54 | { |
55 | printf("RPC Reply "); | 55 | printf("RPC Reply "); |
56 | printf("call=%02x rettype=%02x data=", msg.Buffer[2], msg.Buffer[3]); | 56 | printf("call=%02x rettype=%02x data=", msg.Buffer[2], msg.Buffer[3]); |
57 | if(msg.Buffer[3] == 3) { | 57 | if(msg.Buffer[3] == 3) { |
58 | /* string */ | 58 | /* string */ |
59 | printf("%s", &msg.Buffer[4]); | 59 | printf("%s", &msg.Buffer[4]); |
60 | } else { | 60 | } else { |
61 | dumpraw("RPC Reply data", &msg.Buffer[4], msg.Length-4); | 61 | dumpraw("RPC Reply data", &msg.Buffer[4], msg.Length-4); |
62 | } | 62 | } |
63 | printf("\n"); | 63 | printf("\n"); |
64 | return ERR_NONE; | 64 | return ERR_NONE; |
65 | } | 65 | } |
66 | 66 | ||
67 | /* disassemble mdisnd (0x18xx) packet */ | 67 | /* disassemble mdisnd (0x18xx) packet */ |
68 | static void mdisnd_data(unsigned char type, unsigned char *buffer, size_t length) | 68 | static void mdisnd_data(unsigned char type, unsigned char *buffer, size_t length) |
69 | { | 69 | { |
70 | GSMDecoder_l1l2data dat; | 70 | GSMDecoder_l1l2data dat; |
71 | size_t x; | 71 | size_t x; |
72 | int ch; | 72 | int ch; |
73 | 73 | ||
74 | if(type==0x1B && length>2) { | 74 | if(type==0x1B && length>2) { |
75 | /* channel packet */ | 75 | /* channel packet */ |
76 | ch = buffer[1]; | 76 | ch = buffer[1]; |
77 | dat.tx = GSMDECODER_SEND; | 77 | dat.tx = GSMDECODER_SEND; |
78 | dat.ch = ch; | 78 | dat.ch = ch; |
79 | printf("%02X ch=%02X ",buffer[0],ch); | 79 | printf("%02X ch=%02X ",buffer[0],ch); |
80 | if (ch == 0x80 || ch == 0xB0) { | 80 | if (ch == 0x80 || ch == 0xB0) { |
81 | printf("\n"); | 81 | printf("\n"); |
82 | GSMDecoder_L2packet(gsmdec, &dat, &buffer[2], length-2); | 82 | GSMDecoder_L2packet(gsmdec, &dat, &buffer[2], length-2); |
83 | } else if (ch == 0x70) { | 83 | } else if (ch == 0x70) { |
84 | dumpraw("MDI send ch70 prefix", &buffer[2], 2); | 84 | dumpraw("MDI send ch70 prefix", &buffer[2], 2); |
85 | printf("\n"); | 85 | printf("\n"); |
86 | GSMDecoder_L2packet(gsmdec, &dat, &buffer[4], length-4); | 86 | GSMDecoder_L2packet(gsmdec, &dat, &buffer[4], length-4); |
87 | } else { | 87 | } else { |
88 | dumpraw("MDI recv 1B packet", &buffer[2], length-2); | 88 | dumpraw("MDI recv 1B packet", &buffer[2], length-2); |
89 | } | 89 | } |
90 | } else { | 90 | } else { |
91 | /* hex */ | 91 | /* hex */ |
92 | for(x=0; x<length; x++) { | 92 | for(x=0; x<length; x++) { |
93 | printf("%02x ",buffer[x]&0xFF); | 93 | printf("%02x ",buffer[x]&0xFF); |
94 | } | 94 | } |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | /* disassemble mdircv (0x19xx) packet */ | 98 | /* disassemble mdircv (0x19xx) packet */ |
99 | static void mdircv_data(unsigned char type, unsigned char *buffer, size_t length) | 99 | static void mdircv_data(unsigned char type, unsigned char *buffer, size_t length) |
100 | { | 100 | { |
101 | size_t x; | 101 | size_t x; |
102 | int ch; | 102 | int ch; |
103 | GSMDecoder_l1l2data dat; | 103 | GSMDecoder_l1l2data dat; |
104 | 104 | ||
105 | if (type==0x80 && length>1) { | 105 | if (type==0x80 && length>1) { |
106 | // buffer[0] channel | 106 | // buffer[0] channel |
107 | // buffer[1] flag1 | 107 | // buffer[1] flag1 |
108 | // buffer[2] flag2 | 108 | // buffer[2] flag2 |
109 | // buffer[3..5] timestamp | 109 | // buffer[3..5] timestamp |
110 | // buffer[6..7] unknown_hw1 | 110 | // buffer[6..7] unknown_hw1 |
111 | // buffer[8..9] unknown_hw2 | 111 | // buffer[8..9] unknown_hw2 |
112 | ch = buffer[0]; | 112 | ch = buffer[0]; |
113 | dat.tx = GSMDECODER_RECEIVE; | 113 | dat.tx = GSMDECODER_RECEIVE; |
114 | dat.ch = ch; | 114 | dat.ch = ch; |
115 | dat.bsic = buffer[1]; | 115 | dat.bsic = buffer[1]; |
116 | dat.err = buffer[2]; | 116 | dat.err = buffer[2]; |
117 | dat.seq = (buffer[3]<<16)|(buffer[4]<<8)|(buffer[5]); | 117 | dat.seq = (buffer[3]<<16)|(buffer[4]<<8)|(buffer[5]); |
118 | dat.arfcn = (buffer[6]<<8)|buffer[7]; | 118 | dat.arfcn = (buffer[6]<<8)|buffer[7]; |
119 | dat.timeshift = (buffer[8]<<8)|buffer[9]; | 119 | dat.timeshift = (buffer[8]<<8)|buffer[9]; |
120 | 120 | ||
121 | printf("ch=%02X bsic=%i err=%i t=%06X arfcn=%i shift=%i", | 121 | printf("ch=%02X bsic=%i err=%i t=%06X arfcn=%i shift=%i", |
122 | ch, buffer[1], buffer[2], | 122 | ch, buffer[1], buffer[2], |
123 | dat.seq, dat.arfcn, dat.timeshift | 123 | dat.seq, dat.arfcn, dat.timeshift |
124 | ); | 124 | ); |
125 | 125 | ||
126 | //dumpraw("MDI recv 80 header", &buffer[6], 4); | 126 | //dumpraw("MDI recv 80 header", &buffer[6], 4); |
127 | printf(" "); | 127 | printf(" "); |
diff --git a/gammu/emb/gammu/depend/nokia/dct4.c b/gammu/emb/gammu/depend/nokia/dct4.c index 4bf958d..43d8f09 100644 --- a/gammu/emb/gammu/depend/nokia/dct4.c +++ b/gammu/emb/gammu/depend/nokia/dct4.c | |||
@@ -1,112 +1,112 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #include "../../../common/gsmstate.h" | 3 | #include "../../../common/gsmstate.h" |
4 | 4 | ||
5 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 5 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
6 | 6 | ||
7 | #include <string.h> | 7 | #include <string.h> |
8 | 8 | ||
9 | #include "dct4.h" | 9 | #include "dct4.h" |
10 | #include "../../gammu.h" | 10 | #include "../../gammu.h" |
11 | #include "../../../common/phone/pfunc.h" | 11 | #include "../../../common/phone/pfunc.h" |
12 | #include "../../../common/phone/nokia/nfunc.h" | 12 | #include "../../../common/phone/nokia/nfunc.h" |
13 | #include "../../../common/phone/nokia/dct4/dct4func.h" | 13 | #include "../../../common/phone/nokia/dct4/dct4func.h" |
14 | #include "../../../common/misc/coding/coding.h" | 14 | #include "../../../common/misc/coding/coding.h" |
15 | 15 | ||
16 | extern GSM_Reply_Function UserReplyFunctions4[]; | 16 | static GSM_Reply_Function UserReplyFunctions4[]; |
17 | 17 | ||
18 | /* ------- some usefull functions ----------------------------------------- */ | 18 | /* ------- some usefull functions ----------------------------------------- */ |
19 | 19 | ||
20 | GSM_Error CheckDCT4Only() | 20 | GSM_Error CheckDCT4Only() |
21 | { | 21 | { |
22 | bool found = false; | 22 | bool found = false; |
23 | 23 | ||
24 | /* Checking if phone is DCT4 */ | 24 | /* Checking if phone is DCT4 */ |
25 | #ifdef GSM_ENABLE_NOKIA3650 | 25 | #ifdef GSM_ENABLE_NOKIA3650 |
26 | if (strstr(N3650Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | 26 | if (strstr(N3650Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; |
27 | #endif | 27 | #endif |
28 | #ifdef GSM_ENABLE_NOKIA6510 | 28 | #ifdef GSM_ENABLE_NOKIA6510 |
29 | if (strstr(N6510Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | 29 | if (strstr(N6510Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; |
30 | #endif | 30 | #endif |
31 | #ifdef GSM_ENABLE_NOKIA3320 | 31 | #ifdef GSM_ENABLE_NOKIA3320 |
32 | if (strstr(N3320Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; | 32 | if (strstr(N3320Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; |
33 | #endif | 33 | #endif |
34 | if (!found) return ERR_NOTSUPPORTED; | 34 | if (!found) return ERR_NOTSUPPORTED; |
35 | 35 | ||
36 | if (s.ConnectionType!=GCT_MBUS2 && s.ConnectionType!=GCT_FBUS2 && | 36 | if (s.ConnectionType!=GCT_MBUS2 && s.ConnectionType!=GCT_FBUS2 && |
37 | s.ConnectionType!=GCT_FBUS2DLR3 && s.ConnectionType!=GCT_PHONETBLUE && | 37 | s.ConnectionType!=GCT_FBUS2DLR3 && s.ConnectionType!=GCT_PHONETBLUE && |
38 | s.ConnectionType!=GCT_IRDAPHONET && s.ConnectionType!=GCT_BLUEPHONET && | 38 | s.ConnectionType!=GCT_IRDAPHONET && s.ConnectionType!=GCT_BLUEPHONET && |
39 | s.ConnectionType!=GCT_FBUS2DKU5) { | 39 | s.ConnectionType!=GCT_FBUS2DKU5) { |
40 | return ERR_OTHERCONNECTIONREQUIRED; | 40 | return ERR_OTHERCONNECTIONREQUIRED; |
41 | } | 41 | } |
42 | return ERR_NONE; | 42 | return ERR_NONE; |
43 | } | 43 | } |
44 | 44 | ||
45 | static void CheckDCT4() | 45 | static void CheckDCT4() |
46 | { | 46 | { |
47 | GSM_Error error; | 47 | GSM_Error error; |
48 | 48 | ||
49 | error = CheckDCT4Only(); | 49 | error = CheckDCT4Only(); |
50 | switch (error) { | 50 | switch (error) { |
51 | case ERR_NOTSUPPORTED: | 51 | case ERR_NOTSUPPORTED: |
52 | Print_Error(ERR_NOTSUPPORTED); | 52 | Print_Error(ERR_NOTSUPPORTED); |
53 | break; | 53 | break; |
54 | case ERR_OTHERCONNECTIONREQUIRED: | 54 | case ERR_OTHERCONNECTIONREQUIRED: |
55 | printf("Can't do it with current phone protocol\n"); | 55 | printf("Can't do it with current phone protocol\n"); |
56 | GSM_TerminateConnection(&s); | 56 | GSM_TerminateConnection(&s); |
57 | exit(-1); | 57 | exit(-1); |
58 | default: | 58 | default: |
59 | break; | 59 | break; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
63 | static bool answer_yes2(char *text) | 63 | static bool answer_yes2(char *text) |
64 | { | 64 | { |
65 | int len; | 65 | int len; |
66 | char ans[99]; | 66 | char ans[99]; |
67 | 67 | ||
68 | while (1) { | 68 | while (1) { |
69 | printf("%s (yes/no) ? ",text); | 69 | printf("%s (yes/no) ? ",text); |
70 | len=GetLine(stdin, ans, 99); | 70 | len=GetLine(stdin, ans, 99); |
71 | if (len==-1) exit(-1); | 71 | if (len==-1) exit(-1); |
72 | if (mystrncasecmp(ans, "yes",0)) return true; | 72 | if (mystrncasecmp(ans, "yes",0)) return true; |
73 | if (mystrncasecmp(ans, "no" ,0)) return false; | 73 | if (mystrncasecmp(ans, "no" ,0)) return false; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | /* ------------------- functions ------------------------------------------- */ | 77 | /* ------------------- functions ------------------------------------------- */ |
78 | 78 | ||
79 | static DCT4_Feature DCT4Features[] = { | 79 | static DCT4_Feature DCT4Features[] = { |
80 | {DCT4_ALWAYS_ONLINE, "GPRS Always Online", {{0,"on (Context)"},{1,"off (Attach)"},{0,""}}},///?? | 80 | {DCT4_ALWAYS_ONLINE, "GPRS Always Online", {{0,"on (Context)"},{1,"off (Attach)"},{0,""}}},///?? |
81 | {DCT4_GPRS_PCCH, "PCCH support for GPRS", {{1,"on"},{0,"off"},{0,""}}}, | 81 | {DCT4_GPRS_PCCH, "PCCH support for GPRS", {{1,"on"},{0,"off"},{0,""}}}, |
82 | {DCT4_GEA1, "GEA1 support indication", {{1,"on"},{0,"off"},{0,""}}}, | 82 | {DCT4_GEA1, "GEA1 support indication", {{1,"on"},{0,"off"},{0,""}}}, |
83 | {DCT4_EOTD, "EOTD support", {{1,"on"},{0,"off"},{0,""}}}, | 83 | {DCT4_EOTD, "EOTD support", {{1,"on"},{0,"off"},{0,""}}}, |
84 | {DCT4_WAP_PUSH, "WAP push", {{1,"on"},{0,"off"},{0,""}}}, | 84 | {DCT4_WAP_PUSH, "WAP push", {{1,"on"},{0,"off"},{0,""}}}, |
85 | {DCT4_USE_PREF_SIM_NET, "Use SIM preffered network list",{{1,"on"},{0,"off"},{0,""}}}, | 85 | {DCT4_USE_PREF_SIM_NET, "Use SIM preffered network list",{{1,"on"},{0,"off"},{0,""}}}, |
86 | {DCT4_JAVA_TCK, "Java TCK support", {{1,"on"},{0,"off"},{0,""}}}, | 86 | {DCT4_JAVA_TCK, "Java TCK support", {{1,"on"},{0,"off"},{0,""}}}, |
87 | 87 | ||
88 | {DCT4_ALS, "Alternate Line Service (ALS)", {{1,"on"},{0,"off"},{0,""}}}, | 88 | {DCT4_ALS, "Alternate Line Service (ALS)", {{1,"on"},{0,"off"},{0,""}}}, |
89 | {DCT4_A52, "Ciphering alghoritm A52", {{1,"on"},{0,"off"},{0,""}}}, | 89 | {DCT4_A52, "Ciphering alghoritm A52", {{1,"on"},{0,"off"},{0,""}}}, |
90 | {DCT4_CSP, "Customer Service Profile", {{0,"off"},{1,"on"},{0,""}}}, | 90 | {DCT4_CSP, "Customer Service Profile", {{0,"off"},{1,"on"},{0,""}}}, |
91 | {DCT4_EONS, "EONS support", {{1,"on"},{0,"off"},{0,""}}}, | 91 | {DCT4_EONS, "EONS support", {{1,"on"},{0,"off"},{0,""}}}, |
92 | {DCT4_3GINDICATOR, "3G indicator", {{1,"on"},{0,"off"},{0,""}}}, | 92 | {DCT4_3GINDICATOR, "3G indicator", {{1,"on"},{0,"off"},{0,""}}}, |
93 | {DCT4_DISPLAY_PHONE_NAME, "Display both number and name for incoming calls",{{1,"on"},{0,"off"},{0,""}}}, | 93 | {DCT4_DISPLAY_PHONE_NAME, "Display both number and name for incoming calls",{{1,"on"},{0,"off"},{0,""}}}, |
94 | {DCT4_DISPLAY_WAP_PROFILE, "Display selected WAP profile name instead of Home option menu in Services",{{1,"on"},{0,"off"},{0,""}}}, | 94 | {DCT4_DISPLAY_WAP_PROFILE, "Display selected WAP profile name instead of Home option menu in Services",{{1,"on"},{0,"off"},{0,""}}}, |
95 | 95 | ||
96 | {DCT4_GAMES_WAP_DOWNLOAD, "Games WAP download", {{1,"on"},{0,"off"},{0,""}}}, | 96 | {DCT4_GAMES_WAP_DOWNLOAD, "Games WAP download", {{1,"on"},{0,"off"},{0,""}}}, |
97 | {DCT4_GAMES_SCORE_SEND, "Games WAP score send", {{1,"on"},{0,"off"},{0,""}}}, | 97 | {DCT4_GAMES_SCORE_SEND, "Games WAP score send", {{1,"on"},{0,"off"},{0,""}}}, |
98 | {DCT4_GAMES_URL_CHECK, "Games URL check", {{1,"on"},{0,"off"},{0,""}}}, | 98 | {DCT4_GAMES_URL_CHECK, "Games URL check", {{1,"on"},{0,"off"},{0,""}}}, |
99 | 99 | ||
100 | {DCT4_BLUETOOTH_MENU, "Bluetooth menu", {{1,"on"},{0,"off"},{0,""}}}, | 100 | {DCT4_BLUETOOTH_MENU, "Bluetooth menu", {{1,"on"},{0,"off"},{0,""}}}, |
101 | {DCT4_WAP_BOOKMARKS_MENU, "Bookmarks menu in Services", {{1,"on"},{0,"off"},{0,""}}}, | 101 | {DCT4_WAP_BOOKMARKS_MENU, "Bookmarks menu in Services", {{1,"on"},{0,"off"},{0,""}}}, |
102 | {DCT4_WAP_BOOKMARKS_MENU2, "Bookmarks menu in Services", {{3,"bookmarks & download"},{0,"off"},{0,""}}}, | 102 | {DCT4_WAP_BOOKMARKS_MENU2, "Bookmarks menu in Services", {{3,"bookmarks & download"},{0,"off"},{0,""}}}, |
103 | {DCT4_WAP_GOTO_MENU, "GoTo menu in Services", {{0,"on"},{1,"off"},{0,""}}}, | 103 | {DCT4_WAP_GOTO_MENU, "GoTo menu in Services", {{0,"on"},{1,"off"},{0,""}}}, |
104 | {DCT4_WAP_SETTINGS_MENU, "Profiles menu in Services", {{0,"on"},{1,"off"},{0,""}}}, | 104 | {DCT4_WAP_SETTINGS_MENU, "Profiles menu in Services", {{0,"on"},{1,"off"},{0,""}}}, |
105 | {DCT4_SERVICES_GAMES_APP_GALLERY,"Services menu in Games/Apps/Gallery",{{1,"on"},{0,"off"},{0,""}}}, | 105 | {DCT4_SERVICES_GAMES_APP_GALLERY,"Services menu in Games/Apps/Gallery",{{1,"on"},{0,"off"},{0,""}}}, |
106 | {DCT4_JAVA_GAMES_MENU, "Java games menu in Games", {{1,"on"},{0,"off"},{0,""}}}, | 106 | {DCT4_JAVA_GAMES_MENU, "Java games menu in Games", {{1,"on"},{0,"off"},{0,""}}}, |
107 | {DCT4_SAT_CONFIRM_MENU, "Can use confirming SIM service actions", {{1,"on"},{0,"off"},{0,""}}}, | 107 | {DCT4_SAT_CONFIRM_MENU, "Can use confirming SIM service actions", {{1,"on"},{0,"off"},{0,""}}}, |
108 | {DCT4_INSTANT_MESS_MENU, "Instant Messaging in Messages",{{1,"on"},{0,"off"},{0,""}}}, | 108 | {DCT4_INSTANT_MESS_MENU, "Instant Messaging in Messages",{{1,"on"},{0,"off"},{0,""}}}, |
109 | {DCT4_CONFIRM_ALS, "Confirm using ALS", {{1,"on"},{0,"off"},{0,""}}}, | 109 | {DCT4_CONFIRM_ALS, "Confirm using ALS", {{1,"on"},{0,"off"},{0,""}}}, |
110 | {DCT4_BOOKMARK_GOTO_MENU, "Bookmarks in GoTo menu", {{1,"on"},{0,"off"},{0,""}}}, | 110 | {DCT4_BOOKMARK_GOTO_MENU, "Bookmarks in GoTo menu", {{1,"on"},{0,"off"},{0,""}}}, |
111 | 111 | ||
112 | {DCT4_5100_IDENTIFY, "Phone identification", {{1,"NPM-6U"},{0,"NPM-6"},{0,""}}}, | 112 | {DCT4_5100_IDENTIFY, "Phone identification", {{1,"NPM-6U"},{0,"NPM-6"},{0,""}}}, |
diff --git a/gammu/emb/gammu/depend/siemens/dsiemens.c b/gammu/emb/gammu/depend/siemens/dsiemens.c index dc54102..a34bc3b 100644 --- a/gammu/emb/gammu/depend/siemens/dsiemens.c +++ b/gammu/emb/gammu/depend/siemens/dsiemens.c | |||
@@ -1,116 +1,116 @@ | |||
1 | /* (c) by Walek */ | 1 | /* (c) by Walek */ |
2 | 2 | ||
3 | #include "../../../common/gsmstate.h" | 3 | #include "../../../common/gsmstate.h" |
4 | 4 | ||
5 | #ifdef GSM_ENABLE_ATGEN | 5 | #ifdef GSM_ENABLE_ATGEN |
6 | 6 | ||
7 | #include <string.h> | 7 | #include <string.h> |
8 | 8 | ||
9 | #include "../../../common/misc/coding/coding.h" | 9 | #include "../../../common/misc/coding/coding.h" |
10 | #include "../../../common/gsmcomon.h" | 10 | #include "../../../common/gsmcomon.h" |
11 | #include "../../../common/service/gsmnet.h" | 11 | #include "../../../common/service/gsmnet.h" |
12 | #include "../../../common/phone/at/atgen.h" | 12 | #include "../../../common/phone/at/atgen.h" |
13 | #include "../../gammu.h" | 13 | #include "../../gammu.h" |
14 | #include "dsiemens.h" | 14 | #include "dsiemens.h" |
15 | #include "chiffre.h" | 15 | #include "chiffre.h" |
16 | 16 | ||
17 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); | 17 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); |
18 | extern GSM_Error ATGEN_GetMemoryStatus (GSM_StateMachine *s, GSM_MemoryStatus *status); | 18 | extern GSM_Error ATGEN_GetMemoryStatus (GSM_StateMachine *s, GSM_MemoryStatus *status); |
19 | extern GSM_Error ATGEN_SetMemory (GSM_StateMachine *s, GSM_MemoryEntry *pbk); | 19 | extern GSM_Error ATGEN_SetMemory (GSM_StateMachine *s, GSM_MemoryEntry *pbk); |
20 | extern GSM_Reply_Function UserReplyFunctionsAtS[]; | 20 | static GSM_Reply_Function UserReplyFunctionsAtS[]; |
21 | 21 | ||
22 | bool new_variable; | 22 | bool new_variable; |
23 | GSM_Error CheckSiemens() | 23 | GSM_Error CheckSiemens() |
24 | { | 24 | { |
25 | if (s.Phone.Data.Priv.ATGEN.Manufacturer != AT_Siemens) return ERR_NOTSUPPORTED; | 25 | if (s.Phone.Data.Priv.ATGEN.Manufacturer != AT_Siemens) return ERR_NOTSUPPORTED; |
26 | return ERR_NONE; | 26 | return ERR_NONE; |
27 | } | 27 | } |
28 | 28 | ||
29 | GSM_Error ATSIEMENS_Reply_GetSAT(GSM_Protocol_Message msg, GSM_StateMachine *s) | 29 | GSM_Error ATSIEMENS_Reply_GetSAT(GSM_Protocol_Message msg, GSM_StateMachine *s) |
30 | { | 30 | { |
31 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 31 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
32 | GSM_SAT_Measure_results MeasureResult; | 32 | GSM_SAT_Measure_results MeasureResult; |
33 | unsigned char buf[256]; | 33 | unsigned char buf[256]; |
34 | int length,i,rep,ChNo=1,j=0,result=0,origARFCN=0; | 34 | int length,i,rep,ChNo=1,j=0,result=0,origARFCN=0; |
35 | int freq_tmp,frequency[24]; | 35 | int freq_tmp,frequency[24]; |
36 | GSM_NetworkInfo Network; | 36 | GSM_NetworkInfo Network; |
37 | 37 | ||
38 | if (Priv->ReplyState!=AT_Reply_OK) return ERR_UNKNOWN; | 38 | if (Priv->ReplyState!=AT_Reply_OK) return ERR_UNKNOWN; |
39 | if (s->Protocol.Data.AT.EditMode) s->Protocol.Data.AT.EditMode = false; | 39 | if (s->Protocol.Data.AT.EditMode) s->Protocol.Data.AT.EditMode = false; |
40 | if (strstr(GetLineString(msg.Buffer,Priv->Lines,2),"SSTK")) { | 40 | if (strstr(GetLineString(msg.Buffer,Priv->Lines,2),"SSTK")) { |
41 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,2))-7; | 41 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,2))-7; |
42 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,2)+7,length); | 42 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,2)+7,length); |
43 | if (buf[0]==0x7f) { | 43 | if (buf[0]==0x7f) { |
44 | new_variable=true; | 44 | new_variable=true; |
45 | return ERR_NONE; | 45 | return ERR_NONE; |
46 | } | 46 | } |
47 | else return ERR_UNKNOWN; | 47 | else return ERR_UNKNOWN; |
48 | } | 48 | } |
49 | if (!strstr(GetLineString(msg.Buffer,Priv->Lines,3),"SSTK")) return ERR_UNKNOWN; | 49 | if (!strstr(GetLineString(msg.Buffer,Priv->Lines,3),"SSTK")) return ERR_UNKNOWN; |
50 | 50 | ||
51 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,3))-7; | 51 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,3))-7; |
52 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,3)+7,length); | 52 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,3)+7,length); |
53 | 53 | ||
54 | if (buf[3]!=0x26) return ERR_UNKNOWN; | 54 | if (buf[3]!=0x26) return ERR_UNKNOWN; |
55 | 55 | ||
56 | #ifdef DEBUG | 56 | #ifdef DEBUG |
57 | dbgprintf ("SAT command: Provide Local Information\nFunction: "); | 57 | dbgprintf ("SAT command: Provide Local Information\nFunction: "); |
58 | switch (buf[4]) { | 58 | switch (buf[4]) { |
59 | case 00: dbgprintf ("Loc Info\n"); break; | 59 | case 00: dbgprintf ("Loc Info\n"); break; |
60 | case 01: dbgprintf ("IMEI\n"); break; | 60 | case 01: dbgprintf ("IMEI\n"); break; |
61 | case 02: dbgprintf ("Network Measure\n"); break; | 61 | case 02: dbgprintf ("Network Measure\n"); break; |
62 | case 03: dbgprintf ("Date time and timezone\n");break; | 62 | case 03: dbgprintf ("Date time and timezone\n");break; |
63 | case 04: dbgprintf ("Language setting\n"); break; | 63 | case 04: dbgprintf ("Language setting\n"); break; |
64 | case 05: dbgprintf ("Timing advance\n"); break; | 64 | case 05: dbgprintf ("Timing advance\n"); break; |
65 | } | 65 | } |
66 | #endif | 66 | #endif |
67 | /* Loc Info (MCC, MNC, LAC, Cell ID) */ | 67 | /* Loc Info (MCC, MNC, LAC, Cell ID) */ |
68 | if (buf[4]==00) { | 68 | if (buf[4]==00) { |
69 | DecodeBCD (Network.NetworkCode,buf+14,2); | 69 | DecodeBCD (Network.NetworkCode,buf+14,2); |
70 | Network.NetworkCode[3] = ' '; | 70 | Network.NetworkCode[3] = ' '; |
71 | DecodeBCD (Network.NetworkCode+4,buf+16,1); | 71 | DecodeBCD (Network.NetworkCode+4,buf+16,1); |
72 | EncodeHexBin (Network.LAC,buf+17,2); | 72 | EncodeHexBin (Network.LAC,buf+17,2); |
73 | EncodeHexBin (Network.CID,buf+19,2); | 73 | EncodeHexBin (Network.CID,buf+19,2); |
74 | 74 | ||
75 | printf(" Network code : %s\n",Network.NetworkCode); | 75 | printf(" Network code : %s\n",Network.NetworkCode); |
76 | printf(" Network name for Gammu : %s\n", | 76 | printf(" Network name for Gammu : %s\n", |
77 | DecodeUnicodeString(GSM_GetNetworkName(Network.NetworkCode))); | 77 | DecodeUnicodeString(GSM_GetNetworkName(Network.NetworkCode))); |
78 | printf(" CID : %s\n",Network.CID); | 78 | printf(" CID : %s\n",Network.CID); |
79 | printf(" LAC : %s\n",Network.LAC); | 79 | printf(" LAC : %s\n",Network.LAC); |
80 | } | 80 | } |
81 | 81 | ||
82 | /* Network Measure */ | 82 | /* Network Measure */ |
83 | if (buf[4]==02) { | 83 | if (buf[4]==02) { |
84 | 84 | ||
85 | for (i=0;i<24;i++) frequency[i]=0; | 85 | for (i=0;i<24;i++) frequency[i]=0; |
86 | if (!new_variable) { | 86 | if (!new_variable) { |
87 | GetBufferI(buf+32,&j,&result,7); | 87 | GetBufferI(buf+32,&j,&result,7); |
88 | result &= 0x67; | 88 | result &= 0x67; |
89 | if (result !=0x47) return ERR_NOTSUPPORTED; | 89 | if (result !=0x47) return ERR_NOTSUPPORTED; |
90 | } | 90 | } |
91 | #ifdef DEBUG | 91 | #ifdef DEBUG |
92 | if (new_variable)dbgprintf ("New variable Bitmap format\n"); | 92 | if (new_variable)dbgprintf ("New variable Bitmap format\n"); |
93 | else dbgprintf ("Old variable Bitmap format\n"); | 93 | else dbgprintf ("Old variable Bitmap format\n"); |
94 | #endif | 94 | #endif |
95 | GetBufferI(buf+32,&j,&origARFCN,10); | 95 | GetBufferI(buf+32,&j,&origARFCN,10); |
96 | /* 10 bit origin ARFCN or first frequency (new variable format) */ | 96 | /* 10 bit origin ARFCN or first frequency (new variable format) */ |
97 | #ifdef DEBUG | 97 | #ifdef DEBUG |
98 | dbgprintf("Origin BCCH = %i\n",origARFCN); | 98 | dbgprintf("Origin BCCH = %i\n",origARFCN); |
99 | #endif | 99 | #endif |
100 | rep = buf[31]*8; | 100 | rep = buf[31]*8; |
101 | if (!new_variable ){ | 101 | if (!new_variable ){ |
102 | for (i=0;i<rep;i++){ | 102 | for (i=0;i<rep;i++){ |
103 | result = 0; | 103 | result = 0; |
104 | GetBufferI(buf+32,&j,&result,1); | 104 | GetBufferI(buf+32,&j,&result,1); |
105 | if (result) { | 105 | if (result) { |
106 | frequency[ChNo]=i+origARFCN+1; | 106 | frequency[ChNo]=i+origARFCN+1; |
107 | ChNo++; | 107 | ChNo++; |
108 | } | 108 | } |
109 | } | 109 | } |
110 | } | 110 | } |
111 | else { | 111 | else { |
112 | frequency[ChNo++]=origARFCN; | 112 | frequency[ChNo++]=origARFCN; |
113 | for (i=0; i<rep; i+=10){ | 113 | for (i=0; i<rep; i+=10){ |
114 | result = 0; | 114 | result = 0; |
115 | GetBufferI(buf+32,&j,&result,10); | 115 | GetBufferI(buf+32,&j,&result,10); |
116 | if (!result) break; | 116 | if (!result) break; |