--- /dev/null
+/*\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 */
+static char *Connection; /* Connection type from .gnokiirc file */
+static char *SynchronizeTime; /* If we set date and time from computer to phone (from .gnokiirc file) */
+static char *BinDir; /* Binaries directory from .gnokiirc file - not used here yet */
+static GSM_ConnectionType connectiontype;
+
+\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,
+ NOTSUPPORTED,
+ NOTSUPPORTED,
+ NOTSUPPORTED,
+ NOTSUPPORTED,
+ NOTSUPPORTED,
+ NOTSUPPORTED
+};\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 */\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;\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;\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;\r
+ CurrentSecurityCodeStatus=&secstatus;\r
+ CurrentSecurityCode=&seccode;\r
+ CurrentDateTime=&date;\r
+ CurrentAlarm=&alarm;\r
+ CurrentCalendarNote=¬e;\r
+ CurrentNetmonitor=&netmon;\r
+ CurrentGetBitmap=&logo;\r
+ CurrentProfile=&profile;\r
+ CurrentCBMessage=&cb;\r
+ CurrentGetOperatorNameNetwork=&netname;\r
+ CurrentGetBinRingtone=&binring;
+ CurrentSimLock=⪝\r \r
+
+ /* Read config file, once again to get real model */
+ if (CFG_ReadConfig(&realmodel, &Port, &Initlength, &Connection, &BinDir, &SynchronizeTime,false) < 0) {
+ exit(-1);
+ }
+
+ connectiontype = GetConnectionTypeFromString(Connection);
+ return (GE_NONE);\r
+}\r
+\r
+
+void Nsniff_DispatchMessage(u16 MessageLength, u8 *MessageBuffer, u8 MessageType)
+{
+
+/* switch to real Model */
+ if (CheckModel (N6110_Information, realmodel, connectiontype))
+ N6110_DispatchMessage( MessageLength, MessageBuffer, MessageType);
+
+ if (CheckModel (N7110_Information, realmodel, connectiontype))
+ N7110_DispatchMessage( MessageLength, MessageBuffer, MessageType);
+}