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 friend class PilotSerialDatabase;
00043 Q_OBJECT
00044
00045
00046
00047
00048 public:
00054 KPilotDeviceLink( QObject *parent = 0,
00055 const char *name = 0,
00056 const QString &tempDevice = QString::null );
00058 virtual ~KPilotDeviceLink();
00059
00060
00066 typedef enum {
00067 Init,
00068 WaitingForDevice,
00069 FoundDevice,
00070 CreatedSocket,
00071 DeviceOpen,
00072 AcceptedDevice,
00073 SyncDone,
00074 PilotLinkError,
00075 WorkaroundUSB
00076 } LinkStatus;
00077
00081 LinkStatus status() const { return fLinkStatus; } ;
00083 static QString statusString(LinkStatus l);
00084
00085
00086
00087
00088 virtual QString statusString() const;
00089 virtual bool isConnected() const;
00090 virtual void reset( const QString & );
00091 virtual void close();
00092 virtual void reset();
00093 virtual bool tickle();
00094 virtual const KPilotCard *getCardInfo(int card);
00095 virtual void endOfSync();
00096 virtual void finishSync();
00097 virtual int openConduit();
00098 virtual int getNextDatabase(int index,struct DBInfo *);
00099 virtual int findDatabase(const char *name, struct DBInfo*,
00100 int index=0, unsigned long type=0, unsigned long creator=0);
00101 virtual bool retrieveDatabase(const QString &path, struct DBInfo *db);
00102 virtual DBInfoList getDBList(int cardno=0, int flags=dlpDBListRAM);
00103 virtual PilotDatabase *database( const QString &name );
00104
00105 protected:
00106 virtual bool installFile(const QString &, const bool deleteFile);
00107 virtual void addSyncLogEntryImpl( const QString &s );
00108 virtual int pilotSocket() const { return fCurrentPilotSocket; } ;
00109
00110
00111 private:
00112 LinkStatus fLinkStatus;
00113
00114
00115
00116
00117
00118 public:
00119
00126 void setWorkarounds(bool usb)
00127 {
00128 fWorkaroundUSB = usb;
00129 } ;
00130
00136 void setTempDevice( const QString &device );
00137
00138 private:
00140 bool fWorkaroundUSB;
00142 QTimer *fWorkaroundUSBTimer;
00143
00144 private slots:
00149 void workaroundUSB();
00150
00151 protected slots:
00156 void openDevice();
00157
00162 void acceptDevice();
00163
00164 protected:
00169 bool open( const QString &device = QString::null );
00170
00176 void checkDevice();
00177
00183 enum { OpenMessage=1, OpenFailMessage=2 } ;
00184 int messages;
00185 int messagesMask;
00186 static const int messagesType;
00187
00193 void shouldPrint(int msgid,const QString &s);
00194
00195
00196
00197 private:
00202 QString fRealPilotPath;
00203
00207 int fRetries;
00208
00212 QTimer *fOpenTimer;
00213 QSocketNotifier *fSocketNotifier;
00214 bool fSocketNotifierActive;
00215
00219 int fPilotMasterSocket;
00220 int fCurrentPilotSocket;
00221 QString fTempDevice;
00222
00227 int fAcceptedCount;
00228
00229 private:
00230 class KPilotDeviceLinkPrivate;
00231 } ;
00232
00233 #endif
00234
|