7 A Linux/Unix GUI for Nokia mobile phones.
8 Copyright (C) 1999 Pavel Janík ml., Hugh Blemings
9 & Ján Derfiòák <ja@mail.upjs.sk>.
11 Released under the terms of the GNU GPL, see file COPYING for more details.
20 #include "gsm-common.h"
23 //#include "fbus-3810.h"
24 #include "xgnokii_lowlevel.h"
26 #include "gsm-statemachine.h"
27 //#include "xgnokii_common.h"
30 PhoneMonitor phoneMonitor;
31 pthread_mutex_t memoryMutex;
32 pthread_cond_t memoryCond;
33 pthread_mutex_t calendarMutex;
34 pthread_cond_t calendarCond;
35 pthread_mutex_t smsMutex;
36 pthread_mutex_t sendSMSMutex;
37 pthread_cond_t sendSMSCond;
38 pthread_mutex_t callMutex;
39 pthread_mutex_t netMonMutex;
40 pthread_mutex_t speedDialMutex;
41 pthread_cond_t speedDialCond;
42 pthread_mutex_t callerGroupMutex;
43 pthread_cond_t callerGroupCond;
44 pthread_mutex_t smsCenterMutex;
45 pthread_cond_t smsCenterCond;
46 pthread_mutex_t alarmMutex;
47 pthread_cond_t alarmCond;
48 pthread_mutex_t getBitmapMutex;
49 pthread_cond_t getBitmapCond;
50 pthread_mutex_t setBitmapMutex;
51 pthread_cond_t setBitmapCond;
52 pthread_mutex_t getNetworkInfoMutex;
53 pthread_cond_t getNetworkInfoCond;
54 static pthread_mutex_t eventsMutex;
55 static GSList *ScheduledEvents = NULL;
57 static GSM_Statemachine statemachine;
58 /* FIXME - don't really know what should own the statemachine in */
59 /* the xgnokii scheme of things - Chris */
62 inline void GUI_InsertEvent (PhoneEvent *event)
65 g_print ("Inserting Event: %d\n", event->event);
67 pthread_mutex_lock (&eventsMutex);
68 ScheduledEvents = g_slist_prepend (ScheduledEvents, event);
69 pthread_mutex_unlock (&eventsMutex);
73 inline static PhoneEvent *RemoveEvent (void)
76 PhoneEvent *event = NULL;
78 pthread_mutex_lock (&eventsMutex);
79 list = g_slist_last (ScheduledEvents);
82 event = (PhoneEvent *) list->data;
83 ScheduledEvents = g_slist_remove_link (ScheduledEvents, list);
84 g_slist_free_1 (list);
86 pthread_mutex_unlock (&eventsMutex);
92 static void InitModelInf (void)
101 while ((error = SM_Functions(GOP_GetModel,&data,&statemachine)) != GE_NONE && i++ < 15)
104 if (error == GE_NONE)
106 g_free (phoneMonitor.phone.model);
107 phoneMonitor.phone.version = g_strdup (buf);
108 phoneMonitor.phone.model = GetModel (buf);
109 if (phoneMonitor.phone.model == NULL)
110 phoneMonitor.phone.model = g_strdup (_("unknown"));
112 phoneMonitor.supported = GetPhoneModel(buf)->flags;
117 while ((error = SM_Functions(GOP_GetRevision,&data,&statemachine)) != GE_NONE && i++ < 5)
120 if (error == GE_NONE)
122 g_free (phoneMonitor.phone.revision);
123 phoneMonitor.phone.revision = g_strdup (buf);
128 while ((error = SM_Functions(GOP_GetImei,&data,&statemachine)) != GE_NONE && i++ < 5)
131 if (error == GE_NONE)
133 g_free (phoneMonitor.phone.imei);
134 phoneMonitor.phone.imei = g_strdup (buf);
139 g_print ("Version: %s\n", phoneMonitor.phone.version);
140 g_print ("Model: %s\n", phoneMonitor.phone.model);
141 g_print ("IMEI: %s\n", phoneMonitor.phone.imei);
142 g_print ("Revision: %s\n", phoneMonitor.phone.revision);
147 static GSM_Error fbusinit(bool enable_monitoring)
150 static GSM_Error error=GE_NOLINK;
151 GSM_ConnectionType connection=GCT_Serial;
153 if (!strcmp(xgnokiiConfig.connection, "infrared"))
154 connection = GCT_Infrared;
156 if (!strcmp(xgnokiiConfig.connection, "irda"))
157 connection = GCT_Irda;
159 /* Initialise the code for the GSM interface. */
161 if (error == GE_NOLINK)
162 error = GSM_Initialise (xgnokiiConfig.model, xgnokiiConfig.port,
163 xgnokiiConfig.initlength, connection, RLP_DisplayF96Frame, &statemachine);
166 g_print ("fbusinit: error %d\n", error);
169 if (error != GE_NONE) {
170 g_print (_("GSM/FBUS init failed! (Unknown model ?). Quitting.\n"));
171 /* FIXME: should popup some message... */
175 while (count++ < 40 && *GSM_LinkOK == false)
178 g_print("After usleep. GSM_LinkOK: %d\n", *GSM_LinkOK);
181 if (*GSM_LinkOK == true)
188 void GUI_InitPhoneMonitor (void)
190 phoneMonitor.phone.model = g_strdup (_("unknown"));
191 phoneMonitor.phone.version = phoneMonitor.phone.model;
192 phoneMonitor.phone.revision = g_strdup (_("unknown"));
193 phoneMonitor.phone.imei = g_strdup (_("unknown"));
194 phoneMonitor.supported = 0;
195 phoneMonitor.rfLevel = phoneMonitor.batteryLevel = -1;
196 phoneMonitor.powerSource = GPS_BATTERY;
197 phoneMonitor.working = NULL;
198 phoneMonitor.alarm = FALSE;
199 phoneMonitor.sms.unRead = phoneMonitor.sms.number = 0;
200 phoneMonitor.sms.messages = NULL;
201 phoneMonitor.call.callInProgress = CS_Idle;
202 *phoneMonitor.call.callNum = '\0';
203 phoneMonitor.netmonitor.number = 0;
204 *phoneMonitor.netmonitor.screen = *phoneMonitor.netmonitor.screen3 =
205 *phoneMonitor.netmonitor.screen4 = *phoneMonitor.netmonitor.screen5 = '\0';
206 pthread_mutex_init (&memoryMutex, NULL);
207 pthread_cond_init (&memoryCond, NULL);
208 pthread_mutex_init (&calendarMutex, NULL);
209 pthread_cond_init (&calendarCond, NULL);
210 pthread_mutex_init (&smsMutex, NULL);
211 pthread_mutex_init (&sendSMSMutex, NULL);
212 pthread_cond_init (&sendSMSCond, NULL);
213 pthread_mutex_init (&callMutex, NULL);
214 pthread_mutex_init (&eventsMutex, NULL);
215 pthread_mutex_init (&callMutex, NULL);
216 pthread_mutex_init (&netMonMutex, NULL);
217 pthread_mutex_init (&speedDialMutex, NULL);
218 pthread_cond_init (&speedDialCond, NULL);
219 pthread_mutex_init (&callerGroupMutex, NULL);
220 pthread_cond_init (&callerGroupCond, NULL);
221 pthread_mutex_init (&smsCenterMutex, NULL);
222 pthread_cond_init (&smsCenterCond, NULL);
223 pthread_mutex_init (&getBitmapMutex, NULL);
224 pthread_cond_init (&getBitmapCond, NULL);
225 pthread_mutex_init (&setBitmapMutex, NULL);
226 pthread_cond_init (&setBitmapCond, NULL);
227 pthread_mutex_init (&getNetworkInfoMutex, NULL);
228 pthread_cond_init (&getNetworkInfoCond, NULL);
232 static inline void FreeElement (gpointer data, gpointer userData)
234 g_free ((GSM_SMSMessage *) data);
238 static inline void FreeArray (GSList **array)
242 g_slist_foreach (*array, FreeElement, NULL);
243 g_slist_free (*array);
249 static void RefreshSMS (const gint number)
256 g_print ("RefreshSMS is running...\n");
259 pthread_mutex_lock (&smsMutex);
260 FreeArray (&(phoneMonitor.sms.messages));
261 phoneMonitor.sms.number = 0;
262 pthread_mutex_unlock (&smsMutex);
268 GSM_DataClear(&gdat);
269 msg = g_malloc (sizeof (GSM_SMSMessage));
270 msg->MemoryType = GMT_SM;
272 gdat.SMSMessage = msg;
274 if ((error = SM_Functions(GOP_GetSMS, &gdat, &statemachine)) == GE_NONE)
276 pthread_mutex_lock (&smsMutex);
277 phoneMonitor.sms.messages = g_slist_append (phoneMonitor.sms.messages, msg);
278 phoneMonitor.sms.number++;
279 pthread_mutex_unlock (&smsMutex);
280 if (phoneMonitor.sms.number == number)
283 else if (error == GE_INVALIDSMSLOCATION) /* All positions are readed */
296 static gint A_GetMemoryStatus (gpointer data)
299 D_MemoryStatus *ms = (D_MemoryStatus *) data;
302 error = ms->status = GE_UNKNOWN;
306 GSM_DataClear(&gdat);
307 pthread_mutex_lock (&memoryMutex);
308 gdat.MemoryStatus=&(ms->memoryStatus);
309 error = ms->status = SM_Functions(GOP_GetMemoryStatus,&gdat,&statemachine);
310 pthread_cond_signal (&memoryCond);
311 pthread_mutex_unlock (&memoryMutex);
318 static gint A_GetMemoryLocation (gpointer data)
321 D_MemoryLocation *ml = (D_MemoryLocation *) data;
324 error = ml->status = GE_UNKNOWN;
328 GSM_DataClear(&gdat);
329 pthread_mutex_lock (&memoryMutex);
330 gdat.PhonebookEntry=(ml->entry);
331 error = ml->status = SM_Functions(GOP_ReadPhonebook,&gdat,&statemachine);
332 pthread_cond_signal (&memoryCond);
333 pthread_mutex_unlock (&memoryMutex);
340 static gint A_GetMemoryLocationAll (gpointer data)
342 GSM_PhonebookEntry entry;
344 D_MemoryLocationAll *mla = (D_MemoryLocationAll *) data;
348 error = mla->status = GE_NONE;
349 entry.MemoryType = mla->type;
350 GSM_DataClear(&gdat);
351 gdat.PhonebookEntry=&entry;
353 pthread_mutex_lock (&memoryMutex);
354 for (i = mla->min; i <= mla->max; i++)
357 error = SM_Functions(GOP_ReadPhonebook,&gdat,&statemachine);
358 if (error != GE_NONE && error!=GE_INVALIDPHBOOKLOCATION)
362 while (error != GE_NONE)
364 g_print (_("%s: line %d: Can't get memory entry number %d from memory %d! %d\n"),
365 __FILE__, __LINE__, i, entry.MemoryType, error);
370 pthread_cond_signal (&memoryCond);
371 pthread_mutex_unlock (&memoryMutex);
375 error = SM_Functions(GOP_ReadPhonebook,&gdat,&statemachine);
380 /* If the phonebook location was invalid - just fill up the rest */
381 /* This works on a 7110 anyway...*/
383 if (error==GE_INVALIDPHBOOKLOCATION) {
387 for (i = mla->min; i <= mla->max; i++) {
388 error = mla->InsertEntry (&entry);
389 if (error != GE_NONE) break;
393 error = mla->InsertEntry (&entry);
394 if (error != GE_NONE)
398 pthread_cond_signal (&memoryCond);
399 pthread_mutex_unlock (&memoryMutex);
404 static gint A_WriteMemoryLocation (gpointer data)
407 D_MemoryLocation *ml = (D_MemoryLocation *) data;
410 error = ml->status = GE_UNKNOWN;
412 GSM_DataClear(&gdat);
413 gdat.PhonebookEntry=(ml->entry);
417 pthread_mutex_lock (&memoryMutex);
418 error = ml->status = SM_Functions(GOP_WritePhonebook,&gdat,&statemachine);
419 pthread_cond_signal (&memoryCond);
420 pthread_mutex_unlock (&memoryMutex);
427 static gint A_WriteMemoryLocationAll (gpointer data)
429 /* GSM_PhonebookEntry entry; */
431 D_MemoryLocationAll *mla = (D_MemoryLocationAll *) data;
434 error = mla->status = GE_NONE;
435 /* entry.MemoryType = mla->type;
437 pthread_mutex_lock (&memoryMutex);
438 for (i = mla->min; i <= mla->max; i++)
441 error = GSM->GetMemoryLocation (&entry);
442 if (error != GE_NONE)
446 while (error != GE_NONE)
448 g_print (_("%s: line %d: Can't get memory entry number %d from memory %d! %d\n"),
449 __FILE__, __LINE__, i, entry.MemoryType, error);
454 pthread_cond_signal (&memoryCond);
455 pthread_mutex_unlock (&memoryMutex);
459 error = GSM->GetMemoryLocation (&entry);
463 error = mla->InsertEntry (&entry);
464 if (error != GE_NONE)
468 pthread_cond_signal (&memoryCond);
469 pthread_mutex_unlock (&memoryMutex); */
474 static gint A_GetCalendarNote (gpointer data)
477 D_CalendarNote *cn = (D_CalendarNote *) data;
479 error = cn->status = GE_UNKNOWN;
483 pthread_mutex_lock (&calendarMutex);
484 error = cn->status = GSM->GetCalendarNote (cn->entry);
485 pthread_cond_signal (&calendarCond);
486 pthread_mutex_unlock (&calendarMutex);
493 static gint A_GetCalendarNoteAll (gpointer data)
495 GSM_CalendarNote entry;
496 D_CalendarNoteAll *cna = (D_CalendarNoteAll *) data;
500 pthread_mutex_lock (&calendarMutex);
503 entry.Location = i++;
505 if ((e = GSM->GetCalendarNote (&entry)) != GE_NONE)
508 if (cna->InsertEntry (&entry) != GE_NONE)
512 pthread_mutex_unlock (&calendarMutex);
514 if (e == GE_INVALIDCALNOTELOCATION)
521 static gint A_WriteCalendarNote (gpointer data)
524 D_CalendarNote *cn = (D_CalendarNote *) data;
526 error = cn->status = GE_UNKNOWN;
530 pthread_mutex_lock (&calendarMutex);
531 error = cn->status = GSM->WriteCalendarNote (cn->entry);
532 pthread_cond_signal (&calendarCond);
533 pthread_mutex_unlock (&calendarMutex);
540 static gint A_DeleteCalendarNote (gpointer data)
542 GSM_CalendarNote *note = (GSM_CalendarNote *) data;
543 GSM_Error error = GE_UNKNOWN;
547 error = GSM->DeleteCalendarNote (note);
554 static gint A_GetCallerGroup (gpointer data)
558 D_CallerGroup *cg = (D_CallerGroup *) data;
561 error = cg->status = GE_UNKNOWN;
565 bitmap.type = GSM_CallerLogo;
566 bitmap.number = cg->number;
568 pthread_mutex_lock (&callerGroupMutex);
569 GSM_DataClear(&gdat);
571 error = cg->status = SM_Functions(GOP_GetBitmap,&gdat,&statemachine);
572 strncpy (cg->text, bitmap.text, 256);
573 cg->text[255] = '\0';
574 pthread_cond_signal (&callerGroupCond);
575 pthread_mutex_unlock (&callerGroupMutex);
582 static gint A_SendCallerGroup (gpointer data)
585 D_CallerGroup *cg = (D_CallerGroup *) data;
591 bitmap.type = GSM_CallerLogo;
592 bitmap.number = cg->number;
593 if ((error = GSM->GetBitmap (&bitmap)) != GE_NONE)
598 strncpy (bitmap.text, cg->text, 256);
599 bitmap.text[255] = '\0';
601 return (GSM->SetBitmap (&bitmap));
605 static gint A_GetSMSCenter (gpointer data)
607 D_SMSCenter *c = (D_SMSCenter *) data;
610 error = c->status = GE_UNKNOWN;
613 pthread_mutex_lock (&smsCenterMutex);
614 error = c->status = GSM->GetSMSCenter (c->center);
615 pthread_cond_signal (&smsCenterCond);
616 pthread_mutex_unlock (&smsCenterMutex);
623 static gint A_SetSMSCenter (gpointer data)
625 D_SMSCenter *c = (D_SMSCenter *) data;
628 error = c->status = GE_UNKNOWN;
631 //pthread_mutex_lock (&smsCenterMutex);
632 error = c->status = GSM->SetSMSCenter (c->center);
634 //pthread_cond_signal (&smsCenterCond);
635 //pthread_mutex_unlock (&smsCenterMutex);
642 static gint A_SendSMSMessage (gpointer data)
644 D_SMSMessage *d = (D_SMSMessage *) data;
647 error = d->status = GE_UNKNOWN;
650 pthread_mutex_lock (&sendSMSMutex);
651 error = d->status = GSM->SendSMSMessage (d->sms, 0);
652 pthread_cond_signal (&sendSMSCond);
653 pthread_mutex_unlock (&sendSMSMutex);
656 if (d->status == GE_SMSSENDOK)
663 static gint A_DeleteSMSMessage (gpointer data)
665 GSM_SMSMessage *sms = (GSM_SMSMessage *) data;
666 GSM_Error error = GE_UNKNOWN;
671 GSM_DataClear(&gdat);
672 gdat.SMSMessage = sms;
673 error = SM_Functions(GOP_DeleteSMS, &gdat, &statemachine);
681 static gint A_GetSpeedDial (gpointer data)
683 D_SpeedDial *d = (D_SpeedDial *) data;
686 error = d->status = GE_UNKNOWN;
690 pthread_mutex_lock (&speedDialMutex);
691 error = d->status = GSM->GetSpeedDial (&(d->entry));
692 pthread_cond_signal (&speedDialCond);
693 pthread_mutex_unlock (&speedDialMutex);
700 static gint A_SendSpeedDial (gpointer data)
702 D_SpeedDial *d = (D_SpeedDial *) data;
705 error = d->status = GE_UNKNOWN;
709 //pthread_mutex_lock (&speedDialMutex);
710 error = d->status = GSM->SetSpeedDial (&(d->entry));
712 //pthread_cond_signal (&speedDialCond);
713 //pthread_mutex_unlock (&speedDialMutex);
720 static gint A_SendDTMF (gpointer data)
722 gchar *buf = (gchar *) data;
723 GSM_Error error = GE_UNKNOWN;
727 error = GSM->SendDTMF (buf);
735 static gint A_NetMonOnOff (gpointer data)
738 gint mode = GPOINTER_TO_INT (data);
739 GSM_Error error = GE_UNKNOWN;
742 error = GSM->NetMonitor (0xf3, screen);
744 error = GSM->NetMonitor (0xf1, screen);
750 static gint A_NetMonitor (gpointer data)
752 gint number = GPOINTER_TO_INT (data);
755 phoneMonitor.netmonitor.number = 0;
757 phoneMonitor.netmonitor.number = number;
763 static gint A_DialVoice (gpointer data)
765 gchar *number = (gchar *) data;
766 GSM_Error error = GE_UNKNOWN;
770 error = GSM->DialVoice (number);
778 static gint A_GetAlarm (gpointer data)
780 D_Alarm *a = (D_Alarm *) data;
787 a->status = GE_UNKNOWN;
788 pthread_mutex_lock (&alarmMutex);
789 error = a->status = GSM->GetAlarm (0, &(a->time));
790 pthread_cond_signal (&alarmCond);
791 pthread_mutex_unlock (&alarmMutex);
798 static gint A_SetAlarm (gpointer data)
800 D_Alarm *a = (D_Alarm *) data;
803 error = a->status = GE_UNKNOWN;
807 error = a->status = GSM->SetAlarm (0, &(a->time));
815 static gint A_SendKeyStroke (gpointer data)
817 /* gchar *buf = (gchar *) data;*/
819 /* This is wrong. FIX IT */
822 FB61_TX_SendMessage(0x07, 0x0c, buf);
829 static gint A_GetBitmap(gpointer data) {
831 D_Bitmap *d = (D_Bitmap *)data;
834 GSM_DataClear(&gdat);
835 pthread_mutex_lock(&getBitmapMutex);
836 gdat.Bitmap=d->bitmap;
837 error = d->status = SM_Functions(GOP_GetBitmap,&gdat,&statemachine);
838 pthread_cond_signal(&getBitmapCond);
839 pthread_mutex_unlock(&getBitmapMutex);
843 static gint A_SetBitmap(gpointer data) {
845 D_Bitmap *d = (D_Bitmap *)data;
849 GSM_DataClear(&gdat);
850 pthread_mutex_lock(&setBitmapMutex);
851 if (d->bitmap->type == GSM_CallerLogo) {
852 bitmap.type = d->bitmap->type;
853 bitmap.number = d->bitmap->number;
855 error = d->status = SM_Functions(GOP_GetBitmap,&gdat,&statemachine);
856 if (error == GE_NONE) {
857 strncpy(d->bitmap->text,bitmap.text,sizeof(bitmap.text));
858 d->bitmap->ringtone = bitmap.ringtone;
859 gdat.Bitmap=d->bitmap;
860 error = d->status = SM_Functions(GOP_SetBitmap,&gdat,&statemachine);
863 gdat.Bitmap=d->bitmap;
864 error = d->status = SM_Functions(GOP_SetBitmap,&gdat,&statemachine);
866 pthread_cond_signal(&setBitmapCond);
867 pthread_mutex_unlock(&setBitmapMutex);
871 static gint A_GetNetworkInfo(gpointer data) {
873 D_NetworkInfo *d = (D_NetworkInfo *)data;
876 GSM_DataClear(&gdat);
878 pthread_mutex_lock(&getNetworkInfoMutex);
879 gdat.NetworkInfo=d->info;
880 error = d->status = SM_Functions(GOP_GetNetworkInfo,&gdat,&statemachine);
881 pthread_cond_signal(&getNetworkInfoCond);
882 pthread_mutex_unlock(&getNetworkInfoMutex);
886 static gint A_Exit (gpointer data)
889 return (0); /* just to be proper */
893 gint (*DoAction[])(gpointer) = {
896 A_GetMemoryLocationAll,
897 A_WriteMemoryLocation,
898 A_WriteMemoryLocationAll,
900 A_GetCalendarNoteAll,
902 A_DeleteCalendarNote,
925 void *GUI_Connect (void *a)
927 /* Define required unit types for RF and Battery level meters. */
928 GSM_RFUnits rf_units = GRF_Percentage;
929 GSM_BatteryUnits batt_units = GBU_Percentage;
932 GSM_SMSMemoryStatus SMSStatus = {0, 0};
933 gchar number[INCALL_NUMBER_LENGTH];
939 GSM_DataClear(&data);
942 g_print ("Initializing connection...\n");
945 phoneMonitor.working = _("Connecting...");
946 while (!fbusinit (true))
950 g_print ("Phone connected. Starting monitoring...\n");
955 data.RFLevel=&phoneMonitor.rfLevel;
956 data.RFUnits=&rf_units;
957 data.PowerSource=&phoneMonitor.powerSource;
958 data.BatteryUnits=&batt_units;
959 data.BatteryLevel=&phoneMonitor.batteryLevel;
960 data.DateTime=&Alarm;
961 data.SMSStatus=&SMSStatus;
962 data.IncomingCallNr=number;
966 phoneMonitor.working = NULL;
968 /* FIXME - this loop goes mad on my 7110 - so I've put in a usleep */
971 if (SM_Functions(GOP_GetRFLevel,&data,&statemachine) != GE_NONE)
972 phoneMonitor.rfLevel = -1;
974 if (rf_units == GRF_Arbitrary)
975 phoneMonitor.rfLevel *= 25;
977 if (SM_Functions(GOP_GetPowersource,&data,&statemachine) == GE_NONE
978 && phoneMonitor.powerSource == GPS_ACDC)
979 phoneMonitor.batteryLevel = ((gint) phoneMonitor.batteryLevel + 25) % 125;
982 if (SM_Functions(GOP_GetBatteryLevel,&data,&statemachine) != GE_NONE)
983 phoneMonitor.batteryLevel = -1;
984 if (batt_units == GBU_Arbitrary)
985 phoneMonitor.batteryLevel *= 25;
988 if (SM_Functions(GOP_GetAlarm,&data,&statemachine) == GE_NONE && Alarm.AlarmEnabled != 0)
989 phoneMonitor.alarm = TRUE;
991 phoneMonitor.alarm = FALSE;
993 if (SM_Functions(GOP_GetSMSStatus,&data,&statemachine) == GE_NONE)
995 if (phoneMonitor.sms.unRead != SMSStatus.Unread ||
996 phoneMonitor.sms.number != SMSStatus.Number)
998 phoneMonitor.working = _("Refreshing SMSes...");
999 RefreshSMS (SMSStatus.Number);
1000 phoneMonitor.working = NULL;
1003 phoneMonitor.sms.unRead = SMSStatus.Unread;
1006 if (SM_Functions(GOP_GetIncomingCallNr,&data,&statemachine) == GE_NONE)
1009 g_print ("Call in progress: %s\n", phoneMonitor.call.callNum);
1012 GSM->GetDisplayStatus (&status);
1013 if (status & (1<<DS_Call_In_Progress))
1015 pthread_mutex_lock (&callMutex);
1016 phoneMonitor.call.callInProgress = CS_InProgress;
1017 pthread_mutex_unlock (&callMutex);
1021 pthread_mutex_lock (&callMutex);
1022 phoneMonitor.call.callInProgress = CS_Waiting;
1023 strncpy (phoneMonitor.call.callNum, number, INCALL_NUMBER_LENGTH);
1024 pthread_mutex_unlock (&callMutex);
1029 pthread_mutex_lock (&callMutex);
1030 phoneMonitor.call.callInProgress = CS_Idle;
1031 *phoneMonitor.call.callNum = '\0';
1032 pthread_mutex_unlock (&callMutex);
1035 pthread_mutex_lock (&netMonMutex);
1036 if (phoneMonitor.netmonitor.number)
1038 GSM->NetMonitor (phoneMonitor.netmonitor.number,
1039 phoneMonitor.netmonitor.screen);
1040 GSM->NetMonitor (3, phoneMonitor.netmonitor.screen3);
1041 GSM->NetMonitor (4, phoneMonitor.netmonitor.screen4);
1042 GSM->NetMonitor (5, phoneMonitor.netmonitor.screen5);
1046 *phoneMonitor.netmonitor.screen = *phoneMonitor.netmonitor.screen3 =
1047 *phoneMonitor.netmonitor.screen4 = *phoneMonitor.netmonitor.screen5 = '\0';
1049 pthread_mutex_unlock (&netMonMutex);
1051 while ((event = RemoveEvent ()) != NULL)
1054 g_print ("Processing Event: %d\n", event->event);
1056 phoneMonitor.working = _("Working...");
1057 if (event->event <= Event_Exit)
1058 if ((error = DoAction[event->event] (event->data)) != GE_NONE)
1059 g_print (_("Event %d failed with return code %d!\n"), event->event, error);