1 /*
2     EIBD client library
3     Copyright (C) 2005-2006 Martin K�gler <mkoegler@auto.tuwien.ac.at>
4 
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.
9 
10     In addition to the permissions in the GNU General Public License,
11     you may link the compiled version of this file into combinations
12     with other programs, and distribute those combinations without any
13     restriction coming from the use of this file. (The General Public
14     License restrictions do apply in other respects; for example, they
15     cover modification of the file, and distribution when not linked into
16     a combine executable.)
17 
18     This program is distributed in the hope that it will be useful,
19     but WITHOUT ANY WARRANTY; without even the implied warranty of
20     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21     GNU General Public License for more details.
22 
23     You should have received a copy of the GNU General Public License
24     along with this program; if not, write to the Free Software
25     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 */
27 #ifndef EIBCLIENT_H
28 #define EIBCLIENT_H
29 
30 #include "sys/cdefs.h"
31 #include "stdint.h"
32 #include <pthsem.h>
33 
34 __BEGIN_DECLS;
35 
36 #include "eibloadresult.h"
37 
38 /** type represents a connection to eibd */
39 typedef struct _EIBConnection EIBConnection;
40 
41 /** type for storing a EIB address */
42 typedef uint16_t eibaddr_t;
43 
44 /** Opens a connection to eibd.
45  *   url can either be <code>ip:host:[port]</code> or <code>local:/path/to/socket</code>
46  * \param url contains the url to connect to
47  * \return connection handle or NULL
48  */
49 EIBConnection *EIBSocketURL (const char *url);
50 /** Opens a connection to eibd over a socket.
51  * \param path path to the socket
52  * \return connection handle or NULL
53  */
54 EIBConnection *EIBSocketLocal (const char *path);
55 /** Opens a connection to eibd over TCP/IP.
56  * \param host hostname running eibd
57  * \param port portnumber
58  * \return connection handle or NULL
59  */
60 EIBConnection *EIBSocketRemote (const char *host, int port);
61 
62 /** Closes and frees a connection.
63  * \param con eibd connection
64  */
65 int EIBClose (EIBConnection * con);
66 
67 /** Set event ring for generalized pth API.
68  * \param con eibd connection
69  * \param ev pth event
70  */
71 void EIBSetEvent (EIBConnection * con, pth_event_t ev);
72 
73 /** Finish an asynchronous request (and block until then).
74  * \param con eibd connection
75  * \return return value, as returned by the synchronous function call
76  */
77 int EIBComplete (EIBConnection * con);
78 
79 /** Checks if an asynchronous request is completed (non-blocking).
80  * EIBComplete must be still be used for asynchronous functions to retrieve the return value.
81  * For connections where packets are returned (Busmonitor, T_*), EIB_Poll_Complete can be used to check if new data is available.
82  * If this function returns an error, the eibd connection should be considered as broken (and therefore be closed).
83  * \param con eibd connection
84  * \return -1 if any error, 0 if not finished, 1 if finished
85  */
86 int EIB_Poll_Complete (EIBConnection * con);
87 
88 /** Returns FD to wait for the next event.
89  * The returned file descriptor may only be used to select/poll for read data available.
90  * As EIBComplete (and functions, which return packets) block if only a part of the data is
91  * available, EIB_Poll_Complete can be used to check whether blocking will occur.
92  * \param con eibd connection
93  * \return -1 if any error, else file descriptor
94  */
95 int EIB_Poll_FD (EIBConnection * con);
96 
97 /** Switches the connection to binary busmonitor mode.
98  * \param con eibd connection
99  * \return 0 if successful, -1 if error
100  */
101 int EIBOpenBusmonitor (EIBConnection * con);
102 
103 /** Switches the connection to binary busmonitor mode - asynchronous.
104  * \param con eibd connection
105  * \return 0 if started, -1 if error
106  */
107 int EIBOpenBusmonitor_async (EIBConnection * con);
108 
109 /** Switches the connection to text busmonitor mode.
110  * \param con eibd connection
111  * \return 0 if successful, -1 if error
112  */
113 int EIBOpenBusmonitorText (EIBConnection * con);
114 
115 /** Switches the connection to text busmonitor mode - asynchronous.
116  * \param con eibd connection
117  * \return 0 if started, -1 if error
118  */
119 int EIBOpenBusmonitorText_async (EIBConnection * con);
120 
121 /** Switches the connection to binary vbusmonitor mode.
122  * \param con eibd connection
123  * \return 0 if successful, -1 if error
124  */
125 int EIBOpenVBusmonitor (EIBConnection * con);
126 
127 /** Switches the connection to binary vbusmonitor mode - asynchronous.
128  * \param con eibd connection
129  * \return 0 if started, -1 if error
130  */
131 int EIBOpenVBusmonitor_async (EIBConnection * con);
132 
133 /** Switches the connection to text vbusmonitor mode.
134  * \param con eibd connection
135  * \return 0 if successful, -1 if error
136  */
137 int EIBOpenVBusmonitorText (EIBConnection * con);
138 
139 /** Switches the connection to text vbusmonitor mode - asynchronous.
140  * \param con eibd connection
141  * \return 0 if started, -1 if error
142  */
143 int EIBOpenVBusmonitorText_async (EIBConnection * con);
144 
145 /** Receives a packet on a busmonitor connection.
146  * \param con eibd connection
147  * \param maxlen size of the buffer
148  * \param buf buffer
149  * \return -1 if error, else length of the packet
150  */
151 int EIBGetBusmonitorPacket (EIBConnection * con, int maxlen, uint8_t * buf);
152 
153 /** Opens a connection of type T_Connection.
154  * \param con eibd connection
155  * \param dest destination address
156  * \return 0 if successful, -1 if error
157  */
158 int EIBOpenT_Connection (EIBConnection * con, eibaddr_t dest);
159 
160 /** Opens a connection of type T_Connection - asynchronous.
161  * \param con eibd connection
162  * \param dest destination address
163  * \return 0 if started, -1 if error
164  */
165 int EIBOpenT_Connection_async (EIBConnection * con, eibaddr_t dest);
166 
167 /** Opens a connection of type T_Individual.
168  * \param con eibd connection
169  * \param dest destination address
170  * \param write_only if not null, no packets from the bus will be delivered
171  * \return 0 if successful, -1 if error
172  */
173 int EIBOpenT_Individual (EIBConnection * con, eibaddr_t dest, int write_only);
174 
175 /** Opens a connection of type T_Individual - asynchronous.
176  * \param con eibd connection
177  * \param dest destionation address
178  * \param write_only if not null, no packets from the bus will be delivered
179  * \return 0 if started, -1 if error
180  */
181 int EIBOpenT_Individual_async (EIBConnection * con, eibaddr_t dest,
182 			       int write_only);
183 
184 /** Opens a connection of type T_Group.
185  * \param con eibd connection
186  * \param dest group address
187  * \param write_only if not null, no packets from the bus will be delivered
188  * \return 0 if successful, -1 if error
189  */
190 int EIBOpenT_Group (EIBConnection * con, eibaddr_t dest, int write_only);
191 
192 /** Opens a connection of type T_Group - asynchronous.
193  * \param con eibd connection
194  * \param dest group address
195  * \param write_only if not null, no packets from the bus will be delivered
196  * \return 0 if started, -1 if error
197  */
198 int EIBOpenT_Group_async (EIBConnection * con, eibaddr_t dest,
199 			  int write_only);
200 
201 /** Opens a connection of type T_Broadcast.
202  * \param con eibd connection
203  * \param write_only if not null, no packets from the bus will be delivered
204  * \return 0 if successful, -1 if error
205  */
206 int EIBOpenT_Broadcast (EIBConnection * con, int write_only);
207 
208 /** Opens a connection of type T_Broadcast - asynchronous.
209  * \param con eibd connection
210  * \param write_only if not null, no packets from the bus will be delivered
211  * \return 0 if started, -1 if error
212  */
213 int EIBOpenT_Broadcast_async (EIBConnection * con, int write_only);
214 
215 /** Opens a raw Layer 4 connection.
216  * \param con eibd connection
217  * \param src my source address (0 means default)
218  * \return 0 if successful, -1 if error
219  */
220 int EIBOpenT_TPDU (EIBConnection * con, eibaddr_t src);
221 
222 /** Opens a raw Layer 4 connection - asynchronous.
223  * \param con eibd connection
224  * \param src my source address (0 means default)
225  * \return 0 if started, -1 if error
226  */
227 int EIBOpenT_TPDU_async (EIBConnection * con, eibaddr_t src);
228 
229 /** Sends an APDU.
230  * \param con eibd connection
231  * \param len length of the APDU
232  * \param data buffer with APDU
233  * \return tranmited length or -1 if error
234  */
235 int EIBSendAPDU (EIBConnection * con, int len, uint8_t * data);
236 
237 /** Receive an APDU (blocking).
238  * \param con eibd connection
239  * \param maxlen buffer size
240  * \param buf buffer
241  * \return received length or -1 if error
242  */
243 int EIBGetAPDU (EIBConnection * con, int maxlen, uint8_t * buf);
244 
245 /** Receive a APDU with source address (blocking).
246  * \param con eibd connection
247  * \param maxlen buffer size
248  * \param buf buffer
249  * \param src pointer, where the source address should be stored
250  * \return received length or -1 if error
251  */
252 int EIBGetAPDU_Src (EIBConnection * con, int maxlen, uint8_t * buf,
253 		    eibaddr_t * src);
254 
255 /** Sends a TPDU with destination address.
256  * \param con eibd connection
257  * \param dest destination address
258  * \param len length of the APDU
259  * \param data buffer with APDU
260  * \return tranmited length or -1 if error
261  */
262 int EIBSendTPDU (EIBConnection * con, eibaddr_t dest, int len,
263 		 uint8_t * data);
264 
265 /** Receive a TPDU with source address.
266  * \param con eibd connection
267  * \param maxlen buffer size
268  * \param buf buffer
269  * \param src pointer to where the source address should be stored
270  * \return received length or -1 if error
271  */
272 #define EIBGetTPDU EIBGetAPDU_Src
273 
274 /** Opens a Group communication interface.
275  * \param con eibd connection
276  * \param write_only if not null, no packets from the bus will be delivered
277  * \return 0 if successful, -1 if error
278  */
279 int EIBOpen_GroupSocket (EIBConnection * con, int write_only);
280 
281 /** Opens a Group communication interface - asynchronous.
282  * \param con eibd connection
283  * \param write_only if not null, no packets from the bus will be delivered
284  * \return 0 if started, -1 if error
285  */
286 int EIBOpen_GroupSocket_async (EIBConnection * con, int write_only);
287 
288 /** Sends a group APDU.
289  * \param con eibd connection
290  * \param dest destination address
291  * \param len length of the APDU
292  * \param data buffer with APDU
293  * \return tranmited length or -1 if error
294  */
295 int EIBSendGroup (EIBConnection * con, eibaddr_t dest, int len,
296 		  uint8_t * data);
297 
298 /** Receive a group APDU with source address (blocking).
299  * \param con eibd connection
300  * \param maxlen buffer size
301  * \param buf buffer
302  * \param src pointer to where the source address should be stored
303  * \param dest pointer to where the destination address should be stored
304  * \return received length or -1 if error
305  */
306 int EIBGetGroup_Src (EIBConnection * con, int maxlen, uint8_t * buf,
307 		     eibaddr_t * src, eibaddr_t * dest);
308 
309 /** List devices in programming mode.
310  * \param con eibd connection
311  * \param maxlen buffer size
312  * \param buf buffer
313  * \return number of used bytes in the buffer or -1 if error
314  */
315 int EIB_M_ReadIndividualAddresses (EIBConnection * con, int maxlen,
316 				   uint8_t * buf);
317 
318 /** List devices in programming mode - asynchronous.
319  * \param con eibd connection
320  * \param maxlen buffer size
321  * \param buf buffer
322  * \return 0 if started, -1 if error
323  */
324 int EIB_M_ReadIndividualAddresses_async (EIBConnection * con, int maxlen,
325 					 uint8_t * buf);
326 
327 /** Turn on programming mode (connectionless).
328  * \param con eibd connection
329  * \param dest address of EIB device
330  * \return 0 if successful, -1 if error
331  */
332 int EIB_M_Progmode_On (EIBConnection * con, eibaddr_t dest);
333 
334 /** Turns on programming mode (connectionless) - asynchronous.
335  * \param con eibd connection
336  * \param dest address of EIB device
337  * \return 0 if started, -1 if error
338  */
339 int EIB_M_Progmode_On_async (EIBConnection * con, eibaddr_t dest);
340 
341 /** Turns off programming mode (connectionless).
342  * \param con eibd connection
343  * \param dest address of EIB device
344  * \return 0 if successful, -1 if error
345  */
346 int EIB_M_Progmode_Off (EIBConnection * con, eibaddr_t dest);
347 
348 /** Turns off programming mode (connectionless) - asynchronous.
349  * \param con eibd connection
350  * \param dest address of EIB device
351  * \return 0 if started, -1 if error
352  */
353 int EIB_M_Progmode_Off_async (EIBConnection * con, eibaddr_t dest);
354 
355 /** Toggle programming mode (connectionless).
356  * \param con eibd connection
357  * \param dest address of EIB device
358  * \return 0 if successful, -1 if error
359  */
360 int EIB_M_Progmode_Toggle (EIBConnection * con, eibaddr_t dest);
361 
362 /** Toggle programming mode (connectionless) - asynchronous.
363  * \param con eibd connection
364  * \param dest address of EIB device
365  * \return 0 if started, -1 if error
366  */
367 int EIB_M_Progmode_Toggle_async (EIBConnection * con, eibaddr_t dest);
368 
369 /** Check if a device is in programming mode (connectionless).
370  * \param con eibd connection
371  * \param dest address of EIB device
372  * \return 0 if not in programming mode, -1 if error, else programming mode
373  */
374 int EIB_M_Progmode_Status (EIBConnection * con, eibaddr_t dest);
375 
376 /** Check if a device is in programming mode (connectionless) - asynchronous.
377  * \param con eibd connection
378  * \param dest address of EIB device
379  * \return 0 if started, -1 if error
380  */
381 int EIB_M_Progmode_Status_async (EIBConnection * con, eibaddr_t dest);
382 
383 /** Retrieve the mask version (connectionless).
384  * \param con eibd connection
385  * \param dest address of EIB device
386  * \return -1 if error, else mask version
387  */
388 int EIB_M_GetMaskVersion (EIBConnection * con, eibaddr_t dest);
389 
390 /** Retrieve the mask version (connectionless) - asynchronous.
391  * \param con eibd connection
392  * \param dest address of EIB device
393  * \return 0 if started, -1 if error
394  */
395 int EIB_M_GetMaskVersion_async (EIBConnection * con, eibaddr_t dest);
396 
397 /** Set individual address for device currently in programming mode.
398  * \param con eibd connection
399  * \param dest new address of EIB device
400  * \return -1 if error, 0 if successful
401  */
402 int EIB_M_WriteIndividualAddress (EIBConnection * con, eibaddr_t dest);
403 
404 /** Set individual address for device currently in programming mode - asynchronous.
405  * \param con eibd connection
406  * \param dest new address of EIB device
407  * \return 0 if started, -1 if error
408  */
409 int EIB_M_WriteIndividualAddress_async (EIBConnection * con, eibaddr_t dest);
410 
411 /** Opens a management connection.
412  * \param con eibd connection
413  * \param dest destionation address
414  * \return 0 if successful, -1 if error
415  */
416 int EIB_MC_Connect (EIBConnection * con, eibaddr_t dest);
417 
418 /** Opens a management connection - asynchronous.
419  * \param con eibd connection
420  * \param dest destionation address
421  * \return 0 if started, -1 if error
422  */
423 int EIB_MC_Connect_async (EIBConnection * con, eibaddr_t dest);
424 
425 /** Read BAU memory (over a management connection).
426  * \param con eibd connection
427  * \param addr memory address
428  * \param len size to read
429  * \param buf buffer
430  * \return -1 if error, else read length
431  */
432 int EIB_MC_Read (EIBConnection * con, uint16_t addr, int len, uint8_t * buf);
433 
434 /** Read BAU memory (over a management connection) - asynchronous.
435  * \param con eibd connection
436  * \param addr memory address
437  * \param len size to read
438  * \param buf buffer
439  * \return 0 if started, -1 if error
440  */
441 int EIB_MC_Read_async (EIBConnection * con, uint16_t addr, int len,
442 		       uint8_t * buf);
443 
444 /** Write BAU memory (over a management connection).
445  * \param con eibd connection
446  * \param addr memory address
447  * \param len size to read
448  * \param buf buffer
449  * \return -1 if error, else read length
450  */
451 int EIB_MC_Write (EIBConnection * con, uint16_t addr, int len,
452 		  const uint8_t * buf);
453 
454 /** Write BAU memory (over a management connection) - asynchronous.
455  * \param con eibd connection
456  * \param addr Memory address
457  * \param len size to read
458  * \param buf buffer
459  * \return 0 if started, -1 if error
460  */
461 int EIB_MC_Write_async (EIBConnection * con, uint16_t addr, int len,
462 			const uint8_t * buf);
463 
464 /** Turns programming mode on (over a management connection).
465  * \param con eibd connection
466  * \return 0 if successful, -1 if error
467  */
468 int EIB_MC_Progmode_On (EIBConnection * con);
469 
470 /** Turns programming mode on (over a management connection) - asynchronous.
471  * \param con eibd connection
472  * \return 0 if started, -1 if error
473  */
474 int EIB_MC_Progmode_On_async (EIBConnection * con);
475 
476 /** Turns programming mode off (over a management connection).
477  * \param con eibd connection
478  * \return 0 if successful, -1 if error
479  */
480 int EIB_MC_Progmode_Off (EIBConnection * con);
481 
482 /** Turns programming mode off (over a management connection) - asynchronous.
483  * \param con eibd connection
484  * \return 0 if started, -1 if error
485  */
486 int EIB_MC_Progmode_Off_async (EIBConnection * con);
487 
488 /** Toggles programming mode (over a management connection) - asynchronous.
489  * \param con eibd connection
490  * \return 0 if successful, -1 if error
491  */
492 int EIB_MC_Progmode_Toggle (EIBConnection * con);
493 
494 /** Toggles programming mode (over a management connection) - asynchronous.
495  * \param con eibd connection
496  * \return 0 if started, -1 if error
497  */
498 int EIB_MC_Progmode_Toggle_async (EIBConnection * con);
499 
500 /** Check if a device is in programming mode (over a management connection).
501  * \param con eibd connection
502  * \return 0 if not in programming mode, -1 if error, else programming mode
503  */
504 int EIB_MC_Progmode_Status (EIBConnection * con);
505 
506 /** Check if a device is in programming mode (over a management connection) - asynchronous.
507  * \param con eibd connection
508  * \return 0 if started, -1 if error
509  */
510 int EIB_MC_Progmode_Status_async (EIBConnection * con);
511 
512 /** Retrieve the mask version (over a management connection).
513  * \param con eibd connection
514  * \return -1 if error, else mask version
515  */
516 int EIB_MC_GetMaskVersion (EIBConnection * con);
517 
518 /** Retrieve the mask version (over a management connection) - asynchronous.
519  * \param con eibd connection
520  * \return 0 if started, -1 if error
521  */
522 int EIB_MC_GetMaskVersion_async (EIBConnection * con);
523 
524 /** Read a property (over a management connection).
525  * \param con eibd connection
526  * \param obj object index
527  * \param property property ID
528  * \param start start element
529  * \param nr_of_elem number of elements
530  * \param max_len buffer size
531  * \param buf buffer
532  * \return -1 if error, else read length
533  */
534 int EIB_MC_PropertyRead (EIBConnection * con, uint8_t obj, uint8_t property,
535 			 uint16_t start, uint8_t nr_of_elem, int max_len,
536 			 uint8_t * buf);
537 
538 /** Read a property (over a management connection) - asynchronous.
539  * \param con eibd connection
540  * \param obj object index
541  * \param property property ID
542  * \param start start element
543  * \param nr_of_elem number of elements
544  * \param max_len buffer size
545  * \param buf buffer
546  * \return 0 if started, -1 if error
547  */
548 int EIB_MC_PropertyRead_async (EIBConnection * con, uint8_t obj,
549 			       uint8_t property, uint16_t start,
550 			       uint8_t nr_of_elem, int max_len,
551 			       uint8_t * buf);
552 
553 /** Write a property (over a management connection).
554  * \param con eibd connection
555  * \param obj object index
556  * \param property property ID
557  * \param start start element
558  * \param nr_of_elem number of elements
559  * \param len buffer size
560  * \param buf buffer
561  * \param max_len length of the result buffer
562  * \param res buffer for the result
563  * \return -1 if error, else length of the returned result
564  */
565 int EIB_MC_PropertyWrite (EIBConnection * con, uint8_t obj, uint8_t property,
566 			  uint16_t start, uint8_t nr_of_elem, int len,
567 			  const uint8_t * buf, int max_len, uint8_t * res);
568 
569 /** Write a property (over a management connection) - asynchronous.
570  * \param con eibd connection
571  * \param obj object index
572  * \param property property ID
573  * \param start start element
574  * \param nr_of_elem number of elements
575  * \param len buffer size
576  * \param buf buffer
577  * \param max_len length of the result buffer
578  * \param res buffer for the result
579  * \return 0 if started, -1 if error
580  */
581 int EIB_MC_PropertyWrite_async (EIBConnection * con, uint8_t obj,
582 				uint8_t property, uint16_t start,
583 				uint8_t nr_of_elem, int len,
584 				const uint8_t * buf, int max_len,
585 				uint8_t * res);
586 
587 /** Read a property description (over a management connection)
588  * \param con eibd connection
589  * \param obj object index
590  * \param property property ID
591  * \param type pointer to store type
592  * \param max_nr_of_elem pointer to store element count
593  * \param access pointer to access level
594  * \return -1 if error, else 0
595  */
596 int EIB_MC_PropertyDesc (EIBConnection * con, uint8_t obj, uint8_t property,
597 			 uint8_t * type, uint16_t * max_nr_of_elem,
598 			 uint8_t * access);
599 
600 /** Read a property description (over a mangement connection) - asynchronous.
601  * \param con eibd connection
602  * \param obj object index
603  * \param property property ID
604  * \param type pointer to store type
605  * \param max_nr_of_elem pointer to store element count
606  * \param access pointer to access level
607  * \return 0 if started, -1 if error
608  */
609 int EIB_MC_PropertyDesc_async (EIBConnection * con, uint8_t obj,
610 			       uint8_t property, uint8_t * type,
611 			       uint16_t * max_nr_of_elem, uint8_t * access);
612 
613 /** List properties (over a management connection).
614  * \param con eibd connection
615  * \param maxlen buffer size
616  * \param buf buffer
617  * \return number of used bytes in the buffer or -1 if error
618  */
619 int EIB_MC_PropertyScan (EIBConnection * con, int maxlen, uint8_t * buf);
620 
621 /** List properties (over a management connection) - asynchronous.
622  * \param con eibd connection
623  * \param maxlen buffer size
624  * \param buf buffer
625  * \return 0 if started, -1 if error
626  */
627 int EIB_MC_PropertyScan_async (EIBConnection * con, int maxlen,
628 			       uint8_t * buf);
629 
630 /** Read PEI type (over a management connection).
631  * \param con eibd connection
632  * \return PEI type or -1 if error
633  */
634 int EIB_MC_GetPEIType (EIBConnection * con);
635 
636 /** Read PEI type (over a management connection) - asynchronous.
637  * \param con eibd connection
638  * \return 0 if started, -1 if error
639  */
640 int EIB_MC_GetPEIType_async (EIBConnection * con);
641 
642 /** Read ADC value (over a management connection).
643  * \param con eibd connection
644  * \param channel ADC channel
645  * \param count repeat count
646  * \param val pointer to store result
647  * \return 0, if successful or -1 if error
648  */
649 int EIB_MC_ReadADC (EIBConnection * con, uint8_t channel, uint8_t count,
650 		    int16_t * val);
651 
652 /** Read ADC value (over a management connection) - asynchronous.
653  * \param con eibd connection
654  * \param channel ADC channel
655  * \param count repeat count
656  * \param val pointer to store result
657  * \return 0 if started, -1 if error
658  */
659 int EIB_MC_ReadADC_async (EIBConnection * con, uint8_t channel, uint8_t count,
660 			  int16_t * val);
661 
662 /** Authorize (over a management connection).
663  * \param con eibd connection
664  * \param key key
665  * \return -1 if error, else access level
666  */
667 int EIB_MC_Authorize (EIBConnection * con, uint8_t key[4]);
668 
669 /** Authorize (over a management connection) - asynchronous.
670  * \param con eibd connection
671  * \param key key
672  * \return 0 if started, -1 if error
673  */
674 int EIB_MC_Authorize_async (EIBConnection * con, uint8_t key[4]);
675 
676 /** Sets a key (over a management connection).
677  * \param con eibd connection
678  * \param level level to set
679  * \param key key
680  * \return -1 if error, else 0
681  */
682 int EIB_MC_SetKey (EIBConnection * con, uint8_t key[4], uint8_t level);
683 
684 /** Sets a key (over a management connection) - asynchronous.
685  * \param con eibd connection
686  * \param level level to set
687  * \param key key
688  * \return 0 if started, -1 if error
689  */
690 int EIB_MC_SetKey_async (EIBConnection * con, uint8_t key[4], uint8_t level);
691 
692 /** Loads a BCU SDK program image (over a management connection).
693  * \param con eibd connection
694  * \param image pointer to image
695  * \param len legth of the image
696  * \return result
697  */
698 BCU_LOAD_RESULT EIB_LoadImage (EIBConnection * con, const uint8_t * image,
699 			       int len);
700 /** Loads a BCU SDK program image (over a management connection) - asynchronous.
701  * \param con eibd connection
702  * \param image pointer to image
703  * \param len legth of the image
704  * \return 0 if started, -1 if error
705  */
706 int EIB_LoadImage_async (EIBConnection * con, const uint8_t * image, int len);
707 
708 __END_DECLS
709 #endif
710