From 62e92aa86b6281b4e4c2a2bdb57f3ceb5a87f4e3 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 25 Oct 2004 08:56:23 +0000 Subject: gammu updates --- (limited to 'gammu') diff --git a/gammu/emb/common/common.pro b/gammu/emb/common/common.pro index 797199b..af45382 100644 --- a/gammu/emb/common/common.pro +++ b/gammu/emb/common/common.pro @@ -71,15 +71,10 @@ HEADERS += config.h \ service/gsmprof.h \ service/gsmring.h \ device/bluetoth/affix.h \ - device/bluetoth/blue_w32.h \ device/bluetoth/bluetoth.h \ device/bluetoth/bluez.h \ device/irda/irda.h \ - device/irda/irda_unx.h \ - device/irda/irda_w32.h \ device/serial/ser_djg.h \ - device/serial/ser_unx.h \ - device/serial/ser_w32.h \ misc/coding/coding.h \ misc/coding/md5.h \ phone/alcatel/alcatel.h \ @@ -111,6 +106,7 @@ HEADERS += config.h \ phone/nokia/dct3/dct3func.h \ phone/nokia/dct3/n6110.h \ phone/nokia/dct3/n7110.h \ + phone/nokia/dct3/n0650.h \ phone/nokia/dct3/n9210.h \ phone/nokia/dct4/dct4func.h \ phone/nokia/dct4/n3320.h \ @@ -141,7 +137,6 @@ service/backup/backvcf.c \ service/backup/backics.c \ device/bluetoth/affix.c \ device/bluetoth/bluez.c \ -device/bluetoth/blue_w32.c \ device/bluetoth/bluetoth.c \ device/serial/ser_djg.c \ device/irda/irda.c \ @@ -161,6 +156,7 @@ phone/at/sonyeric.c \ phone/alcatel/alcatel.c \ phone/nokia/dct3/n6110.c \ phone/nokia/dct3/n7110.c \ +phone/nokia/dct3/n0650.c \ phone/nokia/dct3/n9210.c \ phone/nokia/dct3/dct3func.c \ phone/nokia/dct4/n3320.c \ @@ -181,8 +177,18 @@ OBJECTS_DIR = obj/unix MOC_DIR = moc/unix unix: { -SOURCES += device/serial/ser_unx.c +HEADERS += device/serial/ser_unx.h \ + device/irda/irda_unx.h + +SOURCES += device/serial/ser_unx.c \ + } win32:{ -SOURCES += device/serial/ser_w32.c + +HEADERS += device/serial/ser_w32.h \ + device/irda/irda_w32.h \ + device/bluetoth/blue_w32.h + +SOURCES += device/serial/ser_w32.c \ + device/bluetoth/blue_w32.c } diff --git a/gammu/emb/common/commonE.pro b/gammu/emb/common/commonE.pro index f5b559d..1512814 100644 --- a/gammu/emb/common/commonE.pro +++ b/gammu/emb/common/commonE.pro @@ -71,15 +71,12 @@ HEADERS += config.h \ service/gsmprof.h \ service/gsmring.h \ device/bluetoth/affix.h \ - device/bluetoth/blue_w32.h \ device/bluetoth/bluetoth.h \ device/bluetoth/bluez.h \ device/irda/irda.h \ device/irda/irda_unx.h \ - device/irda/irda_w32.h \ device/serial/ser_djg.h \ device/serial/ser_unx.h \ - device/serial/ser_w32.h \ misc/coding/coding.h \ misc/coding/md5.h \ phone/alcatel/alcatel.h \ @@ -114,6 +111,7 @@ HEADERS += config.h \ phone/nokia/dct3/n9210.h \ phone/nokia/dct4/dct4func.h \ phone/nokia/dct4/n3320.h \ + phone/nokia/dct3/n0650.h \ phone/nokia/dct4/n3650.h \ phone/nokia/dct4/n6510.h SOURCES +=gsmcomon.c \ @@ -141,7 +139,6 @@ service/backup/backvcf.c \ service/backup/backics.c \ device/bluetoth/affix.c \ device/bluetoth/bluez.c \ -device/bluetoth/blue_w32.c \ device/bluetoth/bluetoth.c \ device/serial/ser_unx.c \ device/serial/ser_djg.c \ @@ -167,6 +164,7 @@ phone/nokia/dct3/dct3func.c \ phone/nokia/dct4/n3320.c \ phone/nokia/dct4/n3650.c \ phone/nokia/dct4/n6510.c \ +phone/nokia/dct3/n0650.c \ phone/nokia/dct4/dct4func.c \ phone/nokia/nauto.c \ phone/nokia/nfunc.c \ @@ -179,3 +177,11 @@ DESTDIR = $(QPEDIR)/lib OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) CONFIG = warn_off release console + + + + + # device/bluetoth/blue_w32.h \ + # device/irda/irda_w32.h \ + # device/serial/ser_w32.h \ + # device/bluetoth/blue_w32.c \ \ No newline at end of file diff --git a/gammu/emb/common/device/serial/ser_djg.c b/gammu/emb/common/device/serial/ser_djg.c index 2524187..609deb8 100644 --- a/gammu/emb/common/device/serial/ser_djg.c +++ b/gammu/emb/common/device/serial/ser_djg.c @@ -1,3 +1,8 @@ +/* Some sources from SVAsync (c) 1996, 1997, Samuel Vincent + * 7337 Carioca Ct, Rohnert Park, Ca 94928 + * "you may freely use it in your programs without paying me anything" + */ +/* Some sources from DZCOMM */ #include "../../gsmstate.h" @@ -5,55 +10,419 @@ #ifdef DJGPP #include "../../gsmcomon.h" +#include "../../misc/coding/coding.h" #include "ser_djg.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern unsigned short __djgpp_ds_alias; +extern void SVAsyncProtISR(void); + +static unsigned char SVAsyncStatus=0; + +static void lock_interrupt_memory(void); +static void unlock_interrupt_memory(void); + +#define Ctrl8259_0 0x020 /* 8259 port */ +#define Ctrl8259_1 0x021 /* 8259 port (Masks) */ +#define BufSize 32768 /* Buffer Size */ + +static unsigned char VectorNum; /* Vector Number */ +static unsigned char EnableIRQ; /* Mask to enable 8259 IRQ */ +static unsigned char DisableIRQ; /* Mask to disable 8259 IRQ */ +static _go32_dpmi_seginfo ProtVector; /* Old Protmode Vector */ +static _go32_dpmi_seginfo info; /* New Protmode Vector */ + +/* Register Addresses for the UART */ +static unsigned short Port; /* Port Base Address */ +unsigned short THR; /* Transmitter Holding Register */ +unsigned short RDR; /* Reciever Data Register */ +unsigned short BRDL; /* Baud Rate Divisor, Low byte */ +unsigned short BRDH; /* Baud Rate Divisor, High Byte */ +unsigned short IER; /* Interupt Enable Register */ +unsigned short IIR; /* Interupt Identification Register */ +unsigned short FCR; /* FIFO Control Register */ +unsigned short LCR; /* Line Control Register */ +unsigned short MCR; /* Modem Control Register */ +unsigned short LSR; /* Line Status Register */ +unsigned short MSR; /* Modem Status Register */ +unsigned short SCR; /* SCR Register */ + +/* Data Buffer */ +unsigned volatile char RecBuffer[BufSize] = { 0 }; +unsigned volatile int RecHead, RecTail; + +/* This uninstalls the ISR and resets the serial port. */ +static void SVAsyncStop(void) +{ + if(!SVAsyncStatus) return; + SVAsyncStatus = 0; + + /***** Mask (disable) 8259 IRQ Interrupt */ + outportb(Ctrl8259_1, (inportb(Ctrl8259_1) | DisableIRQ)); + + /***** Disable 8250 interrupt */ + outportb(LCR, (inportb(LCR) & 0x7F)); + outportb(IER, 0); + + /***** Set bit 3 in MCR to 0 */ + outportb(MCR, (inportb(MCR) & 0xF7)); + + /***** Interrupts are disabled. Restore saved interrupt vector. */ + _go32_dpmi_set_protected_mode_interrupt_vector(VectorNum, &ProtVector); +} + +/* This will empty the receive buffer */ +static void SVAsyncClear(void) +{ + disable(); + RecHead = 0; + RecTail = 0; + enable(); +} + + +/* Sets communication parameters + * Baud = 150, 300, 600, 1200, 2400, 4800, 9600, 19200, 28800, 38400, 57600 + * Control = The value to place in the LCR + */ +void SVAsyncSet(unsigned int Baud, unsigned int Control) +{ + int divisor; + unsigned char divlow, divhigh; + + if (!Baud) return; + + divisor = 115200 / Baud; + + disable(); + + outportb(LCR, Control | 0x80); /* Set Port Toggle to BRDL/BRDH registers */ + divlow = divisor & 0x000000ff; + divhigh = (divisor >> 8) & 0x000000ff; + outportb(BRDL, divlow); /* Set Baud Rate */ + outportb(BRDH, divhigh); + + outportb(LCR, Control & 0x007F); /* Set LCR and Port Toggle */ + + enable(); +} + +/* Sets various handshaking lines */ +void SVAsyncHand(unsigned int Hand) +{ + outportb(MCR, Hand | 0x08); /* Keep interrupt enable ON */ +} + +static void lock_interrupt_memory(void) +{ + int errval; + __dpmi_meminfo info; + unsigned long address; + + __dpmi_get_segment_base_address(_my_ds(), &address); + + info.address = (int) address + (int) &RDR; + info.size = sizeof(RDR); + errval = __dpmi_lock_linear_region(&info); + if(errval == -1) printf("Error in locking memory\n!"); + + info.address = (int) address + (int) &LSR; + info.size = sizeof(LSR); + errval = __dpmi_lock_linear_region(&info); + if(errval == -1) printf("Error in locking memory\n!"); + + info.address = (int) address + (int) &RecHead; + info.size = sizeof(RecHead); + errval = __dpmi_lock_linear_region(&info); + if(errval == -1) printf("Error in locking memory\n!"); + + info.address = (int) address + (int) &RecBuffer; + info.size = sizeof(RecBuffer); + errval = __dpmi_lock_linear_region(&info); + if(errval == -1) printf("Error in locking memory\n!"); + + info.address = (int) address + (int) RecBuffer; + info.size = BufSize; + errval = __dpmi_lock_linear_region(&info); + if(errval == -1) printf("Error in locking memory\n!"); + + __dpmi_get_segment_base_address(_my_cs(), &address); + + info.address = (int) address + (int) SVAsyncProtISR; + info.size = 4096; /* 4096 bytes is probably overkill. */ + errval = __dpmi_lock_linear_region(&info); + if(errval == -1) printf("Error in locking memory\n!"); +} + +static void unlock_interrupt_memory(void) +{ + __dpmi_meminfo info; + unsigned long address; + + __dpmi_get_segment_base_address(_my_ds(), &address); + info.address = (int) address + (int) &RDR; + info.size = sizeof(RDR); + __dpmi_unlock_linear_region(&info); + info.address = (int) address + (int) &LSR; + info.size = sizeof(LSR); + __dpmi_unlock_linear_region(&info); + info.address = (int) address + (int) &RecHead; + info.size = sizeof(RecHead); + __dpmi_unlock_linear_region(&info); + info.address = (int) address + (int) &RecBuffer; + info.size = sizeof(RecBuffer); + __dpmi_unlock_linear_region(&info); + info.address = (int) address + (int) RecBuffer; + info.size = BufSize; + __dpmi_unlock_linear_region(&info); + + __dpmi_get_segment_base_address(_my_cs(), &address); + + info.address = (int) address + (int) SVAsyncProtISR; + info.size = 4096; /* probably overkill */ + __dpmi_unlock_linear_region(&info); +} + static GSM_Error serial_close(GSM_StateMachine *s) { - GSM_Device_SerialData *d = &s->Device.Data.Serial; + SVAsyncStop(); - return ERR_NOTIMPLEMENTED; + return ERR_NONE; } static GSM_Error serial_open (GSM_StateMachine *s) { - GSM_Device_SerialData *d = &s->Device.Data.Serial; - - return ERR_NOTIMPLEMENTED; + GSM_Device_SerialData *d = &s->Device.Data.Serial; + unsigned char temp; + int i; + + /**** Set various things according to com port number */ + if (mystrncasecmp(s->CurrentConfig->Device,"com1:",0)) { + Port = 0x03F8; + VectorNum = 0x0C; + EnableIRQ = 0xEF; + DisableIRQ = 0x10; + } else if (mystrncasecmp(s->CurrentConfig->Device,"com2:",0)) { + Port = 0x02F8; + VectorNum = 0x0B; + EnableIRQ = 0xF7; + DisableIRQ = 0x08; + } else if (mystrncasecmp(s->CurrentConfig->Device,"com3:",0)) { + Port = 0x03E8; + VectorNum = 0x0C; + EnableIRQ = 0xEF; + DisableIRQ = 0x10; + } else if (mystrncasecmp(s->CurrentConfig->Device,"com4:",0)) { + Port = 0x02E8; + VectorNum = 0x0B; + EnableIRQ = 0xF7; + DisableIRQ = 0x08; + } else return ERR_NOTSUPPORTED; + + /**** Compute Register locations */ + THR = Port; + RDR = Port; + BRDL = Port; + BRDH = 1 + Port; + IER = 1 + Port; + IIR = 2 + Port; + FCR = 2 + Port; + LCR = 3 + Port; + MCR = 4 + Port; + LSR = 5 + Port; + MSR = 6 + Port; + SCR = 7 + Port; + + /***** Initalize Buffer */ + SVAsyncClear(); + + lock_interrupt_memory(); + atexit(unlock_interrupt_memory); + /***** Set bit 3 in MCR to 0 */ + outportb(MCR, (inportb(MCR) & 0xF7)); + + /*** Save and reassign interrupt vectors */ + + _go32_dpmi_get_protected_mode_interrupt_vector(VectorNum, &ProtVector); + + info.pm_offset = (int) SVAsyncProtISR; + info.pm_selector = _my_cs(); + _go32_dpmi_set_protected_mode_interrupt_vector(VectorNum, &info); + + atexit(SVAsyncStop); + + /***** Enable 8259 interrupt (IRQ) line for this async adapter */ + outportb(Ctrl8259_1, (inportb(Ctrl8259_1) & EnableIRQ)); + + /***** Enable 8250 Interrupt-on-data-ready */ + outportb(LCR, (inportb(LCR) & 0x7F)); + + outportb(IER, 0); + if (inportb(IER)) { + SVAsyncStatus = 0; + return ERR_UNKNOWN; + } + outportb(IER, 0x01); + + /***** Clear 8250 Status and data registers */ + do { + temp=inportb(RDR); + temp=inportb(LSR); + temp=inportb(MSR); + temp=inportb(IIR); + } while(!(temp & 1)); + + /***** Set Bit 3 of MCR -- Enable interupts */ + outportb(MCR, (inportb(MCR) | 0x08)); + + SVAsyncStatus = 1; + /***** Clear Buffer Just in case */ + SVAsyncClear(); + + /* Code based on stuff from SVAsync lib. + * Clear UART Status and data registers + * setting up FIFO if possible + */ + outportb(SCR, 0x55); + if (inportb(SCR) == 0x55) { + /* On the off chance that SCR is actually hardwired to 0x55, + * do the same check with a different value. + */ + outportb(SCR, 0xAA); + if (inportb(SCR) == 0xAA) { + /* The chip is better than an 8250 - it has a scratch pad */ + outportb(SCR, i); /* Set SCR back to what it was before */ + inportb(SCR); /* Give slow motherboards a chance */ + + /* Is there a FIFO ? - go through twice for slow motherboards */ + outportb(FCR, 0x01); + i = inportb(FCR); + outportb(FCR, 0x01); + i = inportb(FCR); + + /* Some old stuff relies on this (no idea why) */ + outportb(FCR, 0x00); + inportb(FCR); /* Give slow motherboards a chance */ + + if ((i&0x80) == 0) { + smprintf(s,"UART 16450 or UART 8250 with scratch pad\n"); + } else if ((i&0x40) == 0) { + smprintf(s,"UART 16550 - broken FIFO\n"); + } else { + /* It's a 16450A series : try and start the FIFO. + * It appears that some chips need a two call protocol, but + * those that don't seem to work even if you do start it + * twice. The first call is simply to start it, the second + * starts it and sets an 8 byte FIFO trigger level. + */ + outportb(FCR, 0x01); + inportb(FCR); /* Give slow motherboards a chance */ + outportb(FCR, 0x87); + inportb(FCR); /* Give slow motherboards a chance */ + + /* Check that the FIFO initialised */ + if ((inportb(IIR) & 0xc0) != 0xc0) { + /* + * It didn't so we assume it isn't there but disable it to + * be on the safe side. + */ + outportb(IIR, 0xfe); + inportb(IIR); /* Give slow motherboards a chance */ + smprintf(s,"UART 16450A - FIFO disabled\n"); + } else { + smprintf(s,"UART 16450A - FIFO enabled\n"); + } + } + } else { + smprintf(s,"UART 8250\n"); + } + } + + d->Control = BITS_8 | STOP_1; + d->Parity = false; + d->Speed = 9600; + SVAsyncSet(d->Speed,d->Control | NO_PARITY); + + return ERR_NONE; } static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) { GSM_Device_SerialData *d = &s->Device.Data.Serial; - return ERR_NOTIMPLEMENTED; + d->Parity = parity; + + if (parity) { + SVAsyncSet(d->Speed, d->Control | ODD_PARITY); + } else { + SVAsyncSet(d->Speed, d->Control | NO_PARITY); + } + + return ERR_NONE; } static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts) { - GSM_Device_SerialData *d = &s->Device.Data.Serial; + if (dtr && rts) { + SVAsyncHand(DTR | RTS); + } else if (dtr) { + SVAsyncHand(DTR); + } else if (rts) { + SVAsyncHand(RTS); + } else { + SVAsyncHand(0); + } - return ERR_NOTIMPLEMENTED; + return ERR_NONE; } static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) { GSM_Device_SerialData *d = &s->Device.Data.Serial; - return ERR_NOTIMPLEMENTED; + d->Speed = speed; + + if (d->Parity) { + SVAsyncSet(d->Speed, d->Control | ODD_PARITY); + } else { + SVAsyncSet(d->Speed, d->Control | NO_PARITY); + } + + return ERR_NONE; } -static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) +static int serial_read(GSM_StateMachine *s, char *buf, size_t nbytes) { - GSM_Device_SerialData *d = &s->Device.Data.Serial; + if(RecTail == RecHead) return 0; + + disable(); + buf[0] = RecBuffer[RecTail++]; + if(RecTail >= BufSize) RecTail = 0; + enable(); - return 0; + return 1; } -static int serial_write(GSM_StateMachine *s, void *buf, size_t nbytes) +static int serial_write(GSM_StateMachine *s, char *buf, size_t nbytes) { - GSM_Device_SerialData *d = &s->Device.Data.Serial; + int i; + + for (i=0;iDevice.Data.Serial; - struct termios t; - int i; + struct termios t; + int i; /* O_NONBLOCK MUST is required to avoid waiting for DCD */ d->hPhone = open(s->CurrentConfig->Device, O_RDWR | O_NOCTTY | O_NONBLOCK); @@ -124,7 +133,7 @@ static GSM_Error serial_open (GSM_StateMachine *s) static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) { GSM_Device_SerialData *d = &s->Device.Data.Serial; - struct termios t; + struct termios t; if (tcgetattr(d->hPhone, &t)) { GSM_OSErrorInfo(s,"tcgetattr in serial_setparity"); @@ -150,8 +159,8 @@ static GSM_Error serial_setparity(GSM_StateMachine *s, bool parity) static GSM_Error serial_setdtrrts(GSM_StateMachine *s, bool dtr, bool rts) { GSM_Device_SerialData *d = &s->Device.Data.Serial; - struct termios t; - unsigned int flags; + struct termios t; + unsigned int flags; if (tcgetattr(d->hPhone, &t)) { GSM_OSErrorInfo(s,"tcgetattr in serial_setdtrrts"); @@ -264,8 +273,8 @@ static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) { GSM_Device_SerialData *d = &s->Device.Data.Serial; struct timeval timeout2; - fd_set readfds; - int actual = 0; + fd_set readfds; + int actual = 0; FD_ZERO(&readfds); FD_SET(d->hPhone, &readfds); @@ -283,8 +292,8 @@ static int serial_read(GSM_StateMachine *s, void *buf, size_t nbytes) static int serial_write(GSM_StateMachine *s, void *buf, size_t nbytes) { GSM_Device_SerialData *d = &s->Device.Data.Serial; - int ret; - size_t actual = 0; + int ret; + size_t actual = 0; do { ret = write(d->hPhone, (unsigned char *)buf, nbytes - actual); diff --git a/gammu/emb/common/device/serial/ser_w32.c b/gammu/emb/common/device/serial/ser_w32.c index 7d88fc7..a7919fe 100644 --- a/gammu/emb/common/device/serial/ser_w32.c +++ b/gammu/emb/common/device/serial/ser_w32.c @@ -4,6 +4,15 @@ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * GNU GPL version 2 or later */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #include "../../gsmstate.h" diff --git a/gammu/emb/common/gsmstate.c b/gammu/emb/common/gsmstate.c index 31e365d..c65dc01 100644 --- a/gammu/emb/common/gsmstate.c +++ b/gammu/emb/common/gsmstate.c @@ -554,7 +554,7 @@ static GSM_Error CheckReplyFunctions(GSM_StateMachine *s, GSM_Reply_Function *Re bool execute; bool available = false; int i = 0; -// int j; +// int j; while (Reply[i].requestID!=ID_None) { execute=false; @@ -870,6 +870,7 @@ static OnePhoneModel allmodels[] = { #ifdef GSM_ENABLE_NOKIA6510 {"3100" ,"RH-19" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme {"3100b","RH-50" ,"", {F_PBKTONEGAL,F_PBKSMSLIST,0}},//fixme + {"3105" ,"RH-48" ,"Nokia 3105", {F_PBKTONEGAL,F_PBKSMSLIST,F_VOICETAGS,0}},//fixme {"3108", "RH-6", "Nokia 3108", {0}}, //does it have irda ? {"3200", "RH-30" ,"Nokia 3200", {F_PBKTONEGAL,0}},//fixme {"3200a","RH-31" ,"Nokia 3200", {F_PBKTONEGAL,0}},//fixme @@ -954,8 +955,8 @@ static OnePhoneModel allmodels[] = { {"6610i","RM-37" ,"Nokia 6610i",{F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, {"6800" ,"NSB-9" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, {"6800" ,"NHL-6" ,"Nokia 6800", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}}, - {"6810" ,"RM-2" ,"Nokia 6810", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},//quess - {"6820" ,"NHL-9" ,"Nokia 6820", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,0}},//quess + {"6810" ,"RM-2" ,"Nokia 6810", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_NOTES,0}},//quess + {"6820" ,"NHL-9" ,"Nokia 6820", {F_PBKTONEGAL,F_TODO66,F_PBKSMSLIST,F_NOTES,0}},//quess #endif #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) {"7110" ,"NSE-5" ,"Nokia 7110", {F_CAL62,0}}, diff --git a/gammu/emb/common/gsmstate.h b/gammu/emb/common/gsmstate.h index 2b4806c..6861fbc 100644 --- a/gammu/emb/common/gsmstate.h +++ b/gammu/emb/common/gsmstate.h @@ -378,6 +378,7 @@ typedef enum { ID_SetOBEX, ID_SetUSSD, ID_GetNote, + ID_SetNote, ID_GetSignalQuality, ID_GetBatteryCharge, ID_GetSMSFolders, @@ -1290,9 +1291,34 @@ typedef struct { */ GSM_Error (*SetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); /** - * Gets note. + * Retrieves notes status (number of used entries). */ - GSM_Error (*GetNextNote) (GSM_StateMachine *s, GSM_NoteEntry *Note, bool refresh); + GSM_Error (*GetNotesStatus) (GSM_StateMachine *s, GSM_ToDoStatus *status); + /** + * Retrieves notes entry. + */ + GSM_Error (*GetNote) (GSM_StateMachine *s, GSM_NoteEntry *Note); + /** + * Retrieves note entry. This is useful for continuous reading of all + * notes entries. + */ + GSM_Error (*GetNextNote) (GSM_StateMachine *s, GSM_NoteEntry *Note, bool start); + /** + * Sets note entry + */ + GSM_Error (*SetNote) (GSM_StateMachine *s, GSM_NoteEntry *Note); + /** + * Adds note entry. + */ + GSM_Error (*AddNote) (GSM_StateMachine *s, GSM_NoteEntry *Note); + /** + * Deletes note entry. + */ + GSM_Error (*DeleteNote) (GSM_StateMachine *s, GSM_NoteEntry *Note); + /** + * Deletes all notes entries. + */ + GSM_Error (*DeleteAllNotes) (GSM_StateMachine *s); /** * Reads profile. */ diff --git a/gammu/emb/common/phone/alcatel/alcatel.c b/gammu/emb/common/phone/alcatel/alcatel.c index 3821f13..b75077f 100644 --- a/gammu/emb/common/phone/alcatel/alcatel.c +++ b/gammu/emb/common/phone/alcatel/alcatel.c @@ -3979,7 +3979,13 @@ GSM_Phone_Functions ALCATELPhone = { ALCATEL_DeleteAllCalendar, NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ NOTSUPPORTED, /* GetProfile */ NOTSUPPORTED, /* SetProfile */ NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/at/atgen.c b/gammu/emb/common/phone/at/atgen.c index ba23eb2..a875f0a 100644 --- a/gammu/emb/common/phone/at/atgen.c +++ b/gammu/emb/common/phone/at/atgen.c @@ -696,7 +696,7 @@ GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc) { unsigned char req[50]; - if (smsc->Location!=1) return ERR_NOTSUPPORTED; + if (smsc->Location!=1) return ERR_INVALIDLOCATION; sprintf(req, "AT+CSCA=\"%s\"\r",DecodeUnicodeString(smsc->Number)); @@ -3839,7 +3839,13 @@ GSM_Phone_Functions ATGENPhone = { NOTIMPLEMENTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ NOTSUPPORTED, /* GetProfile */ NOTSUPPORTED, /* SetProfile */ NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/at/sonyeric.c b/gammu/emb/common/phone/at/sonyeric.c index 8eeb39b..363e043 100644 --- a/gammu/emb/common/phone/at/sonyeric.c +++ b/gammu/emb/common/phone/at/sonyeric.c @@ -14,10 +14,11 @@ #include "atgen.h" #include "sonyeric.h" -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) #include "../obex/obexgen.h" +extern GSM_Protocol_Functions OBEXProtocol; extern GSM_Reply_Function OBEXGENReplyFunctions[]; extern GSM_Reply_Function ATGENReplyFunctions[]; @@ -124,7 +125,7 @@ static GSM_Error SONYERIC_SetFile(GSM_StateMachine *s, unsigned char *FileName, GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) { -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) GSM_Error error; GSM_ToDoEntry ToDo; int Pos, num, Loc; @@ -160,7 +161,7 @@ GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start) { -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) GSM_Error error; GSM_CalendarEntry Calendar; int Pos, num, Loc; @@ -199,7 +200,7 @@ GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool st GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) { -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) GSM_Error error; GSM_ToDoEntry ToDo; GSM_CalendarEntry Calendar; @@ -230,7 +231,7 @@ GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) { -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) unsigned char req[5000]; int size=0; @@ -246,7 +247,7 @@ GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) { -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; unsigned char req[5000]; int size=0; @@ -265,7 +266,7 @@ GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) { -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) GSM_Error error; int Pos,Level = 0,Used; unsigned char *Buf; @@ -317,7 +318,7 @@ GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) { -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) GSM_Error error; int Pos,Level = 0,Loc=0,Used; GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; @@ -372,7 +373,7 @@ GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status) { -#ifdef GSM_ENABLE_OBEXGEN +#if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) GSM_Error error; GSM_ToDoEntry ToDo; GSM_CalendarEntry Calendar; diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.c b/gammu/emb/common/phone/nokia/dct3/dct3func.c index 17cd0a4..9810a35 100644 --- a/gammu/emb/common/phone/nokia/dct3/dct3func.c +++ b/gammu/emb/common/phone/nokia/dct3/dct3func.c @@ -4,6 +4,15 @@ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * GNU GPL version 2 or later */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #include /* memcpy only */ #include @@ -457,10 +466,10 @@ GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s smprintf(s, "\n"); smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic"); if (msg.Buffer[8]<0x03) { - sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); + sprintf(NetInfo.CID, "%02X%02X", msg.Buffer[10], msg.Buffer[11]); smprintf(s, "CID : %s\n", NetInfo.CID); - sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); + sprintf(NetInfo.LAC, "%02X%02X", msg.Buffer[12], msg.Buffer[13]); smprintf(s, "LAC : %s\n", NetInfo.LAC); NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode); @@ -511,8 +520,8 @@ GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+2]=0x00; } NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->NetworkInfo->NetworkCode); - sprintf(Data->NetworkInfo->CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); - sprintf(Data->NetworkInfo->LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); + sprintf(Data->NetworkInfo->CID, "%02X%02X", msg.Buffer[10], msg.Buffer[11]); + sprintf(Data->NetworkInfo->LAC, "%02X%02X", msg.Buffer[12], msg.Buffer[13]); } } /* 6210/6250/7110 */ diff --git a/gammu/emb/common/phone/nokia/dct3/n0650.c b/gammu/emb/common/phone/nokia/dct3/n0650.c new file mode 100644 index 0000000..3899a16 --- a/dev/null +++ b/gammu/emb/common/phone/nokia/dct3/n0650.c @@ -0,0 +1,150 @@ +/* (c) 2004 by Marcin Wiacek */ + +#include +#include + +#include "../../../gsmcomon.h" +#include "../../../gsmstate.h" +#include "../nfunc.h" + +#ifdef GSM_ENABLE_NOKIA650 + +static GSM_Reply_Function N650ReplyFunctions[] = { + {DCT3DCT4_ReplyGetModelFirmware,"\xD2",0x02,0x00,ID_GetModel }, + {DCT3DCT4_ReplyGetModelFirmware,"\xD2",0x02,0x00,ID_GetFirmware }, + + {NULL, "\x00",0x00,0x00,ID_None } +}; + +GSM_Phone_Functions N650Phone = { + "0650", + N650ReplyFunctions, + NONEFUNCTION, /* Initialise */ + NONEFUNCTION, /* Terminate */ + GSM_DispatchMessage, + NOTSUPPORTED, /* ShowStartInfo */ + NOKIA_GetManufacturer, + DCT3DCT4_GetModel, + DCT3DCT4_GetFirmware, + NOTSUPPORTED, /* GetIMEI */ + NOTSUPPORTED, /* GetOriginalIMEI */ + NOTSUPPORTED, /* GetManufactureMonth */ + NOTSUPPORTED, /* GetProductCode */ + NOTSUPPORTED, /* GetHardware */ + NOTSUPPORTED, /* GetPPM */ + NOTSUPPORTED, /* GetSIMIMSI */ + NOTSUPPORTED, /* GetDateTime */ + NOTSUPPORTED, /* SetDateTime */ + NOTSUPPORTED, /* GetAlarm */ + NOTSUPPORTED, /* SetAlarm */ + NOTSUPPORTED, /* GetLocale */ + NOTSUPPORTED, /* SetLocale */ + NOTSUPPORTED, /* PressKey */ + NOTSUPPORTED, /* Reset */ + NOTSUPPORTED, /* ResetPhoneSettings */ + NOTSUPPORTED, /* EnterSecurityCode */ + NOTSUPPORTED, /* GetSecurityStatus */ + NOTSUPPORTED, /* GetDisplayStatus */ + NOTSUPPORTED, /* SetAutoNetworkLogin */ + NOTSUPPORTED, /* GetBatteryCharge */ + NOTSUPPORTED, /* GetSignalQuality */ + NOTSUPPORTED, /* GetNetworkInfo */ + NOTSUPPORTED, /* GetCategory */ + NOTSUPPORTED, /* AddCategory */ + NOTSUPPORTED, /* GetCategoryStatus */ + NOTSUPPORTED, /* GetMemoryStatus */ + NOTSUPPORTED, /* GetMemory */ + NOTSUPPORTED, /* GetNextMemory */ + NOTSUPPORTED, /* SetMemory */ + NOTSUPPORTED, /* AddMemory */ + NOTSUPPORTED, /* DeleteMemory */ + NOTIMPLEMENTED, /* DeleteAllMemory */ + NOTSUPPORTED, /* GetSpeedDial */ + NOTSUPPORTED, /* SetSpeedDial */ + NOTSUPPORTED, /* GetSMSC */ + NOTSUPPORTED, /* SetSMSC */ + NOTSUPPORTED, /* GetSMSStatus */ + NOTSUPPORTED, /* GetSMS */ + NOTSUPPORTED, /* GetNextSMS */ + NOTSUPPORTED, /* SetSMS */ + NOTSUPPORTED, /* AddSMS */ + NOTSUPPORTED, /* DeleteSMS */ + NOTSUPPORTED, /* SendSMSMessage */ + NOTSUPPORTED, /* SendSavedSMS */ + NOTSUPPORTED, /* SetIncomingSMS */ + NOTSUPPORTED, /* SetIncomingCB */ + NOTSUPPORTED, /* GetSMSFolders */ + NOTSUPPORTED, /* AddSMSFolder */ + NOTSUPPORTED, /* DeleteSMSFolder */ + NOTSUPPORTED, /* DialVoice */ + NOTSUPPORTED, /* AnswerCall */ + NOTSUPPORTED, /* CancelCall */ + NOTSUPPORTED, /* HoldCall */ + NOTSUPPORTED, /* UnholdCall */ + NOTSUPPORTED, /* ConferenceCall */ + NOTSUPPORTED, /* SplitCall */ + NOTSUPPORTED, /* TransferCall */ + NOTSUPPORTED, /* SwitchCall */ + NOTSUPPORTED, /* GetCallDivert */ + NOTSUPPORTED, /* SetCallDivert */ + NOTSUPPORTED, /* CancelAllDiverts */ + NOTSUPPORTED, /* SetIncomingCall */ + NOTSUPPORTED, /* SetIncomingUSSD */ + NOTSUPPORTED, /* SendDTMF */ + NOTSUPPORTED, /* GetRingtone */ + NOTSUPPORTED, /* SetRingtone */ + NOTSUPPORTED, /* GetRingtonesInfo */ + NOTSUPPORTED, /* DeleteUserRingtones */ + NOTSUPPORTED, /* PlayTone */ + NOTSUPPORTED, /* GetWAPBookmark */ + NOTSUPPORTED, /* SetWAPBookmark */ + NOTSUPPORTED, /* DeleteWAPBookmark */ + NOTSUPPORTED, /* GetWAPSettings */ + NOTSUPPORTED, /* SetWAPSettings */ + NOTSUPPORTED, /* GetMMSSettings */ + NOTSUPPORTED, /* SetMMSSettings */ + NOTSUPPORTED, /* GetBitmap */ + NOTSUPPORTED, /* SetBitmap */ + NOTSUPPORTED, /* GetToDoStatus */ + NOTSUPPORTED, /* GetToDo */ + NOTSUPPORTED, /* GetNextToDo */ + NOTSUPPORTED, /* SetToDo */ + NOTSUPPORTED, /* AddToDo */ + NOTSUPPORTED, /* DeleteToDo */ + NOTSUPPORTED, /* DeleteAllToDo */ + NOTSUPPORTED, /* GetCalendarStatus */ + NOTSUPPORTED, /* GetCalendar */ + NOTSUPPORTED, /* GetNextCalendar */ + NOTSUPPORTED, /* SetCalendar */ + NOTSUPPORTED, /* AddCalendar */ + NOTSUPPORTED, /* DeleteCalendar */ + NOTSUPPORTED, /* DeleteAllCalendar */ + NOTSUPPORTED, /* GetCalendarSettings */ + NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ + NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ + NOTSUPPORTED, /* GetProfile */ + NOTSUPPORTED, /* SetProfile */ + NOTSUPPORTED, /* GetFMStation */ + NOTSUPPORTED, /* SetFMStation */ + NOTSUPPORTED, /* ClearFMStations */ + NOTSUPPORTED, /* GetNextFileFolder */ + NOTSUPPORTED, /* GetFilePart */ + NOTSUPPORTED, /* AddFilePart */ + NOTSUPPORTED, /* GetFileSystemStatus */ + NOTSUPPORTED, /* DeleteFile */ + NOTSUPPORTED, /* AddFolder */ + NOTSUPPORTED, /* GetGPRSAccessPoint */ + NOTSUPPORTED /* SetGPRSAccessPoint */ +}; + +#endif + +/* How should editor hadle tabs in this file? Add editor commands here. + * vim: noexpandtab sw=8 ts=8 sts=8: + */ diff --git a/gammu/emb/common/phone/nokia/dct3/n0650.h b/gammu/emb/common/phone/nokia/dct3/n0650.h new file mode 100644 index 0000000..be491eb --- a/dev/null +++ b/gammu/emb/common/phone/nokia/dct3/n0650.h @@ -0,0 +1,18 @@ +/* (c) 2004 by Marcin Wiacek */ + +#ifndef n650_h +#define n650_h + +typedef struct { + int fake; +} GSM_Phone_N650Data; + +#ifndef GSM_USED_MBUS2 +# define GSM_USED_MBUS2 +#endif + +#endif + +/* How should editor hadle tabs in this file? Add editor commands here. + * vim: noexpandtab sw=8 ts=8 sts=8: + */ diff --git a/gammu/emb/common/phone/nokia/dct3/n6110.c b/gammu/emb/common/phone/nokia/dct3/n6110.c index dac6c12..c3ddfb6 100644 --- a/gammu/emb/common/phone/nokia/dct3/n6110.c +++ b/gammu/emb/common/phone/nokia/dct3/n6110.c @@ -4,6 +4,15 @@ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * GNU GPL version 2 or later */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #include "../../../gsmstate.h" @@ -2868,7 +2877,13 @@ GSM_Phone_Functions N6110Phone = { NOTIMPLEMENTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ - NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ + NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ N6110_GetProfile, N6110_SetProfile, NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/nokia/dct3/n7110.c b/gammu/emb/common/phone/nokia/dct3/n7110.c index b597f9b..a8e0545 100644 --- a/gammu/emb/common/phone/nokia/dct3/n7110.c +++ b/gammu/emb/common/phone/nokia/dct3/n7110.c @@ -3,6 +3,15 @@ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * GNU GPL version 2 or later */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #include "../../../gsmstate.h" @@ -1706,7 +1715,13 @@ GSM_Phone_Functions N7110Phone = { NOTIMPLEMENTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ N7110_GetProfile, N7110_SetProfile, NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/nokia/dct3/n9210.c b/gammu/emb/common/phone/nokia/dct3/n9210.c index ff71ad3..f535c2a 100644 --- a/gammu/emb/common/phone/nokia/dct3/n9210.c +++ b/gammu/emb/common/phone/nokia/dct3/n9210.c @@ -374,7 +374,13 @@ GSM_Phone_Functions N9210Phone = { NOTSUPPORTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ NOTIMPLEMENTED, /* GetProfile */ NOTSUPPORTED, /* SetProfile */ NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/nokia/dct4/n3320.c b/gammu/emb/common/phone/nokia/dct4/n3320.c index 9b1d6cd..9dd9ffb 100644 --- a/gammu/emb/common/phone/nokia/dct4/n3320.c +++ b/gammu/emb/common/phone/nokia/dct4/n3320.c @@ -249,7 +249,13 @@ GSM_Phone_Functions N3320Phone = { NOTIMPLEMENTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ NOTSUPPORTED, /* GetProfile */ NOTSUPPORTED, /* SetProfile */ NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/nokia/dct4/n3650.c b/gammu/emb/common/phone/nokia/dct4/n3650.c index d4746a7..f1fa826 100644 --- a/gammu/emb/common/phone/nokia/dct4/n3650.c +++ b/gammu/emb/common/phone/nokia/dct4/n3650.c @@ -370,7 +370,13 @@ GSM_Phone_Functions N3650Phone = { NOTIMPLEMENTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ NOTSUPPORTED, /* GetProfile */ NOTSUPPORTED, /* SetProfile */ NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.c b/gammu/emb/common/phone/nokia/dct4/n6510.c index 2208def..c481863 100644 --- a/gammu/emb/common/phone/nokia/dct4/n6510.c +++ b/gammu/emb/common/phone/nokia/dct4/n6510.c @@ -4,6 +4,15 @@ * GNU GPL version 2 or later */ /* function for making CRC for filesystem (c) 2003 by Michael Schroeder */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #include "../../../gsmstate.h" @@ -286,10 +295,10 @@ static GSM_Error N6510_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMa DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); - sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[current+1], msg.Buffer[current+2]); + sprintf(NetInfo.LAC, "%02X%02X", msg.Buffer[current+1], msg.Buffer[current+2]); smprintf(s, "LAC : %s\n", NetInfo.LAC); - sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[current+5], msg.Buffer[current+6]); + sprintf(NetInfo.CID, "%02X%02X", msg.Buffer[current+5], msg.Buffer[current+6]); smprintf(s, "CID : %s\n", NetInfo.CID); tmp = 10; @@ -311,8 +320,8 @@ static GSM_Error N6510_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMa if (Data->NetworkInfo->State == GSM_HomeNetwork || Data->NetworkInfo->State == GSM_RoamingNetwork) { tmp = 10; NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,Data->NetworkInfo->NetworkName,true); - sprintf(Data->NetworkInfo->LAC, "%02x%02x", msg.Buffer[current+1], msg.Buffer[current+2]); - sprintf(Data->NetworkInfo->CID, "%02x%02x", msg.Buffer[current+5], msg.Buffer[current+6]); + sprintf(Data->NetworkInfo->LAC, "%02X%02X", msg.Buffer[current+1], msg.Buffer[current+2]); + sprintf(Data->NetworkInfo->CID, "%02X%02X", msg.Buffer[current+5], msg.Buffer[current+6]); NOKIA_DecodeNetworkCode(msg.Buffer + (current+7),Data->NetworkInfo->NetworkCode); } } @@ -1127,10 +1136,8 @@ static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) GSM_SMSMessage sms; GSM_Phone_Bitmap_Types Type; int Width, Height, i, count; -#ifdef DEVELOP unsigned char folderid; - int location; -#endif + int location; GSM_NetworkInfo NetInfo; GSM_Error error; unsigned char reqStartup[1000] = { @@ -1255,7 +1262,6 @@ static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) case GSM_PictureImage: error = N6510_GetPictureImage(s, Bitmap, &sms.Location); if (error == ERR_NONE) { -#ifdef DEVELOP sms.Folder = 0; N6510_GetSMSLocation(s, &sms, &folderid, &location); switch (folderid) { @@ -1265,9 +1271,6 @@ static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) } reqPicture[6]=location / 256; reqPicture[7]=location; -#else - return ERR_NOTSUPPORTED; -#endif } Type = GSM_NokiaPictureImage; count = 78; @@ -2419,6 +2422,9 @@ static GSM_Error N6510_ReplySaveSMSMessage(GSM_Protocol_Message msg, GSM_StateMa case 0x02: printf("Incorrect location\n"); return ERR_INVALIDLOCATION; + case 0x03: + printf("Memory full (for example no empty space in SIM)\n"); + return ERR_FULL; case 0x05: printf("Incorrect folder\n"); return ERR_INVALIDLOCATION; @@ -2676,6 +2682,8 @@ static GSM_Error N6510_ReplyGetRingtonesInfo(GSM_Protocol_Message msg, GSM_State memset(Data->RingtonesInfo,0,sizeof(GSM_AllRingtonesInfo)); if (msg.Buffer[4] * 256 + msg.Buffer[5] == 0x00) return ERR_EMPTY; Data->RingtonesInfo->Number = msg.Buffer[4] * 256 + msg.Buffer[5]; + // allocate array of ringtones based on number + Data->RingtonesInfo->Ringtone = calloc(Data->RingtonesInfo->Number, sizeof(GSM_RingtoneInfo)); tmp = 6; for (i=0;iRingtonesInfo->Number;i++) { Data->RingtonesInfo->Ringtone[i].Group = msg.Buffer[tmp+4]; @@ -2754,7 +2762,7 @@ static GSM_Error N6510_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) { - GSM_AllRingtonesInfo Info; + GSM_AllRingtonesInfo Info = {0, NULL}; GSM_Error error; unsigned char req2[6] = {N7110_FRAME_HEADER, 0x12, 0x00, 0xe7}; /* Location */ @@ -2774,7 +2782,9 @@ static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256; req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256; smprintf(s, "Getting binary ringtone\n"); - return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); + error = GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); + if (Info.Ringtone) free(Info.Ringtone); + return error; case RING_MIDI: case RING_MMF: return ERR_NOTSUPPORTED; @@ -4054,6 +4064,97 @@ GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, bool start return N6510_PrivGetGenericCalendar3(s, LastNote->Location[Note->Location-1], ID_GetNote); } +static GSM_Error N6510_DeleteNote(GSM_StateMachine *s, GSM_NoteEntry *Not) +{ + GSM_Error error; + GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote; + GSM_CalendarEntry Note; + + if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED; + + error=N6510_GetCalendarInfo3(s,LastNote,2); + if (error!=ERR_NONE) return error; + + smprintf(s, "Deleting Note\n"); + + if (Not->Location > LastNote->Number || Not->Location == 0) return ERR_INVALIDLOCATION; + + Note.Location = LastNote->Location[Not->Location-1]; + return N71_65_DelCalendar(s,&Note); +} + +static GSM_Error N6510_ReplyGetNoteFirstLoc(GSM_Protocol_Message msg, GSM_StateMachine *s) +{ + smprintf(s, "First Note location: %i\n",msg.Buffer[8]*256+msg.Buffer[9]); + s->Phone.Data.Note->Location = msg.Buffer[8]*256+msg.Buffer[9]; + return ERR_NONE; +} + +static GSM_Error N6510_ReplyAddNote(GSM_Protocol_Message msg, GSM_StateMachine *s) +{ + smprintf(s, "ToDo added\n"); + return ERR_NONE; +} + +static GSM_Error N6510_AddNote(GSM_StateMachine *s, GSM_NoteEntry *Not) +{ + GSM_Error error; + int count=54; + unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x95, + 0x02}; /* 1 = todo, 2 = note */ + unsigned char req[5000] = { + N6110_FRAME_HEADER, 0x65, + 0x02, /* 0 = calendar, 1 = todo, 2 = note */ + 0x00, 0x00, 0x00, + 0x00, 0x00, /* location */ + 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, /* alarm */ + 0x80, 0x00, 0x00, + 0xA9, /* note icon */ + 0x00, 0x00, 0x00, 0x00, /* alarm type */ + 0x00, /* 0x02 or 0x00 */ + 0x80, /* note type */ + 0x07, 0xD2, 0x01, 0x01, 0x00, 0x00, /* start date/time */ + 0x07, 0xD2, 0x01, 0x11, 0x00, 0x00, /* end date/time */ + 0x00, 0x00, /* recurrance */ + 0xFF, 0xFF, /* birth year */ + 0x00, /* ToDo priority */ + 0x00, /* ToDo completed ? */ + 0x00, 0x00, 0x00, + 0x00, /* note text length */ + 0x00, /* phone length/meeting place */ + 0x00, 0x00, 0x00}; + + s->Phone.Data.Note = Not; + + smprintf(s, "Getting first free Note location\n"); + error = GSM_WaitFor (s, reqLoc, 5, 0x13, 4, ID_SetNote); + if (error!=ERR_NONE) return error; + req[8] = Not->Location/256; + req[9] = Not->Location%256; + + req[49] = UnicodeLength(Not->Text); + CopyUnicodeString(req+54,Not->Text); + count+= req[49]*2; + + req[count++] = 0x00; + + smprintf(s, "Adding Note\n"); + return GSM_WaitFor (s, req, count, 0x13, 4, ID_SetNote); +} + +static GSM_Error N6510_GetNoteStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) +{ + GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote; + GSM_Error error; + + error = N6510_GetCalendarInfo3(s,LastNote,2); + if (error!=ERR_NONE) return error; + + status->Used = LastNote->Number; + return ERR_NONE; +} + static int N6510_FindFileCheckSum(unsigned char *ptr, int len) { int acc, i, accx; @@ -5189,7 +5290,7 @@ static GSM_Error N6510_ReplyAddToDo2(GSM_Protocol_Message msg, GSM_StateMachine static GSM_Error N6510_ReplyGetToDoFirstLoc2(GSM_Protocol_Message msg, GSM_StateMachine *s) { smprintf(s, "First ToDo location method 2: %i\n",msg.Buffer[8]*256+msg.Buffer[9]); - s->Phone.Data.ToDo->Location = msg.Buffer[9]; + s->Phone.Data.ToDo->Location = msg.Buffer[8]*256+msg.Buffer[9]; return ERR_NONE; } @@ -5201,7 +5302,8 @@ static GSM_Error N6510_AddToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) GSM_Error error; GSM_DateTime DT; int Text, Alarm, EndTime, Completed, count=54, Phone; - unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x95, 0x01}; + unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x95, + 0x01}; /* 1 = todo, 2 = note */ unsigned char req[5000] = { N6110_FRAME_HEADER, 0x65, 0x01, /* 0 = calendar, 1 = todo */ @@ -5585,6 +5687,7 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/ {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/ {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo }, + {N6510_ReplyAddNote, "\x13",0x03,0x66,ID_SetNote }, {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/ {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo }, {N6510_ReplyGetNote, "\x13",0x03,0x7E,ID_GetNote }, @@ -5593,6 +5696,7 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings }, {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/ {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo }, + {N6510_ReplyGetNoteFirstLoc, "\x13",0x03,0x96,ID_SetNote }, {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/ {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo }, {N6510_ReplyGetNoteInfo, "\x13",0x03,0x9F,ID_GetNote }, @@ -5732,7 +5836,7 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { }; GSM_Phone_Functions N6510Phone = { - "1100|1100a|1100b|3100|3100b|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|5140|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6610i|6800|6810|6820|7210|7250|7250i|7600|8310|8390|8910|8910i", + "1100|1100a|1100b|3100|3100b|3105|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|5140|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6610i|6800|6810|6820|7210|7250|7250i|7600|8310|8390|8910|8910i", N6510ReplyFunctions, N6510_Initialise, NONEFUNCTION, /* Terminate */ @@ -5841,7 +5945,13 @@ GSM_Phone_Functions N6510Phone = { NOTIMPLEMENTED, /* DeleteAllCalendar */ N6510_GetCalendarSettings, NOTSUPPORTED, /* SetCalendarSettings */ + N6510_GetNoteStatus, + NOTIMPLEMENTED, /* GetNote */ N6510_GetNextNote, + NOTIMPLEMENTED, /* SetNote */ + N6510_AddNote, + N6510_DeleteNote, + NOTSUPPORTED, /* DeleteAllNotes */ N6510_GetProfile, N6510_SetProfile, N6510_GetFMStation, diff --git a/gammu/emb/common/phone/nokia/nauto.c b/gammu/emb/common/phone/nokia/nauto.c index 3bb53ec..3c7f2cd 100644 --- a/gammu/emb/common/phone/nokia/nauto.c +++ b/gammu/emb/common/phone/nokia/nauto.c @@ -121,7 +121,13 @@ GSM_Phone_Functions NAUTOPhone = { NOTSUPPORTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ NOTSUPPORTED, /* GetProfile */ NOTSUPPORTED, /* SetProfile */ NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/obex/obexgen.c b/gammu/emb/common/phone/obex/obexgen.c index 3106369..b91afac 100644 --- a/gammu/emb/common/phone/obex/obexgen.c +++ b/gammu/emb/common/phone/obex/obexgen.c @@ -829,7 +829,13 @@ GSM_Phone_Functions OBEXGENPhone = { NOTIMPLEMENTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ NOTIMPLEMENTED, /* GetProfile */ NOTIMPLEMENTED, /* SetProfile */ NOTIMPLEMENTED, /* GetFMStation */ diff --git a/gammu/emb/common/phone/pfunc.c b/gammu/emb/common/phone/pfunc.c index a03a81d..fe890fc 100644 --- a/gammu/emb/common/phone/pfunc.c +++ b/gammu/emb/common/phone/pfunc.c @@ -61,6 +61,7 @@ GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigne } if (SMS->PDU == SMS_Deliver) { if (SMS->SMSC.Number[0] == 0x00 && SMS->SMSC.Number[1] == 0x00) { + smprintf(s,"No SMSC in SMS Deliver\n"); return ERR_EMPTYSMSC; } } diff --git a/gammu/emb/common/phone/symbian/mroutgen.c b/gammu/emb/common/phone/symbian/mroutgen.c index a7382cf..63d26cf 100644 --- a/gammu/emb/common/phone/symbian/mroutgen.c +++ b/gammu/emb/common/phone/symbian/mroutgen.c @@ -198,7 +198,13 @@ GSM_Phone_Functions MROUTERGENPhone = { NOTSUPPORTED, /* DeleteAllCalendar */ NOTSUPPORTED, /* GetCalendarSettings */ NOTSUPPORTED, /* SetCalendarSettings */ + NOTSUPPORTED, /* GetNoteStatus */ + NOTSUPPORTED, /* GetNote */ NOTSUPPORTED, /* GetNextNote */ + NOTSUPPORTED, /* SetNote */ + NOTSUPPORTED, /* AddNote */ + NOTSUPPORTED, /* DeleteNote */ + NOTSUPPORTED, /* DeleteAllNotes */ NOTSUPPORTED, /* GetProfile */ NOTSUPPORTED, /* SetProfile */ NOTSUPPORTED, /* GetFMStation */ diff --git a/gammu/emb/common/protocol/nokia/fbus2.c b/gammu/emb/common/protocol/nokia/fbus2.c index 2b41f8b..967eaa4 100644 --- a/gammu/emb/common/protocol/nokia/fbus2.c +++ b/gammu/emb/common/protocol/nokia/fbus2.c @@ -4,6 +4,15 @@ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * GNU GPL version 2 or later */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #include "../../gsmstate.h" @@ -145,6 +154,7 @@ static GSM_Error FBUS2_StateMachine(GSM_StateMachine *s, unsigned char rx_char) s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE) { smprintf(s, "[Received Ack of type %02x, seq %02x]\n",d->Msg.Buffer[0],seq_num); } + free(d->Msg.Buffer); d->MsgRXState = RX_Sync; return ERR_NONE; diff --git a/gammu/emb/common/protocol/nokia/fbus2.h b/gammu/emb/common/protocol/nokia/fbus2.h index 8dbcb07..3d31006 100644 --- a/gammu/emb/common/protocol/nokia/fbus2.h +++ b/gammu/emb/common/protocol/nokia/fbus2.h @@ -4,6 +4,15 @@ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * GNU GPL version 2 or later */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #ifndef fbus2_h #define fbus2_h diff --git a/gammu/emb/common/protocol/nokia/phonet.c b/gammu/emb/common/protocol/nokia/phonet.c index db5bd72..495a1bf 100644 --- a/gammu/emb/common/protocol/nokia/phonet.c +++ b/gammu/emb/common/protocol/nokia/phonet.c @@ -3,6 +3,15 @@ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * GNU GPL version 2 or later */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #include "../../gsmstate.h" diff --git a/gammu/emb/common/protocol/nokia/phonet.h b/gammu/emb/common/protocol/nokia/phonet.h index e750bbd..7626c23 100644 --- a/gammu/emb/common/protocol/nokia/phonet.h +++ b/gammu/emb/common/protocol/nokia/phonet.h @@ -3,6 +3,15 @@ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * GNU GPL version 2 or later */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #ifndef PHONET_h #define PHONET_h diff --git a/gammu/emb/common/service/backup/backgen.h b/gammu/emb/common/service/backup/backgen.h index 9a930fc..9d97954 100644 --- a/gammu/emb/common/service/backup/backgen.h +++ b/gammu/emb/common/service/backup/backgen.h @@ -64,7 +64,7 @@ typedef struct { } GSM_SMS_Backup; extern GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); -extern GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup); +extern GSM_Error GSM_AddSMSBackupFile (char *FileName, GSM_SMS_Backup *backup); #endif diff --git a/gammu/emb/common/service/backup/backtext.c b/gammu/emb/common/service/backup/backtext.c index 4cb1bb7..07a3b22 100644 --- a/gammu/emb/common/service/backup/backtext.c +++ b/gammu/emb/common/service/backup/backtext.c @@ -2996,7 +2996,7 @@ GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) return GSM_ReadSMSBackupTextFile(FileName, backup); } -GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) +static GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) { int i,w,current; unsigned char buffer[10000]; @@ -3004,7 +3004,11 @@ GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) fprintf(file,"\n# File created by Gammu (www.mwiacek.com) version %s\n",VERSION); GSM_GetCurrentDateTime (&DT); - fprintf(file,"# Saved %s\n\n",OSDateTime(DT,false)); + fprintf(file,"# Saved "); + fprintf(file, "%04d%02d%02dT%02d%02d%02d", + DT.Year, DT.Month, DT.Day, + DT.Hour, DT.Minute, DT.Second); + fprintf(file," (%s)\n\n",OSDateTime(DT,false)); i=0; while (backup->SMS[i]!=NULL) { @@ -3088,11 +3092,11 @@ GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) return ERR_NONE; } -GSM_Error GSM_SaveSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) +GSM_Error GSM_AddSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) { FILE *file; - file = fopen(FileName, "wb"); + file = fopen(FileName, "ab"); if (file == NULL) return(ERR_CANTOPENFILE); SaveSMSBackupTextFile(file,backup); diff --git a/gammu/emb/common/service/gsmring.h b/gammu/emb/common/service/gsmring.h index 2d2dd7a..33e5424 100644 --- a/gammu/emb/common/service/gsmring.h +++ b/gammu/emb/common/service/gsmring.h @@ -171,7 +171,7 @@ typedef struct { typedef struct { int Number; - GSM_RingtoneInfo Ringtone[100]; + GSM_RingtoneInfo *Ringtone; } GSM_AllRingtonesInfo; GSM_Error GSM_SaveRingtoneFile(char *FileName, GSM_Ringtone *ringtone); diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index 684e67c..4c6486d 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c @@ -435,7 +435,7 @@ static void SetAlarm(int argc, char *argv[]) } GSM_Bitmap caller[5]; -GSM_AllRingtonesInfo Info; +GSM_AllRingtonesInfo Info = {0, NULL}; bool callerinit[5] = {false, false, false, false, false}; bool ringinit = false; @@ -564,12 +564,15 @@ static void GetAllMemory(int argc, char *argv[]) while (!gshutdown) { error = Phone->GetNextMemory(&s, &Entry, start); if (error == ERR_EMPTY) break; + if (error != ERR_NONE && Info.Ringtone) free(Info.Ringtone); Print_Error(error); printmsg("Memory %s, Location %i\n",argv[2],Entry.Location); PrintMemoryEntry(&Entry); start = false; } + if (Info.Ringtone) free(Info.Ringtone); + GSM_Terminate(); } @@ -617,7 +620,10 @@ static void GetMemory(int argc, char *argv[]) entry.Location=j; error=Phone->GetMemory(&s, &entry); - if (error != ERR_EMPTY) Print_Error(error); + if (error != ERR_EMPTY) { + if (Info.Ringtone) free(Info.Ringtone); + Print_Error(error); + } if (error == ERR_EMPTY) { emptynum++; @@ -633,6 +639,8 @@ static void GetMemory(int argc, char *argv[]) } printmsg("%i entries empty, %i entries filled\n",emptynum,fillednum); + + if (Info.Ringtone) free(Info.Ringtone); GSM_Terminate(); } @@ -1623,17 +1631,20 @@ static void GetRingtone(int argc, char *argv[]) static void GetRingtonesList(int argc, char *argv[]) { - GSM_AllRingtonesInfo Info; + GSM_AllRingtonesInfo Info = {0, NULL}; int i; GSM_Init(true); error=Phone->GetRingtonesInfo(&s,&Info); + if (error != ERR_NONE && Info.Ringtone) free(Info.Ringtone); Print_Error(error); GSM_Terminate(); for (i=0;iGetNotesStatus(&s,&ToDoStatus); + if (error == ERR_NONE) { + max = 0; + while (Backup.Note[max]!=NULL) max++; + printmsgerr("%i entries in backup file\n",max); + + if (answer_yes("Restore Notes")) DoRestore = true; + } + } + if (DoRestore) { + printmsgerr("Deleting old Notes: "); + while (1) { + error = Phone->GetNextNote(&s,&Note,true); + if (error != ERR_NONE) break; + error = Phone->DeleteNote(&s,&Note); + Print_Error(error); + printmsgerr("*"); + } + printmsgerr("\n"); + + for (i=0;iAddNote(&s,&Note); + Print_Error(error); + printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); + if (gshutdown) { + GSM_Terminate(); + exit(0); + } + } + printmsgerr("\n"); + } + if (Backup.SMSC[0] != NULL && answer_yes("Restore SMSC profiles")) { max = 0; while (Backup.SMSC[max]!=NULL) max++; @@ -5287,6 +5337,7 @@ static void ClearAll(int argc, char *argv[]) GSM_ToDoStatus ToDoStatus; GSM_CalendarEntry Calendar; GSM_ToDoEntry ToDo; + GSM_NoteEntry Note; GSM_WAPBookmark Bookmark; GSM_FMStation Station; GSM_MemoryEntry Pbk; @@ -5396,6 +5447,23 @@ static void ClearAll(int argc, char *argv[]) } } + DoClear = false; + error = Phone->GetNotesStatus(&s,&ToDoStatus); + if (error == ERR_NONE && ToDoStatus.Used != 0) { + if (answer_yes("Delete Notes")) DoClear = true; + } + if (DoClear) { + printmsgerr("Deleting: "); + while (1) { + error = Phone->GetNextNote(&s,&Note,true); + if (error != ERR_NONE) break; + error = Phone->DeleteNote(&s,&Note); + Print_Error(error); + printmsgerr("*"); + } + printmsgerr("\n"); + } + Bookmark.Location = 1; error = Phone->GetWAPBookmark(&s,&Bookmark); if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { @@ -5642,18 +5710,11 @@ static void BackupSMS(int argc, char *argv[]) GSM_MultiSMSMessage sms; GSM_SMSFolders folders; bool BackupFromFolder[GSM_MAX_SMS_FOLDERS]; - bool start = true; + bool start = true; bool DeleteAfter; - int j, smsnum; + int j, smsnum = 0; char buffer[200]; - /* We ignore return code, because (when file doesn't exist) we - * will create new later - */ - GSM_ReadSMSBackupFile(argv[2], &Backup); - smsnum = 0; - while (Backup.SMS[smsnum]!=NULL) smsnum++; - GSM_Init(true); error=Phone->GetSMSFolders(&s, &folders); @@ -5664,6 +5725,7 @@ static void BackupSMS(int argc, char *argv[]) for (j=0;jGetSMSFolders(&s, &folders); Print_Error(error); while (Backup.SMS[smsnum] != NULL) { - SMS.Number = 1; - memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage)); - displaymultismsinfo(SMS,false,false); - sprintf(buffer,"Restore sms to folder \"%s\"",DecodeUnicodeConsole(folders.Folder[Backup.SMS[smsnum]->Folder-1].Name)); - if (answer_yes(buffer)) { - error=Phone->AddSMS(&s, Backup.SMS[smsnum]); - Print_Error(error); + doit = true; + if (!restore8bit && Backup.SMS[smsnum]->Coding == SMS_Coding_8bit) doit = false; + if (doit) { + SMS.Number = 1; + memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage)); + displaymultismsinfo(SMS,false,false); + sprintf(buffer,"Restore %03i sms to folder \"%s\"",smsnum+1,DecodeUnicodeConsole(folders.Folder[Backup.SMS[smsnum]->Folder-1].Name)); + if (folders.Folder[Backup.SMS[smsnum]->Folder-1].Memory == MEM_SM) strcat(buffer," (SIM)"); + if (answer_yes(buffer)) { + smprintf(&s,"saving %i SMS\n",smsnum); + error=Phone->AddSMS(&s, Backup.SMS[smsnum]); + Print_Error(error); + } } smsnum++; } @@ -6360,7 +6432,7 @@ static void GetProfile(int argc, char *argv[]) int start,stop,j,k; GSM_Bitmap caller[5]; bool callerinit[5],special; - GSM_AllRingtonesInfo Info; + GSM_AllRingtonesInfo Info = {0, NULL}; GetStartStop(&start, &stop, 2, argc, argv); @@ -6374,6 +6446,7 @@ static void GetProfile(int argc, char *argv[]) for (i=start;i<=stop;i++) { Profile.Location=i; error=Phone->GetProfile(&s,&Profile); + if (error != ERR_NONE && Info.Ringtone) free(Info.Ringtone); Print_Error(error); printmsg("%i. \"%s\"",i,DecodeUnicodeConsole(Profile.Name)); @@ -6487,6 +6560,8 @@ static void GetProfile(int argc, char *argv[]) } GSM_Terminate(); + + if (Info.Ringtone) free(Info.Ringtone); } static void GetSpeedDial(int argc, char *argv[]) @@ -7979,7 +8054,7 @@ static GSM_Parameters Parameters[] = { {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0}, "Gallery|Tones file [-name name][-protected][-readonly][-system][-hidden][-newtime]"}, {"--deletefiles", 1,20, DeleteFiles, {H_Filesystem,0}, "fileID"}, {"--playringtone", 1, 1, PlayRingtone, {H_Ringtone,0}, "file"}, - {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, ""}, + {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, "number"}, {"--getdatetime", 0, 0, GetDateTime, {H_DateTime,0}, ""}, {"--setdatetime", 0, 0, SetDateTime, {H_DateTime,0}, ""}, {"--getalarm", 0, 0, GetAlarm, {H_DateTime,0}, ""}, diff --git a/gammu/emb/gammu/smsd/s_files.c b/gammu/emb/gammu/smsd/s_files.c index b791e58..e1c626f 100644 --- a/gammu/emb/gammu/smsd/s_files.c +++ b/gammu/emb/gammu/smsd/s_files.c @@ -66,7 +66,7 @@ static GSM_Error SMSDFiles_SaveInboxSMS(GSM_MultiSMSMessage sms, GSM_SMSDConfig if (mystrncasecmp(Config->inboxformat, "detail", 0)) { for (j=0;jPINCode=INI_GetValue(smsdcfgfile, "smsd", "PIN", false); if (Config->PINCode == NULL) { - if (log) WriteSMSDLog("No PIN code in %s file",filename); - fprintf(stderr,"No PIN code in %s file\n",filename); - exit(-1); + if (log) WriteSMSDLog("Warning: No PIN code in %s file",filename); + fprintf(stderr,"Warning: No PIN code in %s file\n",filename); + } else { + if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode); } - if (log) WriteSMSDLog("PIN code is \"%s\"",Config->PINCode); str = INI_GetValue(smsdcfgfile, "smsd", "commtimeout", false); if (str) Config->commtimeout=atoi(str); else Config->commtimeout = 1; @@ -217,16 +217,21 @@ bool SMSD_CheckSecurity(GSM_SMSDConfig *Config) /* If PIN, try to enter */ switch (SecurityCode.Type) { case SEC_Pin: - WriteSMSDLog("Trying to enter PIN"); - strcpy(SecurityCode.Code,Config->PINCode); - error=Phone->EnterSecurityCode(&s,SecurityCode); - if (error == ERR_SECURITYERROR) { - GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1); - } - if (error != ERR_NONE) { - WriteSMSDLog("Error entering PIN (%i)", error); + if (Config->PINCode==NULL) { + WriteSMSDLog("Warning: no PIN in config"); return false; - } + } else { + WriteSMSDLog("Trying to enter PIN"); + strcpy(SecurityCode.Code,Config->PINCode); + error=Phone->EnterSecurityCode(&s,SecurityCode); + if (error == ERR_SECURITYERROR) { + GSM_Terminate_SMSD("ERROR: incorrect PIN", error, true, -1); + } + if (error != ERR_NONE) { + WriteSMSDLog("Error entering PIN (%i)", error); + return false; + } + } break; case SEC_SecurityCode: case SEC_Pin2: -- cgit v0.9.0.2