Zephyr API Documentation  3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
rfcomm.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2015-2016 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_RFCOMM_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_RFCOMM_H_
12
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* RFCOMM channels (1-30): pre-allocated for profiles to avoid conflicts */
28enum {
34};
35
36struct bt_rfcomm_dlc;
37
47 void (*connected)(struct bt_rfcomm_dlc *dlc);
48
57 void (*disconnected)(struct bt_rfcomm_dlc *dlc);
58
64 void (*recv)(struct bt_rfcomm_dlc *dlc, struct net_buf *buf);
65
71 void (*sent)(struct bt_rfcomm_dlc *dlc, int err);
72};
73
76typedef enum bt_rfcomm_role {
80
83 /* Response Timeout eXpired (RTX) timer */
85
86 /* Queue for outgoing data */
88
89 /* TX credits, Reuse as a binary sem for MSC FC if CFC is not enabled */
90 struct k_sem tx_credits;
91
92 struct bt_rfcomm_session *session;
94 struct bt_rfcomm_dlc *_next;
95
98
103
104 /* Stack & kernel data for TX thread */
106#if defined(CONFIG_BT_RFCOMM_DLC_STACK_SIZE)
107 K_KERNEL_STACK_MEMBER(stack, CONFIG_BT_RFCOMM_DLC_STACK_SIZE);
108#endif /* CONFIG_BT_RFCOMM_DLC_STACK_SIZE */
109};
110
114
125 int (*accept)(struct bt_conn *conn, struct bt_rfcomm_dlc **dlc);
126
127 struct bt_rfcomm_server *_next;
128};
129
141
154int bt_rfcomm_dlc_connect(struct bt_conn *conn, struct bt_rfcomm_dlc *dlc,
156
167int bt_rfcomm_dlc_send(struct bt_rfcomm_dlc *dlc, struct net_buf *buf);
168
179
188
189#ifdef __cplusplus
190}
191#endif
192
197#endif /* ZEPHYR_INCLUDE_BLUETOOTH_RFCOMM_H_ */
Bluetooth data buffer API.
Bluetooth connection handling.
bt_security_t
Security level.
Definition: conn.h:352
enum bt_rfcomm_role bt_rfcomm_role_t
Role of RFCOMM session and dlc.
int bt_rfcomm_dlc_connect(struct bt_conn *conn, struct bt_rfcomm_dlc *dlc, uint8_t channel)
Connect RFCOMM channel.
int bt_rfcomm_dlc_send(struct bt_rfcomm_dlc *dlc, struct net_buf *buf)
Send data to RFCOMM.
int bt_rfcomm_dlc_disconnect(struct bt_rfcomm_dlc *dlc)
Disconnect RFCOMM dlc.
bt_rfcomm_role
Role of RFCOMM session and dlc.
Definition: rfcomm.h:76
struct net_buf * bt_rfcomm_create_pdu(struct net_buf_pool *pool)
Allocate the buffer from pool after reserving head room for RFCOMM, L2CAP and ACL headers.
int bt_rfcomm_server_register(struct bt_rfcomm_server *server)
Register RFCOMM server.
@ BT_RFCOMM_ROLE_INITIATOR
Definition: rfcomm.h:78
@ BT_RFCOMM_ROLE_ACCEPTOR
Definition: rfcomm.h:77
@ BT_RFCOMM_CHAN_SPP
Definition: rfcomm.h:33
@ BT_RFCOMM_CHAN_HFP_HF
Definition: rfcomm.h:29
@ BT_RFCOMM_CHAN_HSP_HS
Definition: rfcomm.h:32
@ BT_RFCOMM_CHAN_HFP_AG
Definition: rfcomm.h:30
@ BT_RFCOMM_CHAN_HSP_AG
Definition: rfcomm.h:31
#define K_KERNEL_STACK_MEMBER(sym, size)
Define an embedded stack memory region.
Definition: thread_stack.h:279
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
RFCOMM DLC operations structure.
Definition: rfcomm.h:39
void(* sent)(struct bt_rfcomm_dlc *dlc, int err)
DLC sent callback.
Definition: rfcomm.h:71
void(* recv)(struct bt_rfcomm_dlc *dlc, struct net_buf *buf)
DLC recv callback.
Definition: rfcomm.h:64
void(* disconnected)(struct bt_rfcomm_dlc *dlc)
DLC disconnected callback.
Definition: rfcomm.h:57
void(* connected)(struct bt_rfcomm_dlc *dlc)
DLC connected callback.
Definition: rfcomm.h:47
RFCOMM DLC structure.
Definition: rfcomm.h:82
struct bt_rfcomm_dlc_ops * ops
Definition: rfcomm.h:93
struct k_fifo tx_queue
Definition: rfcomm.h:87
uint8_t dlci
Definition: rfcomm.h:100
uint16_t mtu
Definition: rfcomm.h:99
struct k_sem tx_credits
Definition: rfcomm.h:90
struct k_work_delayable rtx_work
Definition: rfcomm.h:84
bt_rfcomm_role_t role
Definition: rfcomm.h:97
bt_security_t required_sec_level
Definition: rfcomm.h:96
uint8_t state
Definition: rfcomm.h:101
uint8_t rx_credit
Definition: rfcomm.h:102
struct k_thread tx_thread
Definition: rfcomm.h:105
struct bt_rfcomm_session * session
Definition: rfcomm.h:92
Definition: rfcomm.h:111
uint8_t channel
Server Channel.
Definition: rfcomm.h:113
int(* accept)(struct bt_conn *conn, struct bt_rfcomm_dlc **dlc)
Server accept callback.
Definition: rfcomm.h:125
Definition: kernel.h:2391
Thread Structure.
Definition: thread.h:259
A structure used to submit work after a delay.
Definition: kernel.h:3908
Network buffer pool representation.
Definition: buf.h:1076
Network buffer representation.
Definition: buf.h:1004