2 EIBD eib bus access and management daemon
3 Copyright (C) 2005-2010 Martin Koegler <mkoegler@auto.tuwien.ac.at>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #ifndef TPUART_SERIAL_H
21 #define TPUART_SERIAL_H
23 #include "lowlatency.h"
26 /** TPUART user mode driver */
27 class TPUARTSerialLayer2Driver
:public Layer2Interface
, private Thread
29 /** old serial config */
30 low_latency_save sold
;
31 /** old termios state */
33 /** file descriptor */
37 /** default EIB address */
41 /** vbusmonitor mode */
43 /** semaphore for inqueue */
45 /** semaphore for outqueue */
48 Queue
< LPDU
* >inqueue
;
50 Queue
< LPDU
* >outqueue
;
51 /** event to wait for outqueue */
53 /** my individual addresses */
54 Array
< eibaddr_t
> indaddr
;
55 /** my group addresses */
56 Array
< eibaddr_t
> groupaddr
;
58 bool ackallindividual
;
61 /** process a recevied frame */
62 void RecvLPDU (const uchar
* data
, int len
);
63 void Run (pth_sem_t
* stop
);
65 TPUARTSerialLayer2Driver (const char *dev
, eibaddr_t addr
, int flags
,
67 ~TPUARTSerialLayer2Driver ();
70 void Send_L_Data (LPDU
* l
);
71 LPDU
*Get_L_Data (pth_event_t stop
);
73 bool addAddress (eibaddr_t addr
);
74 bool addGroupAddress (eibaddr_t addr
);
75 bool removeAddress (eibaddr_t addr
);
76 bool removeGroupAddress (eibaddr_t addr
);
78 bool enterBusmonitor ();
79 bool leaveBusmonitor ();
80 bool openVBusmonitor ();
81 bool closeVBusmonitor ();
85 eibaddr_t
getDefaultAddr ();
86 bool Connection_Lost ();
87 bool Send_Queue_Empty ();