-rw-r--r-- | gammu/emb/common/gsmstate.c | 74 |
1 files changed, 53 insertions, 21 deletions
diff --git a/gammu/emb/common/gsmstate.c b/gammu/emb/common/gsmstate.c index b8f5f89..31e365d 100644 --- a/gammu/emb/common/gsmstate.c +++ b/gammu/emb/common/gsmstate.c | |||
@@ -141,172 +141,172 @@ static void GSM_RegisterModule(GSM_StateMachine *s,GSM_Phone_Functions *phone) | |||
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | GSM_Error GSM_RegisterAllPhoneModules(GSM_StateMachine *s) | 145 | GSM_Error GSM_RegisterAllPhoneModules(GSM_StateMachine *s) |
146 | { | 146 | { |
147 | OnePhoneModel *model; | 147 | OnePhoneModel *model; |
148 | 148 | ||
149 | /* Auto model */ | 149 | /* Auto model */ |
150 | if (s->CurrentConfig->Model[0] == 0) { | 150 | if (s->CurrentConfig->Model[0] == 0) { |
151 | model = GetModelData(NULL,s->Phone.Data.Model,NULL); | 151 | model = GetModelData(NULL,s->Phone.Data.Model,NULL); |
152 | #ifdef GSM_ENABLE_ALCATEL | 152 | #ifdef GSM_ENABLE_ALCATEL |
153 | if (model->model[0] != 0 && IsPhoneFeatureAvailable(model, F_ALCATEL)) { | 153 | if (model->model[0] != 0 && IsPhoneFeatureAvailable(model, F_ALCATEL)) { |
154 | smprintf(s,"[Module - \"%s\"]\n",ALCATELPhone.models); | 154 | smprintf(s,"[Module - \"%s\"]\n",ALCATELPhone.models); |
155 | s->Phone.Functions = &ALCATELPhone; | 155 | s->Phone.Functions = &ALCATELPhone; |
156 | return ERR_NONE; | 156 | return ERR_NONE; |
157 | } | 157 | } |
158 | #endif | 158 | #endif |
159 | #ifdef GSM_ENABLE_ATGEN | 159 | #ifdef GSM_ENABLE_ATGEN |
160 | /* With ATgen and auto model we can work with unknown models too */ | 160 | /* With ATgen and auto model we can work with unknown models too */ |
161 | if (s->ConnectionType==GCT_AT || s->ConnectionType==GCT_BLUEAT || s->ConnectionType==GCT_IRDAAT) { | 161 | if (s->ConnectionType==GCT_AT || s->ConnectionType==GCT_BLUEAT || s->ConnectionType==GCT_IRDAAT) { |
162 | smprintf(s,"[Module - \"%s\"]\n",ATGENPhone.models); | 162 | smprintf(s,"[Module - \"%s\"]\n",ATGENPhone.models); |
163 | s->Phone.Functions = &ATGENPhone; | 163 | s->Phone.Functions = &ATGENPhone; |
164 | return ERR_NONE; | 164 | return ERR_NONE; |
165 | } | 165 | } |
166 | #endif | 166 | #endif |
167 | if (model->model[0] == 0) return ERR_UNKNOWNMODELSTRING; | 167 | if (model->model[0] == 0) return ERR_UNKNOWNMODELSTRING; |
168 | } | 168 | } |
169 | s->Phone.Functions=NULL; | 169 | s->Phone.Functions=NULL; |
170 | #ifdef GSM_ENABLE_ATGEN | 170 | #ifdef GSM_ENABLE_ATGEN |
171 | /* AT module can have the same models ID to "normal" Nokia modules */ | 171 | /* AT module can have the same models ID to "normal" Nokia modules */ |
172 | if (s->ConnectionType==GCT_AT || s->ConnectionType==GCT_BLUEAT || s->ConnectionType==GCT_IRDAAT) { | 172 | if (s->ConnectionType==GCT_AT || s->ConnectionType==GCT_BLUEAT || s->ConnectionType==GCT_IRDAAT) { |
173 | GSM_RegisterModule(s,&ATGENPhone); | 173 | GSM_RegisterModule(s,&ATGENPhone); |
174 | if (s->Phone.Functions!=NULL) return ERR_NONE; | 174 | if (s->Phone.Functions!=NULL) return ERR_NONE; |
175 | } | 175 | } |
176 | #endif | 176 | #endif |
177 | #ifdef GSM_ENABLE_OBEXGEN | 177 | #ifdef GSM_ENABLE_OBEXGEN |
178 | GSM_RegisterModule(s,&OBEXGENPhone); | 178 | GSM_RegisterModule(s,&OBEXGENPhone); |
179 | #endif | 179 | #endif |
180 | #ifdef GSM_ENABLE_MROUTERGEN | 180 | #ifdef GSM_ENABLE_MROUTERGEN |
181 | GSM_RegisterModule(s,&MROUTERGENPhone); | 181 | GSM_RegisterModule(s,&MROUTERGENPhone); |
182 | #endif | 182 | #endif |
183 | #ifdef GSM_ENABLE_NOKIA3320 | 183 | #ifdef GSM_ENABLE_NOKIA3320 |
184 | GSM_RegisterModule(s,&N3320Phone); | 184 | GSM_RegisterModule(s,&N3320Phone); |
185 | #endif | 185 | #endif |
186 | #ifdef GSM_ENABLE_NOKIA3650 | 186 | #ifdef GSM_ENABLE_NOKIA3650 |
187 | GSM_RegisterModule(s,&N3650Phone); | 187 | GSM_RegisterModule(s,&N3650Phone); |
188 | #endif | 188 | #endif |
189 | #ifdef GSM_ENABLE_NOKIA650 | ||
190 | GSM_RegisterModule(s,&N650Phone); | ||
191 | #endif | ||
189 | #ifdef GSM_ENABLE_NOKIA6110 | 192 | #ifdef GSM_ENABLE_NOKIA6110 |
190 | GSM_RegisterModule(s,&N6110Phone); | 193 | GSM_RegisterModule(s,&N6110Phone); |
191 | #endif | 194 | #endif |
192 | #ifdef GSM_ENABLE_NOKIA6510 | 195 | #ifdef GSM_ENABLE_NOKIA6510 |
193 | GSM_RegisterModule(s,&N6510Phone); | 196 | GSM_RegisterModule(s,&N6510Phone); |
194 | #endif | 197 | #endif |
195 | #ifdef GSM_ENABLE_NOKIA7110 | 198 | #ifdef GSM_ENABLE_NOKIA7110 |
196 | GSM_RegisterModule(s,&N7110Phone); | 199 | GSM_RegisterModule(s,&N7110Phone); |
197 | #endif | 200 | #endif |
198 | #ifdef GSM_ENABLE_NOKIA9210 | 201 | #ifdef GSM_ENABLE_NOKIA9210 |
199 | GSM_RegisterModule(s,&N9210Phone); | 202 | GSM_RegisterModule(s,&N9210Phone); |
200 | #endif | 203 | #endif |
201 | #ifdef GSM_ENABLE_ALCATEL | 204 | #ifdef GSM_ENABLE_ALCATEL |
202 | GSM_RegisterModule(s,&ALCATELPhone); | 205 | GSM_RegisterModule(s,&ALCATELPhone); |
203 | #endif | 206 | #endif |
204 | if (s->Phone.Functions==NULL) return ERR_UNKNOWNMODELSTRING; | 207 | if (s->Phone.Functions==NULL) return ERR_UNKNOWNMODELSTRING; |
205 | return ERR_NONE; | 208 | return ERR_NONE; |
206 | } | 209 | } |
207 | 210 | ||
208 | GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum) | 211 | GSM_Error GSM_InitConnection(GSM_StateMachine *s, int ReplyNum) |
209 | { | 212 | { |
210 | GSM_Errorerror; | 213 | GSM_Errorerror; |
211 | GSM_DateTimetime; | 214 | GSM_DateTimetime; |
212 | int i; | 215 | int i; |
213 | char Buffer[80]; | ||
214 | 216 | ||
215 | for (i=0;i<s->ConfigNum;i++) { | 217 | for (i=0;i<s->ConfigNum;i++) { |
216 | s->CurrentConfig = &s->Config[i]; | 218 | s->CurrentConfig = &s->Config[i]; |
217 | 219 | ||
218 | s->Speed = 0; | 220 | s->Speed = 0; |
219 | s->ReplyNum = ReplyNum; | 221 | s->ReplyNum = ReplyNum; |
220 | s->Phone.Data.ModelInfo = GetModelData("unknown",NULL,NULL); | 222 | s->Phone.Data.ModelInfo = GetModelData("unknown",NULL,NULL); |
221 | s->Phone.Data.Manufacturer[0] = 0; | 223 | s->Phone.Data.Manufacturer[0] = 0; |
222 | s->Phone.Data.Model[0] = 0; | 224 | s->Phone.Data.Model[0] = 0; |
223 | s->Phone.Data.Version[0] = 0; | 225 | s->Phone.Data.Version[0] = 0; |
224 | s->Phone.Data.VerDate[0] = 0; | 226 | s->Phone.Data.VerDate[0] = 0; |
225 | s->Phone.Data.VerNum = 0; | 227 | s->Phone.Data.VerNum = 0; |
226 | s->Phone.Data.StartInfoCounter = 0; | 228 | s->Phone.Data.StartInfoCounter = 0; |
227 | s->Phone.Data.SentMsg = NULL; | 229 | s->Phone.Data.SentMsg = NULL; |
228 | 230 | ||
229 | s->Phone.Data.HardwareCache[0] = 0; | 231 | s->Phone.Data.HardwareCache[0] = 0; |
230 | s->Phone.Data.ProductCodeCache[0] = 0; | 232 | s->Phone.Data.ProductCodeCache[0] = 0; |
231 | s->Phone.Data.EnableIncomingCall = false; | 233 | s->Phone.Data.EnableIncomingCall = false; |
232 | s->Phone.Data.EnableIncomingSMS = false; | 234 | s->Phone.Data.EnableIncomingSMS = false; |
233 | s->Phone.Data.EnableIncomingCB = false; | 235 | s->Phone.Data.EnableIncomingCB = false; |
234 | s->Phone.Data.EnableIncomingUSSD = false; | 236 | s->Phone.Data.EnableIncomingUSSD = false; |
235 | s->User.UserReplyFunctions = NULL; | 237 | s->User.UserReplyFunctions = NULL; |
236 | s->User.IncomingCall = NULL; | 238 | s->User.IncomingCall = NULL; |
237 | s->User.IncomingSMS = NULL; | 239 | s->User.IncomingSMS = NULL; |
238 | s->User.IncomingCB = NULL; | 240 | s->User.IncomingCB = NULL; |
239 | s->User.IncomingUSSD = NULL; | 241 | s->User.IncomingUSSD = NULL; |
240 | s->User.SendSMSStatus = NULL; | 242 | s->User.SendSMSStatus = NULL; |
241 | s->LockFile = NULL; | 243 | s->LockFile = NULL; |
242 | s->opened = false; | 244 | s->opened = false; |
243 | s->Phone.Functions = NULL; | 245 | s->Phone.Functions = NULL; |
244 | 246 | ||
245 | s->di = di; | 247 | s->di = di; |
246 | s->di.use_global = s->CurrentConfig->UseGlobalDebugFile; | 248 | s->di.use_global = s->CurrentConfig->UseGlobalDebugFile; |
247 | GSM_SetDebugLevel(s->CurrentConfig->DebugLevel, &s->di); | 249 | GSM_SetDebugLevel(s->CurrentConfig->DebugLevel, &s->di); |
248 | error=GSM_SetDebugFile(s->CurrentConfig->DebugFile, &s->di); | 250 | error=GSM_SetDebugFile(s->CurrentConfig->DebugFile, &s->di); |
249 | if (error != ERR_NONE) return error; | 251 | if (error != ERR_NONE) return error; |
250 | 252 | ||
251 | if (s->di.dl == DL_TEXTALL || s->di.dl == DL_TEXT || s->di.dl == DL_TEXTERROR || | 253 | if (s->di.dl == DL_TEXTALL || s->di.dl == DL_TEXT || s->di.dl == DL_TEXTERROR || |
252 | s->di.dl == DL_TEXTALLDATE || s->di.dl == DL_TEXTDATE || s->di.dl == DL_TEXTERRORDATE) { | 254 | s->di.dl == DL_TEXTALLDATE || s->di.dl == DL_TEXTDATE || s->di.dl == DL_TEXTERRORDATE) { |
253 | smprintf(s,"[Gammu - version %s built %s %s]\n",VERSION,__TIME__,__DATE__); | 255 | smprintf(s,"[Gammu - %s built %s %s",VERSION,__TIME__,__DATE__); |
254 | smprintf(s,"[Connection - \"%s\"]\n",s->CurrentConfig->Connection); | 256 | if (strlen(GetCompiler()) != 0) { |
257 | smprintf(s," in %s",GetCompiler()); | ||
258 | } | ||
259 | smprintf(s,"]\n[Connection - \"%s\"]\n",s->CurrentConfig->Connection); | ||
255 | smprintf(s,"[Model type - \"%s\"]\n",s->CurrentConfig->Model); | 260 | smprintf(s,"[Model type - \"%s\"]\n",s->CurrentConfig->Model); |
256 | smprintf(s,"[Device - \"%s\"]\n",s->CurrentConfig->Device); | 261 | smprintf(s,"[Device - \"%s\"]\n",s->CurrentConfig->Device); |
257 | 262 | if (strlen(GetOS()) != 0) { | |
258 | Buffer[0] = 0; | 263 | smprintf(s,"[Run on - %s]\n",GetOS()); |
259 | if (strlen(GetOS()) != 0) sprintf(Buffer,"%s",GetOS()); | ||
260 | if (strlen(GetCompiler()) != 0) { | ||
261 | if (Buffer[0] != 0) strcat(Buffer+strlen(Buffer),", "); | ||
262 | strcat(Buffer+strlen(Buffer),GetCompiler()); | ||
263 | } | 264 | } |
264 | if (Buffer[0] != 0) smprintf(s,"[OS/compiler - %s]\n",Buffer); | ||
265 | } | 265 | } |
266 | if (s->di.dl==DL_BINARY) { | 266 | if (s->di.dl==DL_BINARY) { |
267 | smprintf(s,"%c",((unsigned char)strlen(VERSION))); | 267 | smprintf(s,"%c",((unsigned char)strlen(VERSION))); |
268 | smprintf(s,"%s",VERSION); | 268 | smprintf(s,"%s",VERSION); |
269 | } | 269 | } |
270 | 270 | ||
271 | error=GSM_RegisterAllConnections(s, s->CurrentConfig->Connection); | 271 | error=GSM_RegisterAllConnections(s, s->CurrentConfig->Connection); |
272 | if (error!=ERR_NONE) return error; | 272 | if (error!=ERR_NONE) return error; |
273 | 273 | ||
274 | /* Model auto */ | 274 | /* Model auto */ |
275 | if (s->CurrentConfig->Model[0]==0) { | 275 | if (s->CurrentConfig->Model[0]==0) { |
276 | if (mystrncasecmp(s->CurrentConfig->LockDevice,"yes",0)) { | 276 | if (mystrncasecmp(s->CurrentConfig->LockDevice,"yes",0)) { |
277 | error = lock_device(s->CurrentConfig->Device, &(s->LockFile)); | 277 | error = lock_device(s->CurrentConfig->Device, &(s->LockFile)); |
278 | if (error != ERR_NONE) return error; | 278 | if (error != ERR_NONE) return error; |
279 | } | 279 | } |
280 | 280 | ||
281 | /* Irda devices can set now model to some specific and | 281 | /* Irda devices can set now model to some specific and |
282 | * we don't have to make auto detection later */ | 282 | * we don't have to make auto detection later */ |
283 | error=s->Device.Functions->OpenDevice(s); | 283 | error=s->Device.Functions->OpenDevice(s); |
284 | if (i != s->ConfigNum - 1) { | 284 | if (i != s->ConfigNum - 1) { |
285 | if (error == ERR_DEVICEOPENERROR) continue; | 285 | if (error == ERR_DEVICEOPENERROR) continue; |
286 | if (error == ERR_DEVICELOCKED) continue; | 286 | if (error == ERR_DEVICELOCKED) continue; |
287 | if (error == ERR_DEVICENOTEXIST) continue; | 287 | if (error == ERR_DEVICENOTEXIST) continue; |
288 | if (error == ERR_DEVICEBUSY) continue; | 288 | if (error == ERR_DEVICEBUSY) continue; |
289 | if (error == ERR_DEVICENOPERMISSION) continue; | 289 | if (error == ERR_DEVICENOPERMISSION) continue; |
290 | if (error == ERR_DEVICENODRIVER) continue; | 290 | if (error == ERR_DEVICENODRIVER) continue; |
291 | if (error == ERR_DEVICENOTWORK) continue; | 291 | if (error == ERR_DEVICENOTWORK) continue; |
292 | } | 292 | } |
293 | if (error!=ERR_NONE) { | 293 | if (error!=ERR_NONE) { |
294 | if (s->LockFile!=NULL) unlock_device(&(s->LockFile)); | 294 | if (s->LockFile!=NULL) unlock_device(&(s->LockFile)); |
295 | return error; | 295 | return error; |
296 | } | 296 | } |
297 | 297 | ||
298 | s->opened = true; | 298 | s->opened = true; |
299 | 299 | ||
300 | error=s->Protocol.Functions->Initialise(s); | 300 | error=s->Protocol.Functions->Initialise(s); |
301 | if (error!=ERR_NONE) return error; | 301 | if (error!=ERR_NONE) return error; |
302 | 302 | ||
303 | /* If still auto model, try to get model by asking phone for it */ | 303 | /* If still auto model, try to get model by asking phone for it */ |
304 | if (s->Phone.Data.Model[0]==0) { | 304 | if (s->Phone.Data.Model[0]==0) { |
305 | smprintf(s,"[Module - \"auto\"]\n"); | 305 | smprintf(s,"[Module - \"auto\"]\n"); |
306 | switch (s->ConnectionType) { | 306 | switch (s->ConnectionType) { |
307 | #ifdef GSM_ENABLE_ATGEN | 307 | #ifdef GSM_ENABLE_ATGEN |
308 | case GCT_AT: | 308 | case GCT_AT: |
309 | case GCT_BLUEAT: | 309 | case GCT_BLUEAT: |
310 | case GCT_IRDAAT: | 310 | case GCT_IRDAAT: |
311 | s->Phone.Functions = &ATGENPhone; | 311 | s->Phone.Functions = &ATGENPhone; |
312 | break; | 312 | break; |
@@ -509,112 +509,123 @@ GSM_Error GSM_WaitForOnce(GSM_StateMachine *s, unsigned char *buffer, | |||
509 | } while (i<time); | 509 | } while (i<time); |
510 | 510 | ||
511 | return ERR_TIMEOUT; | 511 | return ERR_TIMEOUT; |
512 | } | 512 | } |
513 | 513 | ||
514 | GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer, | 514 | GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer, |
515 | int length, unsigned char type, int time, | 515 | int length, unsigned char type, int time, |
516 | GSM_Phone_RequestID request) | 516 | GSM_Phone_RequestID request) |
517 | { | 517 | { |
518 | GSM_Phone_Data *Phone = &s->Phone.Data; | 518 | GSM_Phone_Data *Phone = &s->Phone.Data; |
519 | GSM_Error error; | 519 | GSM_Error error; |
520 | int reply; | 520 | int reply; |
521 | 521 | ||
522 | if (mystrncasecmp(s->CurrentConfig->StartInfo,"yes",0)) { | 522 | if (mystrncasecmp(s->CurrentConfig->StartInfo,"yes",0)) { |
523 | if (Phone->StartInfoCounter > 0) { | 523 | if (Phone->StartInfoCounter > 0) { |
524 | Phone->StartInfoCounter--; | 524 | Phone->StartInfoCounter--; |
525 | if (Phone->StartInfoCounter == 0) s->Phone.Functions->ShowStartInfo(s,false); | 525 | if (Phone->StartInfoCounter == 0) s->Phone.Functions->ShowStartInfo(s,false); |
526 | } | 526 | } |
527 | } | 527 | } |
528 | 528 | ||
529 | Phone->RequestID= request; | 529 | Phone->RequestID= request; |
530 | Phone->DispatchError= ERR_TIMEOUT; | 530 | Phone->DispatchError= ERR_TIMEOUT; |
531 | 531 | ||
532 | for (reply=0;reply<s->ReplyNum;reply++) { | 532 | for (reply=0;reply<s->ReplyNum;reply++) { |
533 | if (reply!=0) { | 533 | if (reply!=0) { |
534 | if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl == DL_TEXTERROR || | 534 | if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl == DL_TEXTERROR || |
535 | s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl == DL_TEXTERRORDATE) | 535 | s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl == DL_TEXTERRORDATE) |
536 | { | 536 | { |
537 | smprintf(s, "[Retrying %i type 0x%02X]\n", reply, type); | 537 | smprintf(s, "[Retrying %i type 0x%02X]\n", reply, type); |
538 | } | 538 | } |
539 | } | 539 | } |
540 | error = s->Protocol.Functions->WriteMessage(s, buffer, length, type); | 540 | error = s->Protocol.Functions->WriteMessage(s, buffer, length, type); |
541 | if (error!=ERR_NONE) return error; | 541 | if (error!=ERR_NONE) return error; |
542 | 542 | ||
543 | error = GSM_WaitForOnce(s, buffer, length, type, time); | 543 | error = GSM_WaitForOnce(s, buffer, length, type, time); |
544 | if (error != ERR_TIMEOUT) return error; | 544 | if (error != ERR_TIMEOUT) return error; |
545 | } | 545 | } |
546 | 546 | ||
547 | return Phone->DispatchError; | 547 | return Phone->DispatchError; |
548 | } | 548 | } |
549 | 549 | ||
550 | static GSM_Error CheckReplyFunctions(GSM_StateMachine *s, GSM_Reply_Function *Reply, int *reply) | 550 | static GSM_Error CheckReplyFunctions(GSM_StateMachine *s, GSM_Reply_Function *Reply, int *reply) |
551 | { | 551 | { |
552 | GSM_Phone_Data *Data = &s->Phone.Data; | 552 | GSM_Phone_Data *Data = &s->Phone.Data; |
553 | GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg; | 553 | GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg; |
554 | bool execute; | 554 | bool execute; |
555 | bool available = false; | 555 | bool available = false; |
556 | int i = 0; | 556 | int i = 0; |
557 | //int j; | ||
557 | 558 | ||
558 | while (Reply[i].requestID!=ID_None) { | 559 | while (Reply[i].requestID!=ID_None) { |
559 | execute=false; | 560 | execute=false; |
560 | /* Binary frames like in Nokia */ | 561 | /* Binary frames like in Nokia */ |
561 | if (strlen(Reply[i].msgtype) < 2) { | 562 | if (strlen(Reply[i].msgtype) < 2) { |
562 | if (Reply[i].msgtype[0]==msg->Type) { | 563 | if (Reply[i].msgtype[0]==msg->Type) { |
563 | if (Reply[i].subtypechar!=0) { | 564 | if (Reply[i].subtypechar!=0) { |
564 | if (Reply[i].subtypechar<=msg->Length) { | 565 | if (Reply[i].subtypechar<=msg->Length) { |
565 | if (msg->Buffer[Reply[i].subtypechar]==Reply[i].subtype) | 566 | if (msg->Buffer[Reply[i].subtypechar]==Reply[i].subtype) |
566 | execute=true; | 567 | execute=true; |
567 | } | 568 | } |
568 | } else execute=true; | 569 | } else execute=true; |
569 | } | 570 | } |
570 | } else { | 571 | } else { |
571 | if (strncmp(Reply[i].msgtype,msg->Buffer,strlen(Reply[i].msgtype))==0) { | 572 | // printf("msg length %i %i\n",strlen(Reply[i].msgtype),msg->Length); |
572 | execute=true; | 573 | if ((int)strlen(Reply[i].msgtype)<msg->Length) { |
574 | // printf("Comparing \"%s\" and \"",Reply[i].msgtype); | ||
575 | // for (j=0;j<strlen(Reply[i].msgtype);j++) { | ||
576 | // if (msg->Buffer[j]!=13 && msg->Buffer[j]!=10) { | ||
577 | // printf("%c",msg->Buffer[j]); | ||
578 | // } | ||
579 | // } | ||
580 | // printf("\"\n"); | ||
581 | if (strncmp(Reply[i].msgtype,msg->Buffer,strlen(Reply[i].msgtype))==0) { | ||
582 | execute=true; | ||
583 | } | ||
573 | } | 584 | } |
574 | } | 585 | } |
575 | 586 | ||
576 | if (execute) { | 587 | if (execute) { |
577 | *reply=i; | 588 | *reply=i; |
578 | if (Reply[i].requestID == ID_IncomingFrame || | 589 | if (Reply[i].requestID == ID_IncomingFrame || |
579 | Reply[i].requestID == Data->RequestID || | 590 | Reply[i].requestID == Data->RequestID || |
580 | Data->RequestID== ID_EachFrame) { | 591 | Data->RequestID== ID_EachFrame) { |
581 | return ERR_NONE; | 592 | return ERR_NONE; |
582 | } | 593 | } |
583 | available=true; | 594 | available=true; |
584 | } | 595 | } |
585 | i++; | 596 | i++; |
586 | } | 597 | } |
587 | 598 | ||
588 | if (available) { | 599 | if (available) { |
589 | return ERR_FRAMENOTREQUESTED; | 600 | return ERR_FRAMENOTREQUESTED; |
590 | } else { | 601 | } else { |
591 | return ERR_UNKNOWNFRAME; | 602 | return ERR_UNKNOWNFRAME; |
592 | } | 603 | } |
593 | } | 604 | } |
594 | 605 | ||
595 | GSM_Error GSM_DispatchMessage(GSM_StateMachine *s) | 606 | GSM_Error GSM_DispatchMessage(GSM_StateMachine *s) |
596 | { | 607 | { |
597 | GSM_Error error= ERR_UNKNOWNFRAME; | 608 | GSM_Error error= ERR_UNKNOWNFRAME; |
598 | GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg; | 609 | GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg; |
599 | GSM_Phone_Data *Phone= &s->Phone.Data; | 610 | GSM_Phone_Data *Phone= &s->Phone.Data; |
600 | bool disp = false; | 611 | bool disp = false; |
601 | GSM_Reply_Function*Reply; | 612 | GSM_Reply_Function*Reply; |
602 | int reply, i; | 613 | int reply, i; |
603 | 614 | ||
604 | if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || | 615 | if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || |
605 | s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) { | 616 | s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) { |
606 | smprintf(s, "RECEIVED frame "); | 617 | smprintf(s, "RECEIVED frame "); |
607 | smprintf(s, "type 0x%02X/length 0x%02X/%i", msg->Type, msg->Length, msg->Length); | 618 | smprintf(s, "type 0x%02X/length 0x%02X/%i", msg->Type, msg->Length, msg->Length); |
608 | DumpMessage(s->di.use_global ? di.df : s->di.df, s->di.dl, msg->Buffer, msg->Length); | 619 | DumpMessage(s->di.use_global ? di.df : s->di.df, s->di.dl, msg->Buffer, msg->Length); |
609 | if (msg->Length == 0) smprintf(s, "\n"); | 620 | if (msg->Length == 0) smprintf(s, "\n"); |
610 | fflush(s->di.df); | 621 | fflush(s->di.df); |
611 | } | 622 | } |
612 | if (s->di.dl==DL_BINARY) { | 623 | if (s->di.dl==DL_BINARY) { |
613 | smprintf(s,"%c",0x02);/* Receiving */ | 624 | smprintf(s,"%c",0x02);/* Receiving */ |
614 | smprintf(s,"%c",msg->Type); | 625 | smprintf(s,"%c",msg->Type); |
615 | smprintf(s,"%c",msg->Length/256); | 626 | smprintf(s,"%c",msg->Length/256); |
616 | smprintf(s,"%c",msg->Length%256); | 627 | smprintf(s,"%c",msg->Length%256); |
617 | for (i=0;i<msg->Length;i++) { | 628 | for (i=0;i<msg->Length;i++) { |
618 | smprintf(s,"%c",msg->Buffer[i]); | 629 | smprintf(s,"%c",msg->Buffer[i]); |
619 | } | 630 | } |
620 | } | 631 | } |
@@ -800,255 +811,276 @@ bool GSM_ReadConfig(INI_Section *cfg_info, GSM_Config *cfg, int num) | |||
800 | cfg->DefaultConnection = false; | 811 | cfg->DefaultConnection = false; |
801 | } | 812 | } |
802 | cfg->SyncTime = INI_GetValue(cfg_info, section, "synchronizetime",false); | 813 | cfg->SyncTime = INI_GetValue(cfg_info, section, "synchronizetime",false); |
803 | if (!cfg->SyncTime) { | 814 | if (!cfg->SyncTime) { |
804 | free(cfg->SyncTime); | 815 | free(cfg->SyncTime); |
805 | cfg->SyncTime = strdup(DefaultSynchronizeTime); | 816 | cfg->SyncTime = strdup(DefaultSynchronizeTime); |
806 | } else { | 817 | } else { |
807 | cfg->DefaultSyncTime = false; | 818 | cfg->DefaultSyncTime = false; |
808 | } | 819 | } |
809 | cfg->DebugFile = INI_GetValue(cfg_info, section, "logfile", false); | 820 | cfg->DebugFile = INI_GetValue(cfg_info, section, "logfile", false); |
810 | if (!cfg->DebugFile) { | 821 | if (!cfg->DebugFile) { |
811 | free(cfg->DebugFile); | 822 | free(cfg->DebugFile); |
812 | cfg->DebugFile = strdup(DefaultDebugFile); | 823 | cfg->DebugFile = strdup(DefaultDebugFile); |
813 | } else { | 824 | } else { |
814 | cfg->DefaultDebugFile = false; | 825 | cfg->DefaultDebugFile = false; |
815 | } | 826 | } |
816 | cfg->LockDevice = INI_GetValue(cfg_info, section, "use_locking", false); | 827 | cfg->LockDevice = INI_GetValue(cfg_info, section, "use_locking", false); |
817 | if (!cfg->LockDevice) { | 828 | if (!cfg->LockDevice) { |
818 | free(cfg->LockDevice); | 829 | free(cfg->LockDevice); |
819 | cfg->LockDevice = strdup(DefaultLockDevice); | 830 | cfg->LockDevice = strdup(DefaultLockDevice); |
820 | } else { | 831 | } else { |
821 | cfg->DefaultLockDevice = false; | 832 | cfg->DefaultLockDevice = false; |
822 | } | 833 | } |
823 | Temp = INI_GetValue(cfg_info, section, "model", false); | 834 | Temp = INI_GetValue(cfg_info, section, "model", false); |
824 | if (!Temp) { | 835 | if (!Temp) { |
825 | strcpy(cfg->Model,DefaultModel); | 836 | strcpy(cfg->Model,DefaultModel); |
826 | } else { | 837 | } else { |
827 | cfg->DefaultModel = false; | 838 | cfg->DefaultModel = false; |
828 | strcpy(cfg->Model,Temp); | 839 | strcpy(cfg->Model,Temp); |
829 | } | 840 | } |
830 | Temp = INI_GetValue(cfg_info, section, "logformat", false); | 841 | Temp = INI_GetValue(cfg_info, section, "logformat", false); |
831 | if (!Temp) { | 842 | if (!Temp) { |
832 | strcpy(cfg->DebugLevel,DefaultDebugLevel); | 843 | strcpy(cfg->DebugLevel,DefaultDebugLevel); |
833 | } else { | 844 | } else { |
834 | cfg->DefaultDebugLevel = false; | 845 | cfg->DefaultDebugLevel = false; |
835 | strcpy(cfg->DebugLevel,Temp); | 846 | strcpy(cfg->DebugLevel,Temp); |
836 | } | 847 | } |
837 | cfg->StartInfo = INI_GetValue(cfg_info, section, "startinfo", false); | 848 | cfg->StartInfo = INI_GetValue(cfg_info, section, "startinfo", false); |
838 | if (!cfg->StartInfo) { | 849 | if (!cfg->StartInfo) { |
839 | free(cfg->StartInfo); | 850 | free(cfg->StartInfo); |
840 | cfg->StartInfo = strdup(DefaultStartInfo); | 851 | cfg->StartInfo = strdup(DefaultStartInfo); |
841 | } else { | 852 | } else { |
842 | cfg->DefaultStartInfo = false; | 853 | cfg->DefaultStartInfo = false; |
843 | } | 854 | } |
844 | return true; | 855 | return true; |
845 | } | 856 | } |
846 | 857 | ||
847 | static OnePhoneModel allmodels[] = { | 858 | static OnePhoneModel allmodels[] = { |
859 | #ifdef GSM_ENABLE_NOKIA650 | ||
860 | {"0650" ,"THF-12","", {0}}, | ||
861 | #endif | ||
848 | #ifdef GSM_ENABLE_NOKIA6510 | 862 | #ifdef GSM_ENABLE_NOKIA6510 |
849 | {"1100", "RH-18" ,"", {0}}, | 863 | {"1100" ,"RH-18" ,"", {0}}, |
850 | {"1100a","RH-38" ,"", {0}}, | 864 | {"1100a","RH-38" ,"", {0}}, |
851 | {"1100b","RH-36" ,"", {0}}, | 865 | {"1100b","RH-36" ,"", {0}}, |
852 | #endif | 866 | #endif |
853 | #ifdef GSM_ENABLE_NOKIA6110 | 867 | #ifdef GSM_ENABLE_NOKIA6110 |
854 | {"2100" ,"NAM-2" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess | 868 | {"2100" ,"NAM-2" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess |
855 | #endif | 869 | #endif |
856 | #ifdef GSM_ENABLE_NOKIA6510 | 870 | #ifdef GSM_ENABLE_NOKIA6510 |
857 | {"3100" ,"RH-19" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}}, | 871 | {"3100" ,"RH-19" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme |
858 | {"3100b","RH-50" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}}, | 872 | {"3100b","RH-50" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme |
859 | {"3108", "RH-6", "Nokia 3108",{0}}, //does it have irda ? | 873 | {"3108", "RH-6", "Nokia 3108",{0}}, //does it have irda ? |
860 | {"3200", "RH-30" ,"Nokia 3200",{F_PBKTONEGAL,0}}, | 874 | {"3200", "RH-30" ,"Nokia 3200",{F_PBKTONEGAL,0}},//fixme |
861 | {"3200a","RH-31" ,"Nokia 3200",{F_PBKTONEGAL,0}}, | 875 | {"3200a","RH-31" ,"Nokia 3200",{F_PBKTONEGAL,0}},//fixme |
862 | #endif | 876 | #endif |
863 | #ifdef GSM_ENABLE_NOKIA6110 | 877 | #ifdef GSM_ENABLE_NOKIA6110 |
864 | {"3210" ,"NSE-8" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, | 878 | {"3210" ,"NSE-8" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, |
865 | {"3210" ,"NSE-9" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, | 879 | {"3210" ,"NSE-9" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, |
866 | #endif | 880 | #endif |
867 | #ifdef GSM_ENABLE_NOKIA6510 | 881 | #ifdef GSM_ENABLE_NOKIA6510 |
868 | {"3300" ,"NEM-1" ,"Nokia 3300", {F_PBKTONEGAL,0}}, | 882 | {"3300" ,"NEM-1" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme |
869 | {"3300" ,"NEM-2" ,"Nokia 3300", {F_PBKTONEGAL,0}}, | 883 | {"3300" ,"NEM-2" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme |
870 | #endif | 884 | #endif |
871 | #ifdef GSM_ENABLE_NOKIA6110 | 885 | #ifdef GSM_ENABLE_NOKIA6110 |
872 | {"3310" ,"NHM-5" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, | 886 | {"3310" ,"NHM-5" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, |
873 | #endif | 887 | #endif |
874 | #ifdef GSM_ENABLE_NOKIA3320 | 888 | #ifdef GSM_ENABLE_NOKIA3320 |
875 | {"3320" ,"NPC-1" ,"Nokia 3320", {F_CAL62,F_DAYMONTH,0}},//fixme | 889 | {"3320" ,"NPC-1" ,"Nokia 3320", {F_CAL62,F_DAYMONTH,0}},//fixme |
876 | #endif | 890 | #endif |
877 | #ifdef GSM_ENABLE_NOKIA6110 | 891 | #ifdef GSM_ENABLE_NOKIA6110 |
878 | {"3330" ,"NHM-6" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, | 892 | {"3330" ,"NHM-6" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, |
879 | {"3390" ,"NPB-1" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, | 893 | {"3390" ,"NPB-1" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, |
880 | {"3410" ,"NHM-2" ,"", {F_RING_SM,F_CAL33,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, | 894 | {"3410" ,"NHM-2" ,"", {F_RING_SM,F_CAL33,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, |
881 | #endif | 895 | #endif |
882 | #ifdef GSM_ENABLE_NOKIA6510 | 896 | #ifdef GSM_ENABLE_NOKIA6510 |
883 | {"3510" ,"NHM-8" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, | 897 | {"3510" ,"NHM-8" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, |
884 | {"3510i","RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, | 898 | {"3510i","RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, |
885 | {"3530" ,"RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, | 899 | {"3530" ,"RH-9" ,"", {F_CAL35,F_PBK35,F_NOGPRSPOINT,F_VOICETAGS,0}}, |
886 | {"3589i","RH-44" ,"", {F_VOICETAGS,0}}, | 900 | {"3589i","RH-44" ,"", {F_VOICETAGS,0}}, |
887 | {"3590" ,"NPM-8" ,"", {0}},//irda? | 901 | {"3590" ,"NPM-8" ,"", {0}},//irda? |
888 | {"3595" ,"NPM-10" ,"", {0}},//irda? | 902 | {"3595" ,"NPM-10" ,"", {0}},//irda? |
889 | #endif | 903 | #endif |
890 | #ifdef GSM_ENABLE_NOKIA6110 | 904 | #ifdef GSM_ENABLE_NOKIA6110 |
891 | {"3610" ,"NAM-1" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess | 905 | {"3610" ,"NAM-1" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess |
892 | #endif | 906 | #endif |
893 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA3650) | 907 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA3650) |
894 | {"3650" ,"NHL-8" ,"Nokia 3650", {0}}, | 908 | {"3650" ,"NHL-8" ,"Nokia 3650", {0}}, |
895 | {"NGAGE","NEM-4" ,"", {F_RADIO,0}}, | 909 | {"NGAGE","NEM-4" ,"", {F_RADIO,0}}, |
896 | #endif | 910 | #endif |
897 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 911 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
898 | {"5100" ,"NPM-6" ,"Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 912 | {"5100" ,"NPM-6" ,"Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, |
899 | {"5100" ,"NPM-6U","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 913 | {"5100" ,"NPM-6U","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, |
900 | {"5100" ,"NPM-6X","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 914 | {"5100" ,"NPM-6X","Nokia 5100", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, |
915 | {"5140" ,"NPL-4" ,"Nokia 5140", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKUSER,F_WAPMMSPROXY,0}}, | ||
916 | {"5140" ,"NPL-5" ,"Nokia 5140", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKUSER,F_WAPMMSPROXY,0}}, | ||
901 | #endif | 917 | #endif |
902 | #ifdef GSM_ENABLE_NOKIA6110 | 918 | #ifdef GSM_ENABLE_NOKIA6110 |
903 | {"5110" ,"NSE-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, | 919 | {"5110" ,"NSE-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, |
904 | {"5110i","NSE-2" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, | 920 | {"5110i","NSE-2" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, |
905 | {"5130" ,"NSK-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, | 921 | {"5130" ,"NSK-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, |
906 | {"5190" ,"NSB-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, | 922 | {"5190" ,"NSB-1" ,"", {F_NOWAP,F_NOCALLER,F_NORING,F_NOPICTURE,F_NOSTARTUP,F_NOCALENDAR,F_NOPBKUNICODE,F_PROFILES51,F_MAGICBYTES,F_DISPSTATUS,0}}, |
907 | #endif | 923 | #endif |
908 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) | 924 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) |
909 | {"5210" ,"NSM-5" ,"Nokia 5210", {F_CAL52,F_NOSTARTANI,F_NOPICTUREUNI,F_NODTMF,0}}, | 925 | {"5210" ,"NSM-5" ,"Nokia 5210", {F_CAL52,F_NOSTARTANI,F_NOPICTUREUNI,F_NODTMF,0}}, |
910 | #endif | 926 | #endif |
911 | #ifdef GSM_ENABLE_NOKIA6110 | 927 | #ifdef GSM_ENABLE_NOKIA6110 |
912 | {"5510" ,"NPM-5" ,"", {F_NOCALLER,F_PROFILES33,F_NOPICTUREUNI,0}}, | 928 | {"5510" ,"NPM-5" ,"", {F_NOCALLER,F_PROFILES33,F_NOPICTUREUNI,0}}, |
913 | #endif | 929 | #endif |
914 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 930 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
915 | {"6100" ,"NPL-2" ,"Nokia 6100", {F_PBKTONEGAL,F_TODO66,0}}, | 931 | {"6100" ,"NPL-2" ,"Nokia 6100", {F_PBKTONEGAL,F_TODO66,0}}, |
916 | #endif | 932 | #endif |
917 | #ifdef GSM_ENABLE_NOKIA6110 | 933 | #ifdef GSM_ENABLE_NOKIA6110 |
918 | {"6110" ,"NSE-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, | 934 | {"6110" ,"NSE-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, |
919 | {"6130" ,"NSK-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, | 935 | {"6130" ,"NSK-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, |
920 | {"6150" ,"NSM-1" ,"", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,F_NOPICTUREUNI,0}}, | 936 | {"6150" ,"NSM-1" ,"", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,F_NOPICTUREUNI,0}}, |
921 | {"6190" ,"NSB-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, | 937 | {"6190" ,"NSB-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, |
922 | #endif | 938 | #endif |
923 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 939 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
924 | {"6200" ,"NPL-3" ,"Nokia 6200", {F_PBKTONEGAL,0}}, | 940 | {"6200" ,"NPL-3" ,"Nokia 6200", {F_PBKTONEGAL,0}}, |
925 | {"6220" ,"RH-20" ,"Nokia 6220", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,0}}, | 941 | {"6220" ,"RH-20" ,"Nokia 6220", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}}, |
926 | #endif | 942 | #endif |
927 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) | 943 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) |
928 | {"6210" ,"NPE-3" ,"Nokia 6210", {F_VOICETAGS,F_CAL62,0}}, | 944 | {"6210" ,"NPE-3" ,"Nokia 6210", {F_VOICETAGS,F_CAL62,0}}, |
929 | {"6250" ,"NHM-3" ,"Nokia 6250", {F_VOICETAGS,F_CAL62,0}}, | 945 | {"6250" ,"NHM-3" ,"Nokia 6250", {F_VOICETAGS,F_CAL62,0}}, |
930 | #endif | 946 | #endif |
931 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 947 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
932 | {"6230" ,"RH-12" ,"Nokia 6230", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,0}}, | 948 | {"6230" ,"RH-12" ,"Nokia 6230", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}}, |
933 | {"6310" ,"NPE-4" ,"Nokia 6310", {F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, | 949 | {"6310" ,"NPE-4" ,"Nokia 6310", {F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, |
934 | {"6310i","NPL-1" ,"Nokia 6310i",{F_TODO63,F_CAL65,F_NOMIDI,F_BLUETOOTH,F_NOMMS,F_VOICETAGS,0}}, | 950 | {"6310i","NPL-1" ,"Nokia 6310i",{F_TODO63,F_CAL65,F_NOMIDI,F_BLUETOOTH,F_NOMMS,F_VOICETAGS,0}}, |
935 | {"6385" ,"NHP-2AX","Nokia 6385",{F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, | 951 | {"6385" ,"NHP-2AX","Nokia 6385",{F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, |
936 | {"6510" ,"NPM-9" ,"Nokia 6510", {F_TODO63,F_CAL65,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, | 952 | {"6510" ,"NPM-9" ,"Nokia 6510", {F_TODO63,F_CAL65,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, |
937 | {"6610" ,"NHL-4U","Nokia 6610", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 953 | {"6610" ,"NHL-4U","Nokia 6610", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, |
954 | {"6610i","RM-37" ,"Nokia 6610i",{F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | ||
938 | {"6800" ,"NSB-9" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, | 955 | {"6800" ,"NSB-9" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, |
939 | {"6800" ,"NHL-6" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, | 956 | {"6800" ,"NHL-6" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, |
957 | {"6810" ,"RM-2" ,"Nokia 6810", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},//quess | ||
958 | {"6820" ,"NHL-9" ,"Nokia 6820", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},//quess | ||
940 | #endif | 959 | #endif |
941 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) | 960 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) |
942 | {"7110" ,"NSE-5" ,"Nokia 7110", {F_CAL62,0}}, | 961 | {"7110" ,"NSE-5" ,"Nokia 7110", {F_CAL62,0}}, |
943 | {"7190" ,"NSB-5" ,"Nokia 7190", {F_CAL62,0}}, | 962 | {"7190" ,"NSB-5" ,"Nokia 7190", {F_CAL62,0}}, |
944 | #endif | 963 | #endif |
945 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 964 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
965 | {"7200" ,"RH-23" ,"Nokia 7200", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,0}},//quess | ||
946 | {"7210" ,"NHL-4" ,"Nokia 7210", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, | 966 | {"7210" ,"NHL-4" ,"Nokia 7210", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, |
947 | {"7250" ,"NHL-4J","Nokia 7250", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, | 967 | {"7250" ,"NHL-4J","Nokia 7250", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, |
948 | {"7250i","NHL-4JX","Nokia 7250i",{F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, | 968 | {"7250i","NHL-4JX","Nokia 7250i",{F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, |
949 | {"7600", "NMM-3", "Nokia 7600", {F_TODO66,0}}, | 969 | {"7600", "NMM-3", "Nokia 7600", {F_TODO66,0}}, |
950 | #endif | 970 | #endif |
951 | #if defined(GSM_ENABLE_ATGEN) | 971 | #if defined(GSM_ENABLE_ATGEN) |
952 | {"7650" ,"NHL-2" ,"Nokia 7650", {0}}, | 972 | {"7650" ,"NHL-2" ,"Nokia 7650", {0}}, |
953 | #endif | 973 | #endif |
954 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) | 974 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) |
955 | {"8210" ,"NSM-3" ,"Nokia 8210", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, | 975 | {"8210" ,"NSM-3" ,"Nokia 8210", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, |
956 | {"8250" ,"NSM-3D","Nokia 8250", {F_NOWAP,F_NOSTARTANI,F_CAL82,F_NOPICTUREUNI,0}}, | 976 | {"8250" ,"NSM-3D","Nokia 8250", {F_NOWAP,F_NOSTARTANI,F_CAL82,F_NOPICTUREUNI,0}}, |
957 | {"8290" ,"NSB-7" ,"Nokia 8290", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, | 977 | {"8290" ,"NSB-7" ,"Nokia 8290", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, |
958 | #endif | 978 | #endif |
959 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 979 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
960 | {"8310" ,"NHM-7" ,"Nokia 8310", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, | 980 | {"8310" ,"NHM-7" ,"Nokia 8310", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, |
961 | {"8390" ,"NSB-8" ,"Nokia 8390", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, | 981 | {"8390" ,"NSB-8" ,"Nokia 8390", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, |
962 | #endif | 982 | #endif |
963 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) | 983 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) |
964 | {"8850" ,"NSM-2" ,"Nokia 8850", {0}}, | 984 | {"8850" ,"NSM-2" ,"Nokia 8850", {0}}, |
965 | {"8855" ,"NSM-4" ,"Nokia 8855", {0}}, | 985 | {"8855" ,"NSM-4" ,"Nokia 8855", {0}}, |
966 | {"8890" ,"NSB-6" ,"Nokia 8890", {0}}, | 986 | {"8890" ,"NSB-6" ,"Nokia 8890", {0}}, |
967 | #endif | 987 | #endif |
968 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) | 988 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) |
969 | {"8910" ,"NHM-4" ,"Nokia 8910", {F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, | 989 | {"8910" ,"NHM-4" ,"Nokia 8910", {F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, |
970 | {"8910i","NHM-4" ,"Nokia 8910i",{F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, | 990 | {"8910i","NHM-4" ,"Nokia 8910i",{F_CAL62,F_NOMIDI,F_NOFILESYSTEM,F_NOMMS,0}}, |
971 | #endif | 991 | #endif |
972 | #ifdef GSM_ENABLE_NOKIA9210 | 992 | #ifdef GSM_ENABLE_NOKIA9210 |
973 | {"9210" ,"RAE-3" ,"", {0}}, | 993 | {"9210" ,"RAE-3" ,"", {0}}, |
974 | {"9210i","RAE-5" ,"", {0}}, | 994 | {"9210i","RAE-5" ,"", {0}}, |
975 | #endif | 995 | #endif |
976 | #ifdef GSM_ENABLE_ATGEN | 996 | #ifdef GSM_ENABLE_ATGEN |
977 | {"at" , "at", "", {0}}, | 997 | {"at" , "at", "", {0}}, |
998 | /* Siemens */ | ||
978 | {"M20" , "M20", "", {F_M20SMS,F_SLOWWRITE,0}}, | 999 | {"M20" , "M20", "", {F_M20SMS,F_SLOWWRITE,0}}, |
979 | {"MC35" , "MC35", "", {0}}, | 1000 | {"MC35" , "MC35", "", {0}}, |
1001 | {"TC35" , "TC35", "", {0}}, | ||
980 | {"S25", "S25", "SIEMENS S25", {0}}, | 1002 | {"S25", "S25", "SIEMENS S25", {0}}, |
981 | {"C35i" , "C35i", "", {0}}, | 1003 | {"C35i" , "C35i", "", {0}}, |
982 | {"S35i" , "S35i", "", {0}}, | 1004 | {"S35i" , "S35i", "", {0}}, |
983 | {"M35i" , "M35i", "", {0}}, | 1005 | {"M35i" , "M35i", "", {0}}, |
984 | {"S40" , "Siemens S40", "", {0}}, | 1006 | {"S40" , "Siemens S40", "", {0}}, |
985 | {"C45" , "C45", "", {0}}, | 1007 | {"C45" , "C45", "", {0}}, |
986 | {"S45" , "S45", "", {0}}, | 1008 | {"S45" , "S45", "", {0}}, |
987 | {"ME45" , "ME45", "", {0}}, | 1009 | {"ME45" , "ME45", "", {0}}, |
988 | {"SL45" , "SL45", "", {0}}, | 1010 | {"SL45" , "SL45", "", {0}}, |
989 | {"SL45i" , "SL45i", "", {0}}, | 1011 | {"SL45i" , "SL45i", "", {0}}, |
990 | {"M50" , "M50", "", {0}}, | 1012 | {"M50" , "M50", "", {0}}, |
991 | {"S45" , "6618" , "", {0}}, | 1013 | {"S45" , "6618" , "", {0}}, |
992 | {"ME45" , "3618" , "", {0}}, | 1014 | {"ME45" , "3618" , "", {0}}, |
993 | {"S55" , "S55" , "", {0}}, | 1015 | {"S55" , "S55" , "", {0}}, |
1016 | /* Samsung */ | ||
1017 | {"S100" , "SGH-S100" , "", {0}}, | ||
1018 | {"S200" , "SGH-S200" , "", {0}}, | ||
1019 | {"S300" , "SGH-S300" , "", {0}}, | ||
1020 | {"S500" , "SGH-S500" , "", {0}}, | ||
1021 | {"V200" , "SGH-V200" , "", {0}}, | ||
1022 | {"T100" , "SGH-T100" , "", {0}}, | ||
1023 | {"E700" , "SGH-E700" , "", {0}}, | ||
1024 | /* Ericsson/Sony Ericsson */ | ||
994 | {"T28s", "1101101-BVT28s","", {0}}, | 1025 | {"T28s", "1101101-BVT28s","", {0}}, |
995 | {"R320s" , "1101201-BV R320s","", {0}}, | 1026 | {"R320s" , "1101201-BV R320s","", {0}}, |
996 | {"R380s", "7100101-BVR380s" ,"", {0}}, | 1027 | {"R380s", "7100101-BVR380s" ,"", {0}}, |
997 | {"R520m", "1130101-BVR520m" ,"", {0}}, | 1028 | {"R520m", "1130101-BVR520m" ,"", {0}}, |
998 | {"T39m", "1130102-BVT39m" ,"", {0}}, | 1029 | {"T39m", "1130102-BVT39m" ,"", {0}}, |
999 | {"T65", "1101901-BVT65" , "", {0}}, | 1030 | {"T65", "1101901-BVT65" , "", {0}}, |
1000 | {"T68", "1130201-BVT68" , "", {0}}, | 1031 | {"T68", "1130201-BVT68" , "", {0}}, |
1001 | {"T68i", "1130202-BVT68" , "", {0}}, | 1032 | {"T68i", "1130202-BVT68" , "", {0}}, |
1002 | {"R600", "102001-BVR600" , "", {0}}, | 1033 | {"R600", "102001-BVR600" , "", {0}}, |
1003 | {"T200", "1130501-BVT200" ,"", {0}}, | 1034 | {"T200", "1130501-BVT200" ,"", {0}}, |
1004 | {"T300", "1130601-BVT300" ,"T300", {0}}, | 1035 | {"T300", "1130601-BVT300" ,"T300", {0}}, |
1005 | {"T310", "1130602-BVT310" ,"", {0}}, | 1036 | {"T310", "1130602-BVT310" ,"", {0}}, |
1006 | {"P800", "7130501-BVP800" ,"", {0}}, | 1037 | {"P800", "7130501-BVP800" ,"", {0}}, |
1038 | /* Other */ | ||
1007 | {"iPAQ" , "iPAQ" , "" , {0}}, | 1039 | {"iPAQ" , "iPAQ" , "" , {0}}, |
1008 | {"A2D" , "A2D" , "" , {0}}, | 1040 | {"A2D" , "A2D" , "" , {0}}, |
1009 | {"9210" , "RAE-3", "Nokia Communicator GSM900/1800",{0}}, | 1041 | {"9210" , "RAE-3", "Nokia Communicator GSM900/1800",{0}}, |
1010 | {"myV-65", "myV-65 GPRS", "", {F_SMSME900,0}}, | 1042 | {"myV-65", "myV-65 GPRS", "", {F_SMSME900,0}}, |
1011 | #endif | 1043 | #endif |
1012 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_ALCATEL) | 1044 | #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_ALCATEL) |
1013 | {"BE5", "ONE TOUCH 500","", {F_ALCATEL,F_SMSONLYSENT,F_BROKENCPBS,0}}, | 1045 | {"BE5", "ONE TOUCH 500","", {F_ALCATEL,F_SMSONLYSENT,F_BROKENCPBS,0}}, |
1014 | {"BH4", "ONE TOUCH 535","ALCATEL OT535", {F_ALCATEL,F_SMSONLYSENT,0}}, | 1046 | {"BH4", "ONE TOUCH 535","ALCATEL OT535", {F_ALCATEL,F_SMSONLYSENT,0}}, |
1015 | {"BF5", "ONE TOUCH 715","ALCATEL OT715", {F_ALCATEL,F_SMSONLYSENT,F_BROKENCPBS,0}}, | 1047 | {"BF5", "ONE TOUCH 715","ALCATEL OT715", {F_ALCATEL,F_SMSONLYSENT,F_BROKENCPBS,0}}, |
1016 | #endif | 1048 | #endif |
1017 | {"unknown", "" ,"", {0}} | 1049 | {"unknown", "" ,"", {0}} |
1018 | }; | 1050 | }; |
1019 | 1051 | ||
1020 | OnePhoneModel *GetModelData(char *model, char *number, char *irdamodel) | 1052 | OnePhoneModel *GetModelData(char *model, char *number, char *irdamodel) |
1021 | { | 1053 | { |
1022 | int i = 0; | 1054 | int i = 0; |
1023 | 1055 | ||
1024 | while (strcmp(allmodels[i].number,"") != 0) { | 1056 | while (strcmp(allmodels[i].number,"") != 0) { |
1025 | if (model !=NULL) { | 1057 | if (model !=NULL) { |
1026 | if (strcmp (model, allmodels[i].model) == 0) { | 1058 | if (strcmp (model, allmodels[i].model) == 0) { |
1027 | return (&allmodels[i]); | 1059 | return (&allmodels[i]); |
1028 | } | 1060 | } |
1029 | } | 1061 | } |
1030 | if (number !=NULL) { | 1062 | if (number !=NULL) { |
1031 | if (strcmp (number, allmodels[i].number) == 0) { | 1063 | if (strcmp (number, allmodels[i].number) == 0) { |
1032 | return (&allmodels[i]); | 1064 | return (&allmodels[i]); |
1033 | } | 1065 | } |
1034 | } | 1066 | } |
1035 | if (irdamodel !=NULL) { | 1067 | if (irdamodel !=NULL) { |
1036 | if (strcmp (irdamodel, allmodels[i].irdamodel) == 0) { | 1068 | if (strcmp (irdamodel, allmodels[i].irdamodel) == 0) { |
1037 | return (&allmodels[i]); | 1069 | return (&allmodels[i]); |
1038 | } | 1070 | } |
1039 | } | 1071 | } |
1040 | i++; | 1072 | i++; |
1041 | } | 1073 | } |
1042 | return (&allmodels[i]); | 1074 | return (&allmodels[i]); |
1043 | } | 1075 | } |
1044 | 1076 | ||
1045 | bool IsPhoneFeatureAvailable(OnePhoneModel *model, Feature feature) | 1077 | bool IsPhoneFeatureAvailable(OnePhoneModel *model, Feature feature) |
1046 | { | 1078 | { |
1047 | int i= 0; | 1079 | int i= 0; |
1048 | boolretval = false; | 1080 | boolretval = false; |
1049 | 1081 | ||
1050 | while (model->features[i] != 0) { | 1082 | while (model->features[i] != 0) { |
1051 | if (model->features[i] == feature) { | 1083 | if (model->features[i] == feature) { |
1052 | retval = true; | 1084 | retval = true; |
1053 | break; | 1085 | break; |
1054 | } | 1086 | } |