mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
goep_server: add disconnect, increase l2cap ertm buffer
This commit is contained in:
parent
650271be49
commit
03ebb5214d
@ -63,12 +63,12 @@ static l2cap_ertm_config_t ertm_config = {
|
|||||||
2000,
|
2000,
|
||||||
12000,
|
12000,
|
||||||
(GOEP_SERVER_ERTM_BUFFER / 2), // l2cap ertm mtu
|
(GOEP_SERVER_ERTM_BUFFER / 2), // l2cap ertm mtu
|
||||||
2,
|
4,
|
||||||
2,
|
4,
|
||||||
1, // 16-bit FCS
|
1, // 16-bit FCS
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint8_t goep_server_l2cap_packet_buffer[1000];
|
static uint8_t goep_server_l2cap_packet_buffer[GOEP_SERVER_ERTM_BUFFER];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -430,7 +430,11 @@ uint8_t goep_server_register_service(btstack_packet_handler_t callback, uint8_t
|
|||||||
if (service != NULL) {
|
if (service != NULL) {
|
||||||
return L2CAP_SERVICE_ALREADY_REGISTERED;
|
return L2CAP_SERVICE_ALREADY_REGISTERED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
UNUSED(l2cap_mtu);
|
||||||
|
UNUSED(l2cap_psm);
|
||||||
|
UNUSED(security_level);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// alloc structure
|
// alloc structure
|
||||||
@ -680,13 +684,36 @@ uint8_t goep_server_execute(uint16_t goep_cid, uint8_t response_code){
|
|||||||
#endif
|
#endif
|
||||||
case GOEP_CONNECTION_RFCOMM:
|
case GOEP_CONNECTION_RFCOMM:
|
||||||
return rfcomm_send_prepared(connection->bearer_cid, pos);
|
return rfcomm_send_prepared(connection->bearer_cid, pos);
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
btstack_unreachable();
|
btstack_unreachable();
|
||||||
return ERROR_CODE_SUCCESS;
|
return ERROR_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t goep_server_disconnect(uint16_t goep_cid){
|
||||||
|
goep_server_connection_t * connection = goep_server_get_connection_for_goep_cid(goep_cid);
|
||||||
|
if (connection == NULL) {
|
||||||
|
return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connection->state < GOEP_SERVER_CONNECTED){
|
||||||
|
return ERROR_CODE_COMMAND_DISALLOWED;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (connection->type) {
|
||||||
|
#ifdef ENABLE_GOEP_L2CAP
|
||||||
|
case GOEP_CONNECTION_L2CAP:
|
||||||
|
return l2cap_disconnect(connection->bearer_cid);
|
||||||
|
#endif
|
||||||
|
case GOEP_CONNECTION_RFCOMM:
|
||||||
|
return rfcomm_disconnect(connection->bearer_cid);
|
||||||
|
default:
|
||||||
|
btstack_unreachable();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ERROR_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void goep_server_deinit(void){
|
void goep_server_deinit(void){
|
||||||
goep_server_cid_counter = 0;
|
goep_server_cid_counter = 0;
|
||||||
goep_server_services = NULL;
|
goep_server_services = NULL;
|
||||||
|
@ -47,7 +47,7 @@ extern "C" {
|
|||||||
|
|
||||||
#ifdef ENABLE_GOEP_L2CAP
|
#ifdef ENABLE_GOEP_L2CAP
|
||||||
#ifndef GOEP_SERVER_ERTM_BUFFER
|
#ifndef GOEP_SERVER_ERTM_BUFFER
|
||||||
#define GOEP_SERVER_ERTM_BUFFER 1000
|
#define GOEP_SERVER_ERTM_BUFFER 2000
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -208,6 +208,13 @@ uint8_t goep_server_header_add_application_parameters(uint16_t goep_cid, const u
|
|||||||
*/
|
*/
|
||||||
uint8_t goep_server_execute(uint16_t goep_cid, uint8_t response_code);
|
uint8_t goep_server_execute(uint16_t goep_cid, uint8_t response_code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disconnect client
|
||||||
|
* @param goep_cid
|
||||||
|
* @return status
|
||||||
|
*/
|
||||||
|
uint8_t goep_server_disconnect(uint16_t goep_cid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* De-Init
|
* De-Init
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user