summaryrefslogtreecommitdiff
path: root/glcddrivers/network.h
blob: 4664f4c134f9a44148219cd40254f4d99d1eeffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * GraphLCD driver library
 *
 * network.h  -  Network output device
 *               Output goes to a network client.
 *
 * This file is released under the GNU General Public License. Refer
 * to the COPYING file distributed with this package.
 *
 * (c) 2004 Andreas Regel <andreas.regel AT powarman.de>
 */

#ifndef _GLCDDRIVERS_NETWORK_H_
#define _GLCDDRIVERS_NETWORK_H_

#include <pthread.h>

#include "driver.h"


namespace GLCD
{

class cDriverConfig;

class cDriverNetwork : public cDriver
{
private:
    unsigned char * newLCD;
    unsigned char * oldLCD;
    cDriverConfig * config;
    cDriverConfig * oldConfig;
    int lineSize;
    bool running;
    pthread_t childTid;
    int clientSocket;
    bool clientConnected;

    int CheckSetup();
    static void * ServerThread(cDriverNetwork * Driver);

public:
    cDriverNetwork(cDriverConfig * config);
    virtual ~cDriverNetwork();

    virtual int Init();
    virtual int DeInit();

    virtual void Clear();
    virtual void Set8Pixels(int x, int y, unsigned char data);
    virtual void Refresh(bool refreshAll = false);
};

} // end of namespace

#endif