kpilot/lib
kpilotdevicelink.h00001 #ifndef _KPILOT_KPILOTDEVICELINK_H
00002 #define _KPILOT_KPILOTDEVICELINK_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "kpilotlink.h"
00033
00040 class KDE_EXPORT KPilotDeviceLink : public KPilotLink
00041 {
00042
00043 friend class PilotSerialDatabase;
00044 Q_OBJECT
00045
00046
00047
00048
00049 public:
00055 KPilotDeviceLink( QObject *parent = 0, const char *name = 0, const QString &tempDevice = QString::null );
00057 virtual ~KPilotDeviceLink();
00058
00059
00065 typedef enum {
00066 Init,
00067 WaitingForDevice,
00068 FoundDevice,
00069 CreatedSocket,
00070 DeviceOpen,
00071 AcceptedDevice,
00072 SyncDone,
00073 PilotLinkError,
00074 WorkaroundUSB
00075 } LinkStatus;
00076
00080 LinkStatus status() const { return fLinkStatus; } ;
00082 static QString statusString(LinkStatus l);
00083
00084
00085 virtual QString statusString() const;
00086 virtual bool isConnected() const;
00087 virtual void reset( const QString & );
00088 virtual void close();
00089 virtual void reset();
00090 virtual bool tickle();
00091 virtual const KPilotCard *getCardInfo(int card);
00092 virtual void endOfSync();
00093 virtual void finishSync();
00094 virtual int openConduit();
00095 virtual int getNextDatabase(int index,struct DBInfo *);
00096 virtual int findDatabase(const char *name, struct DBInfo*,
00097 int index=0, unsigned long type=0, unsigned long creator=0);
00098 virtual bool retrieveDatabase(const QString &path, struct DBInfo *db);
00099 virtual DBInfoList getDBList(int cardno=0, int flags=dlpDBListRAM);
00100 virtual PilotDatabase *database( const QString &name );
00101
00102 protected:
00103 virtual bool installFile(const QString &, const bool deleteFile);
00104 virtual void addSyncLogEntryImpl( const QString &s );
00105 virtual int pilotSocket() const { return fCurrentPilotSocket; } ;
00106
00107
00108 private:
00109 LinkStatus fLinkStatus;
00110
00111
00112
00113
00114
00115 public:
00116
00123 void setWorkarounds(bool usb)
00124 {
00125 fWorkaroundUSB = usb;
00126 } ;
00127
00132 void setTempDevice( const QString &device );
00133
00134 private:
00135 bool fWorkaroundUSB;
00136 QTimer *fWorkaroundUSBTimer;
00137
00138 private slots:
00139 void workaroundUSB();
00140
00141 protected slots:
00146 void openDevice();
00147
00152 void acceptDevice();
00153
00154 protected:
00159 bool open( QString device = QString::null );
00160
00166 void checkDevice();
00167
00173 enum { OpenMessage=1, OpenFailMessage=2 } ;
00174 int messages;
00175 int messagesMask;
00176 static const int messagesType;
00177
00178 void shouldPrint(int,const QString &);
00179
00180
00181
00182 private:
00187 QString fRealPilotPath;
00188
00192 int fRetries;
00193
00197 QTimer *fOpenTimer;
00198 QSocketNotifier *fSocketNotifier;
00199 bool fSocketNotifierActive;
00200
00204 int fPilotMasterSocket;
00205 int fCurrentPilotSocket;
00206 QString fTempDevice;
00207
00212 int fAcceptedCount;
00213
00214 private:
00215 class KPilotDeviceLinkPrivate;
00216 } ;
00217
00218 #endif
00219
|