Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
rfcomm.h
Go to the documentation of this file.
1
4
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
19
23#include <zephyr/sys/slist.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
30#define BT_RFCOMM_HDR_MAX_SIZE 4
32#define BT_RFCOMM_FCS_SIZE 1
33
41#define BT_RFCOMM_BUF_SIZE(mtu) \
42 BT_L2CAP_BUF_SIZE(BT_RFCOMM_HDR_MAX_SIZE + BT_RFCOMM_FCS_SIZE + (mtu))
43
44/* RFCOMM channels (1-30): pre-allocated for profiles to avoid conflicts */
45enum {
52};
53
54struct bt_rfcomm_dlc;
55
65 void (*connected)(struct bt_rfcomm_dlc *dlc);
66
75 void (*disconnected)(struct bt_rfcomm_dlc *dlc);
76
82 void (*recv)(struct bt_rfcomm_dlc *dlc, struct net_buf *buf);
83
89 void (*sent)(struct bt_rfcomm_dlc *dlc, int err);
90};
91
98
101 /* Response Timeout eXpired (RTX) timer */
103
104 /* Queue for outgoing data */
106
107 /* TX credits, Reuse as a binary sem for MSC FC if CFC is not enabled */
109
110 /* Worker for RFCOMM TX */
112
113 struct bt_rfcomm_session *session;
115 struct bt_rfcomm_dlc *_next;
116
119
124};
125
138
150 int (*accept)(struct bt_conn *conn, struct bt_rfcomm_server *server,
151 struct bt_rfcomm_dlc **dlc);
152
154 sys_snode_t node;
156};
157
159enum {
169};
170
172enum {
177};
178
180enum {
183};
184
186enum {
192};
193
202#define BT_RFCOMM_SET_LINE_SETTINGS(data, stop, parity) ((data & 0x3) | \
203 ((stop & 0x1) << 2) | \
204 ((parity & 0x7) << 3))
205
206#define BT_RFCOMM_RPN_FLOW_NONE 0x00
207#define BT_RFCOMM_RPN_XON_CHAR 0x11
208#define BT_RFCOMM_RPN_XOFF_CHAR 0x13
209
210/* Set 1 to all the param mask except reserved */
211#define BT_RFCOMM_RPN_PARAM_MASK_ALL 0x3f7f
212
223
235
245
258int bt_rfcomm_dlc_connect(struct bt_conn *conn, struct bt_rfcomm_dlc *dlc,
259 uint8_t channel);
260
271int bt_rfcomm_dlc_send(struct bt_rfcomm_dlc *dlc, struct net_buf *buf);
272
283
292
302
303#ifdef __cplusplus
304}
305#endif
306
310
311#endif /* ZEPHYR_INCLUDE_BLUETOOTH_RFCOMM_H_ */
Bluetooth data buffer API.
Bluetooth connection handling.
bt_security_t
Security level.
Definition conn.h:1162
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:94
int bt_rfcomm_send_rpn_cmd(struct bt_rfcomm_dlc *dlc, struct bt_rfcomm_rpn *rpn)
Send Remote Port Negotiation command.
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_unregister(struct bt_rfcomm_server *server)
Unregister RFCOMM server.
int bt_rfcomm_server_register(struct bt_rfcomm_server *server)
Register RFCOMM server.
@ BT_RFCOMM_RPN_DATA_BITS_5
Definition rfcomm.h:173
@ BT_RFCOMM_RPN_DATA_BITS_7
Definition rfcomm.h:175
@ BT_RFCOMM_RPN_DATA_BITS_6
Definition rfcomm.h:174
@ BT_RFCOMM_RPN_DATA_BITS_8
Definition rfcomm.h:176
@ BT_RFCOMM_RPN_BAUD_RATE_4800
Definition rfcomm.h:161
@ BT_RFCOMM_RPN_BAUD_RATE_19200
Definition rfcomm.h:164
@ BT_RFCOMM_RPN_BAUD_RATE_7200
Definition rfcomm.h:162
@ BT_RFCOMM_RPN_BAUD_RATE_230400
Definition rfcomm.h:168
@ BT_RFCOMM_RPN_BAUD_RATE_38400
Definition rfcomm.h:165
@ BT_RFCOMM_RPN_BAUD_RATE_9600
Definition rfcomm.h:163
@ BT_RFCOMM_RPN_BAUD_RATE_2400
Definition rfcomm.h:160
@ BT_RFCOMM_RPN_BAUD_RATE_57600
Definition rfcomm.h:166
@ BT_RFCOMM_RPN_BAUD_RATE_115200
Definition rfcomm.h:167
@ BT_RFCOMM_ROLE_INITIATOR
Definition rfcomm.h:96
@ BT_RFCOMM_ROLE_ACCEPTOR
Definition rfcomm.h:95
@ BT_RFCOMM_RPN_STOP_BITS_1_5
Definition rfcomm.h:182
@ BT_RFCOMM_RPN_STOP_BITS_1
Definition rfcomm.h:181
@ BT_RFCOMM_RPN_PARITY_NONE
Definition rfcomm.h:187
@ BT_RFCOMM_RPN_PARITY_ODD
Definition rfcomm.h:188
@ BT_RFCOMM_RPN_PARITY_EVEN
Definition rfcomm.h:189
@ BT_RFCOMM_RPN_PARITY_MARK
Definition rfcomm.h:190
@ BT_RFCOMM_RPN_PARITY_SPACE
Definition rfcomm.h:191
@ BT_RFCOMM_CHAN_SPP
Definition rfcomm.h:50
@ BT_RFCOMM_CHAN_DYNAMIC_START
Definition rfcomm.h:51
@ BT_RFCOMM_CHAN_HFP_HF
Definition rfcomm.h:46
@ BT_RFCOMM_CHAN_HSP_HS
Definition rfcomm.h:49
@ BT_RFCOMM_CHAN_HFP_AG
Definition rfcomm.h:47
@ BT_RFCOMM_CHAN_HSP_AG
Definition rfcomm.h:48
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
Bluetooth L2CAP handling.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
RFCOMM DLC operations structure.
Definition rfcomm.h:57
void(* sent)(struct bt_rfcomm_dlc *dlc, int err)
DLC sent callback.
Definition rfcomm.h:89
void(* recv)(struct bt_rfcomm_dlc *dlc, struct net_buf *buf)
DLC recv callback.
Definition rfcomm.h:82
void(* disconnected)(struct bt_rfcomm_dlc *dlc)
DLC disconnected callback.
Definition rfcomm.h:75
void(* connected)(struct bt_rfcomm_dlc *dlc)
DLC connected callback.
Definition rfcomm.h:65
RFCOMM DLC structure.
Definition rfcomm.h:100
struct bt_rfcomm_dlc_ops * ops
Definition rfcomm.h:114
struct k_fifo tx_queue
Definition rfcomm.h:105
uint8_t dlci
Definition rfcomm.h:121
uint16_t mtu
Definition rfcomm.h:120
struct k_sem tx_credits
Definition rfcomm.h:108
struct k_work_delayable rtx_work
Definition rfcomm.h:102
bt_rfcomm_role_t role
Definition rfcomm.h:118
bt_security_t required_sec_level
Definition rfcomm.h:117
uint8_t state
Definition rfcomm.h:122
uint8_t rx_credit
Definition rfcomm.h:123
struct bt_rfcomm_session * session
Definition rfcomm.h:113
struct k_work tx_work
Definition rfcomm.h:111
RFCOMM Remote Port Negotiation (RPN) structure.
Definition rfcomm.h:214
uint16_t param_mask
Definition rfcomm.h:221
uint8_t baud_rate
Definition rfcomm.h:216
uint8_t line_settings
Definition rfcomm.h:217
uint8_t xoff_char
Definition rfcomm.h:220
uint8_t flow_control
Definition rfcomm.h:218
uint8_t xon_char
Definition rfcomm.h:219
uint8_t dlci
Definition rfcomm.h:215
Definition rfcomm.h:126
uint8_t channel
Server Channel.
Definition rfcomm.h:137
int(* accept)(struct bt_conn *conn, struct bt_rfcomm_server *server, struct bt_rfcomm_dlc **dlc)
Server accept callback.
Definition rfcomm.h:150
Definition kernel.h:2872
Semaphore structure.
Definition kernel.h:3607
A structure used to submit work after a delay.
Definition kernel.h:4531
A structure used to submit work.
Definition kernel.h:4503
Network buffer pool representation.
Definition net_buf.h:1079
Network buffer representation.
Definition net_buf.h:1006