OpenCores
URL https://opencores.org/ocsvn/bw_tiff_compression/bw_tiff_compression/trunk

Subversion Repositories bw_tiff_compression

[/] [bw_tiff_compression/] [trunk/] [client_application/] [src/] [Kernel/] [CSerialportDevice.h] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 amulder
/*
2
 * @file     SerialportDevice.h
3
 * @date     May 14, 2012
4
 * @author   Aart Mulder
5
 */
6
 
7
#ifndef CSerialportDevice_h
8
#define CSerialportDevice_h
9
 
10
#include <QString>
11
#include <QList>
12
 
13
#ifndef linux
14
#include <windows.h>
15
#include <tchar.h>
16
#include <stdio.h>
17
#endif
18
 
19
#include "CDevice.h"
20
 
21
        /** @author Aart Mulder
22
         *  @version 1
23
         */
24
 
25
class CSerialportDevice : public CDevice {
26
        /* {since=2011-12-09}*/
27
        Q_OBJECT
28
 
29
 public:
30
        CSerialportDevice(int nLoopTime, QString sName);
31
        virtual ~CSerialportDevice();
32
    static QList<QString> GetPortNames();
33
        bool Connect(char *sName);
34
    bool Connect(char *sName, quint32 nBaudrate);
35
    bool Disconnect();
36
        void ResetRxCnt();
37
        quint64 GetRxCnt();
38
    void Flush();
39
 
40
 protected:
41
        void BeforeDeviceLoop();
42
        void DeviceLoop();
43
        void AfterDeviceLoop();
44
        virtual void BeforeClientLoop() = 0;
45
        virtual void ClientLoop() = 0;
46
        virtual void AfterClientLoop() = 0;
47
        virtual void OnDataReceived(quint8 cData) = 0;
48
        virtual void OnDataReceived(quint8 *pData, int nSize) = 0;
49
        bool Send(unsigned char cData);
50
        bool Send(unsigned char *pData, unsigned int nSize);
51
 
52
        quint64 m_nRxCnt;
53
 
54
 private:
55
        int serialRead(char* aData, int nMaxSize);
56
#ifdef linux
57
    void configure_port(quint32 nBaudrate);
58
#endif
59
 
60
#ifdef linux
61
        int fd1;
62
#else
63
        HANDLE m_fpSerialPort;
64
#endif
65
 
66
 signals:
67
        void DebugMessage(QString sMessage);
68
 
69
 private slots:
70
 
71
};
72
 
73
#endif // CSerialportDevice_h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.