summaryrefslogtreecommitdiffstats
path: root/ABI-IPC/abi-ipc.h
blob: 687ed1409bf40f8ea8af337197e615b6daced8ed (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
//
//  abi-ipc.h
//  AmbientLight
//
//  Created by Thorsten Kummermehr on 10/9/13.
//
//

#ifndef AmbientLight_abi_ipc_h
#define AmbientLight_abi_ipc_h

#include "K2LABI.h"

#include <pthread.h>

namespace K2L
{
    namespace Automotive
    {
        namespace ABI_IPC
        {

            class K2LABI_API AbiUsbIpc :
            public K2L::Automotive::ABI::AbiIpcDevice
            {
            public:
                AbiUsbIpc();
                virtual
                ~AbiUsbIpc();
                virtual bool Connect( const char *cdevRx, const char *cdevTx );
                virtual bool Connect( const char *cdevRxTx );
                virtual void Disconnect( void );
                virtual bool IsConnected();
                virtual int Send( const BYTE *data, DWORD length );
                virtual void SetReceivePriority( int prio );
                virtual void SetReceiveCallback( ABI::AbiIpcDevice_RxCB_t receiveCB, void *cbArg );

            protected:
                static void *ReceiveThread( void *param );

                bool _isConnected;
                bool _receiveThreadIsRunning;
                ABI::AbiIpcDevice_RxCB_t *_receiveCB;
                void *_receiveCBArgument;
                pthread_t _receiveThread;
                int _rxHandle;
                int _txHandle;
                uint8_t receiveBuffer[3000];
            };
        }
    }
}


#endif