Implement connectionless management connection in the client library
[bcusdk.git] / eibd / include / eibclient.h
blob5ca404e501cc3c9ff676aae033356c3b0740b98d
1 /*
2 EIBD client library
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 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.)
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.
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
27 #ifndef EIBCLIENT_H
28 #define EIBCLIENT_H
30 #include "sys/cdefs.h"
31 #include "stdint.h"
33 __BEGIN_DECLS;
35 #include "eibloadresult.h"
37 /** type represents a connection to eibd */
38 typedef struct _EIBConnection EIBConnection;
40 /** type for storing a EIB address */
41 typedef uint16_t eibaddr_t;
43 /** Opens a connection to eibd.
44 * url can either be <code>ip:host:[port]</code> or <code>local:/path/to/socket</code>
45 * \param url contains the url to connect to
46 * \return connection handle or NULL
48 EIBConnection *EIBSocketURL (const char *url);
49 /** Opens a connection to eibd over a socket.
50 * \param path path to the socket
51 * \return connection handle or NULL
53 EIBConnection *EIBSocketLocal (const char *path);
54 /** Opens a connection to eibd over TCP/IP.
55 * \param host hostname running eibd
56 * \param port portnumber
57 * \return connection handle or NULL
59 EIBConnection *EIBSocketRemote (const char *host, int port);
61 /** Closes and frees a connection.
62 * \param con eibd connection
64 int EIBClose (EIBConnection * con);
66 /** Closes and frees a connection and wait, until all resources are freed.
67 * \param con eibd connection
69 int EIBClose_sync (EIBConnection * con);
71 /** Finish an asynchronous request (and block until then).
72 * \param con eibd connection
73 * \return return value, as returned by the synchronous function call
75 int EIBComplete (EIBConnection * con);
77 /** Checks if an asynchronous request is completed (non-blocking).
78 * EIBComplete must be still be used for asynchronous functions to retrieve the return value.
79 * For connections where packets are returned (Busmonitor, T_*), EIB_Poll_Complete can be used to check if new data is available.
80 * If this function returns an error, the eibd connection should be considered as broken (and therefore be closed).
81 * \param con eibd connection
82 * \return -1 if any error, 0 if not finished, 1 if finished
84 int EIB_Poll_Complete (EIBConnection * con);
86 /** Returns FD to wait for the next event.
87 * The returned file descriptor may only be used to select/poll for read data available.
88 * As EIBComplete (and functions, which return packets) block if only a part of the data is
89 * available, EIB_Poll_Complete can be used to check whether blocking will occur.
90 * \param con eibd connection
91 * \return -1 if any error, else file descriptor
93 int EIB_Poll_FD (EIBConnection * con);
95 /** Switches the connection to pristine state
96 * \param con eibd connection
97 * \return 0 if successful, -1 if error
99 int EIBReset (EIBConnection * con);
101 /** Switches the connection to pristine state - asynchronous.
102 * \param con eibd connection
103 * \return 0 if started, -1 if error
105 int EIBReset_async (EIBConnection * con);
107 /** Switches the connection to binary busmonitor mode.
108 * \param con eibd connection
109 * \return 0 if successful, -1 if error
111 int EIBOpenBusmonitor (EIBConnection * con);
113 /** Switches the connection to binary busmonitor mode - asynchronous.
114 * \param con eibd connection
115 * \return 0 if started, -1 if error
117 int EIBOpenBusmonitor_async (EIBConnection * con);
119 /** Switches the connection to text busmonitor mode.
120 * \param con eibd connection
121 * \return 0 if successful, -1 if error
123 int EIBOpenBusmonitorText (EIBConnection * con);
125 /** Switches the connection to text busmonitor mode - asynchronous.
126 * \param con eibd connection
127 * \return 0 if started, -1 if error
129 int EIBOpenBusmonitorText_async (EIBConnection * con);
131 /** Switches the connection to binary vbusmonitor mode.
132 * \param con eibd connection
133 * \return 0 if successful, -1 if error
135 int EIBOpenVBusmonitor (EIBConnection * con);
137 /** Switches the connection to binary vbusmonitor mode - asynchronous.
138 * \param con eibd connection
139 * \return 0 if started, -1 if error
141 int EIBOpenVBusmonitor_async (EIBConnection * con);
143 /** Switches the connection to text vbusmonitor mode.
144 * \param con eibd connection
145 * \return 0 if successful, -1 if error
147 int EIBOpenVBusmonitorText (EIBConnection * con);
149 /** Switches the connection to text vbusmonitor mode - asynchronous.
150 * \param con eibd connection
151 * \return 0 if started, -1 if error
153 int EIBOpenVBusmonitorText_async (EIBConnection * con);
155 /** Receives a packet on a busmonitor connection.
156 * \param con eibd connection
157 * \param maxlen size of the buffer
158 * \param buf buffer
159 * \return -1 if error, else length of the packet
161 int EIBGetBusmonitorPacket (EIBConnection * con, int maxlen, uint8_t * buf);
163 /** Opens a connection of type T_Connection.
164 * \param con eibd connection
165 * \param dest destination address
166 * \return 0 if successful, -1 if error
168 int EIBOpenT_Connection (EIBConnection * con, eibaddr_t dest);
170 /** Opens a connection of type T_Connection - asynchronous.
171 * \param con eibd connection
172 * \param dest destination address
173 * \return 0 if started, -1 if error
175 int EIBOpenT_Connection_async (EIBConnection * con, eibaddr_t dest);
177 /** Opens a connection of type T_Individual.
178 * \param con eibd connection
179 * \param dest destination address
180 * \param write_only if not null, no packets from the bus will be delivered
181 * \return 0 if successful, -1 if error
183 int EIBOpenT_Individual (EIBConnection * con, eibaddr_t dest, int write_only);
185 /** Opens a connection of type T_Individual - asynchronous.
186 * \param con eibd connection
187 * \param dest destionation address
188 * \param write_only if not null, no packets from the bus will be delivered
189 * \return 0 if started, -1 if error
191 int EIBOpenT_Individual_async (EIBConnection * con, eibaddr_t dest,
192 int write_only);
194 /** Opens a connection of type T_Group.
195 * \param con eibd connection
196 * \param dest group address
197 * \param write_only if not null, no packets from the bus will be delivered
198 * \return 0 if successful, -1 if error
200 int EIBOpenT_Group (EIBConnection * con, eibaddr_t dest, int write_only);
202 /** Opens a connection of type T_Group - asynchronous.
203 * \param con eibd connection
204 * \param dest group address
205 * \param write_only if not null, no packets from the bus will be delivered
206 * \return 0 if started, -1 if error
208 int EIBOpenT_Group_async (EIBConnection * con, eibaddr_t dest,
209 int write_only);
211 /** Opens a connection of type T_Broadcast.
212 * \param con eibd connection
213 * \param write_only if not null, no packets from the bus will be delivered
214 * \return 0 if successful, -1 if error
216 int EIBOpenT_Broadcast (EIBConnection * con, int write_only);
218 /** Opens a connection of type T_Broadcast - asynchronous.
219 * \param con eibd connection
220 * \param write_only if not null, no packets from the bus will be delivered
221 * \return 0 if started, -1 if error
223 int EIBOpenT_Broadcast_async (EIBConnection * con, int write_only);
225 /** Opens a raw Layer 4 connection.
226 * \param con eibd connection
227 * \param src my source address (0 means default)
228 * \return 0 if successful, -1 if error
230 int EIBOpenT_TPDU (EIBConnection * con, eibaddr_t src);
232 /** Opens a raw Layer 4 connection - asynchronous.
233 * \param con eibd connection
234 * \param src my source address (0 means default)
235 * \return 0 if started, -1 if error
237 int EIBOpenT_TPDU_async (EIBConnection * con, eibaddr_t src);
239 /** Sends an APDU.
240 * \param con eibd connection
241 * \param len length of the APDU
242 * \param data buffer with APDU
243 * \return tranmited length or -1 if error
245 int EIBSendAPDU (EIBConnection * con, int len, const uint8_t * data);
247 /** Receive an APDU (blocking).
248 * \param con eibd connection
249 * \param maxlen buffer size
250 * \param buf buffer
251 * \return received length or -1 if error
253 int EIBGetAPDU (EIBConnection * con, int maxlen, uint8_t * buf);
255 /** Receive a APDU with source address (blocking).
256 * \param con eibd connection
257 * \param maxlen buffer size
258 * \param buf buffer
259 * \param src pointer, where the source address should be stored
260 * \return received length or -1 if error
262 int EIBGetAPDU_Src (EIBConnection * con, int maxlen, uint8_t * buf,
263 eibaddr_t * src);
265 /** Sends a TPDU with destination address.
266 * \param con eibd connection
267 * \param dest destination address
268 * \param len length of the APDU
269 * \param data buffer with APDU
270 * \return tranmited length or -1 if error
272 int EIBSendTPDU (EIBConnection * con, eibaddr_t dest, int len,
273 const uint8_t * data);
275 /** Receive a TPDU with source address.
276 * \param con eibd connection
277 * \param maxlen buffer size
278 * \param buf buffer
279 * \param src pointer to where the source address should be stored
280 * \return received length or -1 if error
282 int EIBGetTPDU (EIBConnection * con, int maxlen, uint8_t * buf,
283 eibaddr_t * src);
285 /** Opens a Group communication interface.
286 * \param con eibd connection
287 * \param write_only if not null, no packets from the bus will be delivered
288 * \return 0 if successful, -1 if error
290 int EIBOpen_GroupSocket (EIBConnection * con, int write_only);
292 /** Opens a Group communication interface - asynchronous.
293 * \param con eibd connection
294 * \param write_only if not null, no packets from the bus will be delivered
295 * \return 0 if started, -1 if error
297 int EIBOpen_GroupSocket_async (EIBConnection * con, int write_only);
299 /** Sends a group APDU.
300 * \param con eibd connection
301 * \param dest destination address
302 * \param len length of the APDU
303 * \param data buffer with APDU
304 * \return tranmited length or -1 if error
306 int EIBSendGroup (EIBConnection * con, eibaddr_t dest, int len,
307 const uint8_t * data);
309 /** Receive a group APDU with source address (blocking).
310 * \param con eibd connection
311 * \param maxlen buffer size
312 * \param buf buffer
313 * \param src pointer to where the source address should be stored
314 * \param dest pointer to where the destination address should be stored
315 * \return received length or -1 if error
317 int EIBGetGroup_Src (EIBConnection * con, int maxlen, uint8_t * buf,
318 eibaddr_t * src, eibaddr_t * dest);
320 /** List devices in programming mode.
321 * \param con eibd connection
322 * \param maxlen buffer size
323 * \param buf buffer
324 * \return number of used bytes in the buffer or -1 if error
326 int EIB_M_ReadIndividualAddresses (EIBConnection * con, int maxlen,
327 uint8_t * buf);
329 /** List devices in programming mode - asynchronous.
330 * \param con eibd connection
331 * \param maxlen buffer size
332 * \param buf buffer
333 * \return 0 if started, -1 if error
335 int EIB_M_ReadIndividualAddresses_async (EIBConnection * con, int maxlen,
336 uint8_t * buf);
338 /** Turn on programming mode (connectionless).
339 * \param con eibd connection
340 * \param dest address of EIB device
341 * \return 0 if successful, -1 if error
343 int EIB_M_Progmode_On (EIBConnection * con, eibaddr_t dest);
345 /** Turns on programming mode (connectionless) - asynchronous.
346 * \param con eibd connection
347 * \param dest address of EIB device
348 * \return 0 if started, -1 if error
350 int EIB_M_Progmode_On_async (EIBConnection * con, eibaddr_t dest);
352 /** Turns off programming mode (connectionless).
353 * \param con eibd connection
354 * \param dest address of EIB device
355 * \return 0 if successful, -1 if error
357 int EIB_M_Progmode_Off (EIBConnection * con, eibaddr_t dest);
359 /** Turns off programming mode (connectionless) - asynchronous.
360 * \param con eibd connection
361 * \param dest address of EIB device
362 * \return 0 if started, -1 if error
364 int EIB_M_Progmode_Off_async (EIBConnection * con, eibaddr_t dest);
366 /** Toggle programming mode (connectionless).
367 * \param con eibd connection
368 * \param dest address of EIB device
369 * \return 0 if successful, -1 if error
371 int EIB_M_Progmode_Toggle (EIBConnection * con, eibaddr_t dest);
373 /** Toggle programming mode (connectionless) - asynchronous.
374 * \param con eibd connection
375 * \param dest address of EIB device
376 * \return 0 if started, -1 if error
378 int EIB_M_Progmode_Toggle_async (EIBConnection * con, eibaddr_t dest);
380 /** Check if a device is in programming mode (connectionless).
381 * \param con eibd connection
382 * \param dest address of EIB device
383 * \return 0 if not in programming mode, -1 if error, else programming mode
385 int EIB_M_Progmode_Status (EIBConnection * con, eibaddr_t dest);
387 /** Check if a device is in programming mode (connectionless) - asynchronous.
388 * \param con eibd connection
389 * \param dest address of EIB device
390 * \return 0 if started, -1 if error
392 int EIB_M_Progmode_Status_async (EIBConnection * con, eibaddr_t dest);
394 /** Retrieve the mask version (connectionless).
395 * \param con eibd connection
396 * \param dest address of EIB device
397 * \return -1 if error, else mask version
399 int EIB_M_GetMaskVersion (EIBConnection * con, eibaddr_t dest);
401 /** Retrieve the mask version (connectionless) - asynchronous.
402 * \param con eibd connection
403 * \param dest address of EIB device
404 * \return 0 if started, -1 if error
406 int EIB_M_GetMaskVersion_async (EIBConnection * con, eibaddr_t dest);
408 /** Set individual address for device currently in programming mode.
409 * \param con eibd connection
410 * \param dest new address of EIB device
411 * \return -1 if error, 0 if successful
413 int EIB_M_WriteIndividualAddress (EIBConnection * con, eibaddr_t dest);
415 /** Set individual address for device currently in programming mode - asynchronous.
416 * \param con eibd connection
417 * \param dest new address of EIB device
418 * \return 0 if started, -1 if error
420 int EIB_M_WriteIndividualAddress_async (EIBConnection * con, eibaddr_t dest);
422 /** Opens a management connection.
423 * \param con eibd connection
424 * \param dest destionation address
425 * \return 0 if successful, -1 if error
427 int EIB_MC_Connect (EIBConnection * con, eibaddr_t dest);
429 /** Opens a management connection - asynchronous.
430 * \param con eibd connection
431 * \param dest destionation address
432 * \return 0 if started, -1 if error
434 int EIB_MC_Connect_async (EIBConnection * con, eibaddr_t dest);
436 /** Opens a connectionless management connection.
437 * \param con eibd connection
438 * \param dest destionation address
439 * \return 0 if successful, -1 if error
441 int EIB_MC_Individual_Open (EIBConnection * con, eibaddr_t dest);
443 /** Opens a connectionless management connection - asynchronous.
444 * \param con eibd connection
445 * \param dest destionation address
446 * \return 0 if started, -1 if error
448 int EIB_MC_Individual_Open_async (EIBConnection * con, eibaddr_t dest);
450 /** Read BAU memory (over a management connection).
451 * \param con eibd connection
452 * \param addr memory address
453 * \param len size to read
454 * \param buf buffer
455 * \return -1 if error, else read length
457 int EIB_MC_Read (EIBConnection * con, uint16_t addr, int len, uint8_t * buf);
459 /** Read BAU memory (over a management connection) - asynchronous.
460 * \param con eibd connection
461 * \param addr memory address
462 * \param len size to read
463 * \param buf buffer
464 * \return 0 if started, -1 if error
466 int EIB_MC_Read_async (EIBConnection * con, uint16_t addr, int len,
467 uint8_t * buf);
469 /** Write BAU memory (over a management connection).
470 * \param con eibd connection
471 * \param addr memory address
472 * \param len size to read
473 * \param buf buffer
474 * \return -1 if error, else read length
476 int EIB_MC_Write (EIBConnection * con, uint16_t addr, int len,
477 const uint8_t * buf);
479 /** Write BAU memory (over a management connection) - asynchronous.
480 * \param con eibd connection
481 * \param addr Memory address
482 * \param len size to read
483 * \param buf buffer
484 * \return 0 if started, -1 if error
486 int EIB_MC_Write_async (EIBConnection * con, uint16_t addr, int len,
487 const uint8_t * buf);
489 /** Turns programming mode on (over a management connection).
490 * \param con eibd connection
491 * \return 0 if successful, -1 if error
493 int EIB_MC_Progmode_On (EIBConnection * con);
495 /** Turns programming mode on (over a management connection) - asynchronous.
496 * \param con eibd connection
497 * \return 0 if started, -1 if error
499 int EIB_MC_Progmode_On_async (EIBConnection * con);
501 /** Turns programming mode off (over a management connection).
502 * \param con eibd connection
503 * \return 0 if successful, -1 if error
505 int EIB_MC_Progmode_Off (EIBConnection * con);
507 /** Turns programming mode off (over a management connection) - asynchronous.
508 * \param con eibd connection
509 * \return 0 if started, -1 if error
511 int EIB_MC_Progmode_Off_async (EIBConnection * con);
513 /** Toggles programming mode (over a management connection) - asynchronous.
514 * \param con eibd connection
515 * \return 0 if successful, -1 if error
517 int EIB_MC_Progmode_Toggle (EIBConnection * con);
519 /** Toggles programming mode (over a management connection) - asynchronous.
520 * \param con eibd connection
521 * \return 0 if started, -1 if error
523 int EIB_MC_Progmode_Toggle_async (EIBConnection * con);
525 /** Check if a device is in programming mode (over a management connection).
526 * \param con eibd connection
527 * \return 0 if not in programming mode, -1 if error, else programming mode
529 int EIB_MC_Progmode_Status (EIBConnection * con);
531 /** Check if a device is in programming mode (over a management connection) - asynchronous.
532 * \param con eibd connection
533 * \return 0 if started, -1 if error
535 int EIB_MC_Progmode_Status_async (EIBConnection * con);
537 /** Retrieve the mask version (over a management connection).
538 * \param con eibd connection
539 * \return -1 if error, else mask version
541 int EIB_MC_GetMaskVersion (EIBConnection * con);
543 /** Retrieve the mask version (over a management connection) - asynchronous.
544 * \param con eibd connection
545 * \return 0 if started, -1 if error
547 int EIB_MC_GetMaskVersion_async (EIBConnection * con);
549 /** Read a property (over a management connection).
550 * \param con eibd connection
551 * \param obj object index
552 * \param property property ID
553 * \param start start element
554 * \param nr_of_elem number of elements
555 * \param max_len buffer size
556 * \param buf buffer
557 * \return -1 if error, else read length
559 int EIB_MC_PropertyRead (EIBConnection * con, uint8_t obj, uint8_t property,
560 uint16_t start, uint8_t nr_of_elem, int max_len,
561 uint8_t * buf);
563 /** Read a property (over a management connection) - asynchronous.
564 * \param con eibd connection
565 * \param obj object index
566 * \param property property ID
567 * \param start start element
568 * \param nr_of_elem number of elements
569 * \param max_len buffer size
570 * \param buf buffer
571 * \return 0 if started, -1 if error
573 int EIB_MC_PropertyRead_async (EIBConnection * con, uint8_t obj,
574 uint8_t property, uint16_t start,
575 uint8_t nr_of_elem, int max_len,
576 uint8_t * buf);
578 /** Write a property (over a management connection).
579 * \param con eibd connection
580 * \param obj object index
581 * \param property property ID
582 * \param start start element
583 * \param nr_of_elem number of elements
584 * \param len buffer size
585 * \param buf buffer
586 * \param max_len length of the result buffer
587 * \param res buffer for the result
588 * \return -1 if error, else length of the returned result
590 int EIB_MC_PropertyWrite (EIBConnection * con, uint8_t obj, uint8_t property,
591 uint16_t start, uint8_t nr_of_elem, int len,
592 const uint8_t * buf, int max_len, uint8_t * res);
594 /** Write a property (over a management connection) - asynchronous.
595 * \param con eibd connection
596 * \param obj object index
597 * \param property property ID
598 * \param start start element
599 * \param nr_of_elem number of elements
600 * \param len buffer size
601 * \param buf buffer
602 * \param max_len length of the result buffer
603 * \param res buffer for the result
604 * \return 0 if started, -1 if error
606 int EIB_MC_PropertyWrite_async (EIBConnection * con, uint8_t obj,
607 uint8_t property, uint16_t start,
608 uint8_t nr_of_elem, int len,
609 const uint8_t * buf, int max_len,
610 uint8_t * res);
612 /** Read a property description (over a management connection)
613 * \param con eibd connection
614 * \param obj object index
615 * \param property property ID
616 * \param type pointer to store type
617 * \param max_nr_of_elem pointer to store element count
618 * \param access pointer to access level
619 * \return -1 if error, else 0
621 int EIB_MC_PropertyDesc (EIBConnection * con, uint8_t obj, uint8_t property,
622 uint8_t * type, uint16_t * max_nr_of_elem,
623 uint8_t * access);
625 /** Read a property description (over a mangement connection) - asynchronous.
626 * \param con eibd connection
627 * \param obj object index
628 * \param property property ID
629 * \param type pointer to store type
630 * \param max_nr_of_elem pointer to store element count
631 * \param access pointer to access level
632 * \return 0 if started, -1 if error
634 int EIB_MC_PropertyDesc_async (EIBConnection * con, uint8_t obj,
635 uint8_t property, uint8_t * type,
636 uint16_t * max_nr_of_elem, uint8_t * access);
638 /** List properties (over a management connection).
639 * \param con eibd connection
640 * \param maxlen buffer size
641 * \param buf buffer
642 * \return number of used bytes in the buffer or -1 if error
644 int EIB_MC_PropertyScan (EIBConnection * con, int maxlen, uint8_t * buf);
646 /** List properties (over a management connection) - asynchronous.
647 * \param con eibd connection
648 * \param maxlen buffer size
649 * \param buf buffer
650 * \return 0 if started, -1 if error
652 int EIB_MC_PropertyScan_async (EIBConnection * con, int maxlen,
653 uint8_t * buf);
655 /** Read PEI type (over a management connection).
656 * \param con eibd connection
657 * \return PEI type or -1 if error
659 int EIB_MC_GetPEIType (EIBConnection * con);
661 /** Read PEI type (over a management connection) - asynchronous.
662 * \param con eibd connection
663 * \return 0 if started, -1 if error
665 int EIB_MC_GetPEIType_async (EIBConnection * con);
667 /** Read ADC value (over a management connection).
668 * \param con eibd connection
669 * \param channel ADC channel
670 * \param count repeat count
671 * \param val pointer to store result
672 * \return 0, if successful or -1 if error
674 int EIB_MC_ReadADC (EIBConnection * con, uint8_t channel, uint8_t count,
675 int16_t * val);
677 /** Read ADC value (over a management connection) - asynchronous.
678 * \param con eibd connection
679 * \param channel ADC channel
680 * \param count repeat count
681 * \param val pointer to store result
682 * \return 0 if started, -1 if error
684 int EIB_MC_ReadADC_async (EIBConnection * con, uint8_t channel, uint8_t count,
685 int16_t * val);
687 /** Authorize (over a management connection).
688 * \param con eibd connection
689 * \param key key
690 * \return -1 if error, else access level
692 int EIB_MC_Authorize (EIBConnection * con, uint8_t key[4]);
694 /** Authorize (over a management connection) - asynchronous.
695 * \param con eibd connection
696 * \param key key
697 * \return 0 if started, -1 if error
699 int EIB_MC_Authorize_async (EIBConnection * con, uint8_t key[4]);
701 /** Sets a key (over a management connection).
702 * \param con eibd connection
703 * \param level level to set
704 * \param key key
705 * \return -1 if error, else 0
707 int EIB_MC_SetKey (EIBConnection * con, uint8_t key[4], uint8_t level);
709 /** Sets a key (over a management connection) - asynchronous.
710 * \param con eibd connection
711 * \param level level to set
712 * \param key key
713 * \return 0 if started, -1 if error
715 int EIB_MC_SetKey_async (EIBConnection * con, uint8_t key[4], uint8_t level);
717 /** Restarts EIB device (management connection will not be useable after this any more) - asynchronous.
718 * \param con eibd connection
719 * \return 0 if started, -1 if error
721 int EIB_MC_Restart_async (EIBConnection * con);
723 /** Restarts EIB device (management connection will not be useable after this any more).
724 * \param con eibd connection
725 * \return 0 if successful, -1 if error
727 int EIB_MC_Restart (EIBConnection * con);
729 /** Write BAU memory without doing verify (over a management connection).
730 * \param con eibd connection
731 * \param addr memory address
732 * \param len size to read
733 * \param buf buffer
734 * \return -1 if error, else read length
736 int EIB_MC_Write_Plain (EIBConnection * con, uint16_t addr, int len,
737 const uint8_t * buf);
739 /** Write BAU memory without doing verify (over a management connection) - asynchronous.
740 * \param con eibd connection
741 * \param addr Memory address
742 * \param len size to read
743 * \param buf buffer
744 * \return 0 if started, -1 if error
746 int EIB_MC_Write_Plain_async (EIBConnection * con, uint16_t addr, int len,
747 const uint8_t * buf);
750 /** Loads a BCU SDK program image (over a management connection).
751 * \param con eibd connection
752 * \param image pointer to image
753 * \param len legth of the image
754 * \return result (for values see IMG_* constants), -1 if communication error with eibd
756 int EIB_LoadImage (EIBConnection * con, int len, const uint8_t * image);
758 /** Loads a BCU SDK program image (over a management connection) - asynchronous.
759 * \param con eibd connection
760 * \param image pointer to image
761 * \param len legth of the image
762 * \return 0 if started, -1 if error
764 int EIB_LoadImage_async (EIBConnection * con, int len, const uint8_t * image);
767 /** Enable Group Cache
768 * \param con eibd connection
769 * \return 0 if successful, -1 if error (EBUSY if KNX/EIB transmissions are blocked, e.g., because a busmonitor is active)
771 int EIB_Cache_Enable (EIBConnection * con);
773 /** Disable Group Cache
774 * \param con eibd connection
775 * \return 0 if successful, -1 if error
777 int EIB_Cache_Disable (EIBConnection * con);
779 /** Clear Group Cache (all group addresses)
780 * \param con eibd connection
781 * \return 0 if successful, -1 if error
783 int EIB_Cache_Clear (EIBConnection * con);
785 /** Remove all cache data for a group address
786 * \param con eibd connection
787 * \param dest group address
788 * \return 0 if successful, -1 if error
790 int EIB_Cache_Remove (EIBConnection * con, eibaddr_t dest);
792 /** Query the last value sent to a group address; if not in cache, try to get it via A_GroupValue_Read
793 * \param con eibd connection
794 * \param dest group address
795 * \param src source address of the last APDU
796 * \param max_len buffer size
797 * \param buf buffer for last APDU
798 * \param age if non-zero, send a A_GroupValue_Read, if the cached telegram is older than age seconds.
799 * \return -1 if error (ENODEV=group cache not enabled, ENOENT=A_GroupValue_Read request was not answered), else length of APDU
801 int EIB_Cache_Read_Sync (EIBConnection * con, eibaddr_t dest, eibaddr_t * src,
802 int max_len, uint8_t * buf, uint16_t age);
804 /** Query the last value sent to a group address
805 * \param con eibd connection
806 * \param dest group address
807 * \param src source address of the last APDU
808 * \param max_len buffer size
809 * \param buf buffer for last APDU
810 * \return -1 if error (ENODEV=group cache not enabled, ENOENT=no telegram in cache), else length of APDU
812 int EIB_Cache_Read (EIBConnection * con, eibaddr_t dest,
813 eibaddr_t * src, int max_len, uint8_t * buf);
815 /** Enable Group Cache - asynchronous.
816 * \param con eibd connection
817 * \return 0 if started, -1 if error
819 int EIB_Cache_Enable_async (EIBConnection * con);
821 /** Disable Group Cache - asynchronous.
822 * \param con eibd connection
823 * \return 0 if started, -1 if error
825 int EIB_Cache_Disable_async (EIBConnection * con);
827 /** Clear Group Cache (all group addresses) - asynchronous.
828 * \param con eibd connection
829 * \return 0 if started, -1 if error
831 int EIB_Cache_Clear_async (EIBConnection * con);
833 /** Remove all cache data for a group address - asynchronous.
834 * \param con eibd connection
835 * \param dest group address
836 * \return 0 if started, -1 if error
838 int EIB_Cache_Remove_async (EIBConnection * con, eibaddr_t dest);
840 /** Query the last value sent to a group address; if not in cache, try to get it via A_GroupValue_Read - asynchronous.
841 * \param con eibd connection
842 * \param dest group address
843 * \param src source address of the last APDU
844 * \param max_len buffer size
845 * \param buf buffer for last APDU
846 * \param age if non-zero, send a A_GroupValue_Read, if the cached telegram is older than age seconds.
847 * \return 0 if started, -1 if error
849 int EIB_Cache_Read_Sync_async (EIBConnection * con, eibaddr_t dest,
850 eibaddr_t * src, int max_len, uint8_t * buf,
851 uint16_t age);
853 /** Query the last value sent to a group address - asynchronous.
854 * \param con eibd connection
855 * \param dest group address
856 * \param src source address of the last APDU
857 * \param max_len buffer size
858 * \param buf buffer for last APDU
859 * \return 0 if started, -1 if error
861 int EIB_Cache_Read_async (EIBConnection * con, eibaddr_t dest,
862 eibaddr_t * src, int max_len, uint8_t * buf);
865 __END_DECLS
866 #endif