*/
+#include "config.h"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "gsm-api.h"
+#ifndef UCLINUX
#include "newmodules/n6110.h"
#include "newmodules/n7110.h"
#include "newmodules/newat.h"
#include "newmodules/sniff/sniff.h"
#endif
#include "protocol/fbusirda.h"
+#endif /* UCLINUX */
#include "protocol/fbus.h"
+#ifndef UCLINUX
#include "protocol/mbus.h"
#include "protocol/at.h"
+#endif /* UCLINUX */
#include "files/cfgreader.h"
#ifndef WIN32
unsigned char Current_Revision[GSM_MAX_REVISION_LENGTH];
unsigned char Current_Model[GSM_MAX_MODEL_LENGTH];
+#ifndef UCLINUX
GSM_SMSMessage *CurrentSMSMessage;
GSM_Error CurrentSMSMessageError;
int CurrentSMSPointer;
GSM_OneSMSFolder CurrentSMSFolder;
GSM_Error CurrentSMSFolderError;
int CurrentSMSFolderID;
+#endif /* UCLINUX */
GSM_MemoryStatus *CurrentMemoryStatus;
GSM_Error CurrentMemoryStatusError;
+#ifndef UCLINUX
GSM_NetworkInfo *CurrentNetworkInfo;
GSM_Error CurrentNetworkInfoError;
GSM_DateTime *CurrentDateTime;
GSM_Error CurrentDateTimeError;
+GSM_Error CurrentResetPhoneSettingsError;
+
GSM_DateTime *CurrentAlarm;
GSM_Error CurrentAlarmError;
GSM_Error CurrentSetDateTimeError;
GSM_Error CurrentSetAlarmError;
+int *CurrentFirstCalendarFreePos;
+GSM_Error CurrentFirstCalendarFreePosError;
+#endif /* UCLINUX */
+
GSM_Error CurrentEnableExtendedCommandsError;
int CurrentRFLevel,
CurrentBatteryLevel,
CurrentPowerSource;
+#ifndef UCLINUX
int CurrentDisplayStatus;
GSM_Error CurrentDisplayStatusError;
-GSM_Error CurrentResetPhoneSettingsError;
-
char *CurrentNetmonitor;
GSM_Error CurrentNetmonitorError;
GSM_Error CurrentPressKeyError;
GSM_Error CurrentPlayToneError=GE_UNKNOWN;
+#endif /* UCLINUX */
GSM_Error CurrentDialVoiceError;
+#ifndef UCLINUX
GSM_Error CurrentGetOperatorNameError;
GSM_Network *CurrentGetOperatorNameNetwork;
GSM_Error CurrentSetOperatorNameError;
+#endif /* UCLINUX */
GSM_Error CurrentGetIMEIError;
GSM_Error CurrentGetHWError;
+#ifndef UCLINUX
unsigned char CurrentPPS[4];
GSM_Error CurrentProductProfileSettingsError;
GSM_BinRingtone *CurrentGetBinRingtone=NULL;
GSM_Error CurrentRingtoneError;
+#endif /* UCLINUX */
GSM_Error CurrentMagicError;
+#ifndef UCLINUX
GSM_Error CurrentSimlockInfoError;
GSM_AllSimlocks *CurrentSimLock;
GSM_CallDivert *CurrentCallDivert;
char *CurrentManufacturer;
+#endif /* UCLINUX */
/* This is the connection type used in gnokii. */
GSM_ConnectionType CurrentConnectionType;
bool CurrentRequestTerminate;
+#ifndef UCLINUX
bool CurrentDisableKeepAlive;
+#endif /* UCLINUX */
+#ifdef UCLINUX
+static
+#endif /* UCLINUX */
bool CheckModel (GSM_Information InfoToCheck, char *model, GSM_ConnectionType connection) {
bool found_match=false;
if (strstr(InfoToCheck.FBUSModels, model) != NULL) {
if (connection==GCT_FBUS) found_match=true;
}
+#ifndef UCLINUX
if (strstr(InfoToCheck.MBUSModels, model) != NULL) {
if (connection==GCT_MBUS) found_match=true;
}
if (strstr(InfoToCheck.TekramModels, model) != NULL) {
if (connection==GCT_Tekram) found_match=true;
}
+#endif /* UCLINUX */
return found_match;
}
+#ifndef UCLINUX
+
GSM_Error TryNewNokia(char *model, char *device, char *initlength, GSM_ConnectionType connection, void (*rlp_callback)(RLP_F96Frame *frame)) {
int InitLength;
int count;
while (N6110_GetModel(phonemodel) != GE_NONE)
sleep(1);
+#ifndef UCLINUX
if (!strcmp(phonemodel,"NPE-3") || !strcmp(phonemodel,"NSE-5"))
{
GSM->Terminate();
GSM_LinkOK = &CurrentLinkOK;
return GE_NONE;
}
+#endif /* UCLINUX */
return GE_NONE;
}
+#endif /* UCLINUX */
+
+extern GSM_Information N6110_Information;
+extern GSM_Functions N6110_Functions;
GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_ConnectionType connection, void (*rlp_callback)(RLP_F96Frame *frame), char* SynchronizeTime)
{
GSM_ConnectionType connection2;
+#ifndef UCLINUX
struct tm *now;
time_t nowh;
GSM_DateTime Date;
+#endif /* UCLINUX */
GSM_Error error;
connection2=connection;
CurrentRLP_RXCallback = rlp_callback;
CurrentCallPassup=NULL;
CurrentPhonebookEntry=NULL;
+#ifndef UCLINUX
CurrentNetworkInfo = NULL;
CurrentGetBitmap=NULL;
CurrentPlayToneError=GE_UNKNOWN;
strcpy(CurrentIncomingCall," ");
CurrentGetBinRingtone=NULL;
CurrentNetworkInfo=NULL;
+#endif /* UCLINUX */
CurrentRequestTerminate=false;
+#ifndef UCLINUX
CurrentDisableKeepAlive=false;
CurrentCalendarNotesInfo.HowMany=2000;
+#endif /* UCLINUX */
CurrentMagicError = GE_BUSY;
+#ifndef UCLINUX
if (!strcmp(model,"auto")) {
/* For now */
Protocol = &MBUS_Functions;
CurrentConnectionType=GCT_MBUS;
connection2=GCT_MBUS;
+#ifndef UCLINUX
if (TryNewNokia(model,device,initlength,CurrentConnectionType,rlp_callback)==GE_NONE)
{
found_match=true;
- } else {
+ } else
+#endif /* UCLINUX */
+ {
GSM->Terminate();
}
}
usleep(50);
- } else {
+ } else
+#endif /* UCLINUX */
+ {
+#ifndef UCLINUX
#ifdef DEBUG
if (CheckModel (Nsniff_Information, model, connection)) {
/* Set pointers to relevant addresses */
found_match=true;
}
#endif
+#endif /* UCLINUX */
if (CheckModel (N6110_Information, model, connection)) {
/* Set pointers to relevant addresses */
GSM_LinkOK = &CurrentLinkOK;
found_match=true;
}
+#ifndef UCLINUX
if (CheckModel (N7110_Information, model, connection)) {
/* Set pointers to relevant addresses */
GSM = &N7110_Functions;
GSM_LinkOK = &CurrentLinkOK;
found_match=true;
}
+#endif /* UCLINUX */
if (found_match) {
switch (connection) {
case GCT_FBUS : Protocol = &FBUS_Functions; break;
+#ifndef UCLINUX
case GCT_Infrared: Protocol = &FBUS_Functions; break;
case GCT_Tekram : Protocol = &FBUS_Functions; break;
case GCT_DLR3 : Protocol = &FBUS_Functions; break;
case GCT_Irda : Protocol = &FBUSIRDA_Functions;break;
case GCT_AT : Protocol = &AT_Functions; break;
case GCT_Default : Protocol = NULL; break;
+#endif /* UCLINUX */
}
} else
return GE_NOTSUPPORTED;
/* Now call model specific initialisation code. */
error=(GSM->Initialise(device, initlength, connection2, rlp_callback));
+#ifndef UCLINUX
/* RTH: FIXME: second try for Irda (6210 only?)*/
if ( error!=GE_NONE && connection == GCT_Irda)
{
device_close();
error=(GSM->Initialise(device, initlength, connection2, rlp_callback));
}
+#endif /* UCLINUX */
+#ifndef UCLINUX
if (error==GE_NONE && !strcmp(SynchronizeTime,"yes"))
{
nowh=time(NULL);
/* FIXME: Error checking should be here. */
GSM->SetDateTime(&Date);
}
+#endif /* UCLINUX */
return error;
}
+#ifndef UCLINUX
+
GSM_Error Unimplemented(void)
{
return GE_NOTIMPLEMENTED;
return GE_NOTSUPPORTED;
}
+#endif /* UCLINUX */
+
/* Applications should call N6110_Terminate to shut down the N6110 thread and
close the serial port. */
void NULL_Terminate(void)
GSM_ConnectionType connection=GCT_FBUS;
+#ifndef UCLINUX
if (!strcmp(Connection, "irda")) connection=GCT_Irda;
if (!strcmp(Connection, "infrared")) connection=GCT_Infrared;
if (!strcmp(Connection, "mbus")) connection=GCT_MBUS;
if (!strcmp(Connection, "dlr3")) connection=GCT_DLR3;
if (!strcmp(Connection, "at")) connection=GCT_AT;
if (!strcmp(Connection, "tekram210"))connection=GCT_Tekram;
+#endif /* UCLINUX */
return connection;
}
char *name;
} GSM_MTStrings;
- GSM_MTStrings mystring[] = {
+static GSM_MTStrings mystring[] = {
{GMT_ME,"ME"},
{GMT_SM,"SM"},
{GMT_FD,"FD"},
char *name;
} GSM_MTStrings;
- GSM_MTStrings mystring[] = {
+static GSM_MTStrings mystring[] = {
{GMT_ME,"ME"},
{GMT_SM,"SM"},
{GMT_FD,"FD"},
{"" ,"" ,{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
};
-OnePhoneModel *GetPhoneModelData (const char *num)
+static OnePhoneModel *GetPhoneModelData (const char *num)
{
register int i = 0;
return (GetPhoneModelData(model)->features[num]);
}
+#ifndef UCLINUX
int LogAvailable=-1; //-1 not checked earlier, 0 not, 1 yes
char *logfilename;
{
return AppendLog(buffer,strlen(buffer),format);
}
+#endif /* UCLINUX */