mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-26 09:41:01 +00:00
mesh/provisioning_device: update state before sending error or complete
This commit is contained in:
parent
6f3fd12d26
commit
73aea5d931
@ -146,6 +146,7 @@ typedef enum {
|
|||||||
DEVICE_W4_DATA,
|
DEVICE_W4_DATA,
|
||||||
DEVICE_SEND_COMPLETE,
|
DEVICE_SEND_COMPLETE,
|
||||||
DEVICE_SEND_ERROR,
|
DEVICE_SEND_ERROR,
|
||||||
|
DEVICE_W4_DONE,
|
||||||
} device_state_t;
|
} device_state_t;
|
||||||
|
|
||||||
static device_state_t device_state;
|
static device_state_t device_state;
|
||||||
@ -388,9 +389,9 @@ static void provisioning_run(void){
|
|||||||
switch (device_state){
|
switch (device_state){
|
||||||
case DEVICE_SEND_ERROR:
|
case DEVICE_SEND_ERROR:
|
||||||
start_timer = 0; // game over
|
start_timer = 0; // game over
|
||||||
|
device_state = DEVICE_W4_DONE;
|
||||||
prov_waiting_for_outgoing_complete = 1;
|
prov_waiting_for_outgoing_complete = 1;
|
||||||
provisioning_send_provisioning_error();
|
provisioning_send_provisioning_error();
|
||||||
provisioning_done();
|
|
||||||
break;
|
break;
|
||||||
case DEVICE_SEND_CAPABILITIES:
|
case DEVICE_SEND_CAPABILITIES:
|
||||||
device_state = DEVICE_W4_START;
|
device_state = DEVICE_W4_START;
|
||||||
@ -419,9 +420,9 @@ static void provisioning_run(void){
|
|||||||
break;
|
break;
|
||||||
case DEVICE_SEND_COMPLETE:
|
case DEVICE_SEND_COMPLETE:
|
||||||
start_timer = 0; // last message
|
start_timer = 0; // last message
|
||||||
|
device_state = DEVICE_W4_DONE;
|
||||||
prov_waiting_for_outgoing_complete = 1;
|
prov_waiting_for_outgoing_complete = 1;
|
||||||
provisioning_send_complete();
|
provisioning_send_complete();
|
||||||
provisioning_done();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@ -765,6 +766,9 @@ static void provisioning_handle_pdu(uint8_t packet_type, uint16_t channel, uint8
|
|||||||
case MESH_SUBEVENT_PB_TRANSPORT_PDU_SENT:
|
case MESH_SUBEVENT_PB_TRANSPORT_PDU_SENT:
|
||||||
printf("Outgoing packet acked\n");
|
printf("Outgoing packet acked\n");
|
||||||
prov_waiting_for_outgoing_complete = 0;
|
prov_waiting_for_outgoing_complete = 0;
|
||||||
|
if (device_state == DEVICE_W4_DONE){
|
||||||
|
provisioning_done();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED:
|
case MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED:
|
||||||
printf("Link close, reset state\n");
|
printf("Link close, reset state\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user