Connectionless layer 7 access function
[bcusdk.git] / eibd / libserver / layer7.h
blobfdcd80b233d37047eb54cba9d1fa6418bd4e3228
1 /*
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 LAYER7_H
21 #define LAYER7_H
23 #include "layer4.h"
25 class APDU;
27 /** layer 7 broadcast connection */
28 class Layer7_Broadcast
30 Trace *t;
31 T_Broadcast *l4;
33 public:
34 Layer7_Broadcast (Layer3 * l3, Trace * tr);
35 virtual ~ Layer7_Broadcast ();
36 bool init ();
38 /** send IndividualAddress_Write */
39 void A_IndividualAddress_Write (eibaddr_t addr);
40 /** sends A_IndividualAddress_Read and collects responses */
41 Array < eibaddr_t > A_IndividualAddress_Read (unsigned timeout = 3);
44 /** Layer 7 Individual Connection */
45 class Layer7_Connection
47 Trace *t;
48 T_Connection *l4;
49 /** destination address */
50 eibaddr_t dest;
52 /** sends APDU and waits for respone; return NULL, if it fails */
53 APDU *Request_Response (APDU * r);
54 public:
55 Layer7_Connection (Layer3 * l3, Trace * tr, eibaddr_t dest);
56 virtual ~ Layer7_Connection ();
57 bool init ();
59 /** send A_Restart */
60 void A_Restart ();
61 /** read a property */
62 int A_Property_Read (uchar obj, uchar propertyid, uint16_t start,
63 uchar count, CArray & erg);
64 /** write a property */
65 int A_Property_Write (uchar obj, uchar propertyid, uint16_t start,
66 uchar count, const CArray & data, CArray & result);
67 /** descripbe a property */
68 int A_Property_Desc (uchar obj, uchar & property, uchar property_index,
69 uchar & type, uint16_t & max_nr_elements,
70 uchar & access);
71 /** read device descript (mask version) */
72 int A_Device_Descriptor_Read (uint16_t & maskver, uchar type = 0);
73 /** read ADC */
74 int A_ADC_Read (uchar channel, uchar readcount, int16_t & value);
75 /** read memory */
76 int A_Memory_Read (memaddr_t addr, uchar len, CArray & data);
77 /** write memory */
78 int A_Memory_Write (memaddr_t addr, const CArray & data);
79 /** try to authorize */
80 int A_Authorize (eibkey_type key, uchar & level);
81 /** try to write a key */
82 int A_KeyWrite (eibkey_type key, uchar & level);
84 /** write a property and verify */
85 int X_Property_Write (uchar obj, uchar propertyid, uint16_t start,
86 uchar count, const CArray & data);
87 /** write memory and verify */
88 int X_Memory_Write (memaddr_t addr, const CArray & data);
90 /** write arbitray memory block and verify */
91 int X_Memory_Write_Block (memaddr_t addr, const CArray & data);
92 /** read arbitray memory block*/
93 int X_Memory_Read_Block (memaddr_t addr, int len, CArray & erg);
94 /** write arbitray memory block without verify */
95 int A_Memory_Write_Block (memaddr_t addr, const CArray & data);
98 /** Layer 7 Individual */
99 class Layer7_Individual
101 Trace *t;
102 T_Individual *l4;
103 /** destination address */
104 eibaddr_t dest;
106 /** sends APDU and waits for respone; return NULL, if it fails */
107 APDU *Request_Response (APDU * r);
108 public:
109 Layer7_Individual (Layer3 * l3, Trace * tr, eibaddr_t dest);
110 virtual ~ Layer7_Individual ();
111 bool init ();
113 /** read a property */
114 int A_Property_Read (uchar obj, uchar propertyid, uint16_t start,
115 uchar count, CArray & erg);
116 /** write a property */
117 int A_Property_Write (uchar obj, uchar propertyid, uint16_t start,
118 uchar count, const CArray & data, CArray & result);
121 #endif