#include <sys/device.h>
#include <sys/mutex.h>
#include <hardware/btn-hardware.h>
#include <bt/bt_semaphore.h>
#include <bt/bt_hci_defs.h>
#include <stdio.h>
Data Structures | |
struct | bt_hci_uart |
struct | btstack |
Represents one entity of a running stack (more possible) Keeps all data for one stack, like devices, buffers, states, ... More... | |
struct | event_mask_high_low |
struct | host_buffer_len_nr |
struct | param_list |
Defines | |
#define | BT_HCI_CONNECTION 2 |
#define | BT_HCI_CONNECTION_ACTIVE 0 |
#define | BT_HCI_CONNECTION_PASSIVE 1 |
#define | BT_HCI_DISCONNECTION 3 |
#define | BT_HCI_MY_ROLE_MASTER 0 |
#define | BT_HCI_MY_ROLE_SLAVE 1 |
#define | BT_HCI_NR_WAIT_QUEUES 16 |
#define | BT_HCI_WAIT_QUEUE_NONE 0xff |
#define | BTN_DEFAULT_PIN "1234" |
Default pin code for the BTnode. | |
#define | BTN_HI(A) ((u_char)((A)>>8)&0xFF) |
returns the high byte of a u_short. | |
#define | BTN_HI2(A) ((u_char)((A)>>16)&0xFF) |
returns the 2nd high byte of a u_short. | |
#define | BTN_LO(A) ((u_char)((A)&0xFF)) |
returns the low byte of a u_short. | |
#define | HCI_ACL_CB struct bt_hci_pkt_acl *(*hci_acl_cb) (void *arg, struct bt_hci_pkt_acl *pkt, bt_hci_con_handle_t con_handle, u_char pb_flag, u_char bc_flag, u_short len, u_long t_arrive) |
#define | HCI_ACL_CB_REGISTRATION void (*acl_cb_reg)(struct btstack* stack, HCI_ACL_CB, void* cb_arg) |
Definition of the acl callback registration function. | |
#define | HCI_CON_RQST_CB void(*con_rqst_cb) (bt_addr_t addr, u_long cod, u_char type, void* arg) |
Callback to filter connection requests. | |
#define | HCI_CON_TABLE_CB void (*con_table_cb) (u_char type, u_char detail, bt_hci_con_handle_t con_handle, void* cb_arg) |
Callback for connection table changes. | |
#define | HCI_CON_TABLE_CB_REGISTRATION void (*con_table_cb_reg)(struct btstack* stack, HCI_CON_TABLE_CB, void* cb_arg) |
Definition of the con table change callback registration function. | |
#define | HCI_SCO_CB struct bt_hci_pkt_sco *(*hci_sco_cb) (void *arg, struct bt_hci_pkt_sco *pkt, bt_hci_con_handle_t con_handle, u_char len) |
#define | HCI_TRANSPORT UART |
#define | NUT_DEFAULT_STACKSIZE 2048 |
#define BT_HCI_CONNECTION 2 |
Connection type
#define BT_HCI_CONNECTION_ACTIVE 0 |
Connection opened active, means this device triggered connection request
#define BT_HCI_CONNECTION_PASSIVE 1 |
Connection opened passive, means other device triggered connection request
#define BT_HCI_DISCONNECTION 3 |
Disconnection type
#define BT_HCI_MY_ROLE_MASTER 0 |
Indicates that the role of this device is master
#define BT_HCI_MY_ROLE_SLAVE 1 |
Indicates that the role of this device is slave
#define BT_HCI_NR_WAIT_QUEUES 16 |
The number of wait queues for synchronous running events, after completition these threads get woken up. Min: 8, max: 254.
Keep in mind that at most NR_WAIT_QUEUES commands can be running at a time, even if they are called asynchronous!
#define HCI_ACL_CB struct bt_hci_pkt_acl *(*hci_acl_cb) (void *arg, struct bt_hci_pkt_acl *pkt, bt_hci_con_handle_t con_handle, u_char pb_flag, u_char bc_flag, u_short len, u_long t_arrive) |
Callbacks for the acl data
Callback to filter connection requests.
This function is called whenever a connection request event is received from the controller. Connections can be accepted by using bt_hci_accept_connection_request or rejected by calling bt_hci_reject_connection_request.
Note: due to the current implementation of the bt-stack, connection requests must not be handled in the connection request callback - they have to be handled in a separate context.
Note: Connection requests are turned off by default (i.e. auto-acception of incoming connection requests is turned on). To change this policy, use bt_hci_set_event_filter.
For details, refer to the documentation of the Connection Request Event in the BT spec.
addr | The address of the requesting device | |
cod | The class of device of the requesting device | |
type | Requested link type (0x00 for SCO, 0x01 for ACL, ...) | |
arg | pointer to an optional argument that has been registered |
#define HCI_CON_TABLE_CB void (*con_table_cb) (u_char type, u_char detail, bt_hci_con_handle_t con_handle, void* cb_arg) |
Callback for connection table changes.
To observe any connection, disconnection or role changes the application can register a callback function HCI_CON_TABLE_CB that will be called with two arguments: type of change, extra info for some changes and the changed connection It is important that the callback returns very fast!
For BT_HCI_CONNECTION details tells, if connection was opend by us BT_HCI_CONNECTION_ACTIVE or BT_HCI_CONNECTION_PASSIVE
For BT_HCI_DISCONNECTION, details tells the disconnect reason
#define HCI_SCO_CB struct bt_hci_pkt_sco *(*hci_sco_cb) (void *arg, struct bt_hci_pkt_sco *pkt, bt_hci_con_handle_t con_handle, u_char len) |
Callbacks for the sco data