mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-25 09:02:30 +00:00
drop _internal from doc and remaining places
This commit is contained in:
parent
75a994c4ca
commit
add0254b7d
@ -19,6 +19,7 @@ all:
|
|||||||
mv latex/btstack_gettingstarted.pdf btstack.pdf
|
mv latex/btstack_gettingstarted.pdf btstack.pdf
|
||||||
rm -rf latex tmp
|
rm -rf latex tmp
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf docs_final btstack
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
L2CAP events and data packets are delivered to the packet handler
|
L2CAP events and data packets are delivered to the packet handler
|
||||||
specified by *l2cap_register_service* resp.
|
specified by *l2cap_register_service* resp.
|
||||||
*l2cap_create_channel_internal*. Data packets have the
|
*l2cap_create_channel*. Data packets have the
|
||||||
L2CAP_DATA_PACKET packet type. L2CAP provides the following events:
|
L2CAP_DATA_PACKET packet type. L2CAP provides the following events:
|
||||||
|
|
||||||
- L2CAP_EVENT_CHANNEL_OPENED - sent if channel establishment is
|
- L2CAP_EVENT_CHANNEL_OPENED - sent if channel establishment is
|
||||||
@ -17,7 +17,7 @@ L2CAP_DATA_PACKET packet type. L2CAP provides the following events:
|
|||||||
- L2CAP_EVENT_INCOMING_CONNECTION - received when the connection is
|
- L2CAP_EVENT_INCOMING_CONNECTION - received when the connection is
|
||||||
requested by remote. Connection accept and decline are performed
|
requested by remote. Connection accept and decline are performed
|
||||||
with *l2cap_accept_connection* and
|
with *l2cap_accept_connection* and
|
||||||
*l2cap_decline_connecti-on_internal* respectively.
|
*l2cap_decline_connecti-on* respectively.
|
||||||
|
|
||||||
- L2CAP_EVENT_CREDITS - emitted when there is a chance to send a new
|
- L2CAP_EVENT_CREDITS - emitted when there is a chance to send a new
|
||||||
L2CAP packet. BTstack does not buffer packets. Instead, it requires
|
L2CAP packet. BTstack does not buffer packets. Instead, it requires
|
||||||
@ -65,7 +65,7 @@ by RFCOMM:
|
|||||||
- RFCOMM_EVENT_INCOMING_CONNECTION - received when the connection
|
- RFCOMM_EVENT_INCOMING_CONNECTION - received when the connection
|
||||||
is requested by remote. Connection accept and decline are performed
|
is requested by remote. Connection accept and decline are performed
|
||||||
with *rfcomm_accept_connection* and
|
with *rfcomm_accept_connection* and
|
||||||
*rfcomm_decline_con-nection_internal* respectively.
|
*rfcomm_decline_connection* respectively.
|
||||||
|
|
||||||
- RFCOMM_EVENT_CHANNEL_CLOSED - emitted when channel is closed. No
|
- RFCOMM_EVENT_CHANNEL_CLOSED - emitted when channel is closed. No
|
||||||
status information is provided.
|
status information is provided.
|
||||||
|
@ -242,8 +242,8 @@ These handlers are registered with the functions listed in Table
|
|||||||
Packet Handler Registering Function
|
Packet Handler Registering Function
|
||||||
HCI packet handler *hci_register_packet_handler*
|
HCI packet handler *hci_register_packet_handler*
|
||||||
L2CAP packet handler *l2cap_register_packet_handler*
|
L2CAP packet handler *l2cap_register_packet_handler*
|
||||||
L2CAP service packet handler *l2cap_register_service_internal*
|
L2CAP service packet handler *l2cap_register_service*
|
||||||
L2CAP channel packet handler *l2cap_create_channel_internal*
|
L2CAP channel packet handler *l2cap_create_channel*
|
||||||
RFCOMM packet handler *rfcomm_register_packet_handler*
|
RFCOMM packet handler *rfcomm_register_packet_handler*
|
||||||
------------------------------ --------------------------------------
|
------------------------------ --------------------------------------
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ data packets are delivered to different packet handlers. Outgoing
|
|||||||
connections are used access remote services, incoming connections are
|
connections are used access remote services, incoming connections are
|
||||||
used to provide services. For incoming connections, the packet handler
|
used to provide services. For incoming connections, the packet handler
|
||||||
specified by *l2cap_register_service* is used. For outgoing
|
specified by *l2cap_register_service* is used. For outgoing
|
||||||
connections, the handler provided by *l2cap_create_channel_internal*
|
connections, the handler provided by *l2cap_create_channel*
|
||||||
is used. Currently, RFCOMM provides only a single packet handler
|
is used. Currently, RFCOMM provides only a single packet handler
|
||||||
specified by *rfcomm_register_packet_handler* for all RFCOMM
|
specified by *rfcomm_register_packet_handler* for all RFCOMM
|
||||||
connections, but this will be fixed in the next API overhaul.
|
connections, but this will be fixed in the next API overhaul.
|
||||||
@ -273,10 +273,10 @@ application could use three packet handlers: one to handle HCI events
|
|||||||
during discovery of a keyboard registered by
|
during discovery of a keyboard registered by
|
||||||
*l2cap_register_packet_handler*; one that will be registered to an
|
*l2cap_register_packet_handler*; one that will be registered to an
|
||||||
outgoing L2CAP channel to connect to keyboard and to receive keyboard
|
outgoing L2CAP channel to connect to keyboard and to receive keyboard
|
||||||
data registered by *l2cap_create_channel_internal*; after that
|
data registered by *l2cap_create_channel*; after that
|
||||||
keyboard can reconnect by itself. For this, you need to register L2CAP
|
keyboard can reconnect by itself. For this, you need to register L2CAP
|
||||||
services for the HID Control and HID Interrupt PSMs using
|
services for the HID Control and HID Interrupt PSMs using
|
||||||
*l2cap_register_service_internal*. In this call, you’ll also specify
|
*l2cap_register_service*. In this call, you’ll also specify
|
||||||
a packet handler to accept and receive keyboard data.
|
a packet handler to accept and receive keyboard data.
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ To provide an SPP Server, you need to provide an RFCOMM service with a
|
|||||||
specific RFCOMM channel number as explained in section on
|
specific RFCOMM channel number as explained in section on
|
||||||
[RFCOMM service](protocols/#sec:rfcommServiceProtocols). Then, you need to create
|
[RFCOMM service](protocols/#sec:rfcommServiceProtocols). Then, you need to create
|
||||||
an SDP record for it and publish it with the SDP server by calling
|
an SDP record for it and publish it with the SDP server by calling
|
||||||
*sdp_register_service_internal*. BTstack provides the
|
*sdp_register_service*. BTstack provides the
|
||||||
*sdp_create_spp_service* function in that requires an empty buffer of
|
*sdp_create_spp_service* function in that requires an empty buffer of
|
||||||
approximately 200 bytes, the service channel number, and a service name.
|
approximately 200 bytes, the service channel number, and a service name.
|
||||||
Have a look at the [SPP Counter example](examples/generated/#sec:sppcounterExample].
|
Have a look at the [SPP Counter example](examples/generated/#sec:sppcounterExample].
|
||||||
@ -243,7 +243,7 @@ To provide a PANU service, you need to provide a BNEP service with the
|
|||||||
service UUID, e.g. the PANU UUID, and a a maximal ethernet frame size,
|
service UUID, e.g. the PANU UUID, and a a maximal ethernet frame size,
|
||||||
as explained in Section [on BNEP service](protocols/#sec:bnepServiceProtocols). Then, you need to
|
as explained in Section [on BNEP service](protocols/#sec:bnepServiceProtocols). Then, you need to
|
||||||
create an SDP record for it and publish it with the SDP server by
|
create an SDP record for it and publish it with the SDP server by
|
||||||
calling *sdp_register_service_internal*. BTstack provides the
|
calling *sdp_register_service*. BTstack provides the
|
||||||
*pan_create_panu_service* function in *src/pan.c* that requires an
|
*pan_create_panu_service* function in *src/pan.c* that requires an
|
||||||
empty buffer of approximately 200 bytes, a description, and a security
|
empty buffer of approximately 200 bytes, a description, and a security
|
||||||
description.
|
description.
|
||||||
|
@ -185,8 +185,8 @@ protocols. Multiple channels can share the same baseband connection.
|
|||||||
To communicate with an L2CAP service on a remote device, the application
|
To communicate with an L2CAP service on a remote device, the application
|
||||||
on a local Bluetooth device initiates the L2CAP layer using the
|
on a local Bluetooth device initiates the L2CAP layer using the
|
||||||
*l2cap_init* function, and then creates an outgoing L2CAP channel to
|
*l2cap_init* function, and then creates an outgoing L2CAP channel to
|
||||||
the PSM of a remote device using the *l2cap_create_channel_internal*
|
the PSM of a remote device using the *l2cap_create_channel*
|
||||||
function. The *l2cap_create_channel_internal* function will initiate
|
function. The *l2cap_create_channel* function will initiate
|
||||||
a new baseband connection if it does not already exist. The packet
|
a new baseband connection if it does not already exist. The packet
|
||||||
handler that is given as an input parameter of the L2CAP create channel
|
handler that is given as an input parameter of the L2CAP create channel
|
||||||
function will be assigned to the new outgoing L2CAP channel. This
|
function will be assigned to the new outgoing L2CAP channel. This
|
||||||
@ -205,7 +205,7 @@ in Listing [below](#lst:L2CAPremoteService).
|
|||||||
}
|
}
|
||||||
|
|
||||||
void create_outgoing_l2cap_channel(bd_addr_t address, uint16_t psm, uint16_t mtu){
|
void create_outgoing_l2cap_channel(bd_addr_t address, uint16_t psm, uint16_t mtu){
|
||||||
l2cap_create_channel_internal(NULL, l2cap_packet_handler, remote_bd_addr, psm, mtu);
|
l2cap_create_channel(NULL, l2cap_packet_handler, remote_bd_addr, psm, mtu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void l2cap_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
void l2cap_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||||
@ -228,10 +228,10 @@ in Listing [below](#lst:L2CAPremoteService).
|
|||||||
|
|
||||||
To provide an L2CAP service, the application on a local Bluetooth device
|
To provide an L2CAP service, the application on a local Bluetooth device
|
||||||
must init the L2CAP layer and register the service with
|
must init the L2CAP layer and register the service with
|
||||||
*l2cap_register_service_internal*. From there on, it can wait for
|
*l2cap_register_service*. From there on, it can wait for
|
||||||
incoming L2CAP connections. The application can accept or deny an
|
incoming L2CAP connections. The application can accept or deny an
|
||||||
incoming connection by calling the *l2cap_accept_connection*
|
incoming connection by calling the *l2cap_accept_connection*
|
||||||
and *l2cap_deny_connection_internal* functions respectively. If a
|
and *l2cap_deny_connection* functions respectively. If a
|
||||||
connection is accepted and the incoming L2CAP channel gets successfully
|
connection is accepted and the incoming L2CAP channel gets successfully
|
||||||
opened, the L2CAP service can send L2CAP data packets to the connected
|
opened, the L2CAP service can send L2CAP data packets to the connected
|
||||||
device with *l2cap_send*.
|
device with *l2cap_send*.
|
||||||
@ -252,7 +252,7 @@ provides L2CAP service example code.
|
|||||||
void btstack_setup(){
|
void btstack_setup(){
|
||||||
...
|
...
|
||||||
l2cap_init();
|
l2cap_init();
|
||||||
l2cap_register_service_internal(NULL, packet_handler, 0x11,100);
|
l2cap_register_service(NULL, packet_handler, 0x11,100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||||
@ -334,12 +334,12 @@ To communicate with an RFCOMM service on a remote device, the
|
|||||||
application on a local Bluetooth device initiates the RFCOMM layer using
|
application on a local Bluetooth device initiates the RFCOMM layer using
|
||||||
the *rfcomm_init* function, and then creates an outgoing RFCOMM channel
|
the *rfcomm_init* function, and then creates an outgoing RFCOMM channel
|
||||||
to a given server channel on a remote device using the
|
to a given server channel on a remote device using the
|
||||||
*rfcomm_create_channel_internal* function. The
|
*rfcomm_create_channel* function. The
|
||||||
*rfcomm_create_channel_internal* function will initiate a new L2CAP
|
*rfcomm_create_channel* function will initiate a new L2CAP
|
||||||
connection for the RFCOMM multiplexer, if it does not already exist. The
|
connection for the RFCOMM multiplexer, if it does not already exist. The
|
||||||
channel will automatically provide enough credits to the remote side. To
|
channel will automatically provide enough credits to the remote side. To
|
||||||
provide credits manually, you have to create the RFCOMM connection by
|
provide credits manually, you have to create the RFCOMM connection by
|
||||||
calling *rfcomm_create_channel_with_initial_credits_internal* -
|
calling *rfcomm_create_channel_with_initial_credits* -
|
||||||
see Section [on manual credit assignement](#sec:manualCreditsProtocols).
|
see Section [on manual credit assignement](#sec:manualCreditsProtocols).
|
||||||
|
|
||||||
The packet handler that is given as an input parameter of the RFCOMM
|
The packet handler that is given as an input parameter of the RFCOMM
|
||||||
@ -358,7 +358,7 @@ Listing [below](#lst:RFCOMMremoteService).
|
|||||||
}
|
}
|
||||||
|
|
||||||
void create_rfcomm_channel(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
void create_rfcomm_channel(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||||
rfcomm_create_channel_internal(connection, addr, rfcomm_channel);
|
rfcomm_create_channel(connection, addr, rfcomm_channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rfcomm_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
void rfcomm_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||||
@ -381,15 +381,15 @@ Listing [below](#lst:RFCOMMremoteService).
|
|||||||
|
|
||||||
To provide an RFCOMM service, the application on a local Bluetooth
|
To provide an RFCOMM service, the application on a local Bluetooth
|
||||||
device must first init the L2CAP and RFCOMM layers and then register the
|
device must first init the L2CAP and RFCOMM layers and then register the
|
||||||
service with *rfcomm_register_service_internal*. From there on, it
|
service with *rfcomm_register_service*. From there on, it
|
||||||
can wait for incoming RFCOMM connections. The application can accept or
|
can wait for incoming RFCOMM connections. The application can accept or
|
||||||
deny an incoming connection by calling the
|
deny an incoming connection by calling the
|
||||||
*rfcomm_accept_connection* and
|
*rfcomm_accept_connection* and
|
||||||
*rfcomm_deny_connection_internal* functions respectively. If a
|
*rfcomm_deny_connection* functions respectively. If a
|
||||||
connection is accepted and the incoming RFCOMM channel gets successfully
|
connection is accepted and the incoming RFCOMM channel gets successfully
|
||||||
opened, the RFCOMM service can send RFCOMM data packets to the connected
|
opened, the RFCOMM service can send RFCOMM data packets to the connected
|
||||||
device with *rfcomm_send* and receive data packets by the
|
device with *rfcomm_send* and receive data packets by the
|
||||||
packet handler provided by the *rfcomm_register_service_internal*
|
packet handler provided by the *rfcomm_register_service*
|
||||||
call.
|
call.
|
||||||
|
|
||||||
Sending of RFCOMM data packets may fail due to a full internal BTstack
|
Sending of RFCOMM data packets may fail due to a full internal BTstack
|
||||||
@ -408,7 +408,7 @@ provides the RFCOMM service example code.
|
|||||||
void btstack_setup(){
|
void btstack_setup(){
|
||||||
...
|
...
|
||||||
rfcomm_init();
|
rfcomm_init();
|
||||||
rfcomm_register_service_internal(NULL, rfcomm_channel_nr, mtu);
|
rfcomm_register_service(NULL, rfcomm_channel_nr, mtu);
|
||||||
}
|
}
|
||||||
|
|
||||||
void packet_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
void packet_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||||
@ -534,7 +534,7 @@ Listing [below](#lst:explicitFlowControl).
|
|||||||
rfcomm_init();
|
rfcomm_init();
|
||||||
rfcomm_register_packet_handler(packet_handler);
|
rfcomm_register_packet_handler(packet_handler);
|
||||||
// reserved channel, mtu=100, 1 credit
|
// reserved channel, mtu=100, 1 credit
|
||||||
rfcomm_register_service_with_initial_credits_internal(NULL, rfcomm_channel_nr, 100, 1);
|
rfcomm_register_service_with_initial_credits(NULL, rfcomm_channel_nr, 100, 1);
|
||||||
}
|
}
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ connection is used. See Listing [below](#lst:automaticFlowControl).
|
|||||||
// init RFCOMM
|
// init RFCOMM
|
||||||
rfcomm_init();
|
rfcomm_init();
|
||||||
rfcomm_register_packet_handler(packet_handler);
|
rfcomm_register_packet_handler(packet_handler);
|
||||||
rfcomm_register_service_internal(NULL, rfcomm_channel_nr, 100);
|
rfcomm_register_service(NULL, rfcomm_channel_nr, 100);
|
||||||
}
|
}
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ Implementation:
|
|||||||
* call handler on every element: int handle_element(uint8_t element, void *context) - done?
|
* call handler on every element: int handle_element(uint8_t element, void *context) - done?
|
||||||
* Dispatch packets for protocols implemented by BTdaemon
|
* Dispatch packets for protocols implemented by BTdaemon
|
||||||
* add packet_handler to l2cap_service_t and l2cap_channel_t
|
* add packet_handler to l2cap_service_t and l2cap_channel_t
|
||||||
* pass acl/event handler to l2cap_register_service_internal
|
* pass acl/event handler to l2cap_register_service
|
||||||
* copy acl/event handler to l2cap_channel_t
|
* copy acl/event handler to l2cap_channel_t
|
||||||
* if specified, call custom packet_handler instead of general one
|
* if specified, call custom packet_handler instead of general one
|
||||||
* acl -> l2cap -> l2cap_channel -> acl/event handler OR daemon
|
* acl -> l2cap -> l2cap_channel -> acl/event handler OR daemon
|
||||||
|
@ -756,7 +756,7 @@ uint8_t l2cap_create_channel(btstack_packet_handler_t channel_packet_handler, bd
|
|||||||
// check if hci connection is already usable
|
// check if hci connection is already usable
|
||||||
hci_connection_t * conn = hci_connection_for_bd_addr_and_type(address, BD_ADDR_TYPE_CLASSIC);
|
hci_connection_t * conn = hci_connection_for_bd_addr_and_type(address, BD_ADDR_TYPE_CLASSIC);
|
||||||
if (conn){
|
if (conn){
|
||||||
log_info("l2cap_create_channel_internal, hci connection already exists");
|
log_info("l2cap_create_channel, hci connection already exists");
|
||||||
l2cap_handle_connection_complete(conn->con_handle, chan);
|
l2cap_handle_connection_complete(conn->con_handle, chan);
|
||||||
// check if remote supported fearures are already received
|
// check if remote supported fearures are already received
|
||||||
if (conn->bonding_flags & BONDING_RECEIVED_REMOTE_FEATURES) {
|
if (conn->bonding_flags & BONDING_RECEIVED_REMOTE_FEATURES) {
|
||||||
|
@ -608,11 +608,11 @@ static int stdin_process(struct btstack_data_source *ds){
|
|||||||
hci_send_cmd(&hci_create_connection, remote, hci_usable_acl_packet_types(), 0, 0, 0, 1);
|
hci_send_cmd(&hci_create_connection, remote, hci_usable_acl_packet_types(), 0, 0, 0, 1);
|
||||||
break;
|
break;
|
||||||
// printf("Creating L2CAP Connection to %s, PSM SDP\n", bd_addr_to_str(remote));
|
// printf("Creating L2CAP Connection to %s, PSM SDP\n", bd_addr_to_str(remote));
|
||||||
// l2cap_create_channel_internal(NULL, packet_handler, remote, PSM_SDP, 100);
|
// l2cap_create_channel(packet_handler, remote, PSM_SDP, 100);
|
||||||
// break;
|
// break;
|
||||||
// case 'u':
|
// case 'u':
|
||||||
// printf("Creating L2CAP Connection to %s, PSM 3\n", bd_addr_to_str(remote));
|
// printf("Creating L2CAP Connection to %s, PSM 3\n", bd_addr_to_str(remote));
|
||||||
// l2cap_create_channel_internal(NULL, packet_handler, remote, 3, 100);
|
// l2cap_create_channel(packet_handler, remote, 3, 100);
|
||||||
// break;
|
// break;
|
||||||
case 'q':
|
case 'q':
|
||||||
printf("Send L2CAP Data\n");
|
printf("Send L2CAP Data\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user