31 files changed, 948 insertions, 79 deletions
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 @@ -50,139 +50,145 @@ INCLUDEPATH += . \ service/backup \ phone/nokia \ phone # Input HEADERS += config.h \ gammu.h \ gsmcomon.h \ gsmstate.h \ device/devfunc.h \ misc/cfg.h \ misc/misc.h \ phone/pfunc.h \ protocol/protocol.h \ service/gsmcal.h \ service/gsmcall.h \ service/gsmdata.h \ service/gsmlogo.h \ service/gsmmisc.h \ service/gsmnet.h \ service/gsmpbk.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 \ phone/at/atgen.h \ phone/nokia/ncommon.h \ phone/nokia/nfunc.h \ phone/nokia/nfuncold.h \ phone/obex/obexgen.h \ phone/symbian/mroutgen.h \ protocol/alcatel/alcabus.h \ protocol/at/at.h \ protocol/nokia/fbus2.h \ protocol/nokia/mbus2.h \ protocol/nokia/phonet.h \ protocol/obex/obex.h \ protocol/symbian/mrouter.h \ service/backup/backgen.h \ service/backup/backics.h \ service/backup/backldif.h \ service/backup/backlmb.h \ service/backup/backtext.h \ service/backup/backvcf.h \ service/backup/backvcs.h \ service/backup/gsmback.h \ service/sms/gsmems.h \ service/sms/gsmmulti.h \ service/sms/gsmsms.h \ phone/nokia/dct3/dct3comm.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 \ phone/nokia/dct4/n3650.h \ phone/nokia/dct4/n6510.h SOURCES +=gsmcomon.c \ gsmstate.c \ misc/misc.c \ misc/cfg.c \ misc/coding/coding.c \ misc/coding/md5.c \ service/sms/gsmsms.c \ service/sms/gsmems.c \ service/sms/gsmmulti.c \ service/gsmcal.c \ service/gsmdata.c \ service/gsmpbk.c \ service/gsmring.c \ service/gsmlogo.c \ service/gsmmisc.c \ service/gsmnet.c \ service/backup/gsmback.c \ service/backup/backldif.c \ service/backup/backlmb.c \ service/backup/backtext.c \ service/backup/backvcs.c \ 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 \ device/devfunc.c \ protocol/at/at.c \ protocol/alcatel/alcabus.c \ protocol/nokia/mbus2.c \ protocol/nokia/fbus2.c \ protocol/nokia/phonet.c \ protocol/obex/obex.c \ protocol/symbian/mrouter.c \ phone/pfunc.c \ phone/at/atgen.c \ phone/at/siemens.c \ phone/at/samsung.c \ 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 \ phone/nokia/dct4/n3650.c \ phone/nokia/dct4/n6510.c \ phone/nokia/dct4/dct4func.c \ phone/nokia/nauto.c \ phone/nokia/nfunc.c \ phone/nokia/nfuncold.c \ phone/obex/obexgen.c \ phone/symbian/mroutgen.c DEFINES += DESKTOP_VERSION TARGET = microgammu CONFIG = warn_off release console DESTDIR = ../../../bin 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 @@ -50,132 +50,138 @@ INCLUDEPATH += . \ service/backup \ phone/nokia \ phone # Input HEADERS += config.h \ gammu.h \ gsmcomon.h \ gsmstate.h \ device/devfunc.h \ misc/cfg.h \ misc/misc.h \ phone/pfunc.h \ protocol/protocol.h \ service/gsmcal.h \ service/gsmcall.h \ service/gsmdata.h \ service/gsmlogo.h \ service/gsmmisc.h \ service/gsmnet.h \ service/gsmpbk.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 \ phone/at/atgen.h \ phone/nokia/ncommon.h \ phone/nokia/nfunc.h \ phone/nokia/nfuncold.h \ phone/obex/obexgen.h \ phone/symbian/mroutgen.h \ protocol/alcatel/alcabus.h \ protocol/at/at.h \ protocol/nokia/fbus2.h \ protocol/nokia/mbus2.h \ protocol/nokia/phonet.h \ protocol/obex/obex.h \ protocol/symbian/mrouter.h \ service/backup/backgen.h \ service/backup/backics.h \ service/backup/backldif.h \ service/backup/backlmb.h \ service/backup/backtext.h \ service/backup/backvcf.h \ service/backup/backvcs.h \ service/backup/gsmback.h \ service/sms/gsmems.h \ service/sms/gsmmulti.h \ service/sms/gsmsms.h \ phone/nokia/dct3/dct3comm.h \ phone/nokia/dct3/dct3func.h \ phone/nokia/dct3/n6110.h \ phone/nokia/dct3/n7110.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 \ gsmstate.c \ misc/misc.c \ misc/cfg.c \ misc/coding/coding.c \ misc/coding/md5.c \ service/sms/gsmsms.c \ service/sms/gsmems.c \ service/sms/gsmmulti.c \ service/gsmcal.c \ service/gsmdata.c \ service/gsmpbk.c \ service/gsmring.c \ service/gsmlogo.c \ service/gsmmisc.c \ service/gsmnet.c \ service/backup/gsmback.c \ service/backup/backldif.c \ service/backup/backlmb.c \ service/backup/backtext.c \ service/backup/backvcs.c \ 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 \ device/irda/irda.c \ device/devfunc.c \ protocol/at/at.c \ protocol/alcatel/alcabus.c \ protocol/nokia/mbus2.c \ protocol/nokia/fbus2.c \ protocol/nokia/phonet.c \ protocol/obex/obex.c \ protocol/symbian/mrouter.c \ phone/pfunc.c \ phone/at/atgen.c \ phone/at/siemens.c \ phone/at/samsung.c \ phone/at/sonyeric.c \ phone/alcatel/alcatel.c \ phone/nokia/dct3/n6110.c \ phone/nokia/dct3/n7110.c \ phone/nokia/dct3/n9210.c \ 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 \ phone/nokia/nfuncold.c \ phone/obex/obexgen.c \ phone/symbian/mroutgen.c TARGET = kammu 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,74 +1,443 @@ +/* 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" #ifdef GSM_ENABLE_SERIALDEVICE #ifdef DJGPP #include "../../gsmcomon.h" +#include "../../misc/coding/coding.h" #include "ser_djg.h" +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <dos.h> +#include <dpmi.h> +#include <pc.h> +#include <go32.h> +#include <sys/farptr.h> +#include <sys/movedata.h> +#include <conio.h> + +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;i<nbytes;i++) { + while(~inportb(LSR) & 0x20); + outportb(THR, buf[i]); + } - return 0; + return i; } GSM_Device_Functions SerialDevice = { serial_open, serial_close, serial_setparity, serial_setdtrrts, serial_setspeed, serial_read, serial_write }; #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/device/serial/ser_djg.h b/gammu/emb/common/device/serial/ser_djg.h index b35b282..3bb2a5b 100644 --- a/gammu/emb/common/device/serial/ser_djg.h +++ b/gammu/emb/common/device/serial/ser_djg.h @@ -1,15 +1,50 @@ +/* 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" + */ #ifdef DJGPP #ifndef djgppserial_h #define djgppserial_h typedef struct { - int hPhone; + int hPhone; + int Speed; + unsigned int Control; + bool Parity; } GSM_Device_SerialData; +/* Defines for Com Port Paramaters, the second paramater to SVAsyncSet() */ +#define BITS_8 0x03 +#define BITS_7 0x02 +#define STOP_1 0x00 +#define STOP_2 0x04 +#define EVEN_PARITY 0x18 +#define ODD_PARITY 0x08 +#define NO_PARITY 0x00 + +/* Defines for SVAsyncHand() */ +#define DTR 0x01 +#define RTS 0x02 +#define USER 0x04 +#define LOOPBACK 0x10 + +/* Defines for SVAsyncStat() */ +#define D_CTS 0x0100 +#define D_DSR 0x0200 +#define D_RI 0x0400 +#define D_DCD 0x0800 +#define CTS 0x1000 +#define DSR 0x2000 +#define RI 0x4000 +#define DCD 0x8000 +#define PARITY 0x0004 +#define THREMPTY 0x0020 +#define BREAKDET 0x1000 + #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/device/serial/ser_unx.c b/gammu/emb/common/device/serial/ser_unx.c index 69c7515..18b5f6f 100644 --- a/gammu/emb/common/device/serial/ser_unx.c +++ b/gammu/emb/common/device/serial/ser_unx.c @@ -1,30 +1,39 @@ /* (c) 2002-2004 by Marcin Wiacek */ /* locking device and settings all speeds by Michal Cihar */ /* based on some work from Gnokii (www.gnokii.org) * (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" #ifdef GSM_ENABLE_SERIALDEVICE #ifndef WIN32 #ifndef DJGPP #include <sys/file.h> #include <sys/time.h> #include <string.h> #include <termios.h> #include <errno.h> #include "../../gsmcomon.h" #include "ser_unx.h" #ifndef O_NONBLOCK # define O_NONBLOCK 0 #endif #ifdef __NetBSD__ # define FNONBLOCK O_NONBLOCK # define B57600 0010001 @@ -39,50 +48,50 @@ # define B1500000 0010012 # define B2000000 0010013 # define B2500000 0010014 # define B3000000 0010015 # define B3500000 0010016 # define B4000000 0010017 #endif static GSM_Error serial_close(GSM_StateMachine *s) { GSM_Device_SerialData *d = &s->Device.Data.Serial; /* Restores old settings */ tcsetattr(d->hPhone, TCSANOW, &d->old_settings); /* Closes device */ close(d->hPhone); return ERR_NONE; } static GSM_Error serial_open (GSM_StateMachine *s) { GSM_Device_SerialData *d = &s->Device.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); if (d->hPhone < 0) { i = errno; GSM_OSErrorInfo(s,"open in serial_open"); if (i == 2) return ERR_DEVICENOTEXIST; //no such file or directory if (i == 13) return ERR_DEVICENOPERMISSION; //permission denied return ERR_DEVICEOPENERROR; } #ifdef TIOCEXCL /* open() calls from other applications shall fail now */ ioctl(d->hPhone, TIOCEXCL, (char *) 0); #endif if (tcgetattr(d->hPhone, &d->old_settings) == -1) { close(d->hPhone); GSM_OSErrorInfo(s,"tcgetattr in serial_open"); return ERR_DEVICEREADERROR; } if (tcflush(d->hPhone, TCIOFLUSH) == -1) { serial_close(s); @@ -103,76 +112,76 @@ static GSM_Error serial_open (GSM_StateMachine *s) /* t.c_cflag |= CRTSCTS; */ t.c_lflag = 0; t.c_cc[VMIN] = 1; t.c_cc[VTIME] = 0; if (tcsetattr(d->hPhone, TCSANOW, &t) == -1) { serial_close(s); GSM_OSErrorInfo(s,"tcsetattr in serial_open"); return ERR_DEVICEOPENERROR; } /* Making file descriptor asynchronous. */ if (fcntl(d->hPhone, F_SETFL, FASYNC | FNONBLOCK) == -1) { serial_close(s); GSM_OSErrorInfo(s,"fcntl in serial_open"); return ERR_DEVICEOPENERROR; } return ERR_NONE; } 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"); return ERR_DEVICEREADERROR; } if (parity) { t.c_cflag |= (PARENB | PARODD); t.c_iflag = 0; } else { t.c_iflag = IGNPAR; } if (tcsetattr(d->hPhone, TCSANOW, &t) == -1){ serial_close(s); GSM_OSErrorInfo(s,"tcsetattr in serial_setparity"); return ERR_DEVICEPARITYERROR; } return ERR_NONE; } 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"); return ERR_DEVICEREADERROR; } #ifdef CRTSCTS /* Disabling hardware flow control */ t.c_cflag &= ~CRTSCTS; #endif if (tcsetattr(d->hPhone, TCSANOW, &t) == -1) { serial_close(s); GSM_OSErrorInfo(s,"tcsetattr in serial_setdtrrts"); return ERR_DEVICEDTRRTSERROR; } flags = TIOCM_DTR; if (dtr) { ioctl(d->hPhone, TIOCMBIS, &flags); } else { ioctl(d->hPhone, TIOCMBIC, &flags); } @@ -243,69 +252,69 @@ static GSM_Error serial_setspeed(GSM_StateMachine *s, int speed) case 3000000: speed2 = B3000000; break; case 3500000: speed2 = B3500000; break; case 4000000: speed2 = B4000000; break; #endif #endif } /* This should work on all systems because it is done according to POSIX */ cfsetispeed(&t, speed2); cfsetospeed(&t, speed2); if (tcsetattr(d->hPhone, TCSADRAIN, &t) == -1) { serial_close(s); GSM_OSErrorInfo(s,"tcsetattr in serial_setspeed"); return ERR_DEVICECHANGESPEEDERROR; } return ERR_NONE; } 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); timeout2.tv_sec = 0; timeout2.tv_usec = 1; if (select(d->hPhone+1, &readfds, NULL, NULL, &timeout2)) { actual = read(d->hPhone, buf, nbytes); if (actual == -1) GSM_OSErrorInfo(s,"serial_read"); } return actual; } 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); if (ret < 0 && errno == EAGAIN) continue; if (ret < 0) { if (actual != nbytes) GSM_OSErrorInfo(s,"serial_write"); return actual; } actual += ret; buf += ret; if (s->ConnectionType == GCT_FBUS2PL2303) my_sleep(1); } while (actual < nbytes); return actual; } GSM_Device_Functions SerialDevice = { serial_open, serial_close, serial_setparity, serial_setdtrrts, serial_setspeed, serial_read, serial_write }; 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 @@ -1,30 +1,39 @@ /* (c) 2002-2004 by Marcin Wiacek */ /* based on some work from MSDN and others */ /* based on some work from Gnokii (www.gnokii.org) * (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" #ifdef GSM_ENABLE_SERIALDEVICE #ifdef WIN32 #include <windows.h> #include <string.h> #include <stdio.h> #include <io.h> #include <memory.h> #include "../../gsmcomon.h" #include "ser_w32.h" static GSM_Error serial_close(GSM_StateMachine *s) { GSM_Device_SerialData *d = &s->Device.Data.Serial; /* Disables all monitored events for device */ SetCommMask(d->hPhone, 0); /* Discards all characters from input/output buffer and terminates * pending read/write operations 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 @@ -533,49 +533,49 @@ GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer, if (reply!=0) { if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl == DL_TEXTERROR || s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl == DL_TEXTERRORDATE) { smprintf(s, "[Retrying %i type 0x%02X]\n", reply, type); } } error = s->Protocol.Functions->WriteMessage(s, buffer, length, type); if (error!=ERR_NONE) return error; error = GSM_WaitForOnce(s, buffer, length, type, time); if (error != ERR_TIMEOUT) return error; } return Phone->DispatchError; } static GSM_Error CheckReplyFunctions(GSM_StateMachine *s, GSM_Reply_Function *Reply, int *reply) { GSM_Phone_Data *Data = &s->Phone.Data; GSM_Protocol_Message *msg = s->Phone.Data.RequestMsg; bool execute; bool available = false; int i = 0; -// int j; +// int j; while (Reply[i].requestID!=ID_None) { execute=false; /* Binary frames like in Nokia */ if (strlen(Reply[i].msgtype) < 2) { if (Reply[i].msgtype[0]==msg->Type) { if (Reply[i].subtypechar!=0) { if (Reply[i].subtypechar<=msg->Length) { if (msg->Buffer[Reply[i].subtypechar]==Reply[i].subtype) execute=true; } } else execute=true; } } else { // printf("msg length %i %i\n",strlen(Reply[i].msgtype),msg->Length); if ((int)strlen(Reply[i].msgtype)<msg->Length) { // printf("Comparing \"%s\" and \"",Reply[i].msgtype); // for (j=0;j<strlen(Reply[i].msgtype);j++) { // if (msg->Buffer[j]!=13 && msg->Buffer[j]!=10) { // printf("%c",msg->Buffer[j]); // } // } // printf("\"\n"); if (strncmp(Reply[i].msgtype,msg->Buffer,strlen(Reply[i].msgtype))==0) { @@ -849,48 +849,49 @@ bool GSM_ReadConfig(INI_Section *cfg_info, GSM_Config *cfg, int num) if (!cfg->StartInfo) { free(cfg->StartInfo); cfg->StartInfo = strdup(DefaultStartInfo); } else { cfg->DefaultStartInfo = false; } return true; } static OnePhoneModel allmodels[] = { #ifdef GSM_ENABLE_NOKIA650 {"0650" ,"THF-12","", {0}}, #endif #ifdef GSM_ENABLE_NOKIA6510 {"1100" ,"RH-18" ,"", {0}}, {"1100a","RH-38" ,"", {0}}, {"1100b","RH-36" ,"", {0}}, #endif #ifdef GSM_ENABLE_NOKIA6110 {"2100" ,"NAM-2" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}},//quess #endif #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 #endif #ifdef GSM_ENABLE_NOKIA6110 {"3210" ,"NSE-8" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, {"3210" ,"NSE-9" ,"", {F_NOWAP,F_NOCALLER,F_NOCALENDAR,F_NOPBKUNICODE,F_POWER_BATT,F_PROFILES51,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, #endif #ifdef GSM_ENABLE_NOKIA6510 {"3300" ,"NEM-1" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme {"3300" ,"NEM-2" ,"Nokia 3300", {F_PBKTONEGAL,0}},//fixme #endif #ifdef GSM_ENABLE_NOKIA6110 {"3310" ,"NHM-5" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_POWER_BATT,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, #endif #ifdef GSM_ENABLE_NOKIA3320 {"3320" ,"NPC-1" ,"Nokia 3320", {F_CAL62,F_DAYMONTH,0}},//fixme #endif #ifdef GSM_ENABLE_NOKIA6110 {"3330" ,"NHM-6" ,"", {F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, {"3390" ,"NPB-1" ,"", {F_NOWAP,F_NOCALLER,F_RING_SM,F_CAL33,F_PROFILES33,F_NOPICTUREUNI,F_NOCALLINFO,F_NODTMF,0}}, {"3410" ,"NHM-2" ,"", {F_RING_SM,F_CAL33,F_PROFILES33,F_NOCALLINFO,F_NODTMF,0}}, #endif #ifdef GSM_ENABLE_NOKIA6510 @@ -933,50 +934,50 @@ static OnePhoneModel allmodels[] = { #ifdef GSM_ENABLE_NOKIA6110 {"6110" ,"NSE-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, {"6130" ,"NSK-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, {"6150" ,"NSM-1" ,"", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,F_NOPICTUREUNI,0}}, {"6190" ,"NSB-3" ,"", {F_NOWAP,F_NOPICTURE,F_NOSTARTANI,F_NOPBKUNICODE,F_MAGICBYTES,F_DISPSTATUS,0}}, #endif #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) {"6200" ,"NPL-3" ,"Nokia 6200", {F_PBKTONEGAL,0}}, {"6220" ,"RH-20" ,"Nokia 6220", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}}, #endif #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA7110) {"6210" ,"NPE-3" ,"Nokia 6210", {F_VOICETAGS,F_CAL62,0}}, {"6250" ,"NHM-3" ,"Nokia 6250", {F_VOICETAGS,F_CAL62,0}}, #endif #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) {"6230" ,"RH-12" ,"Nokia 6230", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,F_WAPMMSPROXY,F_NOTES,0}}, {"6310" ,"NPE-4" ,"Nokia 6310", {F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, {"6310i","NPL-1" ,"Nokia 6310i",{F_TODO63,F_CAL65,F_NOMIDI,F_BLUETOOTH,F_NOMMS,F_VOICETAGS,0}}, {"6385" ,"NHP-2AX","Nokia 6385",{F_TODO63,F_CAL65,F_NOMIDI,F_NOMMS,F_VOICETAGS,0}}, {"6510" ,"NPM-9" ,"Nokia 6510", {F_TODO63,F_CAL65,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, {"6610" ,"NHL-4U","Nokia 6610", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, {"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}}, {"7190" ,"NSB-5" ,"Nokia 7190", {F_CAL62,0}}, #endif #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) {"7200" ,"RH-23" ,"Nokia 7200", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKSMSLIST,F_PBKUSER,0}},//quess {"7210" ,"NHL-4" ,"Nokia 7210", {F_PBKTONEGAL,F_TODO66,F_RADIO,0}}, {"7250" ,"NHL-4J","Nokia 7250", {F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, {"7250i","NHL-4JX","Nokia 7250i",{F_PBKTONEGAL,F_TODO66,F_RADIO,F_PBKIMG,0}}, {"7600", "NMM-3", "Nokia 7600", {F_TODO66,0}}, #endif #if defined(GSM_ENABLE_ATGEN) {"7650" ,"NHL-2" ,"Nokia 7650", {0}}, #endif #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6110) {"8210" ,"NSM-3" ,"Nokia 8210", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, {"8250" ,"NSM-3D","Nokia 8250", {F_NOWAP,F_NOSTARTANI,F_CAL82,F_NOPICTUREUNI,0}}, {"8290" ,"NSB-7" ,"Nokia 8290", {F_NOWAP,F_NOSTARTANI,F_NOPBKUNICODE,F_NOPICTUREUNI,0}}, #endif #if defined(GSM_ENABLE_ATGEN) || defined(GSM_ENABLE_NOKIA6510) {"8310" ,"NHM-7" ,"Nokia 8310", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, {"8390" ,"NSB-8" ,"Nokia 8390", {F_CAL62,F_NOMIDI,F_RADIO,F_NOFILESYSTEM,F_NOMMS,F_VOICETAGS,0}}, #endif 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 @@ -357,48 +357,49 @@ typedef struct { /* -------------------------- Phone layer ---------------------------------- */ /** * Phone requests identificators, these are used for internally identifying * which operation is being performed. */ typedef enum { ID_None=1, ID_GetModel, ID_GetFirmware, ID_EnableSecurity, ID_GetIMEI, ID_GetDateTime, ID_GetAlarm, ID_GetMemory, ID_GetMemoryStatus, ID_GetSMSC, ID_GetSMSMessage, ID_EnableEcho, ID_EnableErrorInfo, ID_SetOBEX, ID_SetUSSD, ID_GetNote, + ID_SetNote, ID_GetSignalQuality, ID_GetBatteryCharge, ID_GetSMSFolders, ID_GetSMSFolderStatus, ID_GetSMSStatus, ID_AddSMSFolder, ID_GetNetworkInfo, ID_GetRingtone, ID_DialVoice, ID_GetCalendarNotesInfo, ID_GetCalendarNote, ID_GetSecurityCode, ID_GetWAPBookmark, ID_GetBitmap, ID_SaveSMSMessage, ID_CancelCall, ID_SetDateTime, ID_SetAlarm, ID_DisableConnectFunc, ID_EnableConnectFunc, ID_AnswerCall, ID_SetBitmap, ID_SetRingtone, ID_DeleteSMSMessage, @@ -1269,51 +1270,76 @@ typedef struct { * Sets calendar entry */ GSM_Error (*SetCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note); /** * Adds calendar entry. */ GSM_Error (*AddCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note); /** * Deletes calendar entry. */ GSM_Error (*DeleteCalendar) (GSM_StateMachine *s, GSM_CalendarEntry *Note); /** * Deletes all calendar entries. */ GSM_Error (*DeleteAllCalendar) (GSM_StateMachine *s); /** * Reads calendar settings. */ GSM_Error (*GetCalendarSettings)(GSM_StateMachine *s, GSM_CalendarSettings *settings); /** * Sets calendar settings. */ 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. */ GSM_Error (*GetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); /** * Updates profile. */ GSM_Error (*SetProfile) (GSM_StateMachine *s, GSM_Profile *Profile); /** * Reads FM station. */ GSM_Error (*GetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); /** * Sets FM station. */ GSM_Error (*SetFMStation) (GSM_StateMachine *s, GSM_FMStation *FMStation); /** * Clears defined FM stations. */ GSM_Error (*ClearFMStations) (GSM_StateMachine *s); /** * Gets next filename from filesystem. */ GSM_Error (*GetNextFileFolder) (GSM_StateMachine *s, GSM_File *File, bool start); 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 @@ -3958,46 +3958,52 @@ GSM_Phone_Functions ALCATELPhone = { NOTSUPPORTED, /* GetMMSSettings */ NOTSUPPORTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ NOTSUPPORTED, /* GetBitmap */ NOTSUPPORTED, /* SetBitmap */ ALCATEL_GetToDoStatus, ALCATEL_GetToDo, ALCATEL_GetNextToDo, ALCATEL_SetToDo, ALCATEL_AddToDo, ALCATEL_DeleteToDo, ALCATEL_DeleteAllToDo, ALCATEL_GetCalendarStatus, ALCATEL_GetCalendar, ALCATEL_GetNextCalendar, ALCATEL_SetCalendar, ALCATEL_AddCalendar, ALCATEL_DeleteCalendar, 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 */ NOTSUPPORTED, /* SetFMStation */ NOTSUPPORTED, /* ClearFMStations */ NOTSUPPORTED, /* GetNextFileFolder */ NOTSUPPORTED, /* GetFilePart */ NOTSUPPORTED, /* AddFilePart */ NOTSUPPORTED, /* GetFileSystemStatus */ NOTSUPPORTED, /* DeleteFile */ NOTSUPPORTED, /* AddFolder */ NOTSUPPORTED, /* GetGPRSAccessPoint */ NOTSUPPORTED /* SetGPRSAccessPoint */ }; #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/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 @@ -675,49 +675,49 @@ GSM_Error ATGEN_Initialise(GSM_StateMachine *s) smprintf(s, "Enabling CME errors\n"); /* Try numeric errors */ if (GSM_WaitFor (s, "AT+CMEE=1\r", 10, 0x00, 3, ID_EnableErrorInfo) != ERR_NONE) { /* Try textual errors */ if (GSM_WaitFor (s, "AT+CMEE=2\r", 10, 0x00, 3, ID_EnableErrorInfo) != ERR_NONE) { smprintf(s, "CME errors could not be enabled, some error types won't be detected.\n"); } } error = ATGEN_GetModel(s); if (error != ERR_NONE) return error; if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_SLOWWRITE)) { s->Protocol.Data.AT.FastWrite = true; } return error; } 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)); smprintf(s, "Setting SMSC\n"); return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_SetSMSC); } GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine *s) { switch (s->Phone.Data.Priv.ATGEN.ReplyState) { case AT_Reply_OK: /* Reply here is: * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]] * each memory is in quotes, * Example: ("SM"), ("SM"), ("SM") * * We need to get from this supported memories. For this case * we assume, that just appearence of memory makes it * available for everything. Then we need to find out whether * phone supports writing to memory. This is done by searching * for "), (", which will appear between lists. */ s->Phone.Data.Priv.ATGEN.CanSaveSMS = false; if (strstr(msg.Buffer, "), (") != NULL || strstr(msg.Buffer, "),(") != NULL) { @@ -3818,45 +3818,51 @@ GSM_Phone_Functions ATGENPhone = { NOTSUPPORTED, /* GetMMSSettings */ NOTSUPPORTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ ATGEN_GetBitmap, /* GetBitmap */ ATGEN_SetBitmap, /* SetBitmap */ SONYERIC_GetToDoStatus, NOTSUPPORTED, /* GetToDo */ SONYERIC_GetNextToDo, NOTSUPPORTED, /* SetToDo */ SONYERIC_AddToDo, NOTSUPPORTED, /* DeleteToDo */ SONYERIC_DeleteAllToDo, SONYERIC_GetCalendarStatus, NOTIMPLEMENTED, /* GetCalendar */ ATGEN_GetNextCalendar, NOTIMPLEMENTED, /* SetCalendar */ ATGEN_AddCalendarNote, ATGEN_DelCalendarNote, 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 */ NOTSUPPORTED, /* SetFMStation */ NOTSUPPORTED, /* ClearFMStations */ NOTSUPPORTED, /* GetNextFileFolder */ NOTSUPPORTED, /* GetFilePart */ NOTSUPPORTED, /* AddFile */ 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/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 @@ -1,44 +1,45 @@ /* (c) 2003 by Marcin Wiacek */ #include "../../gsmstate.h" #ifdef GSM_ENABLE_ATGEN #include <string.h> #include <time.h> #include <ctype.h> #include "../../gsmcomon.h" #include "../../misc/coding/coding.h" #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[]; static GSM_Error SONYERIC_SetOBEXMode(GSM_StateMachine *s) { GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; GSM_Error error; if (Priv->OBEX) return ERR_NONE; dbgprintf ("Changing to OBEX\n"); error=GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 4, ID_SetOBEX); if (error != ERR_NONE) return error; error = s->Protocol.Functions->Terminate(s); if (error != ERR_NONE) return error; s->Protocol.Functions = &OBEXProtocol; error = s->Protocol.Functions->Initialise(s); if (error != ERR_NONE) { s->Protocol.Functions = &ATProtocol; return error; } @@ -103,190 +104,190 @@ static GSM_Error SONYERIC_SetFile(GSM_StateMachine *s, unsigned char *FileName, GSM_File File; int Pos = 0; error = SONYERIC_SetOBEXMode(s); if (error != ERR_NONE) return error; strcpy(File.ID_FullName,FileName); EncodeUnicode(File.Name,FileName,strlen(FileName)); File.Used = Length; File.Buffer = malloc(Length); memcpy(File.Buffer,Buffer,Length); error = ERR_NONE; while (error == ERR_NONE) error = OBEXGEN_AddFilePart(s,&File,&Pos); free(File.Buffer); if (error != ERR_EMPTY) return error; return SONYERIC_SetATMode(s); } #endif 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; GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; if (start) { error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); if (error != ERR_NONE) return error; Note->Location = 1; } else { Note->Location++; } smprintf(s, "Getting calendar note %i\n",Note->Location); Loc = Note->Location; Pos = 0; num = 0; while (1) { error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, Note, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); if (error == ERR_EMPTY) break; if (error != ERR_NONE) return error; if (Note->EntriesNum != 0) { num++; if (num == Loc) return ERR_NONE; } } return ERR_EMPTY; #else return ERR_SOURCENOTAVAILABLE; #endif } 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; GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; if (start) { error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); if (error != ERR_NONE) return error; ToDo->Location = 1; } else { ToDo->Location++; } smprintf(s,"Getting ToDo %i\n",ToDo->Location); Loc = ToDo->Location; Pos = 0; num = 0; while (1) { error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); if (error == ERR_EMPTY) break; if (error != ERR_NONE) return error; if (ToDo->EntriesNum != 0) { num++; if (num == Loc) return ERR_NONE; } } return ERR_EMPTY; #else return ERR_SOURCENOTAVAILABLE; #endif } 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; int Pos; GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; smprintf(s,"Getting ToDo status\n"); error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); if (error != ERR_NONE) return error; status->Used = 0; Pos = 0; while (1) { error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); if (error == ERR_EMPTY) break; if (error != ERR_NONE) return error; if (ToDo.EntriesNum != 0) status->Used++; } return ERR_NONE; #else return ERR_SOURCENOTAVAILABLE; #endif } 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; smprintf(s,"Adding calendar note\n"); GSM_EncodeVCALENDAR(req,&size,Note,true,SonyEricsson_VCalendar); return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); #else return ERR_SOURCENOTAVAILABLE; #endif } 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; if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; smprintf(s,"Adding ToDo\n"); GSM_EncodeVTODO(req,&size,ToDo,true,SonyEricsson_VToDo); return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); #else return ERR_SOURCENOTAVAILABLE; #endif } 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; GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; unsigned char Line[2000]; if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; smprintf(s,"Deleting all ToDo\n"); error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); if (error != ERR_NONE) return error; Pos = 0; Buf = NULL; Used = 0; while (1) { MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used); if (strlen(Line) == 0) break; dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos); switch (Level) { case 0: if (strstr(Line,"BEGIN:VTODO")) { Level = 2; @@ -296,49 +297,49 @@ GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) strcpy(Buf+Used,Line); Used=Used+strlen(Line)+3; Buf[Used-3] = 13; Buf[Used-2] = 10; Buf[Used-1] = 0x00; break; case 2: /* ToDo note */ if (strstr(Line,"END:VTODO")) { Level = 0; } break; } } error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); // if (Buf != NULL) free(Buf); return error; #else return ERR_SOURCENOTAVAILABLE; #endif } 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; unsigned char Line[2000]; unsigned char *Buf; smprintf(s, "Deleting calendar note %i\n",Note->Location); error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); if (error != ERR_NONE) return error; Pos = 0; Buf = NULL; Used = 0; while (1) { MyGetLine(Priv->file.Buffer, &Pos, Line, Priv->file.Used); if (strlen(Line) == 0) break; dbgprintf("Line is %s,%i,%i\n",Line,Priv->file.Used,Pos); switch (Level) { case 0: if (strstr(Line,"BEGIN:VEVENT")) { Loc++; if (Loc == Note->Location) { Level = 1; @@ -351,49 +352,49 @@ GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) Buf[Used-3] = 13; Buf[Used-2] = 10; Buf[Used-1] = 0x00; break; case 1: /* Calendar note */ if (strstr(Line,"END:VEVENT")) { Level = 0; } break; } } DumpMessage(s->di.df, s->di.dl, Buf, Used); error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); if (Buf != NULL) free(Buf); return error; #else return ERR_SOURCENOTAVAILABLE; #endif } 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; int Pos; GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; smprintf(s, "Getting calendar status\n"); error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); if (error != ERR_NONE) return error; Status->Used = 0; Pos = 0; while (1) { error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); if (error == ERR_EMPTY) break; if (error != ERR_NONE) return error; if (Calendar.EntriesNum != 0) Status->Used++; } return ERR_NONE; #else 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 @@ -1,30 +1,39 @@ /* (c) 2001-2004 by Marcin Wiacek */ /* resetting DCT4 phones settings (c) by Walek */ /* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org) * (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 <string.h> /* memcpy only */ #include <stdio.h> #include <ctype.h> #include "../../../gsmstate.h" #include "../../../misc/coding/coding.h" #include "../../../service/sms/gsmsms.h" #include "../../pfunc.h" #include "../nfunc.h" #include "dct3func.h" #ifdef GSM_ENABLE_NOKIA_DCT3 GSM_Error DCT3_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark) { GSM_Error error; /* We have to enable WAP frames in phone */ error=DCT3DCT4_EnableWAPFunctions(s); if (error!=ERR_NONE) return error; return DCT3DCT4_DeleteWAPBookmarkPart(s,bookmark); } @@ -436,52 +445,52 @@ GSM_Error DCT3_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc) smprintf(s, "Getting SMSC\n"); return GSM_WaitFor (s, req, 6, 0x02, 4, ID_GetSMSC); } GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) { int count; GSM_Phone_Data *Data = &s->Phone.Data; #ifdef DEBUG GSM_NetworkInfo NetInfo; char name[100]; smprintf(s, "Network info received\n"); smprintf(s, "Status : "); switch (msg.Buffer[8]) { case 0x01: smprintf(s, "home network"); break; case 0x02: smprintf(s, "roaming network"); break; case 0x03: smprintf(s, "requesting network"); break; case 0x04: smprintf(s, "not registered in the network"); break; default : smprintf(s, "unknown"); } 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); smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); smprintf(s, "Network name for Gammu : %s ", DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); if (msg.Length>18) { if (msg.Buffer[18]==0x00) { /* In 6210 name is in "normal" Unicode */ memcpy(name,msg.Buffer+18,msg.Buffer[17]*2); name[msg.Buffer[17]*2] =0x00; name[msg.Buffer[17]*2+1]=0x00; smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); } else { /* In 9210 first 0x00 is cut from Unicode string */ name[0] = 0; memcpy(name+1,msg.Buffer+18,msg.Buffer[17]*2); name[msg.Buffer[17]*2+1]=0x00; name[msg.Buffer[17]*2+2]=0x00; smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); } } @@ -490,50 +499,50 @@ GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s if (Data->RequestID==ID_GetNetworkInfo) { Data->NetworkInfo->NetworkName[0] = 0x00; Data->NetworkInfo->NetworkName[1] = 0x00; Data->NetworkInfo->State = 0; switch (msg.Buffer[8]) { case 0x01: Data->NetworkInfo->State = GSM_HomeNetwork; break; case 0x02: Data->NetworkInfo->State = GSM_RoamingNetwork; break; case 0x03: Data->NetworkInfo->State = GSM_RequestingNetwork; break; case 0x04: Data->NetworkInfo->State = GSM_NoNetwork; break; } if (Data->NetworkInfo->State == GSM_HomeNetwork || Data->NetworkInfo->State == GSM_RoamingNetwork) { if (msg.Buffer[18]==0x00) { /* In 6210 name is in "normal" Unicode */ memcpy(Data->NetworkInfo->NetworkName,msg.Buffer+18,msg.Buffer[17]*2); Data->NetworkInfo->NetworkName[msg.Buffer[17]*2] = 0x00; Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1] = 0x00; } else { /* In 9210 first 0x00 is cut from Unicode string */ Data->NetworkInfo->NetworkName[0] = 0; memcpy(Data->NetworkInfo->NetworkName+1,msg.Buffer+18,msg.Buffer[17]*2); Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1]=0x00; 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 */ if (Data->RequestID==ID_GetBitmap) { if (msg.Buffer[4]==0x02) { smprintf(s, "Operator logo available\n"); count = 7; /* skip network info */ count += msg.Buffer[count]; count ++; Data->Bitmap->BitmapWidth = msg.Buffer[count++]; Data->Bitmap->BitmapHeight = msg.Buffer[count++]; count+=4; PHONE_DecodeBitmap(GSM_Nokia7110OperatorLogo,msg.Buffer+count,Data->Bitmap); NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->Bitmap->NetworkCode); } else { Data->Bitmap->BitmapWidth = 78; Data->Bitmap->BitmapHeight = 21; GSM_ClearBitmap(Data->Bitmap); strcpy(Data->Bitmap->NetworkCode,"000 00"); } } return ERR_NONE; } 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 <string.h> +#include <time.h> + +#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 @@ -1,30 +1,39 @@ /* (c) 2001-2004 by Marcin Wiacek */ /* 5210 calendar IDs by Frederick Ros */ /* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org) * (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" #ifdef GSM_ENABLE_NOKIA6110 #include <string.h> #include "../../../../cfg/config.h" #include "../../../misc/coding/coding.h" #include "../../../service/sms/gsmsms.h" #include "../../../gsmcomon.h" #include "../../pfunc.h" #include "../nfunc.h" #include "n6110.h" #include "dct3func.h" static unsigned char N6110_MEMORY_TYPES[] = { MEM_ME, 0x02, MEM_SM, 0x03, MEM_ON, 0x05, MEM_DC, 0x07, MEM_RC, 0x08, MEM_MC, 0x09, MEM_VM, 0x0b, @@ -2847,45 +2856,51 @@ GSM_Phone_Functions N6110Phone = { NOTSUPPORTED, /* GetMMSSettings */ NOTSUPPORTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ N6110_GetBitmap, N6110_SetBitmap, NOTSUPPORTED, /* GetToDoStatus */ NOTSUPPORTED, /* GetToDo */ NOTSUPPORTED, /* GetNextToDo */ NOTSUPPORTED, /* SetToDo */ NOTSUPPORTED, /* AddToDo */ NOTSUPPORTED, /* DeleteToDo */ NOTSUPPORTED, /* DeleteAllToDo */ NOTIMPLEMENTED, /* GetCalendarStatus */ NOTIMPLEMENTED, /* GetCalendar */ N6110_GetNextCalendarNote, NOTIMPLEMENTED, /* SetCalendar */ N6110_AddCalendarNote, N6110_DeleteCalendarNote, 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 */ NOTSUPPORTED, /* SetFMStation */ NOTSUPPORTED, /* ClearFMStations */ NOTSUPPORTED, /* GetNextFileFolder */ NOTSUPPORTED, /* GetFilePart */ NOTSUPPORTED, /* AddFile */ 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/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 @@ -1,29 +1,38 @@ /* (c) 2001-2004 by Marcin Wiacek */ /* based on some Markus Plail work from Gnokii (www.gnokii.org) * (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" #ifdef GSM_ENABLE_NOKIA7110 #include <string.h> #include <time.h> #include "../../../misc/coding/coding.h" #include "../../../gsmcomon.h" #include "../../../service/gsmlogo.h" #include "../../pfunc.h" #include "../nfunc.h" #include "../nfuncold.h" #include "n7110.h" #include "dct3func.h" static GSM_Error N7110_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) { return DCT3_GetAlarm(s, alarm, 0x19); } static GSM_Error N7110_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) { @@ -1685,45 +1694,51 @@ GSM_Phone_Functions N7110Phone = { NOTSUPPORTED, /* GetMMSSettings */ NOTSUPPORTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ N7110_GetBitmap, N7110_SetBitmap, NOTSUPPORTED, /* GetToDoStatus */ NOTSUPPORTED, /* GetToDo */ NOTSUPPORTED, /* GetNextToDo */ NOTSUPPORTED, /* SetToDo */ NOTSUPPORTED, /* AddToDo */ NOTSUPPORTED, /* DeleteToDo */ NOTSUPPORTED, /* DeleteAllToDo */ N7110_GetCalendarStatus, NOTIMPLEMENTED, /* GetCalendar */ N7110_GetNextCalendar, NOTIMPLEMENTED, /* SetCalendar */ N7110_AddCalendar, N71_65_DelCalendar, 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 */ NOTSUPPORTED, /* SetFMStation */ NOTSUPPORTED, /* ClearFMStations */ NOTSUPPORTED, /* GetNextFileFolder */ NOTSUPPORTED, /* GetFilePart */ NOTSUPPORTED, /* AddFile */ 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/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 @@ -353,45 +353,51 @@ GSM_Phone_Functions N9210Phone = { NOTSUPPORTED, /* GetMMSSettings */ NOTSUPPORTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ N9210_GetBitmap, N9210_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 */ NOTIMPLEMENTED, /* GetProfile */ NOTSUPPORTED, /* SetProfile */ NOTSUPPORTED, /* GetFMStation */ NOTSUPPORTED, /* SetFMStation */ NOTSUPPORTED, /* ClearFMStations */ NOTSUPPORTED, /* GetNextFileFolder */ NOTSUPPORTED, /* GetFilePart */ NOTSUPPORTED, /* AddFile */ 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/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 @@ -228,45 +228,51 @@ GSM_Phone_Functions N3320Phone = { NOTSUPPORTED, /* GetMMSSettings */ NOTSUPPORTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ NOTSUPPORTED, /* GetBitmap */ NOTSUPPORTED, /* SetBitmap */ NOTSUPPORTED, /* GetToDoStatus */ NOTSUPPORTED, /* GetToDo */ NOTSUPPORTED, /* GetNextToDo */ NOTSUPPORTED, /* SetToDo */ NOTSUPPORTED, /* AddToDo */ NOTSUPPORTED, /* DeleteToDo */ NOTSUPPORTED, /* DeleteAllToDo */ N3320_GetCalendarStatus, NOTIMPLEMENTED, /* GetCalendar */ N3320_GetNextCalendar, NOTIMPLEMENTED, /* SetCalendar */ NOTSUPPORTED, /* AddCalendar */ NOTSUPPORTED, /* DeleteCalendar */ 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 */ NOTSUPPORTED, /* SetFMStation */ NOTSUPPORTED, /* ClearFMStations */ NOTSUPPORTED, /* GetNextFileFolder */ NOTSUPPORTED, /* GetFilePart */ NOTIMPLEMENTED, /* AddFilePart */ NOTSUPPORTED, /* GetFileSystemStatus */ NOTIMPLEMENTED, /* DeleteFile */ NOTIMPLEMENTED, /* 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/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 @@ -349,45 +349,51 @@ GSM_Phone_Functions N3650Phone = { NOTSUPPORTED, /* GetMMSSettings */ NOTSUPPORTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ NOTSUPPORTED, /* GetBitmap */ NOTSUPPORTED, /* SetBitmap */ NOTSUPPORTED, /* GetToDoStatus */ NOTSUPPORTED, /* GetToDo */ NOTSUPPORTED, /* GetNextToDo */ NOTSUPPORTED, /* SetToDo */ NOTSUPPORTED, /* AddToDo */ NOTSUPPORTED, /* DeleteToDo */ NOTSUPPORTED, /* DeleteAllToDo */ NOTIMPLEMENTED, /* GetCalendarStatus */ NOTIMPLEMENTED, /* GetCalendar */ NOTSUPPORTED, /* GetNextCalendar */ NOTIMPLEMENTED, /* SetCalendar */ NOTSUPPORTED, /* AddCalendar */ NOTSUPPORTED, /* DeleteCalendar */ 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 */ NOTSUPPORTED, /* SetFMStation */ NOTSUPPORTED, /* ClearFMStations */ N3650_GetNextFileFolder, N3650_GetFilePart, NOTIMPLEMENTED, /* AddFilePart */ NOTSUPPORTED, /* GetFileSystemStatus */ NOTIMPLEMENTED, /* DeleteFile */ NOTIMPLEMENTED, /* 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/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 @@ -1,30 +1,39 @@ /* (c) 2002-2004 by Marcin Wiacek */ /* based on some Markus Plail, Pawel Kot work from Gnokii (www.gnokii.org) * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot * 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" #ifdef GSM_ENABLE_NOKIA6510 #include <string.h> #include <time.h> #include "../../../misc/coding/coding.h" #include "../../../gsmcomon.h" #include "../../../service/gsmlogo.h" #include "../nfunc.h" #include "../nfuncold.h" #include "../../pfunc.h" #include "dct4func.h" #include "n6510.h" static GSM_Error N6510_Initialise (GSM_StateMachine *s) { s->Phone.Data.Priv.N6510.CalendarIconsNum = 0; /* Enables various things like incoming SMS, call info, etc. */ return N71_65_EnableFunctions (s, "\x01\x02\x06\x0A\x14\x17\x39", 7); } @@ -265,75 +274,75 @@ static GSM_Error N6510_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc) static GSM_Error N6510_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) { int current = msg.Buffer[7]+7, tmp; GSM_Phone_Data *Data = &s->Phone.Data; #ifdef DEBUG char name[100]; GSM_NetworkInfo NetInfo; smprintf(s, "Network status : "); switch (msg.Buffer[8]) { case 0x00 : smprintf(s, "home network\n"); break; case 0x01 : smprintf(s, "roaming network\n"); break; case 0x04 : smprintf(s, "not logged"); break; case 0x06 : smprintf(s, "SIM card rejected\n"); break; case 0x09 : smprintf(s, "not logged"); break; default : smprintf(s, "unknown %i!\n",msg.Buffer[8]); break; } if (msg.Buffer[8]==0x00 || msg.Buffer[8] == 0x01) { NOKIA_DecodeNetworkCode(msg.Buffer + (current + 7),NetInfo.NetworkCode); smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); smprintf(s, "Network name for Gammu : %s ", 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; NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,name,true); smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); } #endif if (Data->RequestID==ID_GetNetworkInfo) { Data->NetworkInfo->NetworkName[0] = 0x00; Data->NetworkInfo->NetworkName[1] = 0x00; Data->NetworkInfo->State = 0; switch (msg.Buffer[8]) { case 0x00: Data->NetworkInfo->State = GSM_HomeNetwork; break; case 0x01: Data->NetworkInfo->State = GSM_RoamingNetwork; break; case 0x04: case 0x06: case 0x09: Data->NetworkInfo->State = GSM_NoNetwork; break; } 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); } } return ERR_NONE; } static GSM_Error N6510_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo) { unsigned char req[] = {N6110_FRAME_HEADER, 0x00, 0x00}; s->Phone.Data.NetworkInfo=netinfo; smprintf(s, "Getting network info\n"); return GSM_WaitFor (s, req, 5, 0x0a, 4, ID_GetNetworkInfo); } static GSM_Error N6510_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *sms, unsigned char *req, GSM_SMSMessageLayout *Layout, int *length) { int start, count = 0, pos1, pos2, pos3, pos4, pos5; GSM_Error error; memset(Layout,255,sizeof(GSM_SMSMessageLayout)); start = *length; @@ -1106,52 +1115,50 @@ static GSM_Error N6510_SetCallerLogo(GSM_StateMachine *s, GSM_Bitmap *bitmap) string[1] = Height; string[2] = 0; string[3] = 0; string[4] = PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0); PHONE_EncodeBitmap(GSM_NokiaCallerLogo, string + 5, bitmap); count += N71_65_PackPBKBlock(s, N7110_PBK_GROUPLOGO, PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0) + 5, block++, string, req + count); } req[21] = block; return GSM_WaitFor (s, req, count, 0x03, 4, ID_SetBitmap); } static GSM_Error N6510_ReplySetPicture(GSM_Protocol_Message msg, GSM_StateMachine *s) { // smprintf(s, "Picture Image written OK, folder %i, location %i\n",msg.Buffer[4],msg.Buffer[5]*256+msg.Buffer[6]); return ERR_NONE; } 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] = { N7110_FRAME_HEADER, 0x04, 0x0F, 0x00, 0x00, 0x00, 0x04, 0xC0, 0x02, 0x00, 0x41, 0xC0, 0x03, 0x00, 0x60, 0xC0, 0x04}; unsigned char reqColourWallPaper[200] = { N6110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18}; /* Bitmap ID */ unsigned char reqColourStartup[200] = { N6110_FRAME_HEADER, 0x04, 0x25, 0x00, 0x01, 0x00, 0x18}; unsigned char reqOp[1000] = { N7110_FRAME_HEADER, 0x25, 0x01, 0x55, 0x00, 0x00, 0x55, 0x01, /* 0x01 - not set, 0x02 - set */ 0x0C, 0x08, 0x62, 0xF0, 0x10, /* Network code */ 0x03, 0x55, 0x55}; unsigned char reqColourOp[200] = { N6110_FRAME_HEADER, @@ -1234,61 +1241,57 @@ static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) case GSM_ColourOperatorLogo_ID: /* We want to set operator logo, not clear */ if (strcmp(Bitmap->NetworkCode,"000 00")) { EncodeBCD(reqColourOp+23, Bitmap->NetworkCode, 6, false); reqColourOp[21] = Bitmap->ID; } smprintf(s, "Setting colour operator logo\n"); return GSM_WaitFor (s, reqColourOp, 26, 0x43, 4, ID_SetBitmap); case GSM_ColourStartupLogo_ID: switch (Bitmap->Location) { case 0: reqColourStartup[6] = 0x00; reqColourStartup[8] = 0x00; smprintf(s, "Setting colour startup logo\n"); return GSM_WaitFor (s, reqColourStartup, 9, 0x7A, 4, ID_SetBitmap); case 1: reqColourStartup[8] = Bitmap->ID; smprintf(s, "Setting colour startup logo\n"); return GSM_WaitFor (s, reqColourStartup, 9, 0x7A, 4, ID_SetBitmap); default:return ERR_NOTSUPPORTED; } case GSM_CallerGroupLogo: return N6510_SetCallerLogo(s,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) { case 0x01: reqPicture[5] = 0x02; break; /* INBOX SIM */ case 0x02: reqPicture[5] = 0x03; break; /* OUTBOX SIM */ default : reqPicture[5] = folderid - 1; reqPicture[4] = 0x02; break; /* ME folders */ } reqPicture[6]=location / 256; reqPicture[7]=location; -#else - return ERR_NOTSUPPORTED; -#endif } Type = GSM_NokiaPictureImage; count = 78; PHONE_EncodeBitmap(Type, reqPicture + count, Bitmap); count += PHONE_GetBitmapSize(Type,0,0); smprintf(s, "Setting Picture Image\n"); return GSM_WaitFor (s, reqPicture, count, 0x14, 4, ID_SetBitmap); default: break; } return ERR_NOTSUPPORTED; } static GSM_Error N6510_ReplyGetRingtoneID(GSM_Protocol_Message msg, GSM_StateMachine *s) { GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; smprintf(s, "Ringtone ID received\n"); Priv->RingtoneID = msg.Buffer[15]; return ERR_NONE; } static GSM_Error N6510_ReplySetBinRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) { @@ -2398,48 +2401,51 @@ static GSM_Error N6510_ReplySaveSMSMessage(GSM_Protocol_Message msg, GSM_StateMa smprintf(s, "Done OK\n"); smprintf(s, "Folder info: %i %i\n",msg.Buffer[5],msg.Buffer[8]); switch (msg.Buffer[8]) { case 0x02 : if (msg.Buffer[5] == 0x02) { folder = 0x03; /* INBOX ME */ } else { folder = 0x01; /* INBOX SIM */ } break; case 0x03 : if (msg.Buffer[5] == 0x02) { folder = 0x04; /* OUTBOX ME */ } else { folder = 0x02; /* OUTBOX SIM */ } break; default : folder = msg.Buffer[8] + 1; } N6510_SetSMSLocation(s, Data->SaveSMSMessage,folder,msg.Buffer[6]*256+msg.Buffer[7]); smprintf(s, "Saved in folder %i at location %i\n",folder, msg.Buffer[6]*256+msg.Buffer[7]); Data->SaveSMSMessage->Folder = folder; return ERR_NONE; 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; default: smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]); return ERR_UNKNOWNRESPONSE; } case 0x17: smprintf(s, "SMS name changed\n"); return ERR_NONE; } return ERR_UNKNOWNRESPONSE; } static GSM_Error N6510_PrivSetSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) { int location, length = 11; unsigned char folderid, folder; GSM_SMSMessageLayout Layout; GSM_Error error; unsigned char req [300] = { N6110_FRAME_HEADER, 0x00, 0x01, /* 1 = SIM, 2 = ME */ 0x02, /* Folder */ @@ -2655,48 +2661,50 @@ static GSM_Error N6510_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) unsigned char req[] = {N6110_FRAME_HEADER, 0x11, 0x00, 0x01, 0x01, 0x0c, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Hours, Minutes */ 0x00, 0x00, 0x00 }; if (alarm->Location != 1) return ERR_NOTSUPPORTED; req[14] = alarm->DateTime.Hour; req[15] = alarm->DateTime.Minute; smprintf(s, "Setting alarm\n"); return GSM_WaitFor (s, req, 19, 0x19, 4, ID_SetAlarm); } static GSM_Error N6510_ReplyGetRingtonesInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) { int tmp,i; GSM_Phone_Data *Data = &s->Phone.Data; smprintf(s, "Ringtones info received\n"); 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;i<Data->RingtonesInfo->Number;i++) { Data->RingtonesInfo->Ringtone[i].Group = msg.Buffer[tmp+4]; Data->RingtonesInfo->Ringtone[i].ID = msg.Buffer[tmp+2] * 256 + msg.Buffer[tmp+3]; memcpy(Data->RingtonesInfo->Ringtone[i].Name,msg.Buffer+tmp+8,(msg.Buffer[tmp+6]*256+msg.Buffer[tmp+7])*2); smprintf(s, "%5i (%5i). \"%s\"\n", Data->RingtonesInfo->Ringtone[i].ID, Data->RingtonesInfo->Ringtone[i].Group, DecodeUnicodeString(Data->RingtonesInfo->Ringtone[i].Name)); tmp = tmp + (msg.Buffer[tmp]*256+msg.Buffer[tmp+1]); } return ERR_NONE; } static GSM_Error N6510_PrivGetRingtonesInfo(GSM_StateMachine *s, GSM_AllRingtonesInfo *Info, bool AllRingtones) { GSM_Error error; unsigned char UserReq[8] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0x02}; // unsigned char All_Req[9] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x7D}; unsigned char All_Req[8] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0x00}; s->Phone.Data.RingtonesInfo=Info; smprintf(s, "Getting binary ringtones ID\n"); if (AllRingtones) { @@ -2733,69 +2741,71 @@ static GSM_Error N6510_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi smprintf(s,"MIDI\n"); tmp = msg.Buffer[7]*2+10; i = msg.Length - 2; /* ?????? */ Data->Ringtone->Format = RING_MIDI; } else { /* Looking for end */ i=8+msg.Buffer[7]*2+3; tmp = i; while (true) { if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) { i=i+2; break; } i++; if (i==msg.Length) return ERR_EMPTY; } } /* Copying frame */ memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+tmp,i-tmp); Data->Ringtone->NokiaBinary.Length=i-tmp; return ERR_NONE; } 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 */ if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; switch (Ringtone->Format) { case RING_NOTETONE: /* In the future get binary and convert */ return ERR_NOTSUPPORTED; case RING_NOKIABINARY: s->Phone.Data.Ringtone = Ringtone; Info.Number = 0; error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone); if (error != ERR_NONE) return error; if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION; 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; } return ERR_NOTSUPPORTED; } static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start) { GSM_Error error; unsigned char reqStart[] = { 0x00,0x06,0x01,0x00,0x07,0x00 }; unsigned char reqPlay[] = { 0x00,0x06,0x01,0x14,0x05,0x04, 0x00,0x00,0x00,0x03,0x03,0x08, 0x00,0x00,0x00,0x01,0x00,0x00, 0x03,0x08,0x01,0x00, 0x07,0xd0, /*Frequency */ 0x00,0x00,0x03,0x08,0x02,0x00,0x00, 0x05, /*Volume */ 0x00,0x00}; unsigned char reqOff[] = { 0x00,0x06,0x01,0x14,0x05,0x05, 0x00,0x00,0x00,0x01,0x03,0x08, @@ -4033,48 +4043,139 @@ static GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message msg, GSM_StateMachine * } GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, bool start) { GSM_Error error; GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote; if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED; if (start) { error=N6510_GetCalendarInfo3(s,LastNote,2); if (error!=ERR_NONE) return error; Note->Location = 1; } else { Note->Location++; } if (Note->Location > LastNote->Number) return ERR_EMPTY; s->Phone.Data.Note = Note; smprintf(s, "Getting note\n"); 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; accx = 0; acc = 0xffff; while (len--) { accx = (accx & 0xffff00ff) | (acc & 0xff00); acc = (acc & 0xffff00ff) | *ptr++ << 8; for (i = 0; i < 8; i++) { acc <<= 1; if (acc & 0x10000) acc ^= 0x1021; if (accx & 0x80000000) acc ^= 0x1021; accx <<= 1; } } dbgprintf("Checksum from Gammu is %04X\n",(acc & 0xffff)); return (acc & 0xffff); } static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) { GSM_File *File = s->Phone.Data.FileInfo; GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; @@ -5168,61 +5269,62 @@ static GSM_Error N6510_AddToDo1(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) case GSM_Priority_High : reqSet[4] = 1; break; } GSM_ToDoFindDefaultTextTimeAlarmCompleted(ToDo, &Text, &Alarm, &Completed, &EndTime, &Phone); if (Text == -1) return ERR_NOTSUPPORTED; /* XXX: shouldn't this be handled different way? */ ulen = UnicodeLength(ToDo->Entries[Text].Text); reqSet[5] = ulen+1; CopyUnicodeString(reqSet+10,ToDo->Entries[Text].Text); reqSet[10+ulen*2] = 0x00; reqSet[10+ulen*2+1] = 0x00; smprintf(s, "Adding ToDo method 1\n"); return GSM_WaitFor (s, reqSet, 12+ulen*2, 0x55, 4, ID_SetToDo); } static GSM_Error N6510_ReplyAddToDo2(GSM_Protocol_Message msg, GSM_StateMachine *s) { smprintf(s, "ToDo added method 2\n"); return ERR_NONE; } 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; } static GSM_Error N6510_AddToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) { GSM_CalendarEntry Note; time_t t_time1,t_time2; long diff; 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 */ 0x00, 0x00, 0x00, 0x00, 0x00, /* location */ 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, /* alarm */ 0x80, 0x00, 0x00, 0x01, /* note icon */ 0xFF, 0xFF, 0xFF, 0xFF, /* alarm type */ 0x00, /* 0x02 or 0x00 */ 0x01, /* note type */ 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00, /* start date/time */ 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00, /* end date/time */ 0x00, 0x00, /* recurrance */ 0x00, 0x00, /* birth year */ 0x20, /* ToDo priority */ 0x00, /* ToDo completed ? */ 0x00, 0x00, 0x00, 0x00, /* note text length */ 0x00, /* phone length/meeting place */ 0x00, 0x00, 0x00}; s->Phone.Data.ToDo = ToDo; @@ -5564,56 +5666,58 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { {N6510_ReplyGetSignalQuality, "\x0A",0x03,0x0C,ID_GetSignalQuality }, {N6510_ReplyGetIncSignalQuality, "\x0A",0x03,0x1E,ID_IncomingFrame }, {NoneReply, "\x0A",0x03,0x20,ID_IncomingFrame }, {N6510_ReplyGetOperatorLogo, "\x0A",0x03,0x24,ID_GetBitmap }, {N6510_ReplySetOperatorLogo, "\x0A",0x03,0x26,ID_SetBitmap }, {NoneReply, "\x0B",0x03,0x01,ID_PlayTone }, {NoneReply, "\x0B",0x03,0x15,ID_PlayTone }, {NoneReply, "\x0B",0x03,0x16,ID_PlayTone }, {N71_65_ReplyAddCalendar1, "\x13",0x03,0x02,ID_SetCalendarNote }, {N71_65_ReplyAddCalendar1, "\x13",0x03,0x04,ID_SetCalendarNote }, {N71_65_ReplyAddCalendar1, "\x13",0x03,0x06,ID_SetCalendarNote }, {N71_65_ReplyAddCalendar1, "\x13",0x03,0x08,ID_SetCalendarNote }, {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote }, {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/ {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/ {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/ #ifdef DEBUG {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote }, #endif {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 }, {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings }, {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale }, {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 }, {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage }, {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap }, {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage }, {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage }, {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage }, {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus }, {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus }, {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage }, {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder }, {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders }, {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage }, {N6510_ReplyGetSMSStatus, "\x14",0x03,0x1a,ID_GetSMSStatus }, {DCT4_ReplySetPhoneMode, "\x15",0x03,0x64,ID_Reset }, {DCT4_ReplyGetPhoneMode, "\x15",0x03,0x65,ID_Reset }, {NoneReply, "\x15",0x03,0x68,ID_Reset }, {N6510_ReplyGetBatteryCharge, "\x17",0x03,0x0B,ID_GetBatteryCharge }, {N6510_ReplySetDateTime, "\x19",0x03,0x02,ID_SetDateTime }, @@ -5711,49 +5815,49 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { {N6510_ReplyAddFilePart, "\x6D",0x03,0x41,ID_AddFile }, {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_AddFile }, {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFile }, {N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFileInfo }, {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_GetBitmap }, {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_SetBitmap }, {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_GetBitmap }, {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_SetBitmap }, {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_GetBitmap }, {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_SetBitmap }, {N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x25,ID_SetBitmap }, {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel }, {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware }, /* 0xD7 - Bluetooth */ {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone }, {NULL, "\x00",0x00,0x00,ID_None } }; 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 */ GSM_DispatchMessage, N6510_ShowStartInfo, NOKIA_GetManufacturer, DCT3DCT4_GetModel, DCT3DCT4_GetFirmware, DCT4_GetIMEI, N6510_GetOriginalIMEI, N6510_GetManufactureMonth, DCT4_GetProductCode, DCT4_GetHardware, N6510_GetPPM, NOTSUPPORTED, /* GetSIMIMSI */ N6510_GetDateTime, N6510_SetDateTime, N6510_GetAlarm, N6510_SetAlarm, N6510_GetLocale, NOTSUPPORTED, /* SetLocale */ N6510_PressKey, DCT4_Reset, NOTIMPLEMENTED, /* ResetPhoneSettings */ @@ -5820,45 +5924,51 @@ GSM_Phone_Functions N6510Phone = { N6510_GetMMSSettings, N6510_SetMMSSettings, N6510_GetSyncMLSettings, NOTSUPPORTED, /* SetSyncMLSettings */ N6510_GetChatSettings, NOTSUPPORTED, /* SetChatSettings */ N6510_GetBitmap, N6510_SetBitmap, N6510_GetToDoStatus, NOTIMPLEMENTED, /* GetToDo */ N6510_GetNextToDo, NOTIMPLEMENTED, /* SetToDo */ N6510_AddToDo, N6510_DeleteToDo2, N6510_DeleteAllToDo1, N6510_GetCalendarStatus, NOTIMPLEMENTED, /* GetCalendar */ N6510_GetNextCalendar, NOTIMPLEMENTED, /* SetCalendar */ N6510_AddCalendar, N71_65_DelCalendar, 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, N6510_SetFMStation, N6510_ClearFMStations, N6510_GetNextFileFolder, N6510_GetFilePart, N6510_AddFilePart, N6510_GetFileSystemStatus, N6510_DeleteFile, N6510_AddFolder, N6510_GetGPRSAccessPoint, N6510_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/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 @@ -100,45 +100,51 @@ GSM_Phone_Functions NAUTOPhone = { 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/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 @@ -808,45 +808,51 @@ GSM_Phone_Functions OBEXGENPhone = { NOTIMPLEMENTED, /* GetMMSSettings */ NOTIMPLEMENTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ NOTIMPLEMENTED, /* GetBitmap */ NOTIMPLEMENTED, /* SetBitmap */ NOTIMPLEMENTED, /* GetToDoStatus */ NOTIMPLEMENTED, /* GetToDo */ NOTIMPLEMENTED, /* GetNextToDo */ NOTIMPLEMENTED, /* SetToDo */ NOTIMPLEMENTED, /* AddToDo */ NOTIMPLEMENTED, /* DeleteToDo */ NOTIMPLEMENTED, /* DeleteAllToDo */ NOTIMPLEMENTED, /* GetCalendarStatus */ NOTIMPLEMENTED, /* GetCalendar */ NOTIMPLEMENTED, /* GetNextCalendar */ NOTIMPLEMENTED, /* SetCalendar */ NOTIMPLEMENTED, /* AddCalendar */ NOTIMPLEMENTED, /* DeleteCalendar */ 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 */ NOTIMPLEMENTED, /* SetFMStation */ NOTIMPLEMENTED, /* ClearFMStations */ OBEXGEN_GetNextFileFolder, OBEXGEN_GetFilePart, OBEXGEN_AddFilePart, NOTIMPLEMENTED, /* GetFileSystemStatus */ OBEXGEN_DeleteFile, OBEXGEN_AddFolder, NOTIMPLEMENTED, /* GetGPRSAccessPoint */ NOTIMPLEMENTED /* 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/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 @@ -40,48 +40,49 @@ GSM_Error PHONE_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders) folders->Folder[0].InboxFolder = true; folders->Folder[1].InboxFolder = false; folders->Folder[0].Memory = MEM_SM; folders->Folder[1].Memory = MEM_SM; return ERR_NONE; } void GSM_CreateFirmwareNumber(GSM_StateMachine *s) { StringToDouble(s->Phone.Data.Version, &s->Phone.Data.VerNum); dbgprintf("Number version is \"%f\"\n", s->Phone.Data.VerNum); } GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, bool clear) { GSM_Error error; if (SMS->SMSC.Location!=0) { error = s->Phone.Functions->GetSMSC(s, &SMS->SMSC); if (error != ERR_NONE) return error; SMS->SMSC.Location = 0; } 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; } } return GSM_EncodeSMSFrame(SMS, buffer, Layout, length, clear); } GSM_Error PHONE_Terminate(GSM_StateMachine *s) { GSM_Error error; if (s->Phone.Data.EnableIncomingCB==true) { error=s->Phone.Functions->SetIncomingCB(s,false); if (error!=ERR_NONE) return error; } if (s->Phone.Data.EnableIncomingSMS==true) { error=s->Phone.Functions->SetIncomingSMS(s,false); if (error!=ERR_NONE) return error; } return ERR_NONE; } GSM_Error PHONE_RTTLPlayOneNote(GSM_StateMachine *s, GSM_RingNote note, bool first) { int duration, Hz; 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 @@ -177,45 +177,51 @@ GSM_Phone_Functions MROUTERGENPhone = { NOTSUPPORTED, /* GetMMSSettings */ NOTSUPPORTED, /* SetMMSSettings */ NOTSUPPORTED, /* GetSyncMLSettings */ NOTSUPPORTED, /* SetSyncMLSettings */ NOTSUPPORTED, /* GetChatSettings */ NOTSUPPORTED, /* SetChatSettings */ 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/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 @@ -1,30 +1,39 @@ /* (c) 2002-2003 by Marcin Wiacek */ /* based on some work from MyGnokii (www.mwiacek.com) */ /* Based on some work from Gnokii (www.gnokii.org) * (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" #if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) #include <stdio.h> #include <string.h> #include "../../gsmcomon.h" #include "fbus2.h" static GSM_Error FBUS2_WriteFrame(GSM_StateMachine *s, unsigned char *MsgBuffer, int MsgLength, unsigned char MsgType) { unsigned char buffer2[FBUS2_MAX_TRANSMIT_LENGTH + 10]; unsigned char checksum=0; int i, len, sent; buffer2[0] = FBUS2_FRAME_ID; if (s->ConnectionType==GCT_FBUS2IRDA) buffer2[0] = FBUS2_IRDA_FRAME_ID; buffer2[1] = FBUS2_DEVICE_PHONE; //destination @@ -124,48 +133,49 @@ static GSM_Error FBUS2_StateMachine(GSM_StateMachine *s, unsigned char rx_char) /* This is not last byte in frame */ if (d->Msg.Count != d->Msg.Length+(d->Msg.Length%2)+2) return ERR_NONE; /* Checksum is incorrect */ if (d->Msg.CheckSum[0] != d->Msg.CheckSum[1]) { if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl==DL_TEXTERROR || s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl==DL_TEXTERRORDATE) { smprintf(s,"[ERROR: checksum]\n"); } free(d->Msg.Buffer); d->Msg.Length = 0; d->Msg.Buffer = NULL; d->MsgRXState = RX_Sync; return ERR_NONE; } seq_num = d->Msg.Buffer[d->Msg.Length-1]; if (d->Msg.Type == FBUS2_ACK_BYTE) { if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || 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; } frm_num = d->Msg.Buffer[d->Msg.Length-2]; if ((seq_num & 0x40) == 0x40) { d->FramesToGo = frm_num; d->MultiMsg.Length = 0; d->MultiMsg.Type = d->Msg.Type; d->MultiMsg.Destination = d->Msg.Destination; d->MultiMsg.Source = d->Msg.Source; } if ((seq_num & 0x40) != 0x40 && d->FramesToGo != frm_num) { if (s->di.dl==DL_TEXT || s->di.dl==DL_TEXTALL || s->di.dl==DL_TEXTERROR || s->di.dl==DL_TEXTDATE || s->di.dl==DL_TEXTALLDATE || s->di.dl==DL_TEXTERRORDATE) { smprintf(s, "[ERROR: Missed part of multiframe msg]\n"); } free(d->Msg.Buffer); d->Msg.Length = 0; d->Msg.Buffer = NULL; 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 @@ -1,30 +1,39 @@ /* (c) 2002-2003 by Marcin Wiacek */ /* based on some work from MyGnokii (www.mwiacek.com) */ /* Based on some work from Gnokii (www.gnokii.org) * (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 #include "../protocol.h" #define FBUS2_FRAME_ID 0x1e #define FBUS2_IRDA_FRAME_ID 0x1c #define FBUS2_DEVICE_PHONE 0x00 /* Nokia mobile phone */ #define FBUS2_DEVICE_PC 0x0c /* Our PC */ #define FBUS2_ACK_BYTE 0x7f /* Acknowledge of the received frame */ #define FBUS2_MAX_TRANSMIT_LENGTH 120 typedef struct { int MsgSequenceNumber; int MsgRXState; int FramesToGo; GSM_Protocol_Message MultiMsg; GSM_Protocol_Message Msg; } GSM_Protocol_FBUS2Data; #ifndef GSM_USED_SERIALDEVICE # define GSM_USED_SERIALDEVICE 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 @@ -1,29 +1,38 @@ /* (c) 2002-2003 by Marcin Wiacek */ /* Based on some work from Gnokii (www.gnokii.org) * (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" #if defined(GSM_ENABLE_IRDA) || defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_BLUEPHONET) #include <stdio.h> #include <string.h> #include "../../gsmcomon.h" #include "phonet.h" static GSM_Error PHONET_WriteMessage (GSM_StateMachine *s, unsigned char *MsgBuffer, int MsgLength, unsigned char MsgType) { unsigned char *buffer2; int sent; GSM_DumpMessageLevel3(s, MsgBuffer, MsgLength, MsgType); buffer2 = (unsigned char *)malloc(MsgLength + 6); buffer2[0] = PHONET_FRAME_ID, 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 @@ -1,29 +1,38 @@ /* (c) 2002-2003 by Marcin Wiacek */ /* Based on some work from Gnokii (www.gnokii.org) * (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 #include "../protocol.h" #define PHONET_FRAME_ID 0x14 #define PHONET_BLUE_FRAME_ID 0x19 #define PHONET_DEVICE_PHONE 0x00 /* Nokia mobile phone */ #define PHONET_DEVICE_PC 0x0c /* Our PC */ #define PHONET_BLUE_DEVICE_PC 0x10 /* Our PC */ typedef struct { int MsgRXState; GSM_Protocol_Message Msg; } GSM_Protocol_PHONETData; #if defined(GSM_ENABLE_IRDAPHONET) # ifndef GSM_USED_IRDADEVICE # define GSM_USED_IRDADEVICE # endif #endif #if defined(GSM_ENABLE_BLUEPHONET) # ifndef GSM_USED_BLUETOOTHDEVICE 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 @@ -43,31 +43,31 @@ typedef struct { GSM_Bitmap *CallerLogos [GSM_BACKUP_MAX_CALLER + 1]; GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; GSM_WAPBookmark *WAPBookmark [GSM_BACKUP_MAX_WAPBOOKMARK + 1]; GSM_MultiWAPSettings *WAPSettings [GSM_BACKUP_MAX_WAPSETTINGS + 1]; GSM_MultiWAPSettings *MMSSettings [GSM_BACKUP_MAX_MMSSETTINGS + 1]; GSM_SyncMLSettings *SyncMLSettings [GSM_BACKUP_MAX_SYNCMLSETTINGS + 1]; GSM_ChatSettings *ChatSettings [GSM_BACKUP_MAX_CHATSETTINGS + 1]; GSM_Ringtone *Ringtone [GSM_BACKUP_MAX_RINGTONES + 1]; GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; GSM_Profile *Profiles [GSM_BACKUP_MAX_PROFILES + 1]; GSM_FMStation *FMStation [GSM_BACKUP_MAX_FMSTATIONS +1]; GSM_GPRSAccessPoint *GPRSPoint [GSM_BACKUP_MAX_GPRSPOINT + 1]; GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1]; GSM_Bitmap *StartupLogo; GSM_Bitmap *OperatorLogo; } GSM_Backup; #define GSM_BACKUP_MAX_SMS 500 typedef struct { GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS]; } 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 /* 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/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 @@ -2975,57 +2975,61 @@ static GSM_Error GSM_ReadSMSBackupTextFile(char *FileName, GSM_SMS_Backup *backu return ERR_MOREMEMORY; } backup->SMS[num]->Location = num + 1; ReadSMSBackupEntry(file_info, h->SectionName, backup->SMS[num]); num++; } } return ERR_NONE; } GSM_Error GSM_ReadSMSBackupFile(char *FileName, GSM_SMS_Backup *backup) { FILE *file; backup->SMS[0] = NULL; file = fopen(FileName, "rb"); if (file == NULL) return(ERR_CANTOPENFILE); fclose(file); 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]; GSM_DateTime DT; 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) { fprintf(file,"[SMSBackup%03i]\n",i); switch (backup->SMS[i]->Coding) { case SMS_Coding_Unicode: case SMS_Coding_Default: sprintf(buffer,"%s",DecodeUnicodeString(backup->SMS[i]->Text)); fprintf(file,"#"); current = 0; for (w=0;w<(int)(strlen(buffer));w++) { switch (buffer[w]) { case 10: fprintf(file,"\n#"); current = 0; break; case 13: break; default: if (isprint(buffer[w])) { fprintf(file,"%c",buffer[w]); current ++; } if (current == 75) { @@ -3067,43 +3071,43 @@ GSM_Error SaveSMSBackupTextFile(FILE *file, GSM_SMS_Backup *backup) EncodeHexBin(buffer,backup->SMS[i]->Text,backup->SMS[i]->Length); break; } SaveLinkedBackupText(file, "Text", buffer, false); switch (backup->SMS[i]->Coding) { case SMS_Coding_Unicode : fprintf(file,"Coding = Unicode\n"); break; case SMS_Coding_Default : fprintf(file,"Coding = Default\n"); break; case SMS_Coding_8bit : fprintf(file,"Coding = 8bit\n"); break; } fprintf(file,"Folder = %i\n",backup->SMS[i]->Folder); fprintf(file,"Length = %i\n",backup->SMS[i]->Length); fprintf(file,"Class = %i\n",backup->SMS[i]->Class); fprintf(file,"ReplySMSC = "); if (backup->SMS[i]->ReplyViaSameSMSC) fprintf(file,"True\n"); else fprintf(file,"False\n"); fprintf(file,"RejectDuplicates = "); if (backup->SMS[i]->RejectDuplicates) fprintf(file,"True\n"); else fprintf(file,"False\n"); fprintf(file,"ReplaceMessage = %i\n",backup->SMS[i]->ReplaceMessage); fprintf(file,"MessageReference = %i\n",backup->SMS[i]->MessageReference); fprintf(file,"\n"); i++; } 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); fclose(file); return ERR_NONE; } #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/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 @@ -150,49 +150,49 @@ typedef struct { GSM_BinaryTone BinaryTone; GSM_NoteRingtone NoteTone; /** * Ringtone format */ GSM_RingtoneFormat Format; /** * Ringtone name */ char Name[20*2]; /** * Ringtone location */ int Location; } GSM_Ringtone; typedef struct { int Group; //Nokia specific int ID; char Name[30*2]; } GSM_RingtoneInfo; typedef struct { int Number; - GSM_RingtoneInfo Ringtone[100]; + GSM_RingtoneInfo *Ringtone; } GSM_AllRingtonesInfo; GSM_Error GSM_SaveRingtoneFile(char *FileName, GSM_Ringtone *ringtone); GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone); void saveott(FILE *file, GSM_Ringtone *ringtone); void savemid(FILE *file, GSM_Ringtone *ringtone); void saverng(FILE *file, GSM_Ringtone *ringtone); void saveimelody(FILE *file, GSM_Ringtone *ringtone); GSM_Error savewav(FILE *file, GSM_Ringtone *ringtone); GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone); unsigned char GSM_EncodeNokiaRTTLRingtone (GSM_Ringtone ringtone, unsigned char *package, int *maxlength); unsigned char GSM_EncodeEMSSound (GSM_Ringtone ringtone, unsigned char *package, int *maxlength, double version, bool start); GSM_Error GSM_DecodeNokiaRTTLRingtone (GSM_Ringtone *ringtone, unsigned char *package, int maxlength); GSM_Error GSM_RingtoneConvert(GSM_Ringtone *dest, GSM_Ringtone *src, GSM_RingtoneFormat Format); int GSM_RTTLGetTempo (int Beats); int GSM_RingNoteGetFrequency (GSM_RingNote Note); int GSM_RingNoteGetFullDuration (GSM_RingNote Note); char *GSM_GetRingtoneName(GSM_AllRingtonesInfo *Info, int ID); |