http://marcin-wiacek.fkn.pl/english/zips/mygnokii.tar.gz
[gnokii.git] / common / newmodules / sniff / sniff.c
index cf71682..59e7999 100644 (file)
@@ -1,48 +1,48 @@
-/*
-
-  G N O K I I
-
-  A Linux/Unix toolset and driver for Nokia mobile phones.
-
-  Released under the terms of the GNU GPL, see file COPYING for more details.
-
-  This file provides an API for accessing functions on the sniff and similar
-  phones.
-
-*/
-
-/* "Turn on" prototypes in n-sniff.h */
-
-#define __n_sniff_c 
-
-/* System header files */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#ifndef WIN32
-
-  #include "devices/device.h"
-
-#endif
-
-/* Various header file */
-#ifndef VC6
-  #include "config.h"
-#endif
-#include "misc.h"
-#include "gsm-api.h"
-#include "gsm-common.h"
-#include "files/cfgreader.h"
-#include "newmodules/sniff/sniff.h"
-#include "newmodules/n6110.h"
-#include "newmodules/n7110.h"
-#include "gsm-networks.h"
-
-/* Global variables used by code in gsm-api.c to expose the functions
-   supported by this model of phone. */
-
-
+/*\r
+\r
+  G N O K I I\r
+\r
+  A Linux/Unix toolset and driver for Nokia mobile phones.\r
+\r
+  Released under the terms of the GNU GPL, see file COPYING for more details.\r
+\r
+  This file provides an API for accessing functions on the sniff and similar\r
+  phones.\r
+\r
+*/\r
+\r
+/* "Turn on" prototypes in n-sniff.h */\r
+\r
+#define __n_sniff_c \r
+\r
+/* System header files */\r
+#include <stdio.h>\r
+#include <string.h>\r
+#include <stdlib.h>\r
\r
+#ifndef WIN32\r
+\r
+  #include "devices/device.h"\r
+\r
+#endif\r
+\r
+/* Various header file */\r
+#ifndef VC6\r
+  #include "config.h"\r
+#endif\r
+#include "misc.h"\r
+#include "gsm-api.h"\r
+#include "gsm-common.h"\r
+#include "files/cfgreader.h"\r
+#include "newmodules/sniff/sniff.h"\r
+#include "newmodules/n6110.h"\r
+#include "newmodules/n7110.h"\r
+#include "gsm-networks.h"\r
+\r
+/* Global variables used by code in gsm-api.c to expose the functions\r
+   supported by this model of phone. */\r
+\r
+\r
 static char *realmodel;       /* Model from .gnokiirc file. */
 static char *Port;            /* Port from .gnokiirc file */
 static char *Initlength;      /* Init length from .gnokiirc file */
@@ -51,76 +51,76 @@ static char *SynchronizeTime; /* If we set date and time from computer to phone
 static char *BinDir;                 /* Binaries directory from .gnokiirc file - not used here yet */
 static GSM_ConnectionType connectiontype;
 
-
-
-
-
-
-
-/* Here we initialise model specific functions. */
-
-GSM_Functions Nsniff_Functions = {
-  Nsniff_Initialise,
-  Nsniff_DispatchMessage,
-  NULL_Terminate,
-  NULL_KeepAlive,
-  NOTSUPPORTED,
-  NOTSUPPORTED,  
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,
-  NOTSUPPORTED,  NOTSUPPORTED,
+\r
+\r
+\r
+\r
+\r
+\r
+/* Here we initialise model specific functions. */\r
+\r
+GSM_Functions Nsniff_Functions = {\r
+  Nsniff_Initialise,\r
+  Nsniff_DispatchMessage,\r
+  NULL_Terminate,\r
+  NULL_KeepAlive,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,  \r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r
+  NOTSUPPORTED,\r  NOTSUPPORTED,
   NOTSUPPORTED,
   NOTSUPPORTED,
   NOTSUPPORTED,
@@ -130,87 +130,88 @@ GSM_Functions Nsniff_Functions = {
   NOTSUPPORTED,
   NOTSUPPORTED,
   NOTSUPPORTED
-};
-
-
-
-/* for all these Phones we support sniff */
-
-GSM_Information Nsniff_Information = {
-  "3210sniff|3310sniff|3330sniff|5110sniff|5130sniff|5190sniff|6110sniff|6130sniff|6150sniff|6190sniff|8210sniff|8850sniff|6210sniff|6250sniff|7110sniff",
-     /* Supported models in FBUS */
-  "3210sniff|3310sniff|3330sniff|5110sniff|5130sniff|5190sniff|6110sniff|6130sniff|6150sniff|6190sniff|8210sniff|8850sniff|6210sniff|6250sniff|7110sniff",
-     /* Supported models in MBUS */
-  "",
-     /* Supported models in FBUS over infrared */
-  "",
-     /* Supported models in FBUS over DLR3 */
+};\r
+\r
+
+
+/* for all these Phones we support sniff */\r
+\r
+GSM_Information Nsniff_Information = {\r
+  "3210sniff|3310sniff|3330sniff|5110sniff|5130sniff|5190sniff|6110sniff|6130sniff|6150sniff|6190sniff|8210sniff|8850sniff|6210sniff|6250sniff|7110sniff",\r
+     /* Supported models in FBUS */\r
+  "3210sniff|3310sniff|3330sniff|5110sniff|5130sniff|5190sniff|6110sniff|6130sniff|6150sniff|6190sniff|8210sniff|8850sniff|6210sniff|6250sniff|7110sniff",\r
+     /* Supported models in MBUS */\r
+  "",\r
+     /* Supported models in FBUS over infrared */\r
+  "",\r
+     /* Supported models in FBUS over DLR3 */\r
   "",
   "6210decode|6250decode|7110decode", /* Supported models in FBUS over Irda sockets */
   "",
-  4,                     /* Max RF Level */
-  0,                     /* Min RF Level */
-  GRF_Arbitrary,         /* RF level units */
-  4,                     /* Max Battery Level */
-  0,                     /* Min Battery Level */
-  GBU_Arbitrary,         /* Battery level units */
-  GDT_None,              /* No date/time support */
-  GDT_None,             /* No alarm support */
-  0                      /* Max alarms = 0 */
-};
-
-/* Initialise variables and state machine. */
-GSM_Error Nsniff_Initialise(char *port_device, char *initlength,
-                          GSM_ConnectionType connection,
-                          void (*rlp_callback)(RLP_F96Frame *frame))
-{
-
-  GSM_PhonebookEntry phonebook;
-  GSM_SpeedDial speed;
-  GSM_SMSMessage sms;
-  GSM_MemoryStatus status;
-  GSM_NetworkInfo netinfo;
-  GSM_SMSStatus smsstatus;
+  "",
+  4,                     /* Max RF Level */\r
+  0,                     /* Min RF Level */\r
+  GRF_Arbitrary,         /* RF level units */\r
+  4,                     /* Max Battery Level */\r
+  0,                     /* Min Battery Level */\r
+  GBU_Arbitrary,         /* Battery level units */\r
+  GDT_None,              /* No date/time support */\r
+  GDT_None,             /* No alarm support */\r
+  0                      /* Max alarms = 0 */\r
+};\r
+\r
+/* Initialise variables and state machine. */\r
+GSM_Error Nsniff_Initialise(char *port_device, char *initlength,\r
+                          GSM_ConnectionType connection,\r
+                          void (*rlp_callback)(RLP_F96Frame *frame))\r
+{\r
+\r
+  GSM_PhonebookEntry phonebook;\r
+  GSM_SpeedDial speed;\r
+  GSM_SMSMessage sms;\r
+  GSM_MemoryStatus status;\r
+  GSM_NetworkInfo netinfo;\r
+  GSM_SMSStatus smsstatus;\r
   GSM_SMSFolders folders;
-  GSM_MessageCenter smsc;
-  int secstatus;
-  GSM_SecurityCode seccode;
-  GSM_DateTime date;
-  GSM_DateTime alarm;
-  GSM_CalendarNote note;
-  char netmon;
-  GSM_Bitmap logo;
-  GSM_Profile profile;
-  GSM_CBMessage cb;
-  GSM_Network netname;
+  GSM_MessageCenter smsc;\r
+  int secstatus;\r
+  GSM_SecurityCode seccode;\r
+  GSM_DateTime date;\r
+  GSM_DateTime alarm;\r
+  GSM_CalendarNote note;\r
+  char netmon;\r
+  GSM_Bitmap logo;\r
+  GSM_Profile profile;\r
+  GSM_CBMessage cb;\r
+  GSM_Network netname;\r
   GSM_BinRingtone binring;
-  GSM_AllSimlocks siml;    if (Protocol->Initialise(port_device,initlength,connection,rlp_callback)!=GE_NONE)
-  {
-    return GE_NOTSUPPORTED;
-  }
-
-  CurrentLinkOK = true;                           
-
-  CurrentPhonebookEntry=&phonebook;
-  CurrentSpeedDialEntry=&speed;
-  CurrentSMSMessage=&sms;
-  CurrentMemoryStatus=&status;
-  CurrentNetworkInfo=&netinfo;
-  CurrentSMSStatus=&smsstatus;
+  GSM_AllSimlocks siml;\r  \r  if (Protocol->Initialise(port_device,initlength,connection,rlp_callback)!=GE_NONE)\r
+  {\r
+    return GE_NOTSUPPORTED;\r
+  }\r
+\r
+  CurrentLinkOK = true;                           \r
+\r
+  CurrentPhonebookEntry=&phonebook;\r
+  CurrentSpeedDialEntry=&speed;\r
+  CurrentSMSMessage=&sms;\r
+  CurrentMemoryStatus=&status;\r
+  CurrentNetworkInfo=&netinfo;\r
+  CurrentSMSStatus=&smsstatus;\r
   CurrentSMSFolders=&folders;
-  CurrentMessageCenter=&smsc;
-  CurrentSecurityCodeStatus=&secstatus;
-  CurrentSecurityCode=&seccode;
-  CurrentDateTime=&date;
-  CurrentAlarm=&alarm;
-  CurrentCalendarNote=&note;
-  CurrentNetmonitor=&netmon;
-  CurrentGetBitmap=&logo;
-  CurrentProfile=&profile;
-  CurrentCBMessage=&cb;
-  CurrentGetOperatorNameNetwork=&netname;
+  CurrentMessageCenter=&smsc;\r
+  CurrentSecurityCodeStatus=&secstatus;\r
+  CurrentSecurityCode=&seccode;\r
+  CurrentDateTime=&date;\r
+  CurrentAlarm=&alarm;\r
+  CurrentCalendarNote=&note;\r
+  CurrentNetmonitor=&netmon;\r
+  CurrentGetBitmap=&logo;\r
+  CurrentProfile=&profile;\r
+  CurrentCBMessage=&cb;\r
+  CurrentGetOperatorNameNetwork=&netname;\r
   CurrentGetBinRingtone=&binring;
-  CurrentSimLock=&siml;  
+  CurrentSimLock=&siml;\r  \r
 
   /* Read config file, once again to get real model */
     if (CFG_ReadConfig(&realmodel, &Port, &Initlength, &Connection, &BinDir, &SynchronizeTime,false) < 0) {
@@ -218,9 +219,9 @@ GSM_Error Nsniff_Initialise(char *port_device, char *initlength,
     }
 
   connectiontype = GetConnectionTypeFromString(Connection);
-  return (GE_NONE);
-}
-
+  return (GE_NONE);\r
+}\r
+\r
 
 void Nsniff_DispatchMessage(u16 MessageLength, u8 *MessageBuffer, u8 MessageType)
 {