44 #include "serial_cmd_rsp.h" 45 #include "nrf_mesh_serial.h" 46 #include "serial_types.h" 47 #include "internal_event.h" 56 #define SERIAL_OPCODE_EVT_CMD_RSP (0x84) 58 #define SERIAL_OPCODE_EVT_DEVICE_STARTED (0x81) 59 #define SERIAL_OPCODE_EVT_DEVICE_ECHO_RSP (0x82) 60 #define SERIAL_OPCODE_EVT_DEVICE_INTERNAL_EVENT (0x83) 62 #define SERIAL_OPCODE_EVT_APPLICATION (0x8A) 64 #define SERIAL_OPCODE_EVT_SAR_START (0x8B) 65 #define SERIAL_OPCODE_EVT_SAR_CONTINUE (0x8C) 67 #define SERIAL_OPCODE_EVT_DFU_REQ_RELAY (0xA0) 68 #define SERIAL_OPCODE_EVT_DFU_REQ_SOURCE (0xA1) 69 #define SERIAL_OPCODE_EVT_DFU_START (0xA2) 70 #define SERIAL_OPCODE_EVT_DFU_END (0xA3) 71 #define SERIAL_OPCODE_EVT_DFU_BANK_AVAILABLE (0xA4) 72 #define SERIAL_OPCODE_EVT_DFU_FIRMWARE_OUTDATED (0xA5) 73 #define SERIAL_OPCODE_EVT_DFU_FIRMWARE_OUTDATED_NO_AUTH (0xA6) 75 #define SERIAL_OPCODE_EVT_OPENMESH_NEW (0xB3) 76 #define SERIAL_OPCODE_EVT_OPENMESH_UPDATE (0xB4) 77 #define SERIAL_OPCODE_EVT_OPENMESH_CONFLICTING (0xB5) 78 #define SERIAL_OPCODE_EVT_OPENMESH_TX (0xB6) 80 #define SERIAL_OPCODE_EVT_PROV_UNPROVISIONED_RECEIVED (0xC0) 81 #define SERIAL_OPCODE_EVT_PROV_LINK_ESTABLISHED (0xC1) 82 #define SERIAL_OPCODE_EVT_PROV_LINK_CLOSED (0xC2) 83 #define SERIAL_OPCODE_EVT_PROV_CAPS_RECEIVED (0xC3) 84 #define SERIAL_OPCODE_EVT_PROV_INVITE_RECEIVED (0xC4) 85 #define SERIAL_OPCODE_EVT_PROV_COMPLETE (0xC5) 86 #define SERIAL_OPCODE_EVT_PROV_AUTH_REQUEST (0xC6) 87 #define SERIAL_OPCODE_EVT_PROV_ECDH_REQUEST (0xC7) 88 #define SERIAL_OPCODE_EVT_PROV_OUTPUT_REQUEST (0xC8) 89 #define SERIAL_OPCODE_EVT_PROV_FAILED (0xC9) 90 #define SERIAL_OPCODE_EVT_PROV_START_RECEIVED (0xCA) 92 #define SERIAL_OPCODE_EVT_MESH_MESSAGE_RECEIVED_UNICAST (0xD0) 93 #define SERIAL_OPCODE_EVT_MESH_MESSAGE_RECEIVED_SUBSCRIPTION (0xD1) 94 #define SERIAL_OPCODE_EVT_MESH_TX_COMPLETE (0xD2) 95 #define SERIAL_OPCODE_EVT_MESH_IV_UPDATE_NOTIFICATION (0xD3) 96 #define SERIAL_OPCODE_EVT_MESH_KEY_REFRESH_NOTIFICATION (0xD4) 97 #define SERIAL_OPCODE_EVT_MESH_SAR_FAILED (0xD7) 98 #define SERIAL_OPCODE_EVT_MESH_HEARTBEAT_RECEIVED (0xD8) 99 #define SERIAL_OPCODE_EVT_MESH_IV_ENTRY_SET_NOTIFICATION (0xD9) 100 #define SERIAL_OPCODE_EVT_MESH_SEQNUM_ENTRY_SET_NOTIFICATION (0xDA) 102 #define SERIAL_OPCODE_EVT_MODEL_SPECIFIC (0xF0) 108 typedef struct __attribute((packed))
116 typedef struct __attribute((packed))
122 typedef struct __attribute((packed))
127 uint8_t packet[BLE_ADV_PACKET_PAYLOAD_MAX_LENGTH];
131 typedef union __attribute((packed))
139 typedef struct __attribute((packed))
145 uint8_t adv_addr[BLE_GAP_ADDR_LEN];
149 typedef struct __attribute((packed))
155 typedef struct __attribute((packed))
162 typedef struct __attribute((packed))
178 typedef struct __attribute((packed))
185 typedef struct __attribute((packed))
191 typedef struct __attribute((packed))
204 typedef struct __attribute((packed))
213 typedef struct __attribute((packed))
221 typedef struct __attribute((packed))
229 typedef struct __attribute((packed))
235 typedef union __attribute((packed))
251 typedef struct __attribute((packed))
258 typedef struct __attribute((packed))
267 typedef struct __attribute((packed))
273 typedef struct __attribute((packed))
288 uint8_t adv_addr[BLE_GAP_ADDR_LEN];
299 typedef struct __attribute((packed))
305 typedef struct __attribute((packed))
311 typedef struct __attribute((packed))
318 typedef struct __attribute((packed))
330 typedef struct __attribute((packed))
340 typedef struct __attribute((packed))
347 typedef union __attribute((packed))
361 typedef struct __attribute((packed))
369 typedef struct __attribute((packed))
375 typedef struct __attribute((packed))
383 typedef struct __attribute((packed))
392 typedef struct __attribute((packed))
402 typedef struct __attribute((packed))
410 typedef union __attribute((packed))
421 typedef union __attribute((packed))
uint8_t gatt_supported
Whether the unprovisioned device supports GATT provisioning.
uint32_t iv_index
The current IV index.
Union of all serial event parameters.
Application data event parameters.
Provisioning invite event.
serial_evt_mesh_iv_update_t iv_update
IV update parameters.
uint8_t iv_update_flag
IV update in progress flag.
serial_evt_device_internal_event_t internal_event
Internal event data.
serial_evt_mesh_tx_complete_t tx_complete
TX complete parameters.
uint8_t dfu_type
DFU type of the transfer.
uint8_t role
The device's role in the transfer.
uint16_t input_oob_actions
Available OOB input actions.
int8_t rssi
RSSI value of the message when received.
uint16_t net_key_index
Network key index.
#define SERIAL_EVT_MESH_MESSAGE_RECEIVED_DATA_MAXLEN
Message received event data max length.
serial_evt_dfu_bank_t bank
DFU bank available parameters.
serial_evt_prov_invite_received_t invite_received
Invite received event params.
#define NRF_MESH_KEY_SIZE
Size (in octets) of an encryption key.
uint8_t static_oob_types
The available static OOB authentication methods.
uint16_t iv_update_timout_counter
Counter for the IV update process.
int8_t rssi
RSSI of the received unprovisioned beacon.
uint16_t actual_length
Length of the received message, may be larger than the data reported if SERIAL_EVT_MESH_MESSAGE_RECEI...
uint8_t adv_addr_type
Advertisement address type of the last hop sender.
DFU firmware outdated event parameters.
#define NRF_MESH_UUID_SIZE
Size (in octets) of a UUID.
uint8_t init_ttl
Initial TTL value used for sending this heartbeat message.
serial_evt_device_started_t started
Device started parameters.
uint8_t context_id
Context ID of the provisioning link.
Provisioning link established event.
nrf_mesh_fwid_t fwid
Firmware ID of the transfer.
DFU bank available event parameters.
Mesh heartbeat event parameters.
uint8_t context_id
Context ID of the closed link.
serial_evt_cmd_rsp_t cmd_rsp
Command response parameters.
uint8_t adv_addr_type
The advertisement address type of the sender of the unprovisioned beacon.
nrf_mesh_fwid_t available_fwid
Firmware ID of the newest firmware available.
Mesh key refresh event parameters.
uint8_t context_id
Context ID of the provisioning link.
Provisioning event parameters.
uint8_t hops
Number of hops equals: (Initial TTL - Received message TTL + 1).
#define NRF_MESH_ECDH_PUBLIC_KEY_SIZE
Size of an ECDH public key.
uint32_t next_block
The next unallocated sequence number block.
Event generated by one of the initialized models.
uint16_t dst
Destination unicast address or subscription handle.
serial_evt_dfu_t dfu
DFU parameters.
nrf_mesh_tx_token_t token
TX token for the completed packet.
serial_evt_prov_output_request_t output_request
Output request event parameters.
serial_evt_mesh_iv_entry_set_notification_t iv_entry_set
IV index mesh config entry set parameters.
uint8_t phase
Current key refresh phase for the network key being updated.
uint8_t dfu_type
DFU type of the transfer.
serial_evt_prov_caps_received_t caps_received
Capabilities received parameters.
uint8_t is_signed
Whether the bank is signed or not.
Device started event packet.
uint16_t src
Source address for the received heartbeat message.
DFU start event parameters.
uint8_t dfu_type
DFU type of the transfer.
serial_evt_device_echo_t echo
Echo parameters.
uint8_t role
The device's role in the transfer.
serial_evt_prov_t prov
Provisioning parameters.
Mesh IV update event parameters.
uint8_t size
Authentication size.
serial_evt_model_specific_t model
Event generated by one of the models.
uint8_t key_refresh_flag
Key refresh in progress flag.
Unprovisioned beacon received.
uint16_t appkey_handle
Handle of the application the message was received on.
uint8_t dfu_type
DFU type of the transfer.
serial_evt_mesh_seqnum_entry_set_notification_t seqnum_entry_set
Seqnum block mesh config entry set parameters.
Provisioning start event.
uint8_t context_id
Context ID of the completed provisioning link.
uint8_t public_key_type
The public key type used for the provisioning session.
serial_evt_model_specific_header_t model_evt_info
Contains the model id the event generates from and the model specific event type. ...
serial_evt_dfu_req_source_t req_source
DFU source request parameters.
uint16_t features
State bitmap of the feature.
uint8_t action
Authentication action.
uint32_t iv_index
IV index for the network.
uint8_t context_id
Context ID of the link the ECDH request appeared on.
Provisioning authentication data request event packet.
serial_evt_mesh_t mesh
Mesh parameters.
uint16_t netkey_index
Network key index of the network key being updated.
uint8_t error_code
Provisioning error code.
uint8_t authority
Authority level of the transfer.
uint8_t method
Method of authentication requested.
uint8_t context_id
Context ID of the link the output request appeared on.
uint8_t input_oob_size
Maximum size of the input OOB supported.
serial_evt_prov_auth_request_t auth_request
Authorization request event parameters.
uint8_t packet_size
Size (in bytes) of the packet.
serial_evt_prov_start_received_t start_received
Start received event params.
Provisioning link closed event.
serial_evt_prov_ecdh_request_t ecdh_request
ECDH request event parameters.
serial_evt_dfu_req_relay_t req_relay
DFU relay request parameters.
nrf_mesh_fwid_t fwid
Firmware ID of the transfer.
uint8_t output_oob_size
Maximum size of the output OOB supported.
Provisioning capabilities received event.
uint8_t dfu_type
DFU type of the transfer.
uint32_t nrf_mesh_tx_token_t
TX Token type, used as a context parameter to notify the application of ended transmissions.
uint16_t src
Source address of the received packet.
serial_evt_dfu_start_t start
DFU start parameters.
DFU end event parameters.
#define NRF_MESH_ECDH_PRIVATE_KEY_SIZE
Size of an ECDH private key.
uint8_t num_elements
The number of elements on the unprovisoined device.
uint8_t data_credit_available
The number of bytes available in each of the tx and rx buffers.
uint8_t ttl
Packet time to live value when first received.
DFU relay request event parameters.
uint8_t end_reason
Reason for ending the transfer.
uint16_t output_oob_actions
Available OOB output actions.
uint8_t iv_update_in_progress
Indicating the phase in the IV update process.
serial_evt_application_t application
Application parameters.
uint8_t close_reason
Reason for closing the link.
uint8_t dfu_type
DFU type of the transfer.
Union of all serial event parameters.
serial_evt_dfu_firmware_outdated_t firmware_outdated
Firmware outdated parameters.
uint8_t event_type
Reported event.
uint8_t context_id
Context ID of the link the authorization request appeared on.
serial_evt_dfu_end_t end
DFU end parameters.
Provisioning complete event packet.
uint32_t length
Length of the banked firmware.
uint8_t context_id
Context ID of the link the capabilities were received on.
serial_evt_mesh_hb_message_t heartbeat
Heartbeat message parameters.
serial_evt_prov_unprov_t unprov
Unprovisioned event parameters.
nrf_mesh_fwid_t current_fwid
Firmware ID of the current version of the outdated firmware.
nrf_mesh_fwid_t fwid
Firmware ID of the transfer.
Mesh message received event parameters.
uint32_t start_addr
Start address of the bank.
uint32_t iv_index
IV index updated to.
uint8_t state
State information about the event type reported.
serial_evt_mesh_key_refresh_t key_refresh
Key refresh parameters.
uint8_t context_id
Context ID of the link the error happened on.
serial_evt_prov_link_closed_t link_closed
Link closed event parameters.
uint8_t output_action
Output action requested.
ID of a standalone firmware segment.
uint8_t hw_error
Hardware error code, or 0 if no error occurred.
DFU source request event parameters.
Provisioning failed packet.
serial_evt_prov_failed_t failed
Provisioning failed event parameters.
uint8_t context_id
Context ID of the established link.
nrf_mesh_fwid_t fwid
Firmware ID of the requested transfer.
uint8_t operating_mode
Operating mode of the device.
serial_evt_mesh_message_received_t message_received
Message received parameters.
uint16_t subnet_handle
Handle of the subnetwork the message was received on.
uint16_t address
Unicast address for the device.
serial_evt_device_t device
Device parameters.
serial_evt_prov_link_established_t link_established
Link established event parameters.
serial_evt_prov_complete_t complete
Provisioning complete event parameters.
uint8_t attention_duration_s
Time in seconds during which the device will identify itself using any means it can.
#define NRF_MESH_SERIAL_PAYLOAD_MAXLEN
Maximum length of a serial packet's payload.