123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- #ifndef ZEPHYR_INCLUDE_BLUETOOTH_RFCOMM_H_
- #define ZEPHYR_INCLUDE_BLUETOOTH_RFCOMM_H_
- #include <bluetooth/buf.h>
- #include <bluetooth/conn.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- enum {
- BT_RFCOMM_CHAN_HFP_HF = 1,
- BT_RFCOMM_CHAN_HFP_AG,
- BT_RFCOMM_CHAN_HSP_AG,
- BT_RFCOMM_CHAN_HSP_HS,
- BT_RFCOMM_CHAN_SPP,
- };
- struct bt_rfcomm_dlc;
- struct bt_rfcomm_dlc_ops {
-
- void (*connected)(struct bt_rfcomm_dlc *dlc);
-
- void (*disconnected)(struct bt_rfcomm_dlc *dlc);
-
- void (*recv)(struct bt_rfcomm_dlc *dlc, struct net_buf *buf);
- };
- typedef enum bt_rfcomm_role {
- BT_RFCOMM_ROLE_ACCEPTOR,
- BT_RFCOMM_ROLE_INITIATOR
- } __packed bt_rfcomm_role_t;
- struct bt_rfcomm_dlc {
-
- struct k_work_delayable rtx_work;
-
- struct k_fifo tx_queue;
-
- struct k_sem tx_credits;
- struct bt_rfcomm_session *session;
- struct bt_rfcomm_dlc_ops *ops;
- struct bt_rfcomm_dlc *_next;
- bt_security_t required_sec_level;
- bt_rfcomm_role_t role;
- uint16_t mtu;
- uint8_t dlci;
- uint8_t state;
- uint8_t rx_credit;
-
- struct k_thread tx_thread;
- K_KERNEL_STACK_MEMBER(stack, 256);
- };
- struct bt_rfcomm_server {
-
- uint8_t channel;
-
- int (*accept)(struct bt_conn *conn, struct bt_rfcomm_dlc **dlc);
- struct bt_rfcomm_server *_next;
- };
- int bt_rfcomm_server_register(struct bt_rfcomm_server *server);
- int bt_rfcomm_dlc_connect(struct bt_conn *conn, struct bt_rfcomm_dlc *dlc,
- uint8_t channel);
- int bt_rfcomm_dlc_send(struct bt_rfcomm_dlc *dlc, struct net_buf *buf);
- int bt_rfcomm_dlc_disconnect(struct bt_rfcomm_dlc *dlc);
- struct net_buf *bt_rfcomm_create_pdu(struct net_buf_pool *pool);
- #ifdef __cplusplus
- }
- #endif
- #endif
|