mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-26 12:35:25 +00:00
mesh: allow to specify transmission count and interval for adv bearer network pdus
This commit is contained in:
parent
415ff072a7
commit
3bf10e3a89
@ -280,7 +280,7 @@ static void adv_bearer_run(void){
|
||||
}
|
||||
|
||||
//
|
||||
static void adv_bearer_prepare_message(const uint8_t * data, uint16_t data_len, uint8_t type){
|
||||
static void adv_bearer_prepare_message(const uint8_t * data, uint16_t data_len, uint8_t type, uint8_t count, uint16_t interval){
|
||||
log_debug("adv bearer message, type 0x%x\n", type);
|
||||
// prepare message
|
||||
adv_bearer_buffer[0] = data_len+1;
|
||||
@ -288,9 +288,9 @@ static void adv_bearer_prepare_message(const uint8_t * data, uint16_t data_len,
|
||||
memcpy(&adv_bearer_buffer[2], data, data_len);
|
||||
adv_bearer_buffer_length = data_len + 2;
|
||||
|
||||
// setup constraint
|
||||
adv_bearer_count = 3;
|
||||
adv_bearer_interval = 0xa0; // 100 ms
|
||||
// setup trasmission schedule
|
||||
adv_bearer_count = count;
|
||||
adv_bearer_interval = interval;
|
||||
}
|
||||
|
||||
//////
|
||||
@ -335,16 +335,16 @@ void adv_bearer_request_can_send_now_for_provisioning_pdu(void){
|
||||
|
||||
// adv bearer send message
|
||||
|
||||
void adv_bearer_send_network_pdu(const uint8_t * data, uint16_t data_len){
|
||||
adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_MESH_MESSAGE);
|
||||
void adv_bearer_send_network_pdu(const uint8_t * data, uint16_t data_len, uint8_t count, uint16_t interval){
|
||||
adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_MESH_MESSAGE, count, interval);
|
||||
adv_bearer_run();
|
||||
}
|
||||
void adv_bearer_send_beacon(const uint8_t * data, uint16_t data_len){
|
||||
adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_MESH_BEACON);
|
||||
adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_MESH_BEACON, 3, 100);
|
||||
adv_bearer_run();
|
||||
}
|
||||
void adv_bearer_send_provisioning_pdu(const uint8_t * data, uint16_t data_len){
|
||||
adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_PB_ADV);
|
||||
adv_bearer_prepare_message(data, data_len, BLUETOOTH_DATA_TYPE_PB_ADV, 3, 100);
|
||||
adv_bearer_run();
|
||||
}
|
||||
|
||||
|
@ -115,12 +115,20 @@ void adv_bearer_request_can_send_now_for_beacon(void);
|
||||
void adv_bearer_request_can_send_now_for_provisioning_pdu(void);
|
||||
|
||||
/**
|
||||
* Send particular message type: Mesh Message, Mesh Beacon, PB-ADV
|
||||
* @param data to send
|
||||
* Send Mesh Message
|
||||
* @param data to send
|
||||
* @param data_len max 29 bytes
|
||||
* @param count number of transmissions
|
||||
* @param interval between transmission
|
||||
*/
|
||||
void adv_bearer_send_network_pdu(const uint8_t * network_pdu, uint16_t size, uint8_t count, uint16_t interval);
|
||||
|
||||
/**
|
||||
* Send particular message type:Mesh Beacon, PB-ADV
|
||||
* @param data to send
|
||||
* @param data_len max 29 bytes
|
||||
*/
|
||||
void adv_bearer_send_network_pdu(const uint8_t * network_pdu, uint16_t size);
|
||||
void adv_bearer_send_beacon(const uint8_t * beacon_update, uint16_t size);
|
||||
void adv_bearer_send_beacon(const uint8_t * beacon_update, uint16_t size);
|
||||
void adv_bearer_send_provisioning_pdu(const uint8_t * pb_adv_pdu, uint16_t size);
|
||||
|
||||
|
||||
|
@ -715,7 +715,7 @@ static void mesh_adv_bearer_handle_network_event(uint8_t packet_type, uint16_t c
|
||||
printf("TX-E-NetworkPDU (%p): ", adv_bearer_network_pdu);
|
||||
printf_hexdump(adv_bearer_network_pdu->data, adv_bearer_network_pdu->len);
|
||||
#endif
|
||||
adv_bearer_send_network_pdu(adv_bearer_network_pdu->data, adv_bearer_network_pdu->len);
|
||||
adv_bearer_send_network_pdu(adv_bearer_network_pdu->data, adv_bearer_network_pdu->len, 3, 100);
|
||||
network_pdu = adv_bearer_network_pdu;
|
||||
adv_bearer_network_pdu = NULL;
|
||||
|
||||
|
@ -42,7 +42,9 @@ void adv_bearer_request_can_send_now_for_network_pdu(void){
|
||||
event[2] = MESH_SUBEVENT_CAN_SEND_NOW;
|
||||
(*adv_packet_handler)(HCI_EVENT_PACKET, 0, &event[0], sizeof(event));
|
||||
}
|
||||
void adv_bearer_send_network_pdu(const uint8_t * network_pdu, uint16_t size){
|
||||
void adv_bearer_send_network_pdu(const uint8_t * network_pdu, uint16_t size, uint8_t count, uint16_t interval){
|
||||
(void) count;
|
||||
(void) interval;
|
||||
printf_hexdump(network_pdu, size);
|
||||
memcpy(sent_network_pdu_data, network_pdu, size);
|
||||
sent_network_pdu_len = size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user