X-Git-Url: https://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=common%2Fgsm-api.c;h=229232d68ee44b2ad67ca233adfb1dc8087a2f0e;hp=99b73d79b8d1fcdc031d7119882067f7895e5983;hb=07e8833740d5c2268df6000ef3856bb05bf0dc67;hpb=833e1c7c90e13ceaba3dde8e7a36fcc8dfb1db3c diff --git a/common/gsm-api.c b/common/gsm-api.c index 99b73d7..229232d 100644 --- a/common/gsm-api.c +++ b/common/gsm-api.c @@ -18,6 +18,8 @@ */ +#include "config.h" + #include #include #include @@ -30,6 +32,7 @@ #include "gsm-api.h" +#ifndef UCLINUX #include "newmodules/n6110.h" #include "newmodules/n7110.h" #include "newmodules/newat.h" @@ -37,9 +40,12 @@ #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 @@ -88,6 +94,7 @@ unsigned char Current_IMEI[GSM_MAX_IMEI_LENGTH]; 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; @@ -99,10 +106,12 @@ int CurrentSMSFoldersCount; GSM_OneSMSFolder CurrentSMSFolder; GSM_Error CurrentSMSFolderError; int CurrentSMSFolderID; +#endif /* UCLINUX */ GSM_MemoryStatus *CurrentMemoryStatus; GSM_Error CurrentMemoryStatusError; +#ifndef UCLINUX GSM_NetworkInfo *CurrentNetworkInfo; GSM_Error CurrentNetworkInfoError; @@ -119,6 +128,8 @@ GSM_SecurityCode *CurrentSecurityCode; GSM_DateTime *CurrentDateTime; GSM_Error CurrentDateTimeError; +GSM_Error CurrentResetPhoneSettingsError; + GSM_DateTime *CurrentAlarm; GSM_Error CurrentAlarmError; @@ -131,17 +142,20 @@ GSM_Error CurrentCalendarNotesInfoError; 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; @@ -164,17 +178,21 @@ int CurrentPressKeyEvent; 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; @@ -184,9 +202,11 @@ GSM_Error CurrentBinRingtoneError; GSM_BinRingtone *CurrentGetBinRingtone=NULL; GSM_Error CurrentRingtoneError; +#endif /* UCLINUX */ GSM_Error CurrentMagicError; +#ifndef UCLINUX GSM_Error CurrentSimlockInfoError; GSM_AllSimlocks *CurrentSimLock; @@ -201,6 +221,7 @@ GSM_Error CurrentCallDivertError; GSM_CallDivert *CurrentCallDivert; char *CurrentManufacturer; +#endif /* UCLINUX */ /* This is the connection type used in gnokii. */ GSM_ConnectionType CurrentConnectionType; @@ -220,8 +241,13 @@ bool CurrentLinkOK; 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; @@ -229,6 +255,7 @@ bool CheckModel (GSM_Information InfoToCheck, char *model, GSM_ConnectionType co 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; } @@ -247,10 +274,13 @@ bool CheckModel (GSM_Information InfoToCheck, char *model, GSM_ConnectionType co 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; @@ -298,6 +328,7 @@ GSM_Error TryNewNokia(char *model, char *device, char *initlength, GSM_Connectio while (N6110_GetModel(phonemodel) != GE_NONE) sleep(1); +#ifndef UCLINUX if (!strcmp(phonemodel,"NPE-3") || !strcmp(phonemodel,"NSE-5")) { GSM->Terminate(); @@ -308,9 +339,14 @@ GSM_Error TryNewNokia(char *model, char *device, char *initlength, GSM_Connectio 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) { @@ -318,9 +354,11 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec GSM_ConnectionType connection2; +#ifndef UCLINUX struct tm *now; time_t nowh; GSM_DateTime Date; +#endif /* UCLINUX */ GSM_Error error; connection2=connection; @@ -328,17 +366,22 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec 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 */ @@ -395,10 +438,13 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec 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(); } } @@ -407,7 +453,10 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec usleep(50); - } else { + } else +#endif /* UCLINUX */ + { +#ifndef UCLINUX #ifdef DEBUG if (CheckModel (Nsniff_Information, model, connection)) { /* Set pointers to relevant addresses */ @@ -417,6 +466,7 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec found_match=true; } #endif +#endif /* UCLINUX */ if (CheckModel (N6110_Information, model, connection)) { /* Set pointers to relevant addresses */ @@ -425,6 +475,7 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec GSM_LinkOK = &CurrentLinkOK; found_match=true; } +#ifndef UCLINUX if (CheckModel (N7110_Information, model, connection)) { /* Set pointers to relevant addresses */ GSM = &N7110_Functions; @@ -439,10 +490,12 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec 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; @@ -450,6 +503,7 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec 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; @@ -459,6 +513,7 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec /* 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) { @@ -468,7 +523,9 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec device_close(); error=(GSM->Initialise(device, initlength, connection2, rlp_callback)); } +#endif /* UCLINUX */ +#ifndef UCLINUX if (error==GE_NONE && !strcmp(SynchronizeTime,"yes")) { nowh=time(NULL); @@ -499,10 +556,13 @@ GSM_Error GSM_Initialise(char *model, char *device, char *initlength, GSM_Connec /* FIXME: Error checking should be here. */ GSM->SetDateTime(&Date); } +#endif /* UCLINUX */ return error; } +#ifndef UCLINUX + GSM_Error Unimplemented(void) { return GE_NOTIMPLEMENTED; @@ -513,6 +573,8 @@ GSM_Error NotSupported(void) 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) @@ -578,12 +640,14 @@ GSM_ConnectionType GetConnectionTypeFromString(char *Connection) { 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; } @@ -597,7 +661,7 @@ bool GetMemoryTypeString(char *memorytext, GSM_MemoryType *type) char *name; } GSM_MTStrings; - GSM_MTStrings mystring[] = { +static GSM_MTStrings mystring[] = { {GMT_ME,"ME"}, {GMT_SM,"SM"}, {GMT_FD,"FD"}, @@ -630,7 +694,7 @@ bool GetMemoryTypeID(char *memorytext, GSM_MemoryType *type) char *name; } GSM_MTStrings; - GSM_MTStrings mystring[] = { +static GSM_MTStrings mystring[] = { {GMT_ME,"ME"}, {GMT_SM,"SM"}, {GMT_FD,"FD"}, @@ -694,7 +758,7 @@ static OnePhoneModel allmodels[] = { {"" ,"" ,{ 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; @@ -726,6 +790,7 @@ int GetModelFeature (featnum_index num) return (GetPhoneModelData(model)->features[num]); } +#ifndef UCLINUX int LogAvailable=-1; //-1 not checked earlier, 0 not, 1 yes char *logfilename; @@ -790,3 +855,4 @@ bool AppendLogText(u8 *buffer,bool format) { return AppendLog(buffer,strlen(buffer),format); } +#endif /* UCLINUX */