2 EIBD eib bus access and management daemon
3 Copyright (C) 2005-2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 /** process a recevied frame */
59 void RecvLPDU (const uchar
* data
, int len
);
60 void Run (pth_sem_t
* stop
);
62 TPUARTSerialLayer2Driver (const char *dev
, eibaddr_t addr
, Trace
* tr
);
63 ~TPUARTSerialLayer2Driver ();
66 void Send_L_Data (LPDU
* l
);
67 LPDU
*Get_L_Data (pth_event_t stop
);
69 bool addAddress (eibaddr_t addr
);
70 bool addGroupAddress (eibaddr_t addr
);
71 bool removeAddress (eibaddr_t addr
);
72 bool removeGroupAddress (eibaddr_t addr
);
74 bool enterBusmonitor ();
75 bool leaveBusmonitor ();
76 bool openVBusmonitor ();
77 bool closeVBusmonitor ();
81 eibaddr_t
getDefaultAddr ();
82 bool Connection_Lost ();
83 bool Send_Queue_Empty ();