modem.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
#ifndef MODEM_H
00027
#define MODEM_H
00028
00029
#ifdef HAVE_CONFIG_H
00030
#include "config.h"
00031
#endif
00032
00033
#include <termios.h>
00034
00035
#include <qobject.h>
00036
#include <qstring.h>
00037
#include <qtimer.h>
00038
#include <qsocketnotifier.h>
00039
00040
00041
00042
00043
class Modem :
public QObject
00044 {
00045 Q_OBJECT
00046
public:
00047 Modem(
QObject *parent = 0,
const char *name = 0);
00048
virtual ~Modem();
00049
00050
void setDevice(
const QString& name);
00051
00052
void setSpeed(
int speed);
00053
void setData(
int data);
00054
void setParity(
char parity);
00055
void setStop(
int stop);
00056
00057
bool open();
00058
void close();
00059
00060
bool isOpen() {
return mOpen; }
00061
00062
void flush();
00063
00064
bool lockDevice();
00065
void unlockDevice();
00066
00067
bool dsrOn();
00068
bool ctsOn();
00069
00070
void writeChar(
const char c);
00071
void writeLine(
const char *line);
00072
00073
void timerStart(
int msec);
00074
00075
void receiveXModem(
bool crc);
00076
void abortXModem();
00077
00078
private slots:
00079
void timerDone();
00080
00081
void readChar(
int);
00082
void readXChar(
int);
00083
00084
private:
00085
bool mOpen;
00086
00087
void init();
00088
void xreset();
00089
00090 uchar calcChecksum();
00091 ushort calcCRC();
00092
00093
bool is_locked;
00094
struct termios init_tty;
00095
00096 speed_t cspeed;
00097 tcflag_t cflag;
00098
00099
char *fdev;
00100
int fd;
00101
QTimer *timer;
00102
QSocketNotifier *sn;
00103
00104 uchar buffer[1024];
00105
int bufpos;
00106
00107
int xstate;
00108
bool xcrc;
00109 uchar xblock;
00110
int xsize;
00111
00112 signals:
00113
void gotLine(
const char *);
00114
void gotXBlock(
const uchar *,
int);
00115
void xmodemDone(
bool);
00116
void timeout();
00117
00118
void errorMessage(
const QString & );
00119 };
00120
00121
00122
#endif // MODEM_H
This file is part of the documentation for kandy Library Version 3.3.0.