X-Git-Url: https://git.jankratochvil.net/?p=gnokii.git;a=blobdiff_plain;f=gnokii%2Fgnokii.c;h=df3ce22df724c0741d3c177a43b2083d51d84358;hp=9daceb9b3c7f2c9c044f2cb5f2222ec237004b22;hb=81b1712d54efa46b3148a5beb42d32d7632ef30c;hpb=833e1c7c90e13ceaba3dde8e7a36fcc8dfb1db3c diff --git a/gnokii/gnokii.c b/gnokii/gnokii.c index 9daceb9..df3ce22 100644 --- a/gnokii/gnokii.c +++ b/gnokii/gnokii.c @@ -11,6 +11,8 @@ */ +#include "config.h" + #include #include #include @@ -19,6 +21,11 @@ #include #include +#ifdef UCLINUX +/* or "getopt.h" would include insufficient getopt.h from uClinux */ +#include "../getopt/getopt.h" +#endif /* UCLINUX */ + #ifndef VC6 #if defined(__svr4__) || defined(__FreeBSD__) # include /* for bzero */ @@ -53,32 +60,49 @@ #include "gsm-common.h" #include "gsm-api.h" #include "gsm-networks.h" +#ifndef UCLINUX #include "gsm-ringtones.h" #include "gsm-bitmaps.h" #include "gsm-wap.h" #include "gsm-sms.h" #include "gsm-datetime.h" +#endif /* UCLINUX */ #include "gsm-phonebook.h" +#ifndef UCLINUX #include "gsm-calendar.h" +#endif /* UCLINUX */ #include "gsm-coding.h" +#ifndef UCLINUX #include "newmodules/n6110.h" +#endif #include "files/cfgreader.h" +#ifndef UCLINUX #include "files/gsm-filetypes.h" +#endif /* UCLINUX */ #include "gnokii.h" +#ifdef UCLINUX +#include "data/virtmodem.h" +#endif /* UCLINUX */ #ifdef USE_NLS #include #endif -char *model; /* Model from .gnokiirc file. */ -char *Port; /* Port from .gnokiirc file */ -char *Initlength; /* Init length from .gnokiirc file */ -char *Connection; /* Connection type from .gnokiirc file */ +static char *model; /* 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 */ +#ifndef UCLINUX char *SynchronizeTime; /* If we set date and time from computer to phone (from .gnokiirc file) */ -char *BinDir; /* Binaries directory from .gnokiirc file - not used here yet */ +#endif /* UCLINUX */ +static char *BinDir; /* Binaries directory from .gnokiirc file - not used here yet */ -GSM_SMSMessage SMS[4]; +#ifndef UCLINUX +static GSM_SMSMessage SMS[4]; +#endif /* UCLINUX */ +#ifndef UCLINUX + char *GetProfileCallAlertString(int code) { switch (code) { @@ -214,7 +238,7 @@ char *GetProfileCallerGroups(int code) return BufferProfileGroups; } -char *print_error(GSM_Error e) +static char *print_error(GSM_Error e) { // case GE_DEVICEOPENFAILED: return "Couldn't open specified serial device."; @@ -264,7 +288,6 @@ char *print_error(GSM_Error e) } } - GSM_Error GSM_ReadRingtoneFileOnConsole(char *FileName, GSM_Ringtone *ringtone) { GSM_Error error; @@ -537,7 +560,7 @@ int GSM_SendMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int return 0; } -int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int argc, char *argv[], +static int GSM_SaveMultiPartSMSOnConsole(GSM_MultiSMSMessage *MultiSMS, int argnum, int argc, char *argv[], bool inter, bool unicode, bool profile, bool scale) { int w,i; @@ -682,9 +705,11 @@ void GSM_PlayRingtoneOnConsole(GSM_Ringtone *ringtone) GSM->PlayTone(255*255,0); } +#endif /* UCLINUX */ + /* This function shows the copyright and some informations usefull for debugging. */ -int version(void) +static int version(void) { fprintf(stdout, _("GNOKII Version %s\n" @@ -698,12 +723,32 @@ int version(void) /* The function usage is only informative - it prints this program's usage and command-line options. */ -int usage(void) +static int usage(void) { - fprintf(stdout, _(" usage: gnokii [--help|--monitor [-noloop|-nl]|--version]\n" + fprintf(stdout, _(" usage: gnokii [--help] [--version]\n" + )); +#ifndef UCLINUX +" gnokii --monitor [-noloop|-nl]\n" + )); +#endif /* UCLINUX */ + +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --getmemory memory_type [start [end]] [-short|-v30|-v21|-v]\n" + )); +#else /* UCLINUX */ + fprintf(stdout, _( +" gnokii --getmemory memory_type [start [end]] [-short]\n" + )); +#endif /* UCLINUX */ + + fprintf(stdout, _( " gnokii --writephonebook [-i]\n" + )); + +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --sendphonebookentry destination memory_type location\n" " [--smsc message_center_number] [--smscno message_center_index]\n" " [-s] [-v n] [-d]\n" @@ -711,9 +756,16 @@ int usage(void) " [--smsc message_center_number] [--smscno message_center_index]\n" " [-r] [-i] [-s] [-a] [--name name]\n" " gnokii --getvoicemailbox\n" + )); +#endif /* UCLINUX */ + + fprintf(stdout, _( " gnokii --getspeeddial number\n" " gnokii --setspeeddial number memory_type location\n\n" + )); +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --getsms memory_type start [end] [-f file]\n" " gnokii --getsmsstatus\n" " gnokii --getsmsfolders\n" @@ -814,10 +866,25 @@ int usage(void) " gnokii --sendprofile destination profile_name ringtonefile\n" " picturefile [--smsc message_center_number]\n" " [--smscno message_center_index] [-s] [-v n] [-d] [--scale]\n\n" + )); +#endif /* UCLINUX */ + fprintf(stdout, _( " gnokii --reset [soft|hard]\n" + )); + +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --dialvoice number\n" + )); +#endif /* UCLINUX */ + + fprintf(stdout, _( " gnokii --cancelcall\n" + )); + +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --displayoutput\n" " gnokii --presskeysequence sequence\n" " gnokii --backupsettings file\n" @@ -834,8 +901,15 @@ int usage(void) " gnokii --phonetests\n" " gnokii --simlock\n" " gnokii --getdisplaystatus\n" + )); +#endif /* UCLINUX */ + + fprintf(stdout, _( " gnokii --identify\n\n" + )); +#ifndef UCLINUX + fprintf(stdout, _( " gnokii --getwapbookmark location\n" " gnokii --setwapbookmark title url [location]\n" " gnokii --sendwapbookmark location destination\n" @@ -870,13 +944,21 @@ int usage(void) )); #endif +#endif /* UCLINUX */ + +#ifdef UCLINUX + fprintf(stdout, _( +" gnokii --gnokiid [--debug]\n" + )); +#endif + return 0; } /* fbusinit is the generic function which waits for the FBUS link. The limit is 10 seconds. After 10 seconds we quit. */ -void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) +static void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) { int count=0; @@ -888,7 +970,7 @@ void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) #endif /* Initialise the code for the GSM interface. */ - error = GSM_Initialise(model, Port, Initlength, GetConnectionTypeFromString(Connection), rlp_handler, SynchronizeTime); + error = GSM_Initialise(model, Port, Initlength, GetConnectionTypeFromString(Connection), rlp_handler, ""/*SynchronizeTime*/); if (error != GE_NONE) { fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); @@ -909,7 +991,7 @@ void fbusinit(void (*rlp_handler)(RLP_F96Frame *frame)) /* This function checks that the argument count for a given options is withing an allowed range. */ -int checkargs(int opt, struct gnokii_arg_len gals[], int argc) +static int checkargs(int opt, struct gnokii_arg_len gals[], int argc) { int i; @@ -943,6 +1025,8 @@ int checkargs(int opt, struct gnokii_arg_len gals[], int argc) else return 1; } +static int gnokiid(int argc, char *argv[]); + /* Main function - handles command line arguments, passes them to separate functions accordingly. */ @@ -960,14 +1044,19 @@ int main(int argc, char *argv[]) { "help", no_argument, NULL, OPT_HELP },// Display usage. { "version", no_argument, NULL, OPT_VERSION },// Display version and build information. +#ifndef UCLINUX { "getsmsfolders", no_argument, NULL, OPT_GETSMSFOLDERS },// Gets SMS folders { "getsmsstatus", no_argument, NULL, OPT_GETSMSSTATUS },// Get SMS Folder Status +#endif /* UCLINUX */ { "identify", no_argument, NULL, OPT_IDENTIFY },// Identify +#ifndef UCLINUX { "pmon", no_argument, NULL, OPT_PMON },// For development purposes: run in passive monitoring mode { "foogle", no_argument, NULL, OPT_FOOGLE },// For development purposes: insert you function calls here { "getdatetime", no_argument, NULL, OPT_GETDATETIME },// Get date and time mode { "getalarm", no_argument, NULL, OPT_GETALARM },// Get alarm +#endif /* UCLINUX */ { "cancelcall", no_argument, NULL, OPT_CANCELCALL },// Cancel Call +#ifndef UCLINUX { "getdisplaystatus", no_argument, NULL, OPT_GETDISPLAYSTATUS },// Get display status mode { "allringtones", no_argument, NULL, OPT_ALLRINGTONES },/* Displays names of available ringtones */ { "displayoutput", no_argument, NULL, OPT_DISPLAYOUTPUT },/* Show texts from phone's display */ @@ -979,8 +1068,10 @@ int main(int argc, char *argv[]) { "receivesms", no_argument, NULL, OPT_RECEIVESMS }, { "setoperatorname", optional_argument, NULL, OPT_SETOPERATORNAME },/* Set downloaded operator name */ { "setdatetime", optional_argument, NULL, OPT_SETDATETIME },// Set date and time +#endif /* UCLINUX */ { "writephonebook", optional_argument, NULL, OPT_WRITEPHONEBOOK },// Write phonebook (memory) mode { "reset", optional_argument, NULL, OPT_RESET },// Resets the phone +#ifndef UCLINUX { "monitor", optional_argument, NULL, OPT_MONITOR },// Monitor mode { "setlogo", optional_argument, NULL, OPT_SETLOGO },// Set logo { "getprofile", optional_argument, NULL, OPT_GETPROFILE },// Show profile @@ -993,9 +1084,11 @@ int main(int argc, char *argv[]) { "sendphonebookentry", required_argument, NULL, OPT_SENDPHONEBOOKENTRY}, { "savephonebookentry", required_argument, NULL, OPT_SAVEPHONEBOOKENTRY}, { "deletecalendarnote", required_argument, NULL, OPT_DELCALENDARNOTE },// Delete calendar note mode +#endif /* UCLINUX */ { "getmemory", required_argument, NULL, OPT_GETMEMORY },// Get memory mode { "getspeeddial", required_argument, NULL, OPT_GETSPEEDDIAL },// Get speed dial mode { "setspeeddial", required_argument, NULL, OPT_SETSPEEDDIAL },// Set speed dial mode +#ifndef UCLINUX { "getsms", required_argument, NULL, OPT_GETSMS },// Get SMS message mode { "deletesms", required_argument, NULL, OPT_DELETESMS },// Delete SMS message mode { "sendsms", required_argument, NULL, OPT_SENDSMS },// Send SMS message mode @@ -1047,6 +1140,11 @@ int main(int argc, char *argv[]) { "sniff", optional_argument, NULL, OPT_SNIFFER },// Will show datas from port { "decodefile", required_argument, NULL, OPT_DECODEFILE },//decode input file #endif +#endif /* UCLINUX */ + +#ifdef UCLINUX + { "gnokiid", optional_argument, NULL, OPT_GNOKIID },// gnokiid mode +#endif /* UCLINUX */ { 0, 0, 0, 0}, }; @@ -1057,6 +1155,7 @@ int main(int argc, char *argv[]) struct gnokii_arg_len gals[] = { +#ifndef UCLINUX { OPT_MONITOR, 0, 1, 0 }, #ifdef SECURITY @@ -1081,9 +1180,11 @@ int main(int argc, char *argv[]) { OPT_SAVEPHONEBOOKENTRY,2, 9, 0 }, { OPT_SENDPHONEBOOKENTRY,3, 9, 0 }, { OPT_DELCALENDARNOTE, 1, 1, 0 }, +#endif /* UCLINUX */ { OPT_GETMEMORY, 2, 4, 0 }, { OPT_GETSPEEDDIAL, 1, 1, 0 }, { OPT_SETSPEEDDIAL, 3, 3, 0 }, +#ifndef UCLINUX { OPT_GETSMS, 2, 5, 0 }, { OPT_DELETESMS, 2, 3, 0 }, { OPT_SENDSMS, 1,10, 0 }, @@ -1101,11 +1202,15 @@ int main(int argc, char *argv[]) { OPT_SETRINGTONE, 1, 3, 0 }, { OPT_GETRINGTONE, 1, 2, 0 }, { OPT_PRESSKEYSEQUENCE, 1, 1, 0 }, +#endif /* UCLINUX */ { OPT_RESET, 0, 1, 0 }, +#ifndef UCLINUX { OPT_GETPROFILE, 0, 1, 0 }, { OPT_SETPROFILE, 3, 3, 0 }, { OPT_SENDPROFILE, 4,10, 0 }, +#endif /* UCLINUX */ { OPT_WRITEPHONEBOOK, 0, 1, 0 }, +#ifndef UCLINUX { OPT_PLAYRINGTONE, 1, 1, 0 }, { OPT_COMPOSER, 1, 1, 0 }, { OPT_RINGTONECONVERT, 2, 2, 0 }, @@ -1124,10 +1229,17 @@ int main(int argc, char *argv[]) { OPT_SAVEWAPSETTINGS, 1, 9, 0 }, { OPT_SENDWAPSETTINGS, 2, 9, 0 }, { OPT_DIVERT, 3, 5, 0 }, +#endif /* UCLINUX */ + +#ifdef UCLINUX + { OPT_GNOKIID, 0, 1, 0 }, +#endif /* UCLINUX */ { 0, 0, 0, 0 }, }; + LIVE; + opterr = 0; /* For GNU gettext */ @@ -1143,7 +1255,7 @@ int main(int argc, char *argv[]) #endif /* Read config file */ - if (CFG_ReadConfig(&model, &Port, &Initlength, &Connection, &BinDir, &SynchronizeTime,false) < 0) { + if (CFG_ReadConfig(&model, &Port, &Initlength, &Connection, &BinDir, false) < 0) { exit(-1); } @@ -1195,14 +1307,17 @@ int main(int argc, char *argv[]) // Then, options with no arguments case OPT_HELP: rc = usage(); break; case OPT_VERSION: rc = version(); break; +#ifndef UCLINUX case OPT_MONITOR: rc = monitormode(nargc, nargv); break; case OPT_GETSMSFOLDERS: rc = getsmsfolders(); break; case OPT_GETDATETIME: rc = getdatetime(); break; case OPT_GETALARM: rc = getalarm(); break; case OPT_GETDISPLAYSTATUS: rc = getdisplaystatus(); break; case OPT_PMON: rc = pmon(); break; +#endif /* UCLINUX */ case OPT_WRITEPHONEBOOK: rc = writephonebook(nargc, nargv);break; +#ifndef UCLINUX #ifdef SECURITY case OPT_ENTERSECURITYCODE: rc = entersecuritycode(optarg); break; case OPT_GETSECURITYCODESTATUS: rc = getsecuritycodestatus(); break; @@ -1221,7 +1336,9 @@ int main(int argc, char *argv[]) case OPT_SETDATETIME: rc = setdatetime(nargc, nargv); break; case OPT_SETALARM: rc = setalarm(nargv); break; case OPT_DIALVOICE: rc = dialvoice(optarg); break; +#endif /* UCLINUX */ case OPT_CANCELCALL: rc = cancelcall(); break; +#ifndef UCLINUX case OPT_GETCALENDARNOTE: rc = getcalendarnote(nargc, nargv);break; case OPT_DELCALENDARNOTE: rc = deletecalendarnote(optarg);break; case OPT_SAVECALENDARNOTE: rc = savecalendarnote(nargc, nargv);break; @@ -1229,9 +1346,11 @@ int main(int argc, char *argv[]) case OPT_SAVEPHONEBOOKENTRY: rc = savephonebookentry(nargc, nargv);break; case OPT_SENDPHONEBOOKENTRY: rc = sendphonebookentry(nargc, nargv);break; case OPT_WRITECALENDARNOTE: rc = writecalendarnote(nargv); break; +#endif /* UCLINUX */ case OPT_GETMEMORY: rc = getmemory(nargc, nargv); break; case OPT_GETSPEEDDIAL: rc = getspeeddial(optarg); break; case OPT_SETSPEEDDIAL: rc = setspeeddial(nargv); break; +#ifndef UCLINUX case OPT_GETSMS: rc = getsms(argc, argv); break; case OPT_GETSMSSTATUS: rc = getsmsstatus(argc, argv); break; case OPT_DELETESMS: rc = deletesms(nargc, nargv); break; @@ -1243,7 +1362,9 @@ int main(int argc, char *argv[]) case OPT_GETSMSC: rc = getsmsc(optarg); break; case OPT_RENAMESMSC: rc = renamesmsc(nargc,nargv); break; case OPT_NETMONITOR: rc = netmonitor(optarg); break; +#endif /* UCLINUX */ case OPT_IDENTIFY: rc = identify(); break; +#ifndef UCLINUX case OPT_SETLOGO: rc = setlogo(nargc, nargv); break; case OPT_GETLOGO: rc = getlogo(nargc, nargv); break; case OPT_RECEIVESMS: rc = receivesms(nargc, nargv); break; @@ -1268,7 +1389,9 @@ int main(int argc, char *argv[]) case OPT_PHONETESTS: rc = phonetests(); break; case OPT_SIMLOCKINFO: rc = simlockinfo(); break; case OPT_SENDDTMF: rc = senddtmf(optarg); break; +#endif /* UCLINUX */ case OPT_RESET: rc = reset(nargc,nargv); break; +#ifndef UCLINUX case OPT_GETOPERATORNAME: rc = getoperatorname(); break; case OPT_SETOPERATORNAME: rc = setoperatorname(nargc,nargv);break; case OPT_GETWAPBOOKMARK: rc = getwapbookmark(nargc,nargv);break; @@ -1284,7 +1407,11 @@ int main(int argc, char *argv[]) case OPT_GETVOICEMAILBOX: rc = getvoicemailbox(); break; case OPT_NM_COLLECT: rc = nm_collect(nargc, nargv); break; case OPT_NETMONITORDATA: rc = netmonitordata(nargc, nargv);break; +#endif /* UCLINUX */ +#ifdef UCLINUX + case OPT_GNOKIID: rc = gnokiid(nargc, nargv); break; +#endif /* UCLINUX */ default: fprintf(stderr, _("Unknown option: %d\n"), c); break; } @@ -1299,6 +1426,8 @@ int main(int argc, char *argv[]) exit(-1); } +#ifndef UCLINUX + /* Restores various phone settings from one file */ int restoresettings(char *argv[]) { @@ -1651,7 +1780,7 @@ int sendsms(int argc, char *argv[]) case GSM_DisableFax: case GSM_EnableEmail: case GSM_DisableEmail: - fprintf(stdout,_("Warning: saving %i chars\n"),strlen(MultiSMS.SMS[0].MessageText)); + fprintf(stdout,_("Warning: saving %ld chars\n"),(long)strlen(MultiSMS.SMS[0].MessageText)); msgnum=1; break; default: @@ -1856,7 +1985,7 @@ int savesms(int argc, char *argv[]) case GSM_DisableFax: case GSM_EnableEmail: case GSM_DisableEmail: - fprintf(stdout,_("Warning: saving %i chars\n"),strlen(MultiSMS.SMS[0].MessageText)); + fprintf(stdout,_("Warning: saving %ld chars\n"),(long)strlen(MultiSMS.SMS[0].MessageText)); msgnum=1; break; default: @@ -2705,8 +2834,10 @@ int dialvoice(char *Number) return 0; } +#endif /* UCLINUX */ + /* Cancel a call */ -int cancelcall(void) +static int cancelcall(void) { fbusinit(NULL); @@ -2717,6 +2848,8 @@ int cancelcall(void) return 0; } +#ifndef UCLINUX + int savelogo(int argc, char *argv[]) { GSM_Bitmap bitmap; @@ -3325,7 +3458,7 @@ int setlogo(int argc, char *argv[]) } else { GSM->SetBitmap(&bitmap); GSM->GetBitmap(&oldbit); - fprintf(stderr, _("too long, truncated to \"%s\" (length %i)\n"),oldbit.text,strlen(oldbit.text)); + fprintf(stderr, _("too long, truncated to \"%s\" (length %ld)\n"),oldbit.text,(long)strlen(oldbit.text)); } ok=false; } @@ -3977,6 +4110,53 @@ int monitormode(int argc, char *argv[]) return 0; } +#endif /* UCLINUX */ + +/* Emulation of separate gnokiid binary for uClinux */ + +#ifdef UCLINUX + +static int gnokiid(int argc, char *argv[]) +{ + bool DebugMode; /* When true, run in debug mode */ + char *Model; /* Model from .gnokiirc file. */ + char *Port; /* Port from .gnokiirc file */ + char *Initlength; /* Init length from .gnokiirc file */ + char *Connection; /* Connection type from .gnokiirc file */ + char *BinDir; /* Directory of the mgnokiidev command */ + + /* evaluate for presence of "--debug" argument in parameter */ + DebugMode = false; + if(argc>0) + { + if( strcmp(argv[0],"--debug" )) + { + usage(); + return -1; + } + else + DebugMode = true; + } + +#ifdef DEBUG + fprintf (stderr, _("Entering gnokiid mode...\n")); +#endif + + if (CFG_ReadConfig(&Model, &Port, &Initlength, &Connection, &BinDir, true) < 0) + return(-1); + + if (VM_Initialise(Model, Port, Initlength, GCT_FBUS, BinDir, DebugMode, true, ""/*SynchronizeTime*/) == false) + return (-1); + + VM_Terminate(); + + return 0; +} + +#endif /* UCLINUX */ + +#ifndef UCLINUX + /* Shows texts from phone's display */ int displayoutput() @@ -4461,10 +4641,12 @@ int setprofile(int argc, char *argv[]) } +#endif /* UCLINUX */ + /* Get requested range of memory storage entries and output to stdout in easy-to-parse format */ -int getmemory(int argc, char *argv[]) +static int getmemory(int argc, char *argv[]) { GSM_PhonebookEntry entry; @@ -4492,6 +4674,7 @@ int getmemory(int argc, char *argv[]) fprintf(stderr, _("Unknown memory type %s!\n"), argv[0]); return (-1); } + GetMemoryTypeString(memory_type_string, &entry.MemoryType); if (argv[argc-1][0] == '-') @@ -4539,6 +4722,7 @@ int getmemory(int argc, char *argv[]) i_used++; else if (do_all) break; +#ifndef UCLINUX if (output_opt && !strcmp( output_opt,"-v30")) { semicolon_pipe_substitution( &entry, 0 ); fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,30)); @@ -4554,6 +4738,7 @@ int getmemory(int argc, char *argv[]) fprintf(stdout,_("%s"),GSM_GetVCARD(&entry,10)); formatdone=true; } +#endif /* UCLINUX */ if (output_opt && !strcmp(output_opt,"-short")) { semicolon_pipe_substitution( &entry, 0 ); fprintf(stdout, "%s;%s;%s;%d;%d;", entry.Name, entry.Number, memory_type_string, entry.Location, entry.Group); @@ -4696,7 +4881,7 @@ int getmemory(int argc, char *argv[]) /* Read data from stdin, parse and write to phone. The parsing is relatively crude and doesn't allow for much variation from the stipulated format. */ -int writephonebook(int argc, char *args[]) +static int writephonebook(int argc, char *args[]) { GSM_PhonebookEntry entry; @@ -4912,7 +5097,7 @@ int writephonebook(int argc, char *args[]) /* Getting speed dials. */ -int getspeeddial(char *Number) { +static int getspeeddial(char *Number) { GSM_SpeedDial entry; GSM_Error error; @@ -4945,7 +5130,7 @@ int getspeeddial(char *Number) { /* Setting speed dials. */ -int setspeeddial(char *argv[]) { +static int setspeeddial(char *argv[]) { GSM_SpeedDial entry; @@ -4981,6 +5166,8 @@ int setspeeddial(char *argv[]) { return 0; } +#ifndef UCLINUX + /* Getting the status of the display. */ int getdisplaystatus() @@ -5040,29 +5227,42 @@ int netmonitor(char *Mode) return 0; } -int identify( void ) +#endif /* UCLINUX */ + +static int identify( void ) { /* Hopefully is 64 larger as FB38_MAX* / FB61_MAX* */ char imei[64], model[64], rev[64], manufacturer[64]; + LIVE; fbusinit(NULL); + LIVE; while (GSM->GetIMEI(imei) != GE_NONE) sleep(1); + LIVE; while (GSM->GetRevision(rev) != GE_NONE) sleep(1); + LIVE; while (GSM->GetModel(model) != GE_NONE) sleep(1); + LIVE; strcpy(manufacturer, "(unknown)"); + LIVE; GSM->GetManufacturer(manufacturer); + LIVE; fprintf(stdout, _("IMEI: %s\n"), imei); fprintf(stdout, _("Model: %s %s (%s)\n"), manufacturer, GetModelName (model), model); fprintf(stdout, _("Revision: %s\n"), rev); + LIVE; GSM->Terminate(); + LIVE; return 0; } +#ifndef UCLINUX + int senddtmf(char *String) { @@ -5075,8 +5275,10 @@ int senddtmf(char *String) return 0; } +#endif /* UCLINUX */ + /* Resets the phone */ -int reset(int argc, char *argv[]) +static int reset(int argc, char *argv[]) { unsigned char _type=0x03; @@ -5104,6 +5306,8 @@ int reset(int argc, char *argv[]) return 0; } +#ifndef UCLINUX + /* This is a "convenience" function to allow quick test of new API stuff which doesn't warrant a "proper" command line function. */ @@ -5147,7 +5351,7 @@ int pmon() /* Initialise the code for the GSM interface. */ - error = GSM_Initialise(model, Port, Initlength, connection, RLP_DisplayF96Frame, SynchronizeTime); + error = GSM_Initialise(model, Port, Initlength, connection, RLP_DisplayF96Frame, ""/*SynchronizeTime*/); if (error != GE_NONE) { fprintf(stderr, _("GSM/FBUS init failed! (Unknown model ?). Quitting.\n")); @@ -7643,11 +7847,13 @@ int renamesmsc(int argc, char *argv[]) return 0; } +#endif /* UCLINUX */ + /* * Returns number of sostituited characters. * ... may be useful one day ?? */ -int semicolon_pipe_substitution( GSM_PhonebookEntry *pentry, unsigned int direction ) +static int semicolon_pipe_substitution( GSM_PhonebookEntry *pentry, unsigned int direction ) /* direction = 0 : after reading phone memory ( * 1 : writing phone memory */ @@ -7683,6 +7889,10 @@ int str_substch( char *str, const char toric, const char sost ) return( i_sost ); } +#ifndef UCLINUX + +extern GSM_Error N6110_EnableExtendedCommands (unsigned char status); + /* Allows to set simlock state. With older phone (older 51xx, 61xx) can open them, with older and newer should be able to close them */ @@ -8682,9 +8892,12 @@ int savephonebookentry(int argc, char *argv[]) case GE_NONE: /* Put entry into SMS structure */ +#ifndef UCLINUX if (GetModelFeature(FN_PHONEBOOK)==F_PBK71) { GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,21); - } else { + } else +#endif /* UCLINUX */ + { GSM_SavePhonebookEntryToSMS(&MultiSMS,&entry,10); } @@ -8746,3 +8959,5 @@ int sendphonebookentry(int argc, char *argv[]) return 0; } + +#endif /* UCLINUX */