summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/gsmstate.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gammu/emb/common/gsmstate.h b/gammu/emb/common/gsmstate.h
index f15a6a7..2b4806c 100644
--- a/gammu/emb/common/gsmstate.h
+++ b/gammu/emb/common/gsmstate.h
@@ -1,355 +1,356 @@
/* (c) 2002-2004 by Marcin Wiacek & Michal Cihar */
#ifndef __gsm_state_h
#define __gsm_state_h
#include <time.h>
#include "config.h"
#include "misc/cfg.h"
typedef struct _GSM_StateMachine GSM_StateMachine;
typedef struct _GSM_User GSM_User;
typedef struct _OnePhoneModel OnePhoneModel;
typedef struct _GSM_Reply_Function GSM_Reply_Function;
#ifdef GSM_ENABLE_NOKIA3320
# include "phone/nokia/dct4/n3320.h"
#endif
#ifdef GSM_ENABLE_NOKIA3650
# include "phone/nokia/dct4/n3650.h"
#endif
#ifdef GSM_ENABLE_NOKIA650
# include "phone/nokia/dct3/n0650.h"
#endif
#ifdef GSM_ENABLE_NOKIA6110
# include "phone/nokia/dct3/n6110.h"
#endif
#ifdef GSM_ENABLE_NOKIA6510
# include "phone/nokia/dct4/n6510.h"
#endif
#ifdef GSM_ENABLE_NOKIA7110
# include "phone/nokia/dct3/n7110.h"
#endif
#ifdef GSM_ENABLE_NOKIA9210
# include "phone/nokia/dct3/n9210.h"
#endif
#ifdef GSM_ENABLE_ATGEN
# include "phone/at/atgen.h"
#endif
#ifdef GSM_ENABLE_ALCATEL
# include "phone/alcatel/alcatel.h"
#endif
#ifdef GSM_ENABLE_OBEXGEN
# include "phone/obex/obexgen.h"
#endif
#ifdef GSM_ENABLE_MROUTERGEN
# include "phone/symbian/mroutgen.h"
#endif
#ifndef GSM_USED_MBUS2
# undef GSM_ENABLE_MBUS2
#endif
#ifndef GSM_USED_FBUS2
# undef GSM_ENABLE_FBUS2
#endif
#ifndef GSM_USED_FBUS2DLR3
# undef GSM_ENABLE_FBUS2DLR3
#endif
#ifndef GSM_USED_FBUS2DKU5
# undef GSM_ENABLE_FBUS2DKU5
#endif
#ifndef GSM_USED_FBUS2PL2303
# undef GSM_ENABLE_FBUS2PL2303
#endif
#ifndef GSM_USED_FBUS2BLUE
# undef GSM_ENABLE_FBUS2BLUE
#endif
#ifndef GSM_USED_FBUS2IRDA
# undef GSM_ENABLE_FBUS2IRDA
#endif
#ifndef GSM_USED_PHONETBLUE
# undef GSM_ENABLE_PHONETBLUE
#endif
#ifndef GSM_USED_AT
# undef GSM_ENABLE_AT
#endif
#ifndef GSM_USED_IRDAOBEX
# undef GSM_ENABLE_IRDAOBEX
#endif
#ifndef GSM_USED_BLUEOBEX
# undef GSM_ENABLE_BLUEOBEX
#endif
#ifndef GSM_USED_ALCABUS
# undef GSM_ENABLE_ALCABUS
#endif
#ifndef GSM_USED_IRDAPHONET
# undef GSM_ENABLE_IRDAPHONET
#endif
#ifndef GSM_USED_BLUEFBUS2
# undef GSM_ENABLE_BLUEFBUS2
#endif
#ifndef GSM_USED_BLUEPHONET
# undef GSM_ENABLE_BLUEPHONET
#endif
#ifndef GSM_USED_BLUEAT
# undef GSM_ENABLE_BLUEAT
#endif
#ifndef GSM_USED_IRDAAT
# undef GSM_ENABLE_IRDAAT
#endif
#ifndef GSM_USED_MROUTERBLUE
# undef GSM_ENABLE_MROUTERBLUE
#endif
#if defined(GSM_ENABLE_NOKIA3320) || defined(GSM_ENABLE_NOKIA650) || defined(GSM_ENABLE_NOKIA6110) || defined(GSM_ENABLE_NOKIA7110) || defined(GSM_ENABLE_NOKIA9210)
# define GSM_ENABLE_NOKIA_DCT3
#endif
#if defined(GSM_ENABLE_NOKIA3650) || defined(GSM_ENABLE_NOKIA6510)
# define GSM_ENABLE_NOKIA_DCT4
#endif
#include "protocol/protocol.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 "protocol/nokia/fbus2.h"
#endif
#ifdef GSM_ENABLE_MBUS2
# include "protocol/nokia/mbus2.h"
#endif
#if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET)
# include "protocol/nokia/phonet.h"
#endif
#if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT)
# include "protocol/at/at.h"
#endif
#ifdef GSM_ENABLE_ALCABUS
# include "protocol/alcatel/alcabus.h"
#endif
#if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX)
# include "protocol/obex/obex.h"
#endif
#if defined(GSM_ENABLE_MROUTERBLUE)
# include "protocol/symbian/mrouter.h"
#endif
#define GSM_ENABLE_SERIALDEVICE
#ifndef GSM_USED_SERIALDEVICE
# undef GSM_ENABLE_SERIALDEVICE
#endif
#define GSM_ENABLE_IRDADEVICE
#ifndef GSM_USED_IRDADEVICE
# undef GSM_ENABLE_IRDADEVICE
#endif
#define GSM_ENABLE_BLUETOOTHDEVICE
#ifndef GSM_USED_BLUETOOTHDEVICE
# undef GSM_ENABLE_BLUETOOTHDEVICE
#endif
#ifdef DJGPP
# undef GSM_ENABLE_IRDADEVICE
# undef GSM_ENABLE_IRDAPHONET
# undef GSM_ENABLE_IRDAOBEX
# undef GSM_ENABLE_IRDAAT
# undef GSM_ENABLE_FBUS2IRDA
# undef GSM_ENABLE_BLUETOOTHDEVICE
# undef GSM_ENABLE_BLUEPHONET
# undef GSM_ENABLE_BLUEOBEX
# undef GSM_ENABLE_BLUEAT
# undef GSM_ENABLE_BLUEFBUS2
# undef GSM_ENABLE_PHONETBLUE
# undef GSM_ENABLE_FBUS2BLUE
# undef GSM_ENABLE_MROUTERBLUE
#endif
+
#ifndef WIN32
# ifdef ENABLE_LGPL
# undef GSM_ENABLE_IRDADEVICE
# undef GSM_ENABLE_IRDAPHONET
# undef GSM_ENABLE_IRDAOBEX
# undef GSM_ENABLE_IRDAAT
# undef GSM_ENABLE_FBUS2IRDA
# undef GSM_ENABLE_BLUETOOTHDEVICE
# undef GSM_ENABLE_BLUEPHONET
# undef GSM_ENABLE_BLUEOBEX
# undef GSM_ENABLE_BLUEAT
# undef GSM_ENABLE_BLUEFBUS2
# undef GSM_ENABLE_PHONETBLUE
# undef GSM_ENABLE_FBUS2BLUE
# undef GSM_ENABLE_MROUTERBLUE
# endif
#endif
#ifdef GSM_ENABLE_SERIALDEVICE
# include "device/serial/ser_w32.h"
# include "device/serial/ser_unx.h"
# include "device/serial/ser_djg.h"
#endif
#ifdef GSM_ENABLE_IRDADEVICE
# include "device/irda/irda.h"
#endif
#ifdef GSM_ENABLE_BLUETOOTHDEVICE
# include "device/bluetoth/bluetoth.h"
#endif
#include "service/gsmpbk.h"
#include "service/gsmnet.h"
#include "service/gsmring.h"
#include "service/gsmcal.h"
#include "service/gsmdata.h"
#include "service/gsmlogo.h"
#include "service/gsmmisc.h"
#include "service/gsmprof.h"
#include "service/gsmcall.h"
#include "service/sms/gsmsms.h"
#include "service/sms/gsmems.h"
#include "service/sms/gsmmulti.h"
#include "service/backup/gsmback.h"
/* ------------------------- Device layer ---------------------------------- */
/**
* Device functions, each device has to provide these.
*/
typedef struct {
/**
* Opens device.
*/
GSM_Error (*OpenDevice) (GSM_StateMachine *s);
/**
* Closes device.
*/
GSM_Error (*CloseDevice) (GSM_StateMachine *s);
/**
* Sets parity for device.
*/
GSM_Error (*DeviceSetParity) (GSM_StateMachine *s, bool parity);
/**
* Sets dtr (data to read) and rts (ready to send) flags.
*/
GSM_Error (*DeviceSetDtrRts) (GSM_StateMachine *s, bool dtr, bool rts);
/**
* Sets device speed.
*/
GSM_Error (*DeviceSetSpeed) (GSM_StateMachine *s, int speed);
/**
* Attempts to read nbytes from device.
*/
int (*ReadDevice) (GSM_StateMachine *s, void *buf, size_t nbytes);
/**
* Attempts to read nbytes from device.
*/
int (*WriteDevice) (GSM_StateMachine *s, void *buf, size_t nbytes);
} GSM_Device_Functions;
#ifdef GSM_ENABLE_SERIALDEVICE
extern GSM_Device_Functions SerialDevice;
#endif
#ifdef GSM_ENABLE_IRDADEVICE
extern GSM_Device_Functions IrdaDevice;
#endif
#ifdef GSM_ENABLE_BLUETOOTHDEVICE
extern GSM_Device_Functions BlueToothDevice;
#endif
/**
* Structure containing device specific data and pointer to device functions -
* @ref GSM_Device_Functions. The data are in a union, so you can use only
* one device at one time.
*/
typedef struct {
union {
char fake;
#ifdef GSM_ENABLE_SERIALDEVICE
GSM_Device_SerialData Serial;
#endif
#ifdef GSM_ENABLE_IRDADEVICE
GSM_Device_IrdaData Irda;
#endif
#ifdef GSM_ENABLE_BLUETOOTHDEVICE
GSM_Device_BlueToothData BlueTooth;
#endif
} Data;
GSM_Device_Functions *Functions;
} GSM_Device;
/* ---------------------- Protocol layer ----------------------------------- */
/**
* Protocol functions, each protocol has to implement these.
*/
typedef struct {
/**
* Writes message to device.
*/
GSM_Error (*WriteMessage) (GSM_StateMachine *s, unsigned char *buffer,
int length, unsigned char type);
/**
* This one is called when character is received from device.
*/
GSM_Error (*StateMachine) (GSM_StateMachine *s, unsigned char rx_char);
/**
* Protocol initialisation.
*/
GSM_Error (*Initialise) (GSM_StateMachine *s);
/**
* Protocol termination.
*/
GSM_Error (*Terminate) (GSM_StateMachine *s);
} GSM_Protocol_Functions;
#ifdef GSM_ENABLE_MBUS2
extern GSM_Protocol_Functions MBUS2Protocol;
#endif
#if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2) || defined(GSM_ENABLE_FBUS2PL2303)
extern GSM_Protocol_Functions FBUS2Protocol;
#endif
#if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET)
extern GSM_Protocol_Functions PHONETProtocol;
#endif
#if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT)
extern GSM_Protocol_Functions ATProtocol;
#endif
#ifdef GSM_ENABLE_ALCABUS
extern GSM_Protocol_Functions ALCABUSProtocol;
#endif
#if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX)
extern GSM_Protocol_Functions OBEXProtocol;
#endif
#if defined(GSM_ENABLE_MROUTERBLUE)
extern GSM_Protocol_Functions MROUTERProtocol;
#endif
/**
* Structure containing protocol specific data and pointer to protocol
* functions - @ref GSM_Protocol_Functions. The data are in a structure, so
* you may use more protocols at once and switch between them.
*/
typedef struct {
struct {
char fake;
#ifdef GSM_ENABLE_MBUS2
GSM_Protocol_MBUS2Data MBUS2;
#endif
#if defined(GSM_ENABLE_FBUS2) || defined(GSM_ENABLE_FBUS2IRDA) || defined(GSM_ENABLE_FBUS2DLR3) || defined(GSM_ENABLE_FBUS2DKU5) || defined(GSM_ENABLE_FBUS2PL2303) || defined(GSM_ENABLE_FBUS2BLUE) || defined(GSM_ENABLE_BLUEFBUS2)
GSM_Protocol_FBUS2Data FBUS2;
#endif
#if defined(GSM_ENABLE_PHONETBLUE) || defined(GSM_ENABLE_IRDAPHONET) || defined(GSM_ENABLE_BLUEPHONET)
GSM_Protocol_PHONETData PHONET;
#endif
#if defined(GSM_ENABLE_AT) || defined(GSM_ENABLE_BLUEAT) || defined(GSM_ENABLE_IRDAAT)
GSM_Protocol_ATData AT;
#endif
#ifdef GSM_ENABLE_ALCABUS
GSM_Protocol_ALCABUSData ALCABUS;
#endif
#if defined(GSM_ENABLE_IRDAOBEX) || defined(GSM_ENABLE_BLUEOBEX)
GSM_Protocol_OBEXData OBEX;
#endif
#if defined(GSM_ENABLE_MROUTERBLUE)
GSM_Protocol_MROUTERData MROUTER;
#endif
} Data;
GSM_Protocol_Functions *Functions;
} GSM_Protocol;
@@ -1387,193 +1388,192 @@ typedef struct {
} GSM_Phone;
/* --------------------------- User layer ---------------------------------- */
struct _GSM_User {
GSM_Reply_Function *UserReplyFunctions;
void (*IncomingCall) (char *Device, GSM_Call call);
void (*IncomingSMS) (char *Device, GSM_SMSMessage sms);
void (*IncomingCB) (char *Device, GSM_CBMessage cb);
void (*IncomingUSSD) (char *Device, char *Text);
void (*SendSMSStatus) (char *Device, int status, int MessageReference);
};
/* --------------------------- Statemachine layer -------------------------- */
typedef enum {
GCT_MBUS2=1,
GCT_FBUS2,
GCT_FBUS2DLR3,
GCT_FBUS2DKU5,
GCT_FBUS2PL2303,
GCT_FBUS2BLUE,
GCT_FBUS2IRDA,
GCT_PHONETBLUE,
GCT_AT,
GCT_MROUTERBLUE,
GCT_IRDAOBEX,
GCT_IRDAAT,
GCT_IRDAPHONET,
GCT_BLUEFBUS2,
GCT_BLUEAT,
GCT_BLUEPHONET,
GCT_BLUEOBEX
} GSM_ConnectionType;
typedef struct {
/* Config file (or Registry or...) variables */
char Model[50]; /* Model from config file */
char DebugLevel[50]; /* Debug level */
char *Device; /* Device name from config file */
char *Connection; /* Connection type as string */
char *SyncTime; /* Synchronize time on startup? */
char *LockDevice; /* Lock device ? (Unix) */
char *DebugFile; /* Name of debug file */
char *Localize; /* Name of localisation file */
char *StartInfo; /* Display something during start ? */
bool UseGlobalDebugFile;/* Should we use global debug file? */
bool DefaultModel;
bool DefaultDebugLevel;
bool DefaultDevice;
bool DefaultConnection;
bool DefaultSyncTime;
bool DefaultLockDevice;
bool DefaultDebugFile;
bool DefaultLocalize;
bool DefaultStartInfo;
} GSM_Config;
#define MAX_CONFIG_NUM 5
struct _GSM_StateMachine {
GSM_ConnectionType ConnectionType; /* Type of connection as int */
char *LockFile; /* Lock file name for Unix */
Debug_Info di; /* Debug information */
bool opened; /* Is connection opened ? */
GSM_Config Config[MAX_CONFIG_NUM + 1];
GSM_Config *CurrentConfig; /* Config file (or Registry or...) variables */
int ConfigNum;
INI_Section *msg; /* Localisation strings structure */
int ReplyNum; /* How many times make sth. */
int Speed; /* For some protocols used speed */
GSM_Device Device;
GSM_Protocol Protocol;
GSM_Phone Phone;
GSM_User User;
};
/* ------------------------ Other general definitions ---------------------- */
GSM_Error GSM_RegisterAllPhoneModules (GSM_StateMachine *s);
GSM_Error GSM_InitConnection (GSM_StateMachine *s, int ReplyNum);
GSM_Error GSM_TerminateConnection (GSM_StateMachine *s);
int GSM_ReadDevice (GSM_StateMachine *s, bool wait);
GSM_Error GSM_WaitForOnce (GSM_StateMachine *s, unsigned char *buffer,
int length, unsigned char type, int time);
GSM_Error GSM_WaitFor (GSM_StateMachine *s, unsigned char *buffer,
int length, unsigned char type, int time,
GSM_Phone_RequestID request);
GSM_Error GSM_DispatchMessage (GSM_StateMachine *s);
INI_Section *GSM_FindGammuRC(void);
bool GSM_ReadConfig (INI_Section *cfg_info, GSM_Config *cfg, int num);
void GSM_DumpMessageLevel2 (GSM_StateMachine *s, unsigned char *message, int messagesize, int type);
void GSM_DumpMessageLevel3 (GSM_StateMachine *s, unsigned char *message, int messagesize, int type);
/* ---------------------- Phone features ----------------------------------- */
typedef enum {
/* n6110.c */
F_CAL33 = 1, /* Calendar,3310 style - 10 reminders, Unicode, 3 coding types */
F_CAL52, /* Calendar,5210 style - full Unicode, etc. */
F_CAL82, /* Calendar,8250 style - "normal", but with Unicode */
F_RING_SM, /* Ringtones returned in SM format - 33xx */
F_NORING, /* No ringtones */
F_NOPBKUNICODE, /* No phonebook in Unicode */
F_NOWAP, /* No WAP */
F_NOCALLER, /* No caller groups */
F_NOPICTURE, /* No Picture Images */
F_NOPICTUREUNI, /* No Picture Images text in Unicode */
F_NOSTARTUP, /* No startup logo */
F_NOCALENDAR, /* No calendar */
F_NOSTARTANI, /* Startup logo is not animated */
F_POWER_BATT, /* Network and battery level get from netmonitor */
F_PROFILES33, /* Phone profiles in 3310 style */
F_PROFILES51, /* Phone profiles in 5110 style */
F_MAGICBYTES, /* Phone can make authentication with magic bytes */
F_NODTMF, /* Phone can't send DTMF */
F_DISPSTATUS, /* Phone return display status */
F_NOCALLINFO,
/* n3320.c */
F_DAYMONTH, /* Day and month reversed in pbk, when compare to GSM models */
/* n6510.c */
F_PBK35, /* Phonebook in 3510 style with ringtones ID */
F_PBKIMG, /* Phonebook in 7250 style with picture ID */
F_PBKTONEGAL, /* Phonebook with selecting ringtones from gallery */
F_PBKSMSLIST, /* Phonebook with SMS list */
F_PBKUSER, /* Phonebook with user ID */
F_RADIO, /* Phone with FM radio */
F_TODO63, /* ToDo in 6310 style - 0x55 msg type */
F_TODO66, /* ToDo in 6610 style - like calendar, with date and other */
F_NOMIDI, /* No ringtones in MIDI */
F_BLUETOOTH, /* Bluetooth support */
F_NOFILESYSTEM, /* No images, ringtones, java saved in special filesystem */
F_NOMMS, /* No MMS sets in phone */
F_NOGPRSPOINT, /* GPRS point are not useable */
F_CAL35, /* Calendar,3510 style - Reminder,Call,Birthday */
F_CAL65, /* Calendar,6510 style - CBMM, method 3 */
F_WAPMMSPROXY, /* WAP & MMS settings contains first & second proxy */
/* n6510.c && n7110.c */
F_VOICETAGS, /* Voice tags available */
F_CAL62, /* Calendar,6210 style - Call,Birthday,Memo,Meeting */
F_NOTES,
/* AT modules */
F_SMSONLYSENT, /* Phone supports only sent/unsent messages */
F_BROKENCPBS, /* CPBS on some memories can hang phone */
F_M20SMS, /* Siemens M20 like SMS handling */
F_SLOWWRITE, /* Use slower writing which some phone need */
F_SMSME900, /* SMS in ME start from location 900 - case of Sagem */
F_ALCATEL /* Phone supports Alcatel protocol */
} Feature;
/* For models table */
struct _OnePhoneModel {
char *model;
char *number;
char *irdamodel;
Feature features[12];
};
bool IsPhoneFeatureAvailable (OnePhoneModel *model, Feature feature);
OnePhoneModel *GetModelData (char *model, char *number, char *irdamodel);
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
int smprintf(GSM_StateMachine *s, const char *format, ...);
void GSM_OSErrorInfo(GSM_StateMachine *s, char *description);
#ifdef GSM_ENABLE_BACKUP
void GSM_GetPhoneFeaturesForBackup(GSM_StateMachine *s, GSM_Backup_Info *info);
#endif
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
-