
/* Copyright (c) 2020, Peter Barrett
**
** Permission to use, copy, modify, and/or distribute this software for
** any purpose with or without fee is hereby granted, provided that the
** above copyright notice and this permission notice appear in all copies.
**
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
** SOFTWARE.
*/

#ifndef __hci_transport__
#define __hci_transport__

#ifdef __cplusplus
extern "C" {
#endif

typedef void* hci_handle;
typedef void (*hci_on_packet_handler)(hci_handle h, const uint8_t* d, int len, void* ref);
typedef void (*hci_on_ready_to_send_handler)(hci_handle h, void* ref);

hci_handle  hci_open();
int         hci_close(hci_handle h);
void        hci_set_packet_handler(hci_handle h, hci_on_packet_handler p, void* ref);
void        hci_set_ready_to_send_handler(hci_handle h, hci_on_ready_to_send_handler p, void* ref);
int         hci_send(hci_handle h, const uint8_t* d, int len);
int         hci_send_available(hci_handle h);

#ifdef __cplusplus
}
#endif

#endif
