mesh: rename mesh events to start with MESH_SUBEVENT

This commit is contained in:
Milanka Ringwald 2019-06-03 11:30:28 +02:00 committed by Matthias Ringwald
parent 9e3cc73e4f
commit 7bd12f9f48
15 changed files with 406 additions and 406 deletions

View File

@ -76,14 +76,14 @@ static mesh_provisioning_t mesh_provisioning;
static void mesh_provisioning_service_emit_link_open(hci_con_handle_t con_handle, uint8_t status){ static void mesh_provisioning_service_emit_link_open(hci_con_handle_t con_handle, uint8_t status){
uint8_t event[7] = { HCI_EVENT_MESH_META, 5, MESH_PB_TRANSPORT_LINK_OPEN, status}; uint8_t event[7] = { HCI_EVENT_MESH_META, 5, MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN, status};
little_endian_store_16(event, 4, con_handle); little_endian_store_16(event, 4, con_handle);
event[6] = PB_TYPE_GATT; event[6] = PB_TYPE_GATT;
mesh_provisioning_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); mesh_provisioning_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
static void mesh_provisioning_service_emit_link_close(hci_con_handle_t con_handle, uint8_t reason){ static void mesh_provisioning_service_emit_link_close(hci_con_handle_t con_handle, uint8_t reason){
uint8_t event[5] = { HCI_EVENT_MESH_META, 3, MESH_PB_TRANSPORT_LINK_CLOSED}; uint8_t event[5] = { HCI_EVENT_MESH_META, 3, MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED};
little_endian_store_16(event, 4, con_handle); little_endian_store_16(event, 4, con_handle);
mesh_provisioning_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); mesh_provisioning_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }

View File

@ -76,13 +76,13 @@ static mesh_proxy_t mesh_proxy;
static void mesh_proxy_service_emit_connected(hci_con_handle_t con_handle){ static void mesh_proxy_service_emit_connected(hci_con_handle_t con_handle){
uint8_t event[5] = { HCI_EVENT_MESH_META, 3, MESH_PROXY_CONNECTED}; uint8_t event[5] = { HCI_EVENT_MESH_META, 3, MESH_SUBEVENT_PROXY_CONNECTED};
little_endian_store_16(event, 4, con_handle); little_endian_store_16(event, 4, con_handle);
mesh_proxy_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); mesh_proxy_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
static void mesh_proxy_service_emit_disconnected(hci_con_handle_t con_handle){ static void mesh_proxy_service_emit_disconnected(hci_con_handle_t con_handle){
uint8_t event[5] = { HCI_EVENT_MESH_META, 3, MESH_PROXY_DISCONNECTED}; uint8_t event[5] = { HCI_EVENT_MESH_META, 3, MESH_SUBEVENT_PROXY_DISCONNECTED};
little_endian_store_16(event, 4, con_handle); little_endian_store_16(event, 4, con_handle);
mesh_proxy_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); mesh_proxy_service_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }

View File

@ -242,12 +242,12 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
switch (hci_event_packet_get_type(packet)) { switch (hci_event_packet_get_type(packet)) {
case HCI_EVENT_MESH_META: case HCI_EVENT_MESH_META:
switch (hci_event_mesh_meta_get_subevent_code(packet)){ switch (hci_event_mesh_meta_get_subevent_code(packet)){
case MESH_PROXY_CONNECTED: case MESH_SUBEVENT_PROXY_CONNECTED:
gatt_bearer_mtu = ATT_DEFAULT_MTU; gatt_bearer_mtu = ATT_DEFAULT_MTU;
gatt_bearer_con_handle = mesh_proxy_connected_event_get_con_handle(packet); gatt_bearer_con_handle = mesh_subevent_proxy_connected_get_con_handle(packet);
gatt_bearer_emit_event_for_all(packet, size); gatt_bearer_emit_event_for_all(packet, size);
break; break;
case MESH_PROXY_DISCONNECTED: case MESH_SUBEVENT_PROXY_DISCONNECTED:
gatt_bearer_con_handle = HCI_CON_HANDLE_INVALID; gatt_bearer_con_handle = HCI_CON_HANDLE_INVALID;
gatt_bearer_emit_event_for_all(packet, size); gatt_bearer_emit_event_for_all(packet, size);
break; break;

View File

@ -134,19 +134,19 @@ static uint32_t pb_adv_random(void){
} }
static void pb_adv_emit_pdu_sent(uint8_t status){ static void pb_adv_emit_pdu_sent(uint8_t status){
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status}; uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_SUBEVENT_PB_TRANSPORT_PDU_SENT, status};
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
static void pb_adv_emit_link_open(uint8_t status, uint16_t pb_adv_cid){ static void pb_adv_emit_link_open(uint8_t status, uint16_t pb_adv_cid){
uint8_t event[7] = { HCI_EVENT_MESH_META, 5, MESH_PB_TRANSPORT_LINK_OPEN, status}; uint8_t event[7] = { HCI_EVENT_MESH_META, 5, MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN, status};
little_endian_store_16(event, 4, pb_adv_cid); little_endian_store_16(event, 4, pb_adv_cid);
event[6] = PB_TYPE_ADV; event[6] = PB_TYPE_ADV;
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
static void pb_adv_emit_link_close(uint16_t pb_adv_cid, uint8_t reason){ static void pb_adv_emit_link_close(uint16_t pb_adv_cid, uint8_t reason){
uint8_t event[5] = { HCI_EVENT_MESH_META, 3, MESH_PB_TRANSPORT_LINK_CLOSED}; uint8_t event[5] = { HCI_EVENT_MESH_META, 3, MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED};
little_endian_store_16(event, 4, pb_adv_cid); little_endian_store_16(event, 4, pb_adv_cid);
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }

View File

@ -68,7 +68,7 @@ static btstack_packet_handler_t pb_gatt_packet_handler;
static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size); static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size);
static void pb_gatt_emit_pdu_sent(uint8_t status){ static void pb_gatt_emit_pdu_sent(uint8_t status){
uint8_t event[] = {HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status}; uint8_t event[] = {HCI_EVENT_MESH_META, 2, MESH_SUBEVENT_PB_TRANSPORT_PDU_SENT, status};
pb_gatt_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); pb_gatt_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
@ -132,8 +132,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
switch (hci_event_packet_get_type(packet)) { switch (hci_event_packet_get_type(packet)) {
case HCI_EVENT_MESH_META: case HCI_EVENT_MESH_META:
switch (hci_event_mesh_meta_get_subevent_code(packet)){ switch (hci_event_mesh_meta_get_subevent_code(packet)){
case MESH_PB_TRANSPORT_LINK_OPEN: case MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN:
case MESH_PB_TRANSPORT_LINK_CLOSED: case MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED:
// Forward link open/close // Forward link open/close
pb_gatt_mtu = ATT_DEFAULT_MTU; pb_gatt_mtu = ATT_DEFAULT_MTU;
pb_gatt_packet_handler(HCI_EVENT_PACKET, 0, packet, size); pb_gatt_packet_handler(HCI_EVENT_PACKET, 0, packet, size);

View File

@ -2330,7 +2330,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param status * @param status
*/ */
#define MESH_PB_TRANSPORT_PDU_SENT 0x02 #define MESH_SUBEVENT_PB_TRANSPORT_PDU_SENT 0x02
/** /**
* @format 1121 * @format 1121
@ -2339,7 +2339,7 @@ typedef uint8_t sm_key_t[16];
* @param pb_transport_cid * @param pb_transport_cid
* @param pb_type * @param pb_type
*/ */
#define MESH_PB_TRANSPORT_LINK_OPEN 0x03 #define MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN 0x03
/** /**
* @format 112 * @format 112
@ -2347,7 +2347,7 @@ typedef uint8_t sm_key_t[16];
* @param status * @param status
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_TRANSPORT_LINK_CLOSED 0x04 #define MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED 0x04
/** /**
* @format 121 * @format 121
@ -2355,7 +2355,7 @@ typedef uint8_t sm_key_t[16];
* @param pb_transport_cid * @param pb_transport_cid
* @param attention_time in seconds * @param attention_time in seconds
*/ */
#define MESH_PB_PROV_ATTENTION_TIMER 0x10 #define MESH_SUBEVENT_PB_PROV_ATTENTION_TIMER 0x10
/** /**
* Device Role * Device Role
@ -2363,7 +2363,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_START_EMIT_PUBLIC_KEY_OOB 0x11 #define MESH_SUBEVENT_PB_PROV_START_EMIT_PUBLIC_KEY_OOB 0x11
/** /**
* Device Role * Device Role
@ -2371,7 +2371,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB 0x12 #define MESH_SUBEVENT_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB 0x12
/** /**
* Device Role * Device Role
@ -2379,7 +2379,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_INPUT_OOB_REQUEST 0x13 #define MESH_SUBEVENT_PB_PROV_INPUT_OOB_REQUEST 0x13
/** /**
* Device Role * Device Role
@ -2388,7 +2388,7 @@ typedef uint8_t sm_key_t[16];
* @param pb_transport_cid * @param pb_transport_cid
* @param output_oob number * @param output_oob number
*/ */
#define MESH_PB_PROV_START_EMIT_OUTPUT_OOB 0x15 #define MESH_SUBEVENT_PB_PROV_START_EMIT_OUTPUT_OOB 0x15
/** /**
* Device Role * Device Role
@ -2396,7 +2396,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB 0x16 #define MESH_SUBEVENT_PB_PROV_STOP_EMIT_OUTPUT_OOB 0x16
/** /**
* Provisioner Role * Provisioner Role
@ -2404,7 +2404,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB 0x17 #define MESH_SUBEVENT_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB 0x17
/** /**
* Provisioner Role * Provisioner Role
@ -2412,7 +2412,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_STOP_RECEIVE_PUBLIC_KEY_OOB 0x18 #define MESH_SUBEVENT_PB_PROV_STOP_RECEIVE_PUBLIC_KEY_OOB 0x18
/** /**
* Provisioner Role * Provisioner Role
@ -2420,7 +2420,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_OUTPUT_OOB_REQUEST 0x19 #define MESH_SUBEVENT_PB_PROV_OUTPUT_OOB_REQUEST 0x19
/** /**
* Provisioner Role * Provisioner Role
@ -2429,7 +2429,7 @@ typedef uint8_t sm_key_t[16];
* @param pb_transport_cid * @param pb_transport_cid
* @param output_oob number * @param output_oob number
*/ */
#define MESH_PB_PROV_START_EMIT_INPUT_OOB 0x1a #define MESH_SUBEVENT_PB_PROV_START_EMIT_INPUT_OOB 0x1a
/** /**
* Provisioner Role * Provisioner Role
@ -2437,7 +2437,7 @@ typedef uint8_t sm_key_t[16];
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_STOP_EMIT_INPUT_OOB 0x1b #define MESH_SUBEVENT_PB_PROV_STOP_EMIT_INPUT_OOB 0x1b
/** /**
* Provisioner Role * Provisioner Role
@ -2453,14 +2453,14 @@ typedef uint8_t sm_key_t[16];
* @param input_oob_size * @param input_oob_size
* @param input_oob_action * @param input_oob_action
*/ */
#define MESH_PB_PROV_CAPABILITIES 0x1c #define MESH_SUBEVENT_PB_PROV_CAPABILITIES 0x1c
/** /**
* @format 12 * @format 12
* @param subevent_code * @param subevent_code
* @param pb_transport_cid * @param pb_transport_cid
*/ */
#define MESH_PB_PROV_COMPLETE 0x1d #define MESH_SUBEVENT_PB_PROV_COMPLETE 0x1d
/** /**
* @format 11H * @format 11H
@ -2468,21 +2468,21 @@ typedef uint8_t sm_key_t[16];
* @param status * @param status
* @param con_handle * @param con_handle
*/ */
#define MESH_PROXY_CONNECTED 0x20 #define MESH_SUBEVENT_PROXY_CONNECTED 0x20
/** /**
* @format 1H * @format 1H
* @param subevent_code * @param subevent_code
* @param con_handle * @param con_handle
*/ */
#define MESH_PROXY_PDU_SENT 0x21 #define MESH_SUBEVENT_PROXY_PDU_SENT 0x21
/** /**
* @format 1H * @format 1H
* @param subevent_code * @param subevent_code
* @param con_handle * @param con_handle
*/ */
#define MESH_PROXY_DISCONNECTED 0x22 #define MESH_SUBEVENT_PROXY_DISCONNECTED 0x22
/** /**
* @format 1H * @format 1H

View File

@ -3258,331 +3258,6 @@ static inline uint8_t gap_event_inquiry_complete_get_status(const uint8_t * even
return event[2]; return event[2];
} }
/**
* @brief Get field status from event MESH_PB_TRANSPORT_PDU_SENT_EVENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_transport_pdu_sent_event_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field status from event MESH_PB_TRANSPORT_LINK_OPEN_EVENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_transport_link_open_event_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_TRANSPORT_LINK_OPEN_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_transport_link_open_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field pb_type from event MESH_PB_TRANSPORT_LINK_OPEN_EVENT
* @param event packet
* @return pb_type
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_transport_link_open_event_get_pb_type(const uint8_t * event){
return event[6];
}
/**
* @brief Get field status from event MESH_PB_TRANSPORT_LINK_CLOSED_EVENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_transport_link_closed_event_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_TRANSPORT_LINK_CLOSED_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_transport_link_closed_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_ATTENTION_TIMER_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_attention_timer_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field attention_time from event MESH_PB_PROV_ATTENTION_TIMER_EVENT
* @param event packet
* @return attention_time
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_prov_attention_timer_event_get_attention_time(const uint8_t * event){
return event[5];
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_START_EMIT_PUBLIC_KEY_OOB_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_start_emit_public_key_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_stop_emit_public_key_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_INPUT_OOB_REQUEST_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_input_oob_request_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_START_EMIT_OUTPUT_OOB_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_start_emit_output_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field output_oob from event MESH_PB_PROV_START_EMIT_OUTPUT_OOB_EVENT
* @param event packet
* @return output_oob
* @note: btstack_type 4
*/
static inline uint32_t mesh_pb_prov_start_emit_output_oob_event_get_output_oob(const uint8_t * event){
return little_endian_read_32(event, 5);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_stop_emit_output_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_start_receive_public_key_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_STOP_RECEIVE_PUBLIC_KEY_OOB_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_stop_receive_public_key_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_OUTPUT_OOB_REQUEST_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_output_oob_request_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_START_EMIT_INPUT_OOB_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_start_emit_input_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field output_oob from event MESH_PB_PROV_START_EMIT_INPUT_OOB_EVENT
* @param event packet
* @return output_oob
* @note: btstack_type 4
*/
static inline uint32_t mesh_pb_prov_start_emit_input_oob_event_get_output_oob(const uint8_t * event){
return little_endian_read_32(event, 5);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_STOP_EMIT_INPUT_OOB_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_stop_emit_input_oob_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_capabilities_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field num_elements from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return num_elements
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_prov_capabilities_event_get_num_elements(const uint8_t * event){
return event[5];
}
/**
* @brief Get field algorithms from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return algorithms
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_capabilities_event_get_algorithms(const uint8_t * event){
return little_endian_read_16(event, 6);
}
/**
* @brief Get field public_key from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return public_key
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_prov_capabilities_event_get_public_key(const uint8_t * event){
return event[8];
}
/**
* @brief Get field static_oob_type from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return static_oob_type
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_prov_capabilities_event_get_static_oob_type(const uint8_t * event){
return event[9];
}
/**
* @brief Get field output_oob_size from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return output_oob_size
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_prov_capabilities_event_get_output_oob_size(const uint8_t * event){
return event[10];
}
/**
* @brief Get field output_oob_action from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return output_oob_action
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_capabilities_event_get_output_oob_action(const uint8_t * event){
return little_endian_read_16(event, 11);
}
/**
* @brief Get field input_oob_size from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return input_oob_size
* @note: btstack_type 1
*/
static inline uint8_t mesh_pb_prov_capabilities_event_get_input_oob_size(const uint8_t * event){
return event[13];
}
/**
* @brief Get field input_oob_action from event MESH_PB_PROV_CAPABILITIES_EVENT
* @param event packet
* @return input_oob_action
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_capabilities_event_get_input_oob_action(const uint8_t * event){
return little_endian_read_16(event, 14);
}
/**
* @brief Get field pb_transport_cid from event MESH_PB_PROV_COMPLETE_EVENT
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_pb_prov_complete_event_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field status from event MESH_PROXY_CONNECTED_EVENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_proxy_connected_event_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field con_handle from event MESH_PROXY_CONNECTED_EVENT
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t mesh_proxy_connected_event_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field con_handle from event MESH_PROXY_PDU_SENT_EVENT
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t mesh_proxy_pdu_sent_event_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event MESH_PROXY_DISCONNECTED_EVENT
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t mesh_proxy_disconnected_event_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/** /**
* @brief Get field status from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE * @brief Get field status from event HCI_SUBEVENT_LE_CONNECTION_COMPLETE
* @param event packet * @param event packet
@ -7543,6 +7218,331 @@ static inline uint16_t map_subevent_parsing_done_get_map_cid(const uint8_t * eve
} }
/**
* @brief Get field status from event MESH_SUBEVENT_PB_TRANSPORT_PDU_SENT
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_transport_pdu_sent_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field status from event MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_transport_link_open_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_transport_link_open_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field pb_type from event MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN
* @param event packet
* @return pb_type
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_transport_link_open_get_pb_type(const uint8_t * event){
return event[6];
}
/**
* @brief Get field status from event MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_transport_link_closed_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_transport_link_closed_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_ATTENTION_TIMER
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_attention_timer_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field attention_time from event MESH_SUBEVENT_PB_PROV_ATTENTION_TIMER
* @param event packet
* @return attention_time
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_prov_attention_timer_get_attention_time(const uint8_t * event){
return event[5];
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_START_EMIT_PUBLIC_KEY_OOB
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_start_emit_public_key_oob_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_stop_emit_public_key_oob_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_INPUT_OOB_REQUEST
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_input_oob_request_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_START_EMIT_OUTPUT_OOB
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_start_emit_output_oob_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field output_oob from event MESH_SUBEVENT_PB_PROV_START_EMIT_OUTPUT_OOB
* @param event packet
* @return output_oob
* @note: btstack_type 4
*/
static inline uint32_t mesh_subevent_pb_prov_start_emit_output_oob_get_output_oob(const uint8_t * event){
return little_endian_read_32(event, 5);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_STOP_EMIT_OUTPUT_OOB
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_stop_emit_output_oob_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_start_receive_public_key_oob_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_STOP_RECEIVE_PUBLIC_KEY_OOB
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_stop_receive_public_key_oob_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_OUTPUT_OOB_REQUEST
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_output_oob_request_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_START_EMIT_INPUT_OOB
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_start_emit_input_oob_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field output_oob from event MESH_SUBEVENT_PB_PROV_START_EMIT_INPUT_OOB
* @param event packet
* @return output_oob
* @note: btstack_type 4
*/
static inline uint32_t mesh_subevent_pb_prov_start_emit_input_oob_get_output_oob(const uint8_t * event){
return little_endian_read_32(event, 5);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_STOP_EMIT_INPUT_OOB
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_stop_emit_input_oob_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_capabilities_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field num_elements from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return num_elements
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_prov_capabilities_get_num_elements(const uint8_t * event){
return event[5];
}
/**
* @brief Get field algorithms from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return algorithms
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_capabilities_get_algorithms(const uint8_t * event){
return little_endian_read_16(event, 6);
}
/**
* @brief Get field public_key from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return public_key
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_prov_capabilities_get_public_key(const uint8_t * event){
return event[8];
}
/**
* @brief Get field static_oob_type from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return static_oob_type
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_prov_capabilities_get_static_oob_type(const uint8_t * event){
return event[9];
}
/**
* @brief Get field output_oob_size from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return output_oob_size
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_prov_capabilities_get_output_oob_size(const uint8_t * event){
return event[10];
}
/**
* @brief Get field output_oob_action from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return output_oob_action
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_capabilities_get_output_oob_action(const uint8_t * event){
return little_endian_read_16(event, 11);
}
/**
* @brief Get field input_oob_size from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return input_oob_size
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_pb_prov_capabilities_get_input_oob_size(const uint8_t * event){
return event[13];
}
/**
* @brief Get field input_oob_action from event MESH_SUBEVENT_PB_PROV_CAPABILITIES
* @param event packet
* @return input_oob_action
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_capabilities_get_input_oob_action(const uint8_t * event){
return little_endian_read_16(event, 14);
}
/**
* @brief Get field pb_transport_cid from event MESH_SUBEVENT_PB_PROV_COMPLETE
* @param event packet
* @return pb_transport_cid
* @note: btstack_type 2
*/
static inline uint16_t mesh_subevent_pb_prov_complete_get_pb_transport_cid(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field status from event MESH_SUBEVENT_PROXY_CONNECTED
* @param event packet
* @return status
* @note: btstack_type 1
*/
static inline uint8_t mesh_subevent_proxy_connected_get_status(const uint8_t * event){
return event[3];
}
/**
* @brief Get field con_handle from event MESH_SUBEVENT_PROXY_CONNECTED
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t mesh_subevent_proxy_connected_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field con_handle from event MESH_SUBEVENT_PROXY_PDU_SENT
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t mesh_subevent_proxy_pdu_sent_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event MESH_SUBEVENT_PROXY_DISCONNECTED
* @param event packet
* @return con_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t mesh_subevent_proxy_disconnected_get_con_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/** /**
* @brief Get field con_handle from event MESH_SUBEVENT_MESSAGE_SENT * @brief Get field con_handle from event MESH_SUBEVENT_MESSAGE_SENT
* @param event packet * @param event packet

View File

@ -447,23 +447,23 @@ static void mesh_provisioning_message_handler (uint8_t packet_type, uint16_t cha
switch(packet[0]){ switch(packet[0]){
case HCI_EVENT_MESH_META: case HCI_EVENT_MESH_META:
switch(packet[2]){ switch(packet[2]){
case MESH_PB_TRANSPORT_LINK_OPEN: case MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN:
printf("Provisioner link opened"); printf("Provisioner link opened");
pb_transport_cid = mesh_pb_transport_link_open_event_get_pb_transport_cid(packet); pb_transport_cid = mesh_subevent_pb_transport_link_open_get_pb_transport_cid(packet);
break; break;
case MESH_PB_TRANSPORT_LINK_CLOSED: case MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED:
pb_transport_cid = MESH_PB_TRANSPORT_INVALID_CID; pb_transport_cid = MESH_PB_TRANSPORT_INVALID_CID;
break; break;
case MESH_PB_PROV_ATTENTION_TIMER: case MESH_SUBEVENT_PB_PROV_ATTENTION_TIMER:
printf("Attention Timer: %u\n", packet[3]); printf("Attention Timer: %u\n", packet[3]);
break; break;
case MESH_PB_PROV_INPUT_OOB_REQUEST: case MESH_SUBEVENT_PB_PROV_INPUT_OOB_REQUEST:
printf("Enter passphrase: "); printf("Enter passphrase: ");
fflush(stdout); fflush(stdout);
ui_chars_for_pin = 1; ui_chars_for_pin = 1;
ui_pin_offset = 0; ui_pin_offset = 0;
break; break;
case MESH_PB_PROV_COMPLETE: case MESH_SUBEVENT_PB_PROV_COMPLETE:
printf("Provisioning complete\n"); printf("Provisioning complete\n");
memcpy(provisioning_data.device_key, provisioning_device_data_get_device_key(), 16); memcpy(provisioning_data.device_key, provisioning_device_data_get_device_key(), 16);
@ -2765,7 +2765,7 @@ static void mesh_proxy_packet_handler_network_pdu(uint8_t packet_type, uint16_t
case MESH_SUBEVENT_MESSAGE_SENT: case MESH_SUBEVENT_MESSAGE_SENT:
mesh_gatt_handle_event(packet_type, channel, packet, size); mesh_gatt_handle_event(packet_type, channel, packet, size);
break; break;
case MESH_PROXY_CONNECTED: case MESH_SUBEVENT_PROXY_CONNECTED:
printf("mesh: MESH_PROXY_CONNECTED\n"); printf("mesh: MESH_PROXY_CONNECTED\n");
printf("+ Setup Secure Network Beacon\n"); printf("+ Setup Secure Network Beacon\n");
mesh_secure_network_beacon[0] = BEACON_TYPE_SECURE_NETWORK; mesh_secure_network_beacon[0] = BEACON_TYPE_SECURE_NETWORK;

View File

@ -135,7 +135,7 @@ static void mesh_message_handler (uint8_t packet_type, uint16_t channel, uint8_t
switch(packet[0]){ switch(packet[0]){
case HCI_EVENT_MESH_META: case HCI_EVENT_MESH_META:
switch(packet[2]){ switch(packet[2]){
case MESH_PB_PROV_COMPLETE: case MESH_SUBEVENT_PB_PROV_COMPLETE:
printf("Provisioning complete\n"); printf("Provisioning complete\n");
network_key = provisioning_device_data_get_network_key(); network_key = provisioning_device_data_get_network_key();

View File

@ -264,7 +264,7 @@ static void packet_handler_for_mesh_network_pdu(uint8_t packet_type, uint16_t ch
switch (hci_event_packet_get_type(packet)){ switch (hci_event_packet_get_type(packet)){
case HCI_EVENT_MESH_META: case HCI_EVENT_MESH_META:
switch (hci_event_mesh_meta_get_subevent_code(packet)){ switch (hci_event_mesh_meta_get_subevent_code(packet)){
case MESH_PB_TRANSPORT_LINK_OPEN: case MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN:
printf("mesh_proxy_server: MESH_PB_TRANSPORT_LINK_OPEN\n"); printf("mesh_proxy_server: MESH_PB_TRANSPORT_LINK_OPEN\n");
printf("+ Setup Secure Network Beacon\n"); printf("+ Setup Secure Network Beacon\n");
mesh_secure_network_beacon[0] = BEACON_TYPE_SECURE_NETWORK; mesh_secure_network_beacon[0] = BEACON_TYPE_SECURE_NETWORK;

View File

@ -161,20 +161,20 @@ static void mesh_message_handler (uint8_t packet_type, uint16_t channel, uint8_t
switch(packet[0]){ switch(packet[0]){
case HCI_EVENT_MESH_META: case HCI_EVENT_MESH_META:
switch(packet[2]){ switch(packet[2]){
case MESH_PB_TRANSPORT_LINK_OPEN: case MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN:
printf("Provisioner link opened"); printf("Provisioner link opened");
break; break;
case MESH_PB_PROV_CAPABILITIES: case MESH_SUBEVENT_PB_PROV_CAPABILITIES:
printf("// Provisioner capabilities\n"); printf("// Provisioner capabilities\n");
public_oob = mesh_pb_prov_capabilities_event_get_public_key(packet); public_oob = mesh_subevent_pb_prov_capabilities_get_public_key(packet);
if (public_oob){ if (public_oob){
printf("PTS supports Public OOB, select Public OOB\n"); printf("PTS supports Public OOB, select Public OOB\n");
} else { } else {
printf("PTS does not supports Public OOB, select No Public OOB\n"); printf("PTS does not supports Public OOB, select No Public OOB\n");
} }
auth_static_oob = mesh_pb_prov_capabilities_event_get_static_oob_type(packet); auth_static_oob = mesh_subevent_pb_prov_capabilities_get_static_oob_type(packet);
auth_input_oob_action = mesh_pb_prov_capabilities_event_get_input_oob_action(packet); auth_input_oob_action = mesh_subevent_pb_prov_capabilities_get_input_oob_action(packet);
auth_output_oob_action = mesh_pb_prov_capabilities_event_get_output_oob_action(packet); auth_output_oob_action = mesh_subevent_pb_prov_capabilities_get_output_oob_action(packet);
if (auth_output_oob_action){ if (auth_output_oob_action){
auth_method = 0x02; // Output OOB auth_method = 0x02; // Output OOB
// find output action // find output action
@ -182,7 +182,7 @@ static void mesh_message_handler (uint8_t packet_type, uint16_t channel, uint8_t
for (i=0;i<5;i++){ for (i=0;i<5;i++){
if (auth_output_oob_action & (1<<i)){ if (auth_output_oob_action & (1<<i)){
auth_action = i; auth_action = i;
auth_size = mesh_pb_prov_capabilities_event_get_output_oob_size(packet); auth_size = mesh_subevent_pb_prov_capabilities_get_output_oob_size(packet);
printf("// - Pick Output OOB Action with index %u, size %u\n", i, auth_size); printf("// - Pick Output OOB Action with index %u, size %u\n", i, auth_size);
break; break;
} }
@ -194,7 +194,7 @@ static void mesh_message_handler (uint8_t packet_type, uint16_t channel, uint8_t
for (i=0;i<5;i++){ for (i=0;i<5;i++){
if (auth_input_oob_action & (1<<i)){ if (auth_input_oob_action & (1<<i)){
auth_action = i; auth_action = i;
auth_size = mesh_pb_prov_capabilities_event_get_input_oob_size(packet); auth_size = mesh_subevent_pb_prov_capabilities_get_input_oob_size(packet);
printf("// - Pick Input OOB Action with index %u, size %u\n", i, auth_size); printf("// - Pick Input OOB Action with index %u, size %u\n", i, auth_size);
break; break;
} }
@ -209,20 +209,20 @@ static void mesh_message_handler (uint8_t packet_type, uint16_t channel, uint8_t
} }
provisioning_provisioner_select_authentication_method(1, 0, public_oob, auth_method, auth_action, auth_size); provisioning_provisioner_select_authentication_method(1, 0, public_oob, auth_method, auth_action, auth_size);
break; break;
case MESH_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB: case MESH_SUBEVENT_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB:
printf("Simulate Read Public Key OOB\n"); printf("Simulate Read Public Key OOB\n");
btstack_parse_hex(prov_public_key_string, 64, prov_public_key_data); btstack_parse_hex(prov_public_key_string, 64, prov_public_key_data);
provisioning_provisioner_public_key_oob_received(pb_adv_cid, prov_public_key_data); provisioning_provisioner_public_key_oob_received(pb_adv_cid, prov_public_key_data);
break; break;
case MESH_PB_PROV_OUTPUT_OOB_REQUEST: case MESH_SUBEVENT_PB_PROV_OUTPUT_OOB_REQUEST:
printf("Enter passphrase: "); printf("Enter passphrase: ");
fflush(stdout); fflush(stdout);
ui_chars_for_pin = 1; ui_chars_for_pin = 1;
ui_pin_offset = 0; ui_pin_offset = 0;
break; break;
case MESH_PB_PROV_START_EMIT_INPUT_OOB: case MESH_SUBEVENT_PB_PROV_START_EMIT_INPUT_OOB:
break; break;
case MESH_PB_PROV_COMPLETE: case MESH_SUBEVENT_PB_PROV_COMPLETE:
printf("Provisioning complete\n"); printf("Provisioning complete\n");
break; break;
default: default:

View File

@ -182,7 +182,7 @@ static void provisioning_emit_event(uint16_t pb_adv_cid, uint8_t mesh_subevent){
static void provisioning_emit_output_oob_event(uint16_t pb_adv_cid, uint32_t number){ static void provisioning_emit_output_oob_event(uint16_t pb_adv_cid, uint32_t number){
if (!prov_packet_handler) return; if (!prov_packet_handler) return;
uint8_t event[9] = { HCI_EVENT_MESH_META, 7, MESH_PB_PROV_START_EMIT_OUTPUT_OOB}; uint8_t event[9] = { HCI_EVENT_MESH_META, 7, MESH_SUBEVENT_PB_PROV_START_EMIT_OUTPUT_OOB};
little_endian_store_16(event, 3, pb_adv_cid); little_endian_store_16(event, 3, pb_adv_cid);
little_endian_store_16(event, 5, number); little_endian_store_16(event, 5, number);
prov_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); prov_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
@ -190,7 +190,7 @@ static void provisioning_emit_output_oob_event(uint16_t pb_adv_cid, uint32_t num
static void provisioning_emit_attention_timer_event(uint16_t pb_adv_cid, uint8_t timer_s){ static void provisioning_emit_attention_timer_event(uint16_t pb_adv_cid, uint8_t timer_s){
if (!prov_packet_handler) return; if (!prov_packet_handler) return;
uint8_t event[4] = { HCI_EVENT_MESH_META, 7, MESH_PB_PROV_ATTENTION_TIMER}; uint8_t event[4] = { HCI_EVENT_MESH_META, 7, MESH_SUBEVENT_PB_PROV_ATTENTION_TIMER};
event[3] = timer_s; event[3] = timer_s;
prov_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); prov_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
@ -322,11 +322,11 @@ static void provisioning_send_complete(void){
static void provisioning_done(void){ static void provisioning_done(void){
if (prov_emit_public_key_oob_active){ if (prov_emit_public_key_oob_active){
prov_emit_public_key_oob_active = 0; prov_emit_public_key_oob_active = 0;
provisioning_emit_event(1, MESH_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB); provisioning_emit_event(1, MESH_SUBEVENT_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB);
} }
if (prov_emit_output_oob_active){ if (prov_emit_output_oob_active){
prov_emit_output_oob_active = 0; prov_emit_output_oob_active = 0;
provisioning_emit_event(1, MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB); provisioning_emit_event(1, MESH_SUBEVENT_PB_PROV_STOP_EMIT_OUTPUT_OOB);
} }
if (prov_attention_timer_timeout){ if (prov_attention_timer_timeout){
prov_attention_timer_timeout = 0; prov_attention_timer_timeout = 0;
@ -373,7 +373,7 @@ static void provisioning_public_key_exchange_complete(void){
case 0x03: case 0x03:
// Input OOB // Input OOB
printf("Input OOB requested\n"); printf("Input OOB requested\n");
provisioning_emit_event(1, MESH_PB_PROV_INPUT_OOB_REQUEST); provisioning_emit_event(1, MESH_SUBEVENT_PB_PROV_INPUT_OOB_REQUEST);
device_state = DEVICE_W4_INPUT_OOK; device_state = DEVICE_W4_INPUT_OOK;
break; break;
default: default:
@ -506,7 +506,7 @@ static void provisioning_handle_start(uint8_t * packet, uint16_t size){
// start emit public OOK if specified // start emit public OOK if specified
if (prov_public_key_oob_available && prov_public_key_oob_used){ if (prov_public_key_oob_available && prov_public_key_oob_used){
provisioning_emit_event(1, MESH_PB_PROV_START_EMIT_PUBLIC_KEY_OOB); provisioning_emit_event(1, MESH_SUBEVENT_PB_PROV_START_EMIT_PUBLIC_KEY_OOB);
} }
printf("PublicKey: %02x\n", prov_public_key_oob_used); printf("PublicKey: %02x\n", prov_public_key_oob_used);
@ -546,7 +546,7 @@ static void provisioning_handle_public_key(uint8_t *packet, uint16_t size){
// stop emit public OOK if specified and send to crypto module // stop emit public OOK if specified and send to crypto module
if (prov_public_key_oob_available && prov_public_key_oob_used){ if (prov_public_key_oob_available && prov_public_key_oob_used){
provisioning_emit_event(1, MESH_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB); provisioning_emit_event(1, MESH_SUBEVENT_PB_PROV_STOP_EMIT_PUBLIC_KEY_OOB);
printf("Replace generated ECC with Public Key OOB:"); printf("Replace generated ECC with Public Key OOB:");
memcpy(prov_ec_q, prov_public_key_oob_q, 64); memcpy(prov_ec_q, prov_public_key_oob_q, 64);
@ -614,7 +614,7 @@ static void provisioning_handle_confirmation(uint8_t *packet, uint16_t size){
// //
if (prov_emit_output_oob_active){ if (prov_emit_output_oob_active){
prov_emit_output_oob_active = 0; prov_emit_output_oob_active = 0;
provisioning_emit_event(1, MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB); provisioning_emit_event(1, MESH_SUBEVENT_PB_PROV_STOP_EMIT_OUTPUT_OOB);
} }
// CalculationInputs // CalculationInputs
@ -684,7 +684,7 @@ static void provisioning_handle_network_dervived(void * arg){
provisioning_timer_stop(); provisioning_timer_stop();
// notify client // notify client
provisioning_emit_event(1, MESH_PB_PROV_COMPLETE); provisioning_emit_event(1, MESH_SUBEVENT_PB_PROV_COMPLETE);
device_state = DEVICE_SEND_COMPLETE; device_state = DEVICE_SEND_COMPLETE;
provisioning_run(); provisioning_run();
@ -741,17 +741,17 @@ static void provisioning_handle_pdu(uint8_t packet_type, uint16_t channel, uint8
case HCI_EVENT_PACKET: case HCI_EVENT_PACKET:
if (packet[0] != HCI_EVENT_MESH_META) break; if (packet[0] != HCI_EVENT_MESH_META) break;
switch (packet[2]){ switch (packet[2]){
case MESH_PB_TRANSPORT_LINK_OPEN: case MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN:
pb_transport_cid = mesh_pb_transport_link_open_event_get_pb_transport_cid(packet); pb_transport_cid = mesh_subevent_pb_transport_link_open_get_pb_transport_cid(packet);
pb_type = mesh_pb_transport_link_open_event_get_pb_type(packet); pb_type = mesh_subevent_pb_transport_link_open_get_pb_type(packet);
printf("Link opened, reset state, transport cid 0x%02x, PB type %d\n", pb_transport_cid, pb_type); printf("Link opened, reset state, transport cid 0x%02x, PB type %d\n", pb_transport_cid, pb_type);
provisioning_done(); provisioning_done();
break; break;
case MESH_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;
break; break;
case MESH_PB_TRANSPORT_LINK_CLOSED: case MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED:
printf("Link close, reset state\n"); printf("Link close, reset state\n");
pb_transport_cid = MESH_PB_TRANSPORT_INVALID_CID; pb_transport_cid = MESH_PB_TRANSPORT_INVALID_CID;
provisioning_done(); provisioning_done();

View File

@ -152,7 +152,7 @@ static void send_prov_pdu(const uint8_t * packet, uint16_t size){
} }
static void pb_adv_emit_pdu_sent(uint8_t status){ static void pb_adv_emit_pdu_sent(uint8_t status){
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status}; uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_SUBEVENT_PB_TRANSPORT_PDU_SENT, status};
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }

View File

@ -142,7 +142,7 @@ static void provisioning_attention_timer_set(void){
static void provisioning_emit_output_oob_event(uint16_t pb_adv_cid, uint32_t number){ static void provisioning_emit_output_oob_event(uint16_t pb_adv_cid, uint32_t number){
if (!prov_packet_handler) return; if (!prov_packet_handler) return;
uint8_t event[9] = { HCI_EVENT_MESH_META, 7, MESH_PB_PROV_START_EMIT_OUTPUT_OOB}; uint8_t event[9] = { HCI_EVENT_MESH_META, 7, MESH_SUBEVENT_PB_PROV_START_EMIT_OUTPUT_OOB};
little_endian_store_16(event, 3, pb_adv_cid); little_endian_store_16(event, 3, pb_adv_cid);
little_endian_store_16(event, 5, number); little_endian_store_16(event, 5, number);
prov_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); prov_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
@ -276,7 +276,7 @@ static void provisioning_run(void){
case PROVISIONED_W2_EMIT_READ_PUB_KEY_OOB: case PROVISIONED_W2_EMIT_READ_PUB_KEY_OOB:
printf("Public OOB: please read OOB from remote device\n"); printf("Public OOB: please read OOB from remote device\n");
provisioner_state = PROVISIONER_W4_PUB_KEY_OOB; provisioner_state = PROVISIONER_W4_PUB_KEY_OOB;
provisioning_emit_event(MESH_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB, 1); provisioning_emit_event(MESH_SUBEVENT_PB_PROV_START_RECEIVE_PUBLIC_KEY_OOB, 1);
break; break;
case PROVISIONER_SEND_PUB_KEY: case PROVISIONER_SEND_PUB_KEY:
provisioning_send_public_key(); provisioning_send_public_key();
@ -316,7 +316,7 @@ static void provisioning_done(void){
// } // }
if (prov_emit_output_oob_active){ if (prov_emit_output_oob_active){
prov_emit_output_oob_active = 0; prov_emit_output_oob_active = 0;
provisioning_emit_event(MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB, 1); provisioning_emit_event(MESH_SUBEVENT_PB_PROV_STOP_EMIT_OUTPUT_OOB, 1);
} }
provisioner_state = PROVISIONER_IDLE; provisioner_state = PROVISIONER_IDLE;
} }
@ -343,7 +343,7 @@ static void provisioning_handle_capabilities(uint16_t pb_adv_cid, const uint8_t
provisioner_state = PROVISIONER_W4_AUTH_CONFIGURATION; provisioner_state = PROVISIONER_W4_AUTH_CONFIGURATION;
// notify client and wait for auth method selection // notify client and wait for auth method selection
uint8_t event[16] = { HCI_EVENT_MESH_META, 3, MESH_PB_PROV_CAPABILITIES}; uint8_t event[16] = { HCI_EVENT_MESH_META, 3, MESH_SUBEVENT_PB_PROV_CAPABILITIES};
little_endian_store_16(event, 3, pb_adv_cid); little_endian_store_16(event, 3, pb_adv_cid);
event[5] = packet_data[0]; event[5] = packet_data[0];
little_endian_store_16(event, 6, big_endian_read_16(packet_data, 1)); little_endian_store_16(event, 6, big_endian_read_16(packet_data, 1));
@ -450,7 +450,7 @@ static void provisioning_public_key_exchange_complete(void){
prov_authentication_string = prov_start_authentication_action == 0x04; prov_authentication_string = prov_start_authentication_action == 0x04;
printf("Output OOB requested (and we're in Provisioniner role), string %u\n", prov_authentication_string); printf("Output OOB requested (and we're in Provisioniner role), string %u\n", prov_authentication_string);
provisioner_state = PROVISIONER_W4_INPUT_OOK; provisioner_state = PROVISIONER_W4_INPUT_OOK;
provisioning_emit_event(MESH_PB_PROV_OUTPUT_OOB_REQUEST, 1); provisioning_emit_event(MESH_SUBEVENT_PB_PROV_OUTPUT_OOB_REQUEST, 1);
break; break;
case 0x03: case 0x03:
// Input OOB // Input OOB
@ -459,7 +459,7 @@ static void provisioning_public_key_exchange_complete(void){
printf("Generate random for auth_value\n"); printf("Generate random for auth_value\n");
// generate single byte of random data to use for authentication // generate single byte of random data to use for authentication
btstack_crypto_random_generate(&prov_random_request, &auth_value[15], 1, &provisioning_handle_auth_value_input_oob, NULL); btstack_crypto_random_generate(&prov_random_request, &auth_value[15], 1, &provisioning_handle_auth_value_input_oob, NULL);
provisioning_emit_event(MESH_PB_PROV_START_EMIT_INPUT_OOB, 1); provisioning_emit_event(MESH_SUBEVENT_PB_PROV_START_EMIT_INPUT_OOB, 1);
break; break;
default: default:
break; break;
@ -532,7 +532,7 @@ static void provisioning_handle_confirmation(uint16_t pb_adv_cid, const uint8_t
// //
if (prov_emit_output_oob_active){ if (prov_emit_output_oob_active){
prov_emit_output_oob_active = 0; prov_emit_output_oob_active = 0;
provisioning_emit_event(MESH_PB_PROV_STOP_EMIT_OUTPUT_OOB, 1); provisioning_emit_event(MESH_SUBEVENT_PB_PROV_STOP_EMIT_OUTPUT_OOB, 1);
} }
#if 0 #if 0
@ -633,15 +633,15 @@ static void provisioning_handle_pdu(uint8_t packet_type, uint16_t channel, uint8
case HCI_EVENT_PACKET: case HCI_EVENT_PACKET:
if (packet[0] != HCI_EVENT_MESH_META) break; if (packet[0] != HCI_EVENT_MESH_META) break;
switch (packet[2]){ switch (packet[2]){
case MESH_PB_TRANSPORT_LINK_OPEN: case MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN:
printf("Link opened, sending Invite\n"); printf("Link opened, sending Invite\n");
provisioning_handle_link_opened(pb_adv_cid); provisioning_handle_link_opened(pb_adv_cid);
break; break;
case MESH_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;
break; break;
case MESH_PB_TRANSPORT_LINK_CLOSED: case MESH_SUBEVENT_PB_TRANSPORT_LINK_CLOSED:
printf("Link close, reset state\n"); printf("Link close, reset state\n");
provisioning_done(); provisioning_done();
break; break;

View File

@ -100,14 +100,14 @@ static uint8_t * pdu_data;
static uint16_t pdu_size; static uint16_t pdu_size;
static void pb_adv_emit_link_open(uint8_t status, uint16_t pb_adv_cid){ static void pb_adv_emit_link_open(uint8_t status, uint16_t pb_adv_cid){
uint8_t event[7] = { HCI_EVENT_MESH_META, 5, MESH_PB_TRANSPORT_LINK_OPEN, status}; uint8_t event[7] = { HCI_EVENT_MESH_META, 5, MESH_SUBEVENT_PB_TRANSPORT_LINK_OPEN, status};
little_endian_store_16(event, 4, pb_adv_cid); little_endian_store_16(event, 4, pb_adv_cid);
event[6] = PB_TYPE_ADV; event[6] = PB_TYPE_ADV;
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
static void pb_adv_emit_pdu_sent(uint8_t status){ static void pb_adv_emit_pdu_sent(uint8_t status){
uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_PB_TRANSPORT_PDU_SENT, status}; uint8_t event[] = { HCI_EVENT_MESH_META, 2, MESH_SUBEVENT_PB_TRANSPORT_PDU_SENT, status};
pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event)); pb_adv_packet_handler(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
@ -189,7 +189,7 @@ static void provisioning_handle_pdu(uint8_t packet_type, uint16_t channel, uint8
switch(packet[0]){ switch(packet[0]){
case HCI_EVENT_MESH_META: case HCI_EVENT_MESH_META:
switch(packet[2]){ switch(packet[2]){
case MESH_PB_PROV_CAPABILITIES: case MESH_SUBEVENT_PB_PROV_CAPABILITIES:
printf("Provisioner capabilities\n"); printf("Provisioner capabilities\n");
provisioning_provisioner_select_authentication_method(1, 0, 0, 0, 0, 0); provisioning_provisioner_select_authentication_method(1, 0, 0, 0, 0, 0);
break; break;