blob: 30590afd44c031196a87ebe673ec3e19c6ef1b71 [file] [log] [blame]
/**
* @addtogroup BLE_COMMON
* @{
* @defgroup BLE_COMMON_MSC Message Sequence Charts
* @{
*
* @defgroup BLE_COMMON_ENABLE BLE Stack Enable
* @{
* @msc
* hscale = "1.5";
* APP,SD;
* |||;
* APP=>SD [label = "sd_softdevice_enable(clock, assertion_handler);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox APP [label="Set app_ram_base to SoftDevice default from release notes"];
* |||;
* --- [label = "Configure the BLE stack"];
* |||;
* APP=>SD [label = "sd_ble_cfg_set(cfg_id, cfg, app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* ...;
* APP=>SD [label = "sd_ble_cfg_set(cfg_id, cfg, app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = "During development: Determine the region of memory required by the SoftDevice"];
* --- [label = "Alternative 1: The default app_ram_base is too small for the configuration"];
* |||;
* APP=>SD [label = "sd_ble_enable(&app_ram_base);"];
* APP<<SD [label = "NRF_ERROR_NO_MEM"];
* APP rbox APP [label="app_ram_base filled by the SoftDevice with 0x2000xxxx"];
* |||;
* APP abox APP [label="App sets 0x2000xxxx as its RAM starting point and rebuilds", textbgcolor="#7fff7f"];
* |||;
* --- [label = "Alternative 2: The default app_ram_base is large enough for the configuration but
* the app wants to save RAM"];
* |||;
* APP=>SD [label = "sd_ble_enable(&app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP rbox APP [label="app_ram_base filled by the SoftDevice with 0x2000yyyy"];
* |||;
* APP abox APP [label="App sets 0x2000yyyy as its RAM starting point and rebuilds", textbgcolor="#7fff7f"];
* |||;
* --- [label = "Alternative 3: The default app_ram_base is large enough for the configuration, app
* does not need to save RAM"];
* |||;
* APP=>SD [label = "sd_ble_enable(&app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP rbox APP [label="The app doesn't care about the value filled into app_ram_base"];
* |||;
* --- [label = "After development: The normal BLE Stack Enable sequence"];
* APP=>SD [label = "sd_softdevice_enable(clock, assertion_handler);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox APP [label="Set app_ram_base to value determined during development"];
* |||;
* --- [label = "Configure the BLE stack"];
* |||;
* APP=>SD [label = "sd_ble_cfg_set(cfg_id, cfg, app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* ...;
* APP=>SD [label = "sd_ble_cfg_set(cfg_id, cfg, app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = "Enable the BLE stack"];
* |||;
* APP=>SD [label = "sd_ble_enable(&app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* @endmsc
* @}
*
* @defgroup BLE_CONN_CFG Connection Configuration
* @{
* @msc
* hscale = "1.5";
* APP,SD;
* |||;
* APP=>SD [label = "sd_softdevice_enable(clock, assertion_handler);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = "Configure the connection configurations"];
* |||;
* APP rbox APP [label=" Configure GAP connection configuration"];
* APP=>SD [label = "sd_ble_cfg_set(BLE_CONN_CFG_GAP, cfg = {conn_cfg_tag = 1, gap_conn_cfg.conn_count = 1, app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox APP [label=" Configure GATT connection configuration"];
* APP=>SD [label = "sd_ble_cfg_set(BLE_CONN_CFG_GATT, cfg = {conn_cfg_tag = 1, gatt_conn_cfg, app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox APP [label=" Configure GATTC connection configuration"];
* APP=>SD [label = "sd_ble_cfg_set(BLE_CONN_CFG_GATTC, cfg = {conn_cfg_tag = 1, gattc_conn_cfg, app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox APP [label=" Configure GATTS connection configuration"];
* APP=>SD [label = "sd_ble_cfg_set(BLE_CONN_CFG_GATTS, cfg = {conn_cfg_tag = 1, gatts_conn_cfg, app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_enable(&app_ram_base);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = "Establish connection with different connection configurations"];
* |||;
* APP rbox APP [label="Establish connection with the default connection configuration"];
* APP=>SD [label = "sd_ble_gap_connect(params, conn_cfg_tag = BLE_CONN_CFG_TAG_DEFAULT);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox APP [label="Establish connection with connection configuration #1"];
* APP=>SD [label = "sd_ble_gap_adv_start(params, conn_cfg_tag = 1);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " No more connections can be established with connection configuration #1"];
* |||;
* APP note SD [label = "A connection cannot be established if the number of established connections is equal to the connection count of the connection configuration"];
* |||;
* APP=>SD [label = "sd_ble_gap_connect(params, conn_cfg_tag = 1);"];
* APP<<SD [label = "NRF_ERROR_CONN_COUNT"];
* @endmsc
* @}
* @defgroup BLE_COMMON_IRQ_EVT_MSC Interrupt-driven Event Retrieval
* @msc
* hscale = "1.5";
* APP,SD;
* |||;
* APP=>SD [label = "sd_softdevice_enable(clock, assertion_handler);"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_nvic_EnableIRQ(SD_EVT_IRQn)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox SD [label="Application runs and uses SD API"];
* |||;
* SD rbox SD [label="Event Available for the App"];
* |||;
* APP<-SD [label = "SD_EVT_IRQn", textcolor="#800080", linecolor="#800080"];
* APP=>APP [label = "SD_EVT_IRQHandler()"];
* APP=>SD [label = "sd_ble_evt_get(buffer);"];
* APP<<SD [label = "{NRF_SUCCESS, event}"];
* |||;
* @endmsc
*
* @defgroup BLE_COMMON_THREAD_EVT_MSC Thread Mode Event Retrieval
* @msc
* hscale = "1.5";
* APP,SD;
* |||;
* APP=>SD [label = "sd_softdevice_enable(clock, assertion_handler);"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_app_evt_wait(void);"];
* APP rbox APP [label="App Thread Mode blocked, CPU in low power mode"];
* |||;
* ...;
* |||;
* SD rbox SD [label="Event Available for the App"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_evt_get(buffer);"];
* APP<<SD [label = "{NRF_SUCCESS, event}"];
* APP=>SD [label = "sd_app_evt_wait(void);"];
* APP rbox APP [label="App Thread Mode blocked, CPU in low power mode"];
* |||;
* ...;
* |||;
* SD rbox SD [label="Event Available for the App"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_evt_get(buffer);"];
* APP<<SD [label = "{NRF_SUCCESS, event}"];
* APP=>SD [label = "sd_app_evt_wait(void);"];
* APP rbox APP [label="App Thread Mode blocked, CPU in low power mode"];
* |||;
* ...;
* |||;
* @endmsc
*
* @}
* @}
*/
/**
* @addtogroup BLE_GAP
* @{
* @defgroup BLE_GAP_MSC Message Sequence Charts
* @{
* @defgroup BLE_GAP_ADV_MSC Advertising
* @msc
* hscale = "1.5";
* APP,SD,SCANNERS;
* |||;
* APP=>SD [label = "sd_ble_gap_addr_set(peer_addr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gap_adv_data_set(adv, sr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gap_adv_start(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD->SCANNERS [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* SD->SCANNERS [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* SD->SCANNERS [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* ...;
* SD->SCANNERS [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #1 App Stops Advertisement "];
* APP=>SD [label = "sd_ble_gap_adv_stop()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " Variant #2 Advertisement Timeout "];
* APP<<=SD [label = "BLE_GAP_EVT_TIMEOUT"];
* @endmsc
*
* @defgroup BLE_GAP_CONN_MSC Peripheral Connection Establishment and Termination
* @msc
* hscale = "1.5";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Start Connectable Advertising"];
* |||;
* SD<:>CENTRAL [label = "Connection Establishment", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONNECTED"];
* |||;
* --- [label = " Variant #1 Local Disconnection "];
* APP=>SD [label = "sd_ble_gap_disconnect(reason)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "Connection Termination", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_DISCONNECTED {reason}"];
* |||;
* --- [label = " Variant #2 Remote Disconnection "];
* SD<:CENTRAL [label = "Connection Termination", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_DISCONNECTED {reason}"];
* @endmsc
*
* @defgroup BLE_GAP_CPU_MSC Peripheral Connection Parameter Update
* @msc
* hscale = "1.5";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established with conn. params. CP#1"];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update(CP#2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "L2CAP CPU Request", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #1 Central Accepts "];
* |||;
* SD<:CENTRAL [label = "L2CAP CPU Response: Accepted", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:CENTRAL [label = "Connection Update Start", textcolor="#000080", linecolor="#000080"];
* SD:>CENTRAL [label = "Connection Update Complete", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {CP#2}"];
* |||;
* --- [label = " Variant #2 Central Rejects "];
* |||;
* SD<:CENTRAL [label = "L2CAP CPU Response: Rejected", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {CP#1}"];
* --- [label = " Variant #3 Central Ignores "];
* |||;
* ...;
* |||;
* SD box SD [label="Timeout"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {CP#1}"];
* @endmsc
*
* @defgroup BLE_GAP_RSSI_FILT_MSC RSSI for connections with event filter
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* --- [label = " Variant #1: Trigger event when a new RSSI is available"];
* |||;
* APP=>SD [label = "sd_ble_gap_rssi_start(conn_handle, 0, 0)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD<-PEER [label = "RSSI Sample", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_RSSI_CHANGED {RSSI#1}"];
* |||;
* SD<-PEER [label = "RSSI Sample", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_RSSI_CHANGED {RSSI#2}"];
* |||;
* SD<-PEER [label = "RSSI Sample", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_RSSI_CHANGED {RSSI#3}"];
* |||;
* APP=>SD [label = "sd_ble_gap_rssi_stop()"];
* APP<<SD [label = "NRF_SUCCESS"];
* --- [label = " Variant #2: Only trigger event if RSSI changes by 5 dBm or more."];
* |||;
* APP=>SD [label = "sd_ble_gap_rssi_start(conn_handle, 0x05, 0x00)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD<-PEER [label = "RSSI Sample=0x00", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_RSSI_CHANGED {RSSI#1}"];
* |||;
* SD<-PEER [label = "RSSI Sample=0x04", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<-PEER [label = "RSSI Sample=0x03", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<-PEER [label = "RSSI Sample>=0x05", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_RSSI_CHANGED {RSSI#2}"];
* |||;
* APP=>SD [label = "sd_ble_gap_rssi_stop()"];
* APP<<SD [label = "NRF_SUCCESS"];
* --- [label = " Variant #3: Only trigger event if more than 3 RSSI samples have deviated from the last reported RSSI by 5 dBm or more."];
* |||;
* APP=>SD [label = "sd_ble_gap_rssi_start(conn_handle, 0x05, 0x03)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD<-PEER [label = "RSSI Sample=0x00", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_RSSI_CHANGED {RSSI#1}"];
* |||;
* SD<-PEER [label = "RSSI Sample=0x04", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<-PEER [label = "RSSI Sample=0x0A", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<-PEER [label = "RSSI Sample>=0x06", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<-PEER [label = "RSSI Sample>=0x09", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<-PEER [label = "RSSI Sample>=0x07", textcolor="#000080", linecolor="#000080"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_RSSI_CHANGED {RSSI#2}"];
* |||;
* APP=>SD [label = "sd_ble_gap_rssi_stop()"];
* APP<<SD [label = "NRF_SUCCESS"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_RSSI_READ_MSC RSSI get sample
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_rssi_get(conn_handle, p_rssi)"];
* APP<<SD [label = "NRF_ERROR_INVALID_STATE"];
* |||;
* APP=>SD [label = "sd_ble_gap_rssi_start(conn_handle, BLE_GAP_RSSI_THRESHOLD_INVALID, 0x00)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gap_rssi_get(conn_handle, p_rssi)"];
* APP<<SD [label = "NRF_ERROR_NOT_FOUND"];
* ...;
* ...;
* APP rbox PEER [label="Connection events"];
* ...;
* ...;
* |||;
* SD<-PEER [label = "RSSI Sample=0x03 [dBm]", textcolor="#000080", linecolor="#000080"];
* APP=>SD [label = "sd_ble_gap_rssi_get(conn_handle, p_rssi)"];
* APP<<SD [label = "NRF_SUCCESS, *p_rssi=0x03 [dBm]"];
* APP=>SD [label = "sd_ble_gap_rssi_stop()"];
* APP<<SD [label = "NRF_SUCCESS"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_SEC_MSC Peripheral Security Procedures
* @{
*
* @defgroup BLE_GAP_PERIPH_SEC_REQ_MSC Peripheral Security Request
* @msc
* hscale = "1.5";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Security Request", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #1 Central initiates Security Establishment "];
* |||;
* APP rbox CENTRAL [label="Encryption or Pairing/Bonding initiated by Central"];
* |||;
* --- [label = " Variant #2 Central ignores "];
* |||;
* ...;
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_TIMEOUT {error_src: BLE_GAP_TIMEOUT_SRC_SECURITY_REQUEST}"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_LEGACY_MSC Peripheral Legacy Pairing
* @{
*
* @defgroup BLE_GAP_PERIPH_PAIRING_JW_MSC Pairing: Just Works
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: no_bond, no_mitm, no_io_caps}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: no_bond, no_mitm, no_io_caps, p_keyset: NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* |||;
* SD abox CENTRAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_NO_MITM}"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_BONDING_JW_MSC Bonding: Just Works
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: bond, no_mitm, no_io_caps}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: bond, no_mitm, no_io_caps, p_keyset)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* |||;
* SD abox CENTRAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_NO_MITM}"];
* |||;
* SD abox CENTRAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_BONDING_PK_PERIPH_MSC Bonding: Passkey Entry, Peripheral displays
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: bond, mitm, keyboard}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: bond, mitm, display, p_keyset)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_PASSKEY_DISPLAY {passkey, match_request=0}"];
* APP rbox APP [label="Passkey displayed to the user"];
* |||;
* SD abox CENTRAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_MITM}"];
* |||;
* SD abox CENTRAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_BONDING_PK_CENTRAL_OOB_MSC Bonding: Passkey Entry, User Inputs on Peripheral or OOB
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: bond, mitm, display}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: bond, mitm, keyboard, p_keyset)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_KEY_REQUEST {type}"];
* APP rbox APP [label="User enters Passkey or data received Out Of Band"];
* APP=>SD [label = "sd_ble_gap_auth_key_reply(passkey or OOB)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD abox CENTRAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_MITM}"];
* |||;
* SD abox CENTRAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_BONDING_STATIC_PK_MSC Bonding: Passkey Entry with static passkey
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP=>SD [label = "sd_ble_opt_set(opt_id = BLE_GAP_OPT_PASSKEY, p_opt->p_passkey=passkey)"];
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: bond, mitm, keyboard}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: bond, mitm, display, p_keyset)"];
*
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_PASSKEY_DISPLAY {passkey, match_request=0}"];
* APP rbox APP [label="Passkey displayed to the user"];
* |||;
* SD abox CENTRAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_MITM}"];
* |||;
* SD abox CENTRAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_PAIRING_CONFIRM_FAIL_MSC Pairing failure: Confirm failed
* This occurs if the random value doesn't match, usually because the user entered a wrong pin
* or out of band data was missing.
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: mitm, display}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: mitm, keyboard, p_keyset: NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* SD<:CENTRAL [label = "SMP Pairing Confirm", textcolor="#000080", linecolor="#000080"];
* SD:>CENTRAL [label = "SMP Pairing Confirm", textcolor="#000080", linecolor="#000080"];
* SD<:CENTRAL [label = "SMP Pairing Random", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: Confirm value, error_src: local}"];
* SD:>CENTRAL [label = "SMP Pairing failed", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @}
*
* @defgroup BLE_GAP_PERIPH_LESC_MSC Peripheral LESC Pairing
* @{
*
* @defgroup BLE_GAP_PERIPH_LESC_PAIRING_JW_MSC Pairing: Just Works
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, no_bond, no_mitm, no_io_caps}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: lesc, no_bond, no_mitm, no_io_caps, p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk}"];
* SD:>CENTRAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* SD abox CENTRAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_NO_MITM}"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_LESC_BONDING_NC_MSC Bonding: Numeric Comparison
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, bond, mitm, display(kbd/yesno)}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: lesc, bond, mitm, display(kbd/yesno), keyset with p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk}"];
* SD:>CENTRAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* SD abox CENTRAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_PASSKEY_DISPLAY {passkey, match_request=1}"];
* APP rbox APP [label="Passkey displayed to the user, user compares values"];
* |||;
* --- [label = " Variant #1 User confirms on both sides "];
* APP=>SD [label = "sd_ble_gap_auth_key_reply(BLE_GAP_AUTH_KEY_TYPE_PASSKEY, NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {LESC_ENC_MITM}"];
* |||;
* SD abox CENTRAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* --- [label = " Variant #2 User does not confirm locally "];
* APP=>SD [label = "sd_ble_gap_auth_key_reply(BLE_GAP_AUTH_KEY_TYPE_NONE, NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: num comp failure, error_src: local}"];
* SD:>CENTRAL [label = "SMP Pairing failed", textcolor="#000080", linecolor="#000080"];
* --- [label = " Variant #3 User does not confirm remotely "];
* SD<:CENTRAL [label = "SMP Pairing failed", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: num comp failure, error_src: remote}"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_LESC_BONDING_PKE_PD_MSC Bonding: Passkey Entry, Peripheral Displays
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, bond, mitm, keyboard}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: lesc, bond, mitm, display, keyset with p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_PASSKEY_DISPLAY {passkey, match_request=0}"];
* APP rbox APP [label="Passkey displayed to the user"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk}"];
* SD:>CENTRAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* --- [label = " Optional keypresses from peer "];
* SD<:CENTRAL [label = "Keypress Notification", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_KEY_PRESSED {type}"];
* APP abox APP [label="App displays keypress"];
* SD<:CENTRAL [label = "Keypress Notification", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_KEY_PRESSED {type}"];
* APP abox APP [label="App displays keypress"];
* |||;
* --- [label = ""];
* SD abox CENTRAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {LESC_ENC_MITM}"];
* |||;
* SD abox CENTRAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_LESC_BONDING_PKE_CD_MSC Bonding: Passkey Entry, User Inputs on Peripheral
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, bond, mitm, display}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: lesc, bond, mitm, keyboard, keyset with p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_KEY_REQUEST {passkey}"];
* APP rbox APP [label="User enters Passkey"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk}"];
* SD:>CENTRAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* --- [label = " Optional keypresses sent to peer "];
* APP=>SD [label = "sd_ble_gap_keypress_notify(type)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "Keypress Notification", textcolor="#000080", linecolor="#000080"];
* APP=>SD [label = "sd_ble_gap_keypress_notify(type)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "Keypress Notification", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = ""];
* APP=>SD [label = "sd_ble_gap_auth_key_reply(passkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD abox CENTRAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {LESC_ENC_MITM}"];
* |||;
* SD abox CENTRAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_LESC_BONDING_OOB_MSC Bonding: Out of Band
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP=>SD [label = "sd_ble_gap_addr_set(addr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gap_lesc_oob_data_get(p_pk_own, p_oobd_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox CENTRAL [label="OOB communication: oobd_own sent and/or oobd_peer received", textbgcolor="silver"];
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, bond, oob}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: lesc, bond, oob, keyset with p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk, oobd_req=1}"];
* SD:>CENTRAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* APP=>SD [label = "sd_ble_gap_lesc_oob_data_set(p_oobd_own, p_oobd_peer)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD abox CENTRAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox CENTRAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {LESC_ENC_MITM}"];
* |||;
* SD abox CENTRAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @}
*
* @defgroup BLE_GAP_PERIPH_PAIRING_KS_OUT_OF_RANGE_MSC Pairing failure: Keysize out of supported range
* This occurs if the min key size offered by the peer is above 16, or max key size below 7.
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: Invalid params, error_src: local}"];
* SD:>CENTRAL [label = "SMP Pairing failed", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_PAIRING_KS_TOO_SMALL_MSC GAP Failed Pairing: Keysize too small
* This occurs if the max key size offered by the peer is below the min key size specified by
* the app.
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* SD<:CENTRAL [label = "SMP Pairing Confirm", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: Enc key size, error_src: local}"];
* SD:>CENTRAL [label = "SMP Pairing failed", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_PAIRING_APP_ERROR_MSC Pairing failure: Pairing aborted by the application
* When the application detects that the pairing should not be performed, for example an
* insufficient IO combination, it can use sd_ble_gap_sec_params_reply() to send
* SMP Pairing failed to the peer.
*
* When the stack handles the response from the application it will also validate
* the passkey (SMP_STC_PASSKEY_ENTRY_FAILED). If any error is detected it will be
* reported when sd_ble_gap_sec_params_reply() is called.
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST"];
* SD abox APP [label="Stack looks for errors", textbgcolor="#7f7fff"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(<code from application>)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing failed", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: <code from application>, error_src: local}"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_PAIRING_REMOTE_PAIRING_FAIL_MSC Pairing failure: Pairing failed from central
* SMP Pairing Failed may be sent from the central at various times. The application should
* prepare for this and gracefully handle the event.
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* SD<:CENTRAL [label = "SMP Pairing Failed", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: <remote_reason>, error_src: remote}"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_PAIRING_TIMEOUT_MSC Pairing failure: Timeout
* This occurs if the central device doesn't continue the pairing sequence within 30 seconds.
* @msc
* hscale = "2";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* --- [ label = "Wait 30 sec" ];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: Timeout, error_src: local}"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_ENC_MSC Peripheral Encryption Establishment using stored keys
* @msc
* hscale = "1.5";
* APP,SD,CENTRAL;
* |||;
* APP rbox CENTRAL [label="Connection Established"];
* |||;
* SD<:CENTRAL [label = "LL Encryption Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_INFO_REQUEST {addr, ediv, rand}"];
* |||;
* --- [label = " Variant #1 App Replies with Keys "];
* |||;
* APP rbox APP [label = "Load Peripheral Keys"];
* APP=>SD [label = "sd_ble_gap_sec_info_reply(ediv, rand, LTK)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "LL Encryption Response", textcolor="#000080", linecolor="#000080"];
* APP rbox CENTRAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE"];
* |||;
* --- [label = " Variant #2 App Replies without Keys "];
* |||;
* APP=>SD [label = "sd_ble_gap_sec_info_reply(NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "LL Reject Ind: Pin or Key Missing", textcolor="#000080", linecolor="#000080"];
* APP rbox CENTRAL [label = "Link is NOT encrypted"];
* |||;
* --- [label = " Variant #3 App Replies with Incorrect Keys "];
* |||;
* APP rbox APP [label = "Load Incorrect Peripheral Keys"];
* APP=>SD [label = "sd_ble_gap_sec_info_reply(ediv, rand, LTK)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>CENTRAL [label = "LL Encryption Response", textcolor="#000080", linecolor="#000080"];
* SD<:CENTRAL [label = "Connection Termination", textcolor="#000080", linecolor="#000080"];
* APP rbox CENTRAL [label = "Link Terminated"];
* APP<<=SD [label = "BLE_GAP_EVT_DISCONNECTED {MIC Failure}"];
* @endmsc
* @}
*
*
*
* @defgroup BLE_GAP_SCAN_MSC Scanning
* @msc
* hscale = "1.5";
* APP,SD,ADVERTISERS;
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD<-ADVERTISERS [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {bdaddr, rssi, data}"];
* SD<-ADVERTISERS [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {bdaddr, rssi, data}"];
* SD<-ADVERTISERS [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {bdaddr, rssi, data}"];
* ...;
* SD<-ADVERTISERS [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {bdaddr, rssi, data}"];
* |||;
* --- [label = " Variant #1 App Stops Scanning "];
* APP=>SD [label = "sd_ble_gap_scan_stop()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " Variant #2 Scanning Timeout "];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_TIMEOUT {BLE_GAP_TIMEOUT_SRC_SCAN}"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_CONN_MSC Central Connection Establishment and Termination
* @msc
* hscale = "1.5";
* APP,SD,PERIPHERAL;
* |||;
* PERIPHERAL rbox PERIPHERAL [label="Peripheral Start Connectable Advertising"];
* |||;
* APP=>SD [label = "sd_ble_gap_connect(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "Scanning", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #1 Connection Established "];
* SD<:>PERIPHERAL [label = "Connection Establishment", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONNECTED"];
* |||;
* --- [label = " Variant #2 Connection Establishment Cancelled "];
* APP=>SD [label = "sd_ble_gap_connect_cancel()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " Variant #3 Connection Timeout "];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_TIMEOUT {BLE_GAP_TIMEOUT_SRC_CONN}"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_CPU_MSC Central Connection Parameter Update
* @msc
* hscale = "1.5";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established with conn. params. CP#1"];
* |||;
* --- [label = " Unsolicited procedure"];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update(CP#2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERAL [label = "Connection Update Start", textcolor="#000080", linecolor="#000080"];
* SD<:PERIPHERAL [label = "Connection Update Complete", textcolor="#000080", linecolor="#000080"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {CP#2}"];
* |||;
* --- [label = " Peripheral Solicited procedure"];
* |||;
* SD<:PERIPHERAL [label = "L2CAP CPU Request {CP#3}", textcolor="#000080", linecolor="#000080"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST {CP#3}"];
* |||;
* --- [label = " Variant #1 App Accepts "];
* APP=>SD [label = "sd_ble_gap_conn_param_update(CP#3)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "L2CAP CPU Response: Accepted", textcolor="#000080", linecolor="#000080"];
* SD:>PERIPHERAL [label = "Connection Update Start", textcolor="#000080", linecolor="#000080"];
* SD<:PERIPHERAL [label = "Connection Update Complete", textcolor="#000080", linecolor="#000080"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {CP#3}"];
* |||;
* --- [label = " Variant #2 App Rejects "];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update(NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "L2CAP CPU Response: Rejected", textcolor="#000080", linecolor="#000080"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_SEC_MSC Central Security Procedures
* @{
*
* @defgroup BLE_GAP_CENTRAL_SEC_REQ_MSC Security Request Reception
* @msc
* hscale = "1.5";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* SD<:PERIPHERAL [label = "SMP Security Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_REQUEST {bond, mitm}"];
* |||;
* --- [label = " Variant #1 Central initiates Security Establishment "];
* |||;
* APP=>SD [label = "sd_ble_gap_encrypt(ediv, rand, LTK)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with LTK"];
* |||;
* --- [label = " Variant #2 Central Triggers pairing or bonding "];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox PERIPHERAL [label = "Pairing procedure"];
* |||;
* --- [label = " Variant #3 Central rejects the Security Request "];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERAL [label = "SMP Pairing Failed: Pairing Not Supported", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: Pairing Not Supp, error_src: local}"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_LEGACY_MSC Central Legacy Pairing
* @{
*
* @defgroup BLE_GAP_CENTRAL_PAIRING_JW_MSC Pairing: Just Works
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(no_bond, no_mitm, no_io_caps)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: no_bond, no_mitm, no_io_caps}"];
* |||;
* --- [label = " Variant #1 Central Accepts Peripheral parameters "];
* |||;
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, p_keyset: NULL)"];
* |||;
* SD abox PERIPHERAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_NO_MITM}"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* |||;
* --- [label = " Variant #2 Central Rejects Peripheral parameters "];
* |||;
* APP=>SD [label = "sd_ble_gap_sec_params_reply(BLE_GAP_SEC_STATUS_INVALID_PARAMS, own_params: NULL, p_keyset: NULL)"];
* |||;
* SD:>PERIPHERAL [label = "SMP Pairing Failed", textcolor="#000080", linecolor="#000080"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {FAILURE}"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_BONDING_JW_MSC Bonding: Just Works
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(bond, no_mitm, no_io_caps)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: bond, no_mitm, no_io_caps}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, p_keyset)"];
* |||;
* SD abox PERIPHERAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_NO_MITM}"];
* |||;
* SD abox PERIPHERAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_BONDING_PK_PERIPH_MSC Bonding: Passkey Entry, Central displays
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(bond, mitm, display)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: bond, mitm, keyboard}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, p_keyset)"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_PASSKEY_DISPLAY {passkey, match_request=0}"];
* APP rbox APP [label="Passkey displayed to the user"];
* |||;
* SD abox PERIPHERAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_MITM}"];
* |||;
* SD abox PERIPHERAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_BONDING_PK_PERIPH_OOB_MSC Bonding: Passkey Entry, User Inputs on Central or OOB
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(bond, mitm, keyboard)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: bond, mitm, display}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, p_keyset)"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_KEY_REQUEST {type}"];
* APP rbox APP [label="User enters Passkey or data received Out Of Band"];
* APP=>SD [label = "sd_ble_gap_auth_key_reply(passkey or OOB)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD abox PERIPHERAL [label="Legacy Pairing Phase 2", textbgcolor="#7f7fff"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with STK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_MITM}"];
* |||;
* SD abox PERIPHERAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @}
*
* @defgroup BLE_GAP_CENTRAL_LESC_MSC Central LESC Pairing
* @{
* @defgroup BLE_GAP_CENTRAL_LESC_PAIRING_JW_MSC Pairing: Just Works
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(lesc, no_bond, no_mitm, no_io_caps)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, no_bond, no_mitm, no_io_caps}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk}"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* SD abox PERIPHERAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {ENC_NO_MITM}"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_LESC_BONDING_NC_MSC Bonding: Numeric Comparison
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(lesc, bond, mitm, display(kbd/yesno))"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, bond, mitm, display(kbd/yesno)}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, keyset with p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk}"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* SD abox PERIPHERAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_PASSKEY_DISPLAY {passkey, match_request=1}"];
* APP rbox APP [label="Passkey displayed to the user, user compares values"];
* |||;
* --- [label = " Variant #1 User confirms on both sides "];
* APP=>SD [label = "sd_ble_gap_auth_key_reply(BLE_GAP_AUTH_KEY_TYPE_PASSKEY, NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {LESC_ENC_MITM}"];
* |||;
* SD abox PERIPHERAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* --- [label = " Variant #2 User does not confirm locally "];
* APP=>SD [label = "sd_ble_gap_auth_key_reply(BLE_GAP_AUTH_KEY_TYPE_NONE, NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: num comp failure, error_src: local}"];
* SD:>PERIPHERAL [label = "SMP Pairing failed", textcolor="#000080", linecolor="#000080"];
* --- [label = " Variant #3 User does not confirm remotely "];
* SD<:PERIPHERAL [label = "SMP Pairing failed", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {auth_status: num comp failure, error_src: remote}"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_LESC_BONDING_PKE_PD_MSC Bonding: Passkey Entry: Central Displays
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(lesc, bond, mitm, display)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, bond, mitm, keyboard}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, keyset with p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_PASSKEY_DISPLAY {passkey, match_request=0}"];
* APP rbox APP [label="Passkey displayed to the user"];
* |||;
* SD:>PERIPHERAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk}"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* --- [label = " Optional keypresses from peer "];
* SD<:PERIPHERAL [label = "Keypress Notification", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_KEY_PRESSED {type}"];
* APP abox APP [label="App displays keypress"];
* SD<:PERIPHERAL [label = "Keypress Notification", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_KEY_PRESSED {type}"];
* APP abox APP [label="App displays keypress"];
* |||;
* --- [label = ""];
* SD abox PERIPHERAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {LESC_ENC_MITM}"];
* |||;
* SD abox PERIPHERAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_LESC_BONDING_PKE_CD_MSC Bonding: Passkey Entry: User Inputs on Central
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(lesc, bond, mitm, keyboard)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, bond, mitm, display}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, keyset with p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_KEY_REQUEST {passkey}"];
* APP rbox APP [label="User enters Passkey"];
* |||;
* SD:>PERIPHERAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk}"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* --- [label = " Optional keypresses sent to peer "];
* APP=>SD [label = "sd_ble_gap_keypress_notify(type)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "Keypress Notification", textcolor="#000080", linecolor="#000080"];
* APP=>SD [label = "sd_ble_gap_keypress_notify(type)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "Keypress Notification", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = ""];
* APP=>SD [label = "sd_ble_gap_auth_key_reply(passkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD abox PERIPHERAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {LESC_ENC_MITM}"];
* |||;
* SD abox PERIPHERAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_LESC_BONDING_OOB_MSC Bonding: Out of Band
* @msc
* hscale = "2";
* APP,SD,PERIPHERAL;
* |||;
* APP=>SD [label = "sd_ble_gap_addr_set(addr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gap_lesc_oob_data_get(p_pk_own, p_oobd_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox PERIPHERAL [label="OOB communication: oobd_own sent and/or oobd_peer received", textbgcolor="silver"];
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate(lesc, bond, oob)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing Request", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_SEC_PARAMS_REQUEST {peer_params: lesc, bond, oob}"];
* APP=>SD [label = "sd_ble_gap_sec_params_reply(SUCCESS, own_params: NULL, keyset with p_pk_own)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERAL [label = "SMP Pairing Public Key: PKa", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing Public Key: PKb", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_LESC_DHKEY_REQUEST {p_peer_pk, oobd_req=1}"];
* |||;
* APP abox APP [label="App starts DHKey calculation"];
* |||;
* APP=>SD [label = "sd_ble_gap_lesc_oob_data_set(p_oobd_own, p_oobd_peer)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD abox PERIPHERAL [label="LESC Authentication Stage 1", textbgcolor="#7f7fff"];
* |||;
* APP abox APP [label="App completes DHKey calculation"];
* APP=>SD [label = "sd_ble_gap_lesc_dhkey_reply(p_dhkey)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERAL [label = "SMP Pairing DHKey Check: Ea", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERAL [label = "SMP Pairing DHKey Check: Eb", textcolor="#000080", linecolor="#000080"];
* |||;
* APP rbox PERIPHERAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {LESC_ENC_MITM}"];
* |||;
* SD abox PERIPHERAL [label="SMP Pairing Phase 3", textbgcolor="#7f7fff"];
* |||;
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {SUCCESS}"];
* APP rbox APP [label = "Keys stored in keyset"];
* @endmsc
* @}
*
*
* @defgroup BLE_GAP_INVALID_SMP_PDU_MSC Unexpected Security Packet Reception
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP rbox PEER [label="No pairing in progress"];
* |||;
* PEER rbox PEER [label="Peer misbehaving"];
* |||;
* SD<:PEER [label = "SMP Pairing Failed (or other unexpected SMP PDU)", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_AUTH_STATUS {PDU_INVALID}"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_ENC_MSC Encryption Establishment using stored keys
* @msc
* hscale = "1.5";
* APP,SD,PERIPHERAL;
* |||;
* APP rbox PERIPHERAL [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gap_encrypt(ediv, rand, LTK)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERAL [label = "LL Encryption Request", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #1 Peripheral replies with keys "];
* |||;
* PERIPHERAL rbox PERIPHERAL [label = "Peripheral Loads Keys"];
* SD<:PERIPHERAL [label = "LL Encryption Response", textcolor="#000080", linecolor="#000080"];
* APP rbox PERIPHERAL [label = "Encrypted with LTK"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE"];
* |||;
* --- [label = " Variant #2 Peripheral keys missing "];
* |||;
* PERIPHERAL rbox PERIPHERAL [label = "Peripheral Keys Missing"];
* SD<:PERIPHERAL [label = "LL Reject Ind: Pin or Key Missing", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE"];
* APP rbox PERIPHERAL [label = "Link is NOT encrypted"];
* |||;
* --- [label = " Variant #3 Incorrect peripheral keys "];
* |||;
* PERIPHERAL rbox PERIPHERAL [label = "Peripheral Loads Incorrect Keys"];
* SD<:PERIPHERAL [label = "LL Encryption Response", textcolor="#000080", linecolor="#000080"];
* SD:>PERIPHERAL [label = "Connection Termination", textcolor="#000080", linecolor="#000080"];
* APP rbox PERIPHERAL [label = "Link Terminated"];
* APP<<=SD [label = "BLE_GAP_EVT_DISCONNECTED {MIC Failure}"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_ENC_AUTH_MUTEX_MSC Central Encryption and Authentication mutual exclusion
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP=>SD [label = "sd_ble_gap_encrypt(ediv, rand, LTK)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PEER [label = "Encryption Start", textcolor="#000080", linecolor="#000080"];
* |||;
* APP note SD [label = " Encryption in progress, authentication disallowed"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate()"];
* APP<<SD [label = "NRF_ERROR_INVALID_STATE"];
* |||;
* SD<:PEER [label = "Encryption Complete", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE "];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PEER [label = "Connection Update Start", textcolor="#000080", linecolor="#000080"];
* |||;
* APP=>SD [label = "sd_ble_gap_encrypt(ediv, rand, LTK)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD rbox SD [label="Encryption queued"];
* |||;
* APP note SD [label = " Encryption queued, authentication disallowed"];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate()"];
* APP<<SD [label = "NRF_ERROR_INVALID_STATE"];
* |||;
* SD<:PEER [label = "Connection Update Complete", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE"];
* |||;
* SD:>PEER [label = "Encryption Start", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "Encryption Complete", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE "];
* |||;
* APP=>SD [label = "sd_ble_gap_authenticate()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP note SD [label = " Authentication in progress, encryption disallowed"];
* |||;
* APP=>SD [label = "sd_ble_gap_encrypt(ediv, rand, LTK)"];
* APP<<SD [label = "NRF_ERROR_INVALID_STATE"];
* @endmsc
* @}
*
* @defgroup BLE_GAP_MULTILINK_CPU_MSC Central Connection Parameter Update on multiple links
* @msc
* hscale = "1.5";
* APP,SD,PERIPHERALS;
* |||;
* APP rbox PERIPHERALS [label="Connection Established with 4 peers, all with conn. params. CP#0"];
* |||;
* APP note PERIPHERALS [label = " Peripheral solicited procedure on link #2"];
* |||;
* SD<:PERIPHERALS [label = "L2CAP CPU Request {CP#2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST {conn_handle_2, CP#3}"];
* |||;
* APP note PERIPHERALS [label = " Unsolicited procedure on links #3 and #1"];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update(conn_handle_3, CP#3)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERALS [label = "Connection Update Start on link #3", textcolor="#000080", linecolor="#000080"];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update(conn_handle_1, CP#1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP note PERIPHERALS [label = " Respond to solicited procedure on link #2"];
* APP=>SD [label = "sd_ble_gap_conn_param_update(conn_handle_2, CP#2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERALS [label = "L2CAP CPU Response: Accepted", textcolor="#000080", linecolor="#000080"];
* |||;
* APP note PERIPHERALS [label = " Additional procedure on link #2 fails, since another one is pending"];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update(conn_handle_2, CP#5)"];
* APP<<SD [label = "NRF_ERROR_BUSY"];
* |||;
* APP note PERIPHERALS [label = " Note: the order of execution is not guaranteed"];
* |||;
* SD<:PERIPHERALS [label = "Connection Update Complete on link #3", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {conn_handle_3, CP#3}"];
* |||;
* SD:>PERIPHERALS [label = "Connection Update Start on link #1", textcolor="#000080", linecolor="#000080"];
* SD<:PERIPHERALS [label = "Connection Update Complete on link #1", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {conn_handle_1, CP#1}"];
* |||;
* SD:>PERIPHERALS [label = "Connection Update Start on link #2", textcolor="#000080", linecolor="#000080"];
* |||;
* APP note PERIPHERALS [label = " Peripheral solicited procedure on link #4"];
* |||;
* SD<:PERIPHERALS [label = "L2CAP CPU Request {CP#4}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST {conn_handle_4, CP#4}"];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update(conn_handle_4, CP#4)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERALS [label = "L2CAP CPU Response: Accepted", textcolor="#000080", linecolor="#000080"];
* |||;
* SD<:PERIPHERALS [label = "Connection Update Complete on link #2", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {conn_handle_2, CP#2}"];
* |||;
* SD:>PERIPHERALS [label = "Connection Update Start on link #4", textcolor="#000080", linecolor="#000080"];
* SD<:PERIPHERALS [label = "Connection Update Complete on link #4", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {conn_handle_4, CP#4}"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_MULTILINK_CTRL_PROC_MSC Central Control Procedure Serialization on multiple links
* @msc
* hscale = "1.5";
* APP,SD,PERIPHERALS;
* |||;
* APP rbox PERIPHERALS [label="Connection Established with 4 peers, all with conn. params. CP#0"];
* |||;
* APP note PERIPHERALS [label = " Peripheral solicited procedure on link #2"];
* |||;
* SD<:PERIPHERALS [label = "L2CAP CPU Request {CP#2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST {conn_handle_2, CP#3}"];
* |||;
* APP note PERIPHERALS [label = " Encryption procedure on link #3"];
* |||;
* APP=>SD [label = "sd_ble_gap_encrypt(conn_handle_3, LTK#3)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERALS [label = "Encryption Start on link #3", textcolor="#000080", linecolor="#000080"];
* |||;
* APP note PERIPHERALS [label = " Connection Update procedure on link #1"];
* |||;
* APP=>SD [label = "sd_ble_gap_conn_param_update(conn_handle_1, CP#1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP note PERIPHERALS [label = " Respond to solicited procedure on link #2"];
* APP=>SD [label = "sd_ble_gap_conn_param_update(conn_handle_2, CP#2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PERIPHERALS [label = "L2CAP CPU Response: Accepted", textcolor="#000080", linecolor="#000080"];
* |||;
* APP note PERIPHERALS [label = " Encryption procedure on link #4"];
* |||;
* APP=>SD [label = "sd_ble_gap_encrypt(conn_handle_4, LTK#4)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP note PERIPHERALS [label = " Note: the order of execution is not guaranteed, but encryption always has priority"];
* |||;
* SD<:PERIPHERALS [label = "Encryption Complete on link #3", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {conn_handle_3}"];
* |||;
* SD:>PERIPHERALS [label = "Encryption Start on link #4", textcolor="#000080", linecolor="#000080"];
* SD<:PERIPHERALS [label = "Encryption Complete on link #4", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_SEC_UPDATE {conn_handle_4}"];
* |||;
* SD:>PERIPHERALS [label = "Connection Update Start on link #1", textcolor="#000080", linecolor="#000080"];
* SD<:PERIPHERALS [label = "Connection Update Complete on link #1", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {conn_handle_1, CP#1}"];
* |||;
* SD:>PERIPHERALS [label = "Connection Update Start on link #2", textcolor="#000080", linecolor="#000080"];
* SD<:PERIPHERALS [label = "Connection Update Complete on link #2", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONN_PARAM_UPDATE {conn_handle_2, CP#2}"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_WL_SHARE_MSC Whitelist Sharing
* @msc
* hscale = "1.5";
* APP,SD;
* |||;
* APP=>SD [label = "sd_ble_gap_adv_data_set(adv, sr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gap_whitelist_set(WL#1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gap_adv_start(fp = CONNREQ)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD rbox SD [label="Advertising with Whitelist #1"];
* |||;
* APP note APP [label = "Unable to change whitelist while adv in progress"];
* APP=>SD [label = "sd_ble_gap_whitelist_set(WL#2)"];
* APP<<SD [label = "BLE_ERROR_GAP_WHITELIST_IN_USE"];
* |||;
* APP note APP [label = "Scan with the current active whitelist"];
* APP=>SD [label = "sd_ble_gap_scan_start(use_whitelist = 1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD rbox SD [label="Advertising and scanning with Whitelist #1"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_stop()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD rbox SD [label="Scanning with Whitelist #1"];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_stop()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_whitelist_set(WL#2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gap_scan_start(use_whitelist = 1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD rbox SD [label="Scanning with Whitelist #2"];
* |||;
* APP note APP [label = "Connect with the current active whitelist"];
* APP=>SD [label = "sd_ble_gap_connect(use_whitelist = 1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD note SD [label = "Scanning is automatically stopped"];
* SD rbox SD [label="Connecting with Whitelist #2"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_PRIVACY_MSC Privacy
* @{
*
* @defgroup BLE_GAP_PRIVACY_ADV_MSC Private Advertising
* @msc
* hscale = "1.5";
* APP,SD,SCANNERS;
* |||;
* APP=>SD [label = "sd_ble_gap_addr_set(addr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_data_set(adv, sr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " Variant #1 Advertise with address resolvable by device IRK "];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_start(params: {p_peer_addr = NULL})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD->SCANNERS [label = "ADV packet, Addr = Resolvable1", textcolor="#000080", linecolor="#000080"];
* SD->SCANNERS [label = "ADV packet, Addr = Resolvable1", textcolor="#000080", linecolor="#000080"];
* SD->SCANNERS [label = "ADV packet, Addr = Resolvable1", textcolor="#000080", linecolor="#000080"];
* ...;
* SD box SD [label="Private address timeout"];
* SD->SCANNERS [label = "ADV packet, Addr = Resolvable2", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #2 Advertise with address resolvable by local IRK in device identity list "];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}}, pp_local_irks: {local_irk1}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_start(params: {p_peer_addr = peer_addr1})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD->SCANNERS [label = "ADV packet, Addr = Resolvable1", textcolor="#000080", linecolor="#000080"];
* SD->SCANNERS [label = "ADV packet, Addr = Resolvable1", textcolor="#000080", linecolor="#000080"];
* SD->SCANNERS [label = "ADV packet, Addr = Resolvable1", textcolor="#000080", linecolor="#000080"];
* ...;
* SD box SD [label="Private address timeout"];
* SD->SCANNERS [label = "ADV packet, Addr = Resolvable2", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #3 Advertise with non-resolvable address "];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: NON_RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_start(params: {p_peer_addr = NULL})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD->SCANNERS [label = "ADV packet, Addr = Non-Resolvable1", textcolor="#000080", linecolor="#000080"];
* SD->SCANNERS [label = "ADV packet, Addr = Non-Resolvable1", textcolor="#000080", linecolor="#000080"];
* SD->SCANNERS [label = "ADV packet, Addr = Non-Resolvable1", textcolor="#000080", linecolor="#000080"];
* ...;
* SD box SD [label="Private address timeout"];
* SD->SCANNERS [label = "ADV packet, Addr = Non-Resolvable2", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GAP_PRIVACY_SCAN_MSC Private Scanning
* @msc
* hscale = "1.5";
* APP,SD,ADVERTISERS;
* |||;
* APP=>SD [label = "sd_ble_gap_addr_set(addr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " Variant #1 Active Scan with address resolvable by device IRK "];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ADVERTISERS->SD [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* SD->ADVERTISERS [label = "SCAN REQ packet, Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* ADVERTISERS->SD [label = "SCAN RSP packet", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #2 Active Scan with address resolvable by local IRKs "];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}, {peer_addr2, peer_irk2}}, pp_local_irks: {local_irk1, local_irk2}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Addr = peer_addr1", textcolor="#000080", linecolor="#000080"];
* SD box ADVERTISERS [label = "peer_addr1 is in the device identity list, respond with an address generated from local_irk1"];
* SD->ADVERTISERS [label = "SCAN REQ packet, Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* ADVERTISERS->SD [label = "SCAN RSP packet, Addr = peer_addr1", textcolor="#000080", linecolor="#000080"];
* |||;
* ...;
* ADVERTISERS->SD [label = "ADV packet, Addr = Resolvable2", textcolor="#000080", linecolor="#000080"];
* SD box ADVERTISERS [label = "Resolvable2 resolved to device identity peer_addr2 in the device identity list, respond with an address generated from local_irk2"];
* SD->ADVERTISERS [label = "SCAN REQ packet, Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* ADVERTISERS->SD [label = "SCAN RSP packet, Addr = peer_addr1", textcolor="#000080", linecolor="#000080"];
* |||;
* ...;
* ADVERTISERS->SD [label = "ADV packet, Addr = peer_addr3", textcolor="#000080", linecolor="#000080"];
* SD box ADVERTISERS [label = "peer_addr3 is not in the device identity list, respond with an address generated from device_irk"];
* SD->ADVERTISERS [label = "SCAN REQ packet, Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* ADVERTISERS->SD [label = "SCAN RSP packet, Addr = peer_addr1", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #3 Active Scan with non-resolvable address "];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: NON_RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ADVERTISERS->SD [label = "ADV packet", textcolor="#000080", linecolor="#000080"];
* SD->ADVERTISERS [label = "SCAN REQ packet, Addr = Non-Resolvable", textcolor="#000080", linecolor="#000080"];
* ADVERTISERS->SD [label = "SCAN RSP packet", textcolor="#000080", linecolor="#000080"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_PRIVACY_SCAN_PRIVATE_SCAN_MSC Scan Private Devices
* @msc
* hscale = "1.5";
* APP,SD,ADVERTISERS;
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}}, pp_local_irks: NULL) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " Variant #1 Scan and resolve private devices "];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Addr = Resolvable1", textcolor="#000080", linecolor="#000080"];
* SD note ADVERTISERS [label="Resolvable1 resolved to device identity peer_addr1"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {peer_addr1, rssi, data}"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Addr = peer_addr2", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {peer_addr2, rssi, data}"];
* |||;
* --- [label = " Variant #2 Scan and resolve private devices with whitelist "];
* |||;
* APP=>SD [label = "sd_ble_gap_whitelist_set({peer_addr1, Resolvable2}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start(params)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Addr = Resolvable1", textcolor="#000080", linecolor="#000080"];
* SD note ADVERTISERS [label="Resolvable1 resolved to device identity peer_addr1 which is in the whitelist"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {peer_addr1, rssi, data}"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Addr = Resolvable2", textcolor="#000080", linecolor="#000080"];
* SD note ADVERTISERS [label="Resolvable2 did not resolve to a device identity but is in the whitelist"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {Resolvable2, rssi, data}"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Addr = Resolvable3", textcolor="#000080", linecolor="#000080"];
* SD note ADVERTISERS [label="Resolvable3 is not in the whitelist, no report generated"];
* |||;
* --- [label = " Variant #3 Scan directed advertisers and resolve initiator address using device IRK"];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* ADVERTISERS box SD [label = "Advertiser Address resolved using peer_irk1, Initiator address resolved using device_irk"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {peer_addr: peer_addr1"];
* |||;
* --- [label = " Variant #4 Scan directed advertisers and resolve initiator address using local IRK in device identity list"];
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}}, pp_local_irks: local_irk1) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* ADVERTISERS box SD [label = "Advertiser Address resolved using peer_irk1, Initiator address resolved using local_irk1"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {peer_addr: peer_addr1"];
* |||;
* --- [label = " Variant #5 Scan directed advertisers with unresolved direct address "];
* |||;
* APP=>SD [label = "sd_ble_gap_scan_start(params: {adv_dir_report = 1})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ADVERTISERS->SD [label = "ADV packet, Advertiser Addr = peer_addr2, Initiator Addr = Resolvable2", textcolor="#000080", linecolor="#000080"];
* ADVERTISERS box SD [label = "Resolvable2 could not be resolved, report the unresolved direct address"];
* APP<<=SD [label = "BLE_GAP_EVT_ADV_REPORT {peer_addr: peer_addr2, direct_addr: Resolvable2}"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_PRIVACY_ADV_DIR_PRIV_MSC Directed Advertising
* @msc
* hscale = "1.5";
* APP,SD,INITIATOR;
* |||;
* APP=>SD [label = "sd_ble_gap_addr_set(addr)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " Variant #1 Advertise directed to private peer"];
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}}, pp_local_irks: NULL) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_start(params: {p_peer_addr = peer_addr1})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD box SD [label = "Generate initiator addr from peer_irk1"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = addr, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = addr, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = addr, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #2 Private directed advertising to private peer using device IRK"];
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}}, pp_local_irks: NULL) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_start(params: {p_peer_addr = peer_addr1})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD box SD [label = "Generate advertiser address from device_irk Generate initiator address from peer_irk1"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #3 Private directed advertising to private peer using local IRK in device identity list"];
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}}, pp_local_irks: {{local_irk1}}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_start(params: {p_peer_addr = peer_addr1})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD box SD [label = "Generate advertiser address from local_irk1 Generate initiator address from peer_irk1"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = Resolvable", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #4 Private directed advertising to non-private peer using local IRK in device identity list"];
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk=0..0}}, pp_local_irks: {{local_irk1}}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_privacy_set(params: {mode: DEVICE_PRIVACY, private_addr_type: RESOLVABLE } "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP=>SD [label = "sd_ble_gap_adv_start(params: {p_peer_addr = peer_addr1})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD box SD [label = "Generate advertiser address from local_irk1"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = peer_addr1", textcolor="#000080", linecolor="#000080"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = peer_addr1", textcolor="#000080", linecolor="#000080"];
* SD->INITIATOR[label = "ADV packet, Advertiser Addr = Resolvable, Initiator Addr = peer_addr1", textcolor="#000080", linecolor="#000080"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_PERIPH_CONN_PRIV_MSC Peripheral Connection Establishment with Private Peer
* @msc
* hscale = "1.5";
* APP,SD,CENTRAL;
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}}, pp_local_irks: NULL) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* --- [label = " Variant #1 Peer used resolvable addresses during connection setup "];
* |||;
* APP rbox CENTRAL [label="Start Connectable Advertising"];
* |||;
* SD<:>CENTRAL [label = "Connection Establishment", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONNECTED, peer_addr = {peer_addr1, addr_id_peer = 1}"];
* |||;
* --- [label = " Variant #2 Peer used identity address during connection setup "];
* |||;
* APP rbox CENTRAL [label="Start Connectable Advertising"];
* |||;
* SD<:>CENTRAL [label = "Connection Establishment", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONNECTED, peer_addr = {peer_addr1, addr_id_peer = 0}"];
* |||;
* @endmsc
*
* @defgroup BLE_GAP_CENTRAL_CONN_PRIV_MSC Central Connection Establishment with Private Peer
* @msc
* hscale = "1.5";
* APP,SD,PERIPHERAL;
* |||;
* APP=>SD [label = "sd_ble_gap_device_identities_set(pp_id_keys: {{peer_addr1, peer_irk1}}, pp_local_irks: NULL) "];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* PERIPHERAL rbox PERIPHERAL [label="Peripheral Start Connectable Advertising"];
* |||;
* APP=>SD [label = "sd_ble_gap_connect(peer_addr = {peer_addr1, addr_id_peer = 1})"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PERIPHERAL [label = "Scanning", textcolor="#000080", linecolor="#000080"];
* --- [label = " Variant #1 Peer used resolvable addresses during connection setup "];
* |||;
* SD<:>PERIPHERAL [label = "Connection Establishment", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONNECTED, peer_addr = {peer_addr1, addr_id_peer = 1}"];
* |||;
* --- [label = " Variant #2 Peer used identity address during connection setup "];
* |||;
* SD<:>PERIPHERAL [label = "Connection Establishment", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_CONNECTED, peer_addr = {peer_addr1, addr_id_peer = 0}"];
* |||;
* @endmsc
*
* @}
*
* @defgroup BLE_GAP_EVT_PHY_MSC PHY Request
* @{
*
* @defgroup BLE_GAP_CENTRAL_PHY_REQUEST Central PHY Request
* @msc
* hscale = "1.5";
* APP,SD,PERIPHERAL;
* |||;
* --- [label = " Variant #1 Initiated by Peripheral, no preferred phy set "];
* SD<=PERIPHERAL [label = "LL_PHY_REQ"];
* SD=>PERIPHERAL [label = "LL_PHY_UPDATE_IND - No change"];
* |||;
* --- [label = " Variant #2 Initiated by Peripheral, preferred phy set and change required"];
* APP=>SD [label = "sd_ble_opt_set(BLE_GAP_OPT_PREFERRED_PHYS_SET)"];
* APP<<SD [label = "NRF_SUCCESS"];
* ...;
* SD<=PERIPHERAL [label = "LL_PHY_REQ"];
* SD=>PERIPHERAL [label = "LL_PHY_UPDATE_IND - preferred phy from app"];
* APP<<=SD [label = "BLE_GAP_EVT_PHY_UPDATE"];
* |||;
* --- [label = " Variant #3 Initiated by APP, not supported by peer"];
* |||;
* APP=>SD [label = "sd_ble_gap_phy_request(conn_handle, {{ALL_PHY, ALL_PHY}}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox PERIPHERAL [label="Feature exchange if required\n peer support changing phy"];
* SD=>PERIPHERAL [label="LL_PHY_REQ"];
* SD<=PERIPHERAL [label="LL_UNKNOWN_RSP"];
* APP<<=SD [label="BLE_GAP_EVT_PHY_UPDATE {Status=Not supported}"];
* |||;
* --- [label = " Variant #4 Initiated by APP, change required"];
* |||;
* APP=>SD [label = "sd_ble_gap_phy_request(conn_handle, {{ALL_PHY, ALL_PHY}}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox PERIPHERAL [label="Feature exchange if required\n peer support changing phy"];
* SD=>PERIPHERAL [label = "LL_PHY_REQ"];
* SD<=PERIPHERAL [label = "LL_PHY_RSP"];
* SD=>PERIPHERAL [label = "LL_PHY_UPDATE_IND"];
* APP<<=SD [label = "BLE_GAP_EVT_PHY_UPDATE"];
* @endmsc
*
* @defgroup BLE_GAP_PERIPHERAL_PHY_REQUEST Peripheral PHY Request
* @msc
* hscale = "1.5";
* APP,SD,CENTRAL;
* |||;
* --- [label = " Variant #1 Initiated by Central, no preferred phy set "];
* SD<=CENTRAL [label = "LL_PHY_REQ"];
* SD=>CENTRAL [label = "LL_PHY_RSP - 1 Mbps tx, 1 Mbps rx"];
* SD<=CENTRAL [label = "LL_PHY_UPDATE_IND - No change"];
* |||;
* --- [label = " Variant #2 Initiated by Central, preferred phy set and change required"];
* APP=>SD [label = "sd_ble_opt_set(BLE_GAP_OPT_PREFERRED_PHYS_SET)"];
* APP<<SD [label = "NRF_SUCCESS"];
* ...;
* SD<=CENTRAL [label = "LL_PHY_REQ"];
* SD=>CENTRAL [label = "LL_PHY_RSP - preferred phy from app"];
* SD<=CENTRAL [label = "LL_PHY_UPDATE_IND - preferred phy from app"];
* APP<<=SD [label = "BLE_GAP_EVT_PHY_UPDATE"];
* |||;
* --- [label = " Variant #3 Initiated by APP, not supported by peer"];
* |||;
* APP=>SD [label = "sd_ble_gap_phy_request(conn_handle, {{ALL_PHY, ALL_PHY}}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox CENTRAL [label="Feature exchange if required\n peer support changing phy"];
* SD=>CENTRAL [label="LL_PHY_REQ"];
* SD<=CENTRAL [label="LL_UNKNOWN_RSP"];
* APP<<=SD [label="BLE_GAP_EVT_PHY_UPDATE {Status=Not supported}"];
* |||;
* --- [label = " Variant #4 Initiated by APP, change required"];
* |||;
* APP=>SD [label = "sd_ble_gap_phy_request(conn_handle, {{ALL_PHY, ALL_PHY}}) "];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox CENTRAL [label="Feature exchange if required\n peer support changing phy"];
* SD=>CENTRAL [label="LL_PHY_REQ"];
* SD<=CENTRAL [label="LL_PHY_UPDATE_IND"];
* APP<<=SD [label="BLE_GAP_EVT_PHY_UPDATE"];
* |||;
* @endmsc
*
* @}
* @defgroup BLE_GAP_DATA_LENGTH_UPDATE_PROCEDURE_MSC Data Length Update Procedure
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* --- [label = " Self initiated "];
* |||;
* SD rbox SD [label = "max_tx_octets=27, max_rx_octets=27"];
* |||;
* ...;
* |||;
* APP=>SD [label = "sd_ble_gap_data_length_update(conn_handle, local_max_tx=251, local_max_rx=251, &limitation)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "LL Length Request {tx=251, rx=251}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "LL Length Response {tx=251, rx=251}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label = "max_tx_octets=251, max_rx_octets=251"];
* APP<<=SD [label = "BLE_GAP_EVT_DATA_LENGTH_UPDATE {max_tx_octets=251, max_rx_octets=251}"];
* |||;
* ...;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* --- [label = " Peer initiated "];
* SD rbox SD [label = "max_tx_octets=27, max_rx_octets=27"];
* |||;
* ...;
* |||;
* SD<:PEER [label = "LL Length Request {tx=251, rx=251}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST {local_max_tx: 251, local_max_rx: 251}"];
* APP=>SD [label = "sd_ble_gap_data_length_update(conn_handle, local_max_tx=251, local_max_rx=251, &limitation)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "LL Length Response {tx=251, rx=251}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label = "max_tx_octets=251, max_rx_octets=251"];
* APP<<=SD [label = "BLE_GAP_EVT_DATA_LENGTH_UPDATE {max_tx_octets=251, max_rx_octets=251}"];
* |||;
* ...;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* --- [label = " Using the limitation out parameter to adjust Link Layer Data Channel PDU size "];
* |||;
* SD rbox SD [label = "max_tx_octets=27, max_rx_octets=27"];
* |||;
* ...;
* |||;
* APP=>SD [label = "sd_ble_gap_data_length_update(conn_handle, local_max_tx=251, local_max_rx=251, &limitation)"];
* APP<<SD [label = "NRF_ERROR_RESOURCES"];
* APP note SD [label = "limitation = { .tx_payload_limited_octets = 51, .rx_payload_limited_octets = 51, .tx_rx_time_limited_us = 0}"];
* |||;
* APP=>SD [label = "sd_ble_gap_data_length_update(conn_handle, local_max_tx=200, local_max_rx=200, &limitation)"];
* APP<<SD [label = "NRF_SUCCESS"];
* @endmsc
* @}
*
* @}
* @}
*/
/**
* @addtogroup BLE_GATTC
* @{
* @defgroup BLE_GATTC_MSC Message Sequence Charts
* @{
* @defgroup BLE_GATTC_PRIM_SRVC_DISC_MSC GATTC Primary Service Discovery
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* --- [label = " Variant #1 Discover All Services "];
* |||;
* APP=>SD [label = "sd_ble_gattc_primary_services_discover(handle, NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Group Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read By Group Type Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP {SUCCESS, services}"];
* APP=>SD [label = "sd_ble_gattc_primary_services_discover(handle + N, NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Group Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read By Group Type Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP {SUCCESS, services}"];
* APP=>SD [label = "sd_ble_gattc_primary_services_discover(handle + N + M, NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Group Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Error Response: Attribute Not Found", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP {ATTRIBUTE_NOT_FOUND}"];
* |||;
* --- [label = " Variant #2 Discover a Specific Service "];
* |||;
* APP=>SD [label = "sd_ble_gattc_primary_services_discover(handle, uuid)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Find By Type Value Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Find By Type Value Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP {SUCCESS, services}"];
* APP=>SD [label = "sd_ble_gattc_primary_services_discover(handle + N, uuid)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Find By Type Value Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Find By Type Value Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP {SUCCESS, services}"];
* APP=>SD [label = "sd_ble_gattc_primary_services_discover(handle + N + M, uuid)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Find By Type Value Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Error Response: Attribute Not Found", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP {ATTRIBUTE_NOT_FOUND}"];
* @endmsc
*
* @defgroup BLE_GATTC_REL_DISC_MSC GATTC Relationship Discovery
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gattc_relationships_discover(handle_range)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read By Type Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_REL_DISC_RSP {SUCCESS, includes}"];
* APP=>SD [label = "sd_ble_gattc_relationships_discover(handle_range + N)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read By Type Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_REL_DISC_RSP {SUCCESS, includes}"];
* APP=>SD [label = "sd_ble_gattc_relationships_discover(handle_range + N + M)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Error Response: Attribute Not Found", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_REL_DISC_RSP {ATTRIBUTE_NOT_FOUND}"];
* @endmsc
*
* @defgroup BLE_GATTC_CHAR_DISC_MSC GATTC Characteristic Discovery
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gattc_characteristics_discover(handle_range)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read By Type Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_CHAR_DISC_RSP {SUCCESS, chars}"];
* APP=>SD [label = "sd_ble_gattc_characteristics_discover(handle_range + N)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read By Type Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_CHAR_DISC_RSP {SUCCESS, chars}"];
* APP=>SD [label = "sd_ble_gattc_characteristics_discover(handle_range + N + M)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Error Response: Attribute Not Found", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_CHAR_DISC_RSP {ATTRIBUTE_NOT_FOUND}"];
* @endmsc
*
* @defgroup BLE_GATTC_DESC_DISC_MSC GATTC Descriptor Discovery
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gattc_descriptors_discover(handle_range)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Find Information Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Find Information Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_DESC_DISC_RSP {SUCCESS, descs}"];
* APP=>SD [label = "sd_ble_gattc_descriptors_discover(handle_range + N)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Find Information Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Find Information Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_DESC_DISC_RSP {SUCCESS, descs}"];
* APP=>SD [label = "sd_ble_gattc_descriptors_discover(handle_range + N + M)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Find Information Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Error Response: Attribute Not Found", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_DESC_DISC_RSP {ATTRIBUTE_NOT_FOUND}"];
* @endmsc
*
* @defgroup BLE_GATTC_READ_UUID_MSC GATTC Read Characteristic Value by UUID
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gattc_char_value_by_uuid_read(uuid, handle_range)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read By Type Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP {SUCCESS, char_values}"];
* APP=>SD [label = "sd_ble_gattc_char_value_by_uuid_read(uuid, handle_range + N)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read By Type Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP {SUCCESS, char_values}"];
* APP=>SD [label = "sd_ble_gattc_char_value_by_uuid_read(uuid, handle_range + N + M)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read By Type Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Error Response: Attribute Not Found", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP {ATTRIBUTE_NOT_FOUND}"];
* @endmsc
*
* @defgroup BLE_GATTC_VALUE_READ_MSC GATTC Characteristic or Descriptor Value Read
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* --- [label = " Variant #1 offset == 0 "];
* |||;
* APP=>SD [label = "sd_ble_gattc_read(handle, 0)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_READ_RSP {SUCCESS, value}"];
* |||;
* --- [label = " Variant #2 offset != 0 "];
* |||;
* APP=>SD [label = "sd_ble_gattc_read(handle, offset)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read Blob Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read Blob Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_READ_RSP {SUCCESS, value}"];
* APP=>SD [label = "sd_ble_gattc_read(handle, offset + N)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read Blob Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read Blob Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_READ_RSP {SUCCESS, value}"];
* APP=>SD [label = "sd_ble_gattc_read(handle, offset + N + M + 1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read Blob Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Error Response: Invalid Offset", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_READ_RSP {INVALID_OFFSET}"];
* @endmsc
*
* @defgroup BLE_GATTC_READ_MULT_MSC GATTC Read Multiple Characteristic Values
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* --- [label = " Variant #1 Successful request "];
* |||;
* APP=>SD [label = "sd_ble_gattc_char_values_read(handles)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read Multiple Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Read Multiple Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_CHAR_VALS_READ_RSP {SUCCESS, char_values}"];
* |||;
* --- [label = " Variant #2 Failing request (invalid handle) "];
* |||;
* APP=>SD [label = "sd_ble_gattc_char_values_read(handles)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read Multiple Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Error Response: Invalid Handle", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_CHAR_VALS_READ_RSP {INVALID_HANDLE, error_handle=<invalid handle>}"];
* @endmsc
*
* @defgroup BLE_GATTC_VALUE_WRITE_WITHOUT_RESP_MSC GATTC Characteristic Value Write Without Response
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* --- [label = " Variant #1 App does not keep track of the available queue element count for writes without responses "];
* APP note PEER [label = " This variant makes it possible for APP to transmit writes without responses without keeping track of the available queue element count. However, successful queuing of writes without responses cannot be guaranteed. "];
* |||;
* APP=>SD [label = "sd_ble_enable()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_CMD, handle, value_1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_CMD, handle, value_2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_CMD, handle, value_3)"];
* APP<<SD [label = "NRF_ERROR_RESOURCES"];
* |||;
* ...;
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_CMD, handle, value_4)"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* SD:>PEER [label = "ATT Write Command {value_1}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Write Command {value_2}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Write Command {value_4}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE {SUCCESS, 3}"];
* |||;
* --- [label = " Variant #2 App keeps track of the available queue element count for writes without responses "];
* APP note PEER [label = " This variant makes it possible for APP to know when successful queuing of writes without responses is guaranteed. "];
* |||;
* APP=>SD [label = "sd_ble_cfg_set(BLE_CONN_CFG_GATTC, gattc_conn_cfg.write_cmd_tx_queue_size = 2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_enable()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox PEER [label="Connection Established"];
* APP abox APP [label="available_queue_element_count = 2"];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_CMD, handle, value_1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox APP [label="available_queue_element_count--"];
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_CMD, handle, value_2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox APP [label="available_queue_element_count--"];
* APP note APP [label = "available_queue_element_count == 0"];
* |||;
* SD:>PEER [label = "ATT Write Command {value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE {SUCCESS, 1}"];
* APP abox APP [label="available_queue_element_count += 1"];
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_CMD, handle, value_3)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox APP [label="available_queue_element_count--"];
* APP note APP [label = "available_queue_element_count == 0"];
* |||;
* SD:>PEER [label = "ATT Write Command {value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE {SUCCESS, 1}"];
* APP abox APP [label="available_queue_element_count += 1"];
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_CMD, handle, value_4)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox APP [label="available_queue_element_count--"];
* APP note APP [label = "available_queue_element_count == 0"];
* |||;
* SD:>PEER [label = "ATT Write Command {value_3}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Write Command {value_4}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE {SUCCESS, 2}"];
* APP abox APP [label="available_queue_element_count += 2"];
* @endmsc
*
* @defgroup BLE_GATTC_VALUE_WRITE_MSC GATTC Characteristic or Descriptor Value Write
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_WRITE_REQ, handle, value)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Write Request", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_WRITE_REQ, SUCCESS}"];
* @endmsc
*
* @defgroup BLE_GATTC_VALUE_LONG_WRITE_MSC GATTC Characteristic or Descriptor Value Long Write
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_PREP_WRITE_REQ, handle, offset_1, value_1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Prepare Write Request {handle, offset_1, value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Response {handle, offset_1, value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_PREP_WRITE_REQ, SUCCESS, value_1}"];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_PREP_WRITE_REQ, handle, offset_2, value_2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Prepare Write Request {handle, offset_2, value_2}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Response {handle, offset_2, value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_PREP_WRITE_REQ, SUCCESS, value_2}"];
* |||;
* ...;
* |||;
* --- [label = " Variant #1 App executes the Long Write procedure "];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_EXEC_WRITE_REQ, PREPARED_WRITE)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Execute Write Request: flags = 0x01", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_EXEC_WRITE_REQ, SUCCESS}"];
* |||;
* --- [label = " Variant #2 App cancels the Long Write procedure "];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_EXEC_WRITE_REQ, PREPARED_CANCEL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Execute Write Request: flags = 0x00", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_EXEC_WRITE_REQ, SUCCESS}"];
* @endmsc
*
* @defgroup BLE_GATTC_VALUE_RELIABLE_WRITE_MSC GATTC Characteristic or Descriptor Value Reliable Write
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_PREP_WRITE_REQ, handle_1, offset, value_1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Prepare Write Request {handle_1, offset, value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Response {handle_1, offset, value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_PREP_WRITE_REQ, SUCCESS, value_1}"];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_PREP_WRITE_REQ, handle_2, offset, value_2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Prepare Write Request {handle_2, offset, value_2}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Response {handle_2, offset, value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_PREP_WRITE_REQ, SUCCESS, value_2}"];
* |||;
* ...;
* |||;
* --- [label = " Variant #1 App executes the Reliable Write procedure "];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_EXEC_WRITE_REQ, PREPARED_WRITE)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Execute Write Request: flags = 0x01", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_EXEC_WRITE_REQ, SUCCESS}"];
* |||;
* --- [label = " Variant #2 App cancels the Reliable Write procedure "];
* |||;
* APP=>SD [label = "sd_ble_gattc_write(BLE_GATT_OP_EXEC_WRITE_REQ, PREPARED_CANCEL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Execute Write Request: flags = 0x00", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_WRITE_RSP {BLE_GATT_OP_EXEC_WRITE_REQ, SUCCESS}"];
* @endmsc
*
* @defgroup BLE_GATTC_HVI_MSC GATTC Handle Value Indication
* <b> GATTC Handle Value Indication MSC </b>
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD<:PEER [label = "ATT Handle Value Indication", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_HVX {INDICATION, data}"];
* APP=>SD [label = "sd_ble_gattc_hv_confirm(handle)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Handle Value Confirmation", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GATTC_HVN_MSC GATTC Handle Value Notification
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD<:PEER [label = "ATT Handle Value Notification", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTC_EVT_HVX {NOTIFICATION, data}"];
* @endmsc
*
* @defgroup BLE_GATTC_TIMEOUT_MSC GATTC Timeout
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP rbox PEER [label="Any GATTC API used"];
* SD:>PEER [label = "ATT Packet", textcolor="#000080", linecolor="#000080"];
* APP note PEER [label = "No Response from Peer"];
* |||;
* ...;
* |||;
* SD box SD [label="Timeout"];
* APP<<=SD [label = "BLE_GATTC_EVT_TIMEOUT {source}"];
* APP rbox PEER [label="No additional ATT Traffic Allowed", textbgcolour="#ff7f7f"];
* APP=>SD [label = "Any API call"];
* APP<<SD [label = "NRF_ERROR_BUSY"];
* @endmsc
*
* @defgroup BLE_GATTC_MTU_EXCHANGE GATTC ATT_MTU Exchange
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP=>SD [label = "sd_ble_cfg_set(BLE_CONN_CFG_GATT, gatt_conn_cfg.att_mtu=100)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_enable()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ...;
* |||;
* APP rbox PEER [label="Connection Established"];
* SD rbox SD [label="att_mtu=23"];
* |||;
* APP=>SD [label = "sd_ble_gattc_exchange_mtu_request(conn_handle, client_rx_mtu=80)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Exchange MTU Request {client_rx_mtu=80}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Exchange MTU Response {server_rx_mtu=75}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="att_mtu=75"];
* APP<<=SD [label = "BLE_GATTC_EVT_EXCHANGE_MTU_RSP {SUCCESS, server_rx_mtu=75}"];
* @endmsc
*
* @}
* @}
*/
/**
* @addtogroup BLE_GATTS
* @{
* @defgroup BLE_GATTS_MSC Message Sequence Charts
* @{
* @defgroup BLE_GATTS_ATT_TABLE_POP_MSC GATTS ATT Table Population
* @msc
* hscale = "1.5";
* APP,SD;
* |||;
* APP=>SD [label = "sd_ble_gatts_service_add(uuid#1)"];
* APP<<SD [label = "{NRF_SUCCESS, handle_srvc#1}"];
* APP=>SD [label = "sd_ble_gatts_characteristic_add(handle_srvc#1, char_md, value)"];
* APP<<SD [label = "{NRF_SUCCESS, handle_char#1, ...}"];
* APP=>SD [label = "sd_ble_gatts_descriptor_add(handle_char#1, value)"];
* APP<<SD [label = "{NRF_SUCCESS, handle_desc#1}"];
* APP=>SD [label = "sd_ble_gatts_descriptor_add(handle_char#1, value)"];
* APP<<SD [label = "{NRF_SUCCESS, handle_desc#2}"];
* APP=>SD [label = "sd_ble_gatts_characteristic_add(handle_srvc#1, char_md, value)"];
* APP<<SD [label = "{NRF_SUCCESS, handle_char#2, ...}"];
* APP=>SD [label = "sd_ble_gatts_descriptor_add(handle_char#2, value)"];
* APP<<SD [label = "{NRF_SUCCESS, handle_desc#3}"];
* APP=>SD [label = "sd_ble_gatts_service_add(uuid#2)"];
* APP<<SD [label = "{NRF_SUCCESS, handle_srvc#2}"];
* APP=>SD [label = "sd_ble_gatts_include_add(handle_srvc#2, handle_srvc#1)"];
* APP<<SD [label = "{NRF_SUCCESS, handle_inc#1}"];
* |||;
* ...;
* |||;
* @endmsc
*
* @defgroup BLE_GATTS_READ_REQ_NO_AUTH_MSC GATTS Read Request without Authorization
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD<:PEER [label = "ATT Read Request", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Read Response", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GATTS_WRITE_REQ_NO_AUTH_MSC GATTS Write Request without Authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Value in ATT Table: current_value"];
* SD<:PEER [label = "ATT Write Request {peer_value}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Write Response", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Value in ATT Table: peer_value"];
* APP<<=SD [label = "BLE_GATTS_EVT_WRITE {WRITE_REQ, auth_required=0, peer_value}"];
* @endmsc
*
@defgroup BLE_GATTS_WRITE_CMD_NO_AUTH_MSC GATTS Write Command Without Authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Value in ATT Table: current_value"];
* SD<:PEER [label = "ATT Write Command {peer_value}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Value in ATT Table: peer_value"];
* APP<<=SD [label = "BLE_GATTS_EVT_WRITE {WRITE_CMD, auth_required=0, peer_value}"];
* @endmsc
*
* @defgroup BLE_GATTS_WRITE_CMD_AUTH_MSC GATTS Write Command With Authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Value in ATT Table: current_value"];
* SD<:PEER [label = "ATT Write Command {peer_value}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Value in ATT Table: current_value"];
* APP<<=SD [label = "BLE_GATTS_EVT_WRITE {WRITE_CMD, auth_required=1, peer_value}"];
* --- [label = " Variant #1 App Authorizes "];
* APP=>SD [label = "sd_ble_gatts_value_set(peer_value)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label="Value in ATT Table: peer_value"];
* --- [label = " Variant #2 App Authorizes but changes value "];
* APP=>SD [label = "sd_ble_gatts_value_set(app_value)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label="Value in ATT Table: app_value"];
* --- [label = " Variant #3 App ignores the incoming operation "];
* SD rbox SD [label="Value in ATT Table: current_value"];
* @endmsc
*
* @defgroup BLE_GATTS_READ_REQ_AUTH_MSC GATTS Read Request with Authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Value in ATT Table: current_value"];
* SD<:PEER [label = "ATT Read Request", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {READ, current_value}"];
* --- [label = " Variant #1 App Authorizes "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(SUCCESS, app_value)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label="Value in ATT Table: app_value"];
* SD:>PEER [label = "ATT Read Response {app_value}", textcolor="#000080", linecolor="#000080"];
* --- [label = " Variant #2 App Disallows "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(READ_NOT_PERMITTED)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Error Response", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GATTS_WRITE_REQ_AUTH_MSC GATTS Write Request with Authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Value in ATT Table: current_value"];
* SD<:PEER [label = "ATT Write Request {peer_value}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, peer_value}"];
* --- [label = " Variant #1 App Authorizes "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(SUCCESS, peer_value)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label="Value in ATT Table: peer_value"];
* SD:>PEER [label = "ATT Write Response", textcolor="#000080", linecolor="#000080"];
* --- [label = " Variant #2 App Authorizes but changes value "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(SUCCESS, app_value)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label="Value in ATT Table: app_value"];
* SD:>PEER [label = "ATT Write Response", textcolor="#000080", linecolor="#000080"];
* --- [label = " Variant #3 App Disallows "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE_NOT_PERMITTED)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label="Value in ATT Table: current_value"];
* SD:>PEER [label = "ATT Error Response", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GATTS_QUEUED_WRITE_BUF_NOAUTH_MSC GATTS Queued Writes: Stack handled, no attributes require authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_REQUEST {BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES}"];
* APP=>SD [label = "sd_ble_user_mem_reply {user_mem_block}"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #1 Attribute Values validation passed "];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: peer_value_2"];
* APP<<=SD [label = "BLE_GATTS_EVT_WRITE {EXEC_WRITE_REQ_NOW}"];
* APP rbox APP [label="App parses the memory it provided"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_RELEASE {user_mem_block}"];
* |||;
* --- [label = " Variant #2 Attribute Values validation failed "];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD:>PEER [label = "ATT Error Response {Invalid Value Length / Offset}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_RELEASE {user_mem_block}"];
* |||;
* --- [label = " Variant #3 Peer cancels operation "];
* SD<:PEER [label = "ATT Execute Write Request {CANCEL}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_RELEASE {user_mem_block}"];
* |||;
* @endmsc
*
* @defgroup BLE_GATTS_QUEUED_WRITE_BUF_AUTH_MSC GATTS Queued Writes: Stack handled, one or more attributes require authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_REQUEST {BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES}"];
* APP=>SD [label = "sd_ble_user_mem_reply {user_mem_block}"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_2, offset_2, peer_value_2}"];
* |||;
* --- [label = " Variant #1 App Authorizes both Prepare Write and Execute Write"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_NOW}"];
* APP rbox APP [label="App parses the memory it provided"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: peer_value_2"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_RELEASE {user_mem_block}"];
* |||;
* --- [label = " Variant #2 App Disallows Prepare Write and Authorizes Execute Write "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, INSUF_AUTHORIZATION)"];
* SD:>PEER [label = "ATT Error Response {Insufficient Authorization}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_NOW}"];
* APP rbox APP [label="App parses the memory it provided"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: current_value_2"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_RELEASE {user_mem_block}"];
* |||;
* --- [label = " Variant #3 App Authorizes Prepare Write and Disallows Execute Write "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_NOW}"];
* APP rbox APP [label="App parses the memory it provided"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, APP_ERROR_CODE)"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD:>PEER [label = "ATT Error Response {APP_ERROR_CODE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_RELEASE {user_mem_block}"];
* @endmsc
*
* @defgroup BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC GATTS Queued Writes: App handled, no attributes require authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_REQUEST {BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES}"];
* APP=>SD [label = "sd_ble_user_mem_reply {NULL}"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_1, offset_1, peer_value_1}"];
* APP rbox APP [label="App queues {handle_1, offset_1, peer_value_1}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS, handle_1, offset_1, peer_value_1)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_2, offset_2, peer_value_2}"];
* APP rbox APP [label="App queues {handle_2, offset_2, peer_value_2}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS, handle_2, offset_2, peer_value_2)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_NOW}"];
* |||;
* --- [label = " Variant #1 Attribute values in stack memory (VLOC_STACK), attribute values validation passed "];
* APP=>SD [label = "sd_ble_gatts_value_set {handle_1, offset_1, peer_value_1}"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gatts_value_set {handle_2, offset_2, peer_value_2}"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: peer_value_2"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #2 Attribute values in user memory (VLOC_USER), attribute values validation passed "];
* APP rbox APP [label="Application traverses its queue and executes the write operations (memcpy)"];
* APP rbox APP [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: peer_value_2"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #3 Attribute values validation failed "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, INVALID_OFFSET)"];
* APP rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD:>PEER [label = "ATT Error Response {Invalid Offset}", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
@defgroup BLE_GATTS_QUEUED_WRITE_NOBUF_PEER_CANCEL_MSC GATTS Queued Writes: App handled, peer cancels operation
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_REQUEST {BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES}"];
* APP=>SD [label = "sd_ble_user_mem_reply {NULL}"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_1, offset_1, peer_value_1}"];
* APP rbox APP [label="App queues {handle_1, offset_1, peer_value_1}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS, handle_1, offset_1, peer_value_1)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_2, offset_2, peer_value_2}"];
* APP rbox APP [label="App queues {handle_2, offset_2, peer_value_2}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS, handle_2, offset_2, peer_value_2)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {CANCEL}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_CANCEL}"];
* APP rbox APP [label="Queue Erased\nValues in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* |||;
* @endmsc
*
* @defgroup BLE_GATTS_QUEUED_WRITE_NOBUF_AUTH_MSC GATTS Queued Writes: App handled, one or more attributes require authorization
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP rbox APP [label="Values in ATT Table in user memory (VLOC_USER):\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_REQUEST {BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES}"];
* APP=>SD [label = "sd_ble_user_mem_reply {NULL}"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_1, offset_1, peer_value_1}"];
* APP rbox APP [label="App queues {handle_1, offset_1, peer_value_1}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS, handle_1, offset_1, peer_value_1)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_2, offset_2, peer_value_2}"];
* |||;
* --- [label = " Variant #1 App Authorizes both Prepare Write and Execute Write"];
* APP rbox APP [label="App queues {handle_2, offset_2, peer_value_2}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS, handle_2, offset_2, peer_value_2)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_NOW}"];
* APP rbox APP [label="Application traverses its queue and executes the write operations (memcpy)"];
* APP rbox APP [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: peer_value_2"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #2 App Disallows Prepare Write and Authorizes Execute Write "];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, INSUF_AUTHORIZATION)"];
* SD:>PEER [label = "ATT Error Response {Insufficient Authorization}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_NOW}"];
* APP rbox APP [label="Application traverses its queue and executes the write operations (memcpy)"];
* APP rbox APP [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: current_value_2"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #3 App Authorizes Prepare Write and Disallows Execute Write "];
* APP rbox APP [label="App queues {handle_2, offset_2, peer_value_2}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS, handle_2, offset_2, peer_value_2)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_NOW}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, APP_ERROR_CODE)"];
* APP rbox APP [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD:>PEER [label = "ATT Error Response {APP_ERROR_CODE}", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC GATTS Queued Writes: Prepare Queue Full
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_REQUEST {BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES}"];
* |||;
* --- [label = " Variant #1 Stack handled "];
* APP=>SD [label = "sd_ble_user_mem_reply {user_mem_block}"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Error Response {Prepare Queue Full}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: current_value_2"];
* APP<<=SD [label = "BLE_GATTS_EVT_WRITE {EXEC_WRITE_REQ_NOW}"];
* APP rbox APP [label="App parses the memory it provided"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_EVT_USER_MEM_RELEASE {user_mem_block}"];
* |||;
* --- [label = " Variant #2 App handled "];
* APP=>SD [label = "sd_ble_user_mem_reply {NULL}"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_1, offset_1, peer_value_1}"];
* APP rbox APP [label="App queues {handle_1, offset_1, peer_value_1}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS, handle_1, offset_1, peer_value_1)"];
* SD:>PEER [label = "ATT Prepare Write Response {handle_1, offset_1, peer_value_1}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Prepare Write Request {handle_2, offset_2, peer_value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, PREP_WRITE_REQ, handle_2, offset_2, peer_value_2}"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, PREPARE_QUEUE_FULL)"];
* SD:>PEER [label = "ATT Error Response {Prepare Queue Full}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST {WRITE, EXEC_WRITE_REQ_NOW}"];
* APP=>SD [label = "sd_ble_gatts_value_set {handle_1, offset_1, peer_value_1}"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_gatts_rw_authorize_reply(WRITE, SUCCESS)"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: peer_value_1\nhandle_2: current_value_2"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GATTS_QUEUED_WRITE_EXECUTE_WITHOUT_PREPARE_MSC GATTS Queued Writes: Execute Write without Prepare Write
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* |||;
* SD rbox SD [label="No ATT Prepare Write Request has been received by SD"];
* |||;
* --- [label = " Variant #1 Write cancelled "];
* SD<:PEER [label = "ATT Execute Write Request {CANCEL}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* APP<<=SD [label = "BLE_GATTS_EVT_WRITE {EXEC_WRITE_REQ_CANCEL}"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* |||;
* --- [label = " Variant #2 Write now "];
* SD<:PEER [label = "ATT Execute Write Request {WRITE}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="Values in ATT Table:\nhandle_1: current_value_1\nhandle_2: current_value_2"];
* APP<<=SD [label = "BLE_GATTS_EVT_WRITE {EXEC_WRITE_REQ_NOW}"];
* SD:>PEER [label = "ATT Execute Write Response", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GATTS_MTU_EXCHANGE GATTS ATT_MTU Exchange
* @msc
* hscale = "2";
* APP,SD,PEER;
* |||;
* APP=>SD [label = "sd_ble_cfg_set(BLE_CONN_CFG_GATT, gatt_conn_cfg.att_mtu=100)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_enable()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ...;
* |||;
* APP rbox PEER [label="Connection Established"];
* SD rbox SD [label="att_mtu=23"];
* |||;
* SD<:PEER [label = "ATT Exchange MTU Request {client_rx_mtu=80}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST {att_mtu=80}"];
* APP=>SD [label = "sd_ble_gatts_exchange_mtu_reply(conn_handle, server_rx_mtu=75)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Exchange MTU Response {server_rx_mtu=75}", textcolor="#000080", linecolor="#000080"];
* SD rbox SD [label="att_mtu=75"];
* @endmsc
*
* @defgroup BLE_GATTS_HVI_MSC GATTS Handle Value Indication
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP rbox PEER [label="Indications Enabled in CCCD"];
* |||;
* SD rbox SD [label="Value in ATT Table: current_value"];
* APP=>SD [label = "sd_ble_gatts_hvx(INDICATION, app_value)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label="Value in ATT Table: app_value"];
* SD:>PEER [label = "ATT Handle Value Indication {app_value}", textcolor="#000080", linecolor="#000080"];
* --- [label = " Variant #1 Peer Confirms "];
* SD<:PEER [label = "ATT Handle Value Confirmation", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_HVC"];
* --- [label = " Variant #2 Peer Ignores "];
* |||;
* ...;
* |||;
* SD box SD [label="Timeout"];
* APP<<=SD [label = "BLE_GATTS_EVT_TIMEOUT"];
* @endmsc
*
* @defgroup BLE_GATTS_HVN_MSC GATTS Handle Value Notification
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* --- [label = " Variant #1 App does not keep track of the available queue element count for notifications "];
* APP note PEER [label = " This variant makes it possible for APP to transmit notifications without keeping track of the available queue element count. However, successful queuing of notifications cannot be guaranteed. "];
* |||;
* APP=>SD [label = "sd_ble_enable()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox PEER [label = "Connection Established"];
* |||;
* APP rbox PEER [label = "Notifications Enabled in CCCD"];
* SD note SD [label = "Value in ATT Table: current_value"];
* |||;
* APP=>SD [label = "sd_ble_gatts_hvx(NOTIFICATION, app_value_1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD note SD [label="Value in ATT Table: app_value_1"];
* APP=>SD [label = "sd_ble_gatts_hvx(NOTIFICATION, app_value_2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD note SD [label="Value in ATT Table: app_value_2"];
* APP=>SD [label = "sd_ble_gatts_hvx(NOTIFICATION, app_value_3)"];
* APP<<SD [label = "NRF_ERROR_RESOURCES"];
* SD note SD [label = "Value in ATT Table: app_value_3"];
* |||;
* ...;
* |||;
* APP=>SD [label = "sd_ble_gatts_hvx(NOTIFICATION, app_value_4)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD rbox SD [label = "Value in ATT Table: app_value_4"];
* |||;
* SD:>PEER [label = "ATT Handle Value Notification {app_value_1}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Handle Value Notification {app_value_2}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Handle Value Notification {app_value_4}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_HVN_TX_COMPLETE {3}"];
* |||;
* --- [label = " Variant #2 App keeps track of the available queue element count for notifications "];
* APP note PEER [label = " This variant makes it possible for APP to know when successful queuing of notifications is guaranteed. "];
* |||;
* APP=>SD [label = "sd_ble_cfg_set(BLE_CONN_CFG_GATTS, gatts_conn_cfg.hvn_tx_queue_size=2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP=>SD [label = "sd_ble_enable()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* APP rbox PEER [label = "Connection Established"];
* APP abox APP [label="available_queue_element_count = 2"];
* |||;
* APP rbox PEER [label = "Notifications Enabled in CCCD"];
* SD note SD [label = "Value in ATT Table: current_value"];
* |||;
* APP=>SD [label = "sd_ble_gatts_hvx(NOTIFICATION, app_value_1)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox APP [label="available_queue_element_count--"];
* APP note APP [label="available_queue_element_count == 1"], SD note SD [label="Value in ATT Table: app_value_1"];
* APP=>SD [label = "sd_ble_gatts_hvx(NOTIFICATION, app_value_2)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox APP [label="available_queue_element_count--"];
* APP note APP [label="available_queue_element_count == 0"], SD note SD [label="Value in ATT Table: app_value_2"];
* |||;
* SD:>PEER [label = "ATT Handle Value Notification {app_value_1}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_HVN_TX_COMPLETE {1}"];
* APP abox APP [label="available_queue_element_count += 1"];
* APP=>SD [label = "sd_ble_gatts_hvx(NOTIFICATION, app_value_3)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox APP [label="available_queue_element_count--"];
* APP note APP [label="available_queue_element_count == 0"], SD note SD [label="Value in ATT Table: app_value_3"];
* |||;
* SD:>PEER [label = "ATT Handle Value Notification {app_value_2}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_HVN_TX_COMPLETE {1}"];
* APP abox APP [label="available_queue_element_count += 1"];
* APP=>SD [label = "sd_ble_gatts_hvx(NOTIFICATION, app_value_4)"];
* APP<<SD [label = "NRF_SUCCESS"];
* APP abox APP [label="available_queue_element_count--"];
* APP note APP [label="available_queue_element_count == 0"], SD note SD [label="Value in ATT Table: app_value_4"];
* |||;
* SD:>PEER [label = "ATT Handle Value Notification {app_value_3}", textcolor="#000080", linecolor="#000080"];
* SD:>PEER [label = "ATT Handle Value Notification {app_value_4}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_HVN_TX_COMPLETE {2}"];
* APP abox APP [label="available_queue_element_count += 2"];
* @endmsc
*
* @defgroup BLE_GATTS_HVX_DISABLED_MSC GATTS Handle Value Indication or Notification disabled
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP rbox PEER [label="Indications and Notifications Disabled in CCCD"];
* |||;
* SD rbox SD [label="Value in ATT Table: current_value"];
* APP=>SD [label = "sd_ble_gatts_hvx(INDICATION or NOTIFICATION, app_value)"];
* APP<<SD [label = "NRF_ERROR_INVALID_STATE"];
* SD rbox SD [label="Value in ATT Table: current_value"];
* @endmsc
*
* @defgroup BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC GATTS Handle Value Indication or Notification with System Attributes Missing
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established"];
* |||;
* APP rbox PEER [label="System Attributes Uninitialized"];
* |||;
* SD rbox SD [label="Value in ATT Table: current_value"];
* APP=>SD [label = "sd_ble_gatts_hvx(INDICATION or NOTIFICATION, app_value)"];
* APP<<SD [label = "BLE_ERROR_GATTS_SYS_ATTR_MISSING"];
* SD rbox SD [label="Value in ATT Table: current_value"];
* APP=>SD [label = "sd_ble_gatts_sys_attr_set()"];
* APP<<SD [label = "NRF_SUCCESS"];
* |||;
* ...;
* @endmsc
*
* @defgroup BLE_GATTS_SC_MSC GATTS Service Changed
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox SD [label="Entries added to the ATT Table between handles N and M"];
* |||;
* APP rbox PEER [label="Connection Established with a Bonded Peer"];
* |||;
* APP=>SD [label = "sd_ble_gatts_service_changed(N, M)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Handle Value Indication {N, M}", textcolor="#000080", linecolor="#000080"];
* SD<:PEER [label = "ATT Handle Value Confirmation", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_SC_CONFIRM"];
* |||;
* SD rbox PEER [label="Service Discovery"];
* @endmsc
*
* @defgroup BLE_GATTS_SYS_ATTRS_UNK_PEER_MSC GATTS System Attributes Handling: Unknown Peer
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established with an Unknown Peer"];
* |||;
* SD<:PEER [label = "ATT Read Request {sys_attr_handle}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_SYS_ATTR_MISSING"];
* APP=>SD [label = "sd_ble_gatts_sys_attr_set(NULL)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read Response {sys_attr_value}", textcolor="#000080", linecolor="#000080"];
* @endmsc
*
* @defgroup BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC GATTS System Attributes Handling: Bonded Peer
* @msc
* hscale = "1.5";
* APP,SD,PEER;
* |||;
* APP rbox PEER [label="Connection Established with a Bonded Peer"];
* |||;
* APP rbox PEER [label="ATT Traffic"];
* |||;
* APP rbox PEER [label="Connection Terminated"];
* APP<<=SD [label = "BLE_GAP_EVT_DISCONNECTED {reason}"];
* |||;
* APP=>SD [label = "sd_ble_gatts_sys_attr_get()"];
* APP<<SD [label = "{NRF_SUCCESS, sys_attr_data}"];
* APP rbox APP [label="Store System Attributes"];
* |||;
* APP rbox SD [label="Shut down IC"];
* |||;
* APP rbox SD [label="Power up IC"];
* |||;
* APP rbox PEER [label="Connection Established with the Bonded Peer"];
* SD<:PEER [label = "ATT Read Request {sys_attr_handle}", textcolor="#000080", linecolor="#000080"];
* APP<<=SD [label = "BLE_GATTS_EVT_SYS_ATTR_MISSING"];
* APP rbox APP [label="Load System Attributes"];
* APP=>SD [label = "sd_ble_gatts_sys_attr_set(sys_attr_data)"];
* APP<<SD [label = "NRF_SUCCESS"];
* SD:>PEER [label = "ATT Read Response {sys_attr_value}", textcolor="#000080", linecolor="#000080"];
* @endmsc
* @}
*
* @addtogroup BLE_GATTS_QUEUED_WRITES_USER_MEM User memory layout for Queued Writes
* @{
* The following table shows the memory layout used by the SoftDevice to queue a Queued Write operation (Prepare Write ATT packet) in user memory:
*
* <table style="border:1px solid black;border-collapse:collapse;">
* <caption>Queued Write</caption>
* <tr>
* <th style="border:1px solid black;padding:5px;">Parameter</th>
* <th style="border:1px solid black;padding:5px;">Size (octets)</th>
* <th style="border:1px solid black;padding:5px;">Description</th>
* </tr>
* <tr>
* <td style="border:1px solid black;padding:5px;">Handle</td>
* <td style="border:1px solid black;padding:5px;">2</td>
* <td style="border:1px solid black;padding:5px;">Attribute Handle</td>
* </tr>
* <tr>
* <td style="border:1px solid black;padding:5px;">Offset</td>
* <td style="border:1px solid black;padding:5px;">2</td>
* <td style="border:1px solid black;padding:5px;">Value Offset</td>
* </tr>
* <tr>
* <td style="border:1px solid black;padding:5px;">Length</td>
* <td style="border:1px solid black;padding:5px;">2</td>
* <td style="border:1px solid black;padding:5px;">Value Length</td>
* </tr>
* <tr>
* <td style="border:1px solid black;padding:5px;">Value</td>
* <td style="border:1px solid black;padding:5px;">Length</td>
* <td style="border:1px solid black;padding:5px;">Attribute Value</td>
* </tr>
* </table>
*
* The application can parse the array of Queued Write instances at any time, but it is recommended to do so whenever an Execute Write ATT packet
* has been received over the air. See the GATT Server Queued Writes MSCs for more details.
* The array will be terminated by an Queued Write instance with its handle set to @ref BLE_GATT_HANDLE_INVALID.
* @}
*/
/**
* @addtogroup BLE_GATTS_SYS_ATTRS_FORMAT User memory layout for System Attributes
* @{
* The following table shows the memory layout used by the SoftDevice to store a
* system attribute.
*
* <table style="border:1px solid black;border-collapse:collapse;">
* <caption>System Attribute</caption>
* <tr>
* <th style="border:1px solid black;padding:5px;">Parameter</th>
* <th style="border:1px solid black;padding:5px;">Size (octets)</th>
* <th style="border:1px solid black;padding:5px;">Description</th>
* </tr>
* <tr>
* <td style="border:1px solid black;padding:5px;">Handle</td>
* <td style="border:1px solid black;padding:5px;">2</td>
* <td style="border:1px solid black;padding:5px;">Attribute handle</td>
* </tr>
* <tr>
* <td style="border:1px solid black;padding:5px;">Length</td>
* <td style="border:1px solid black;padding:5px;">2</td>
* <td style="border:1px solid black;padding:5px;">Attribute length</td>
* </tr>
* <tr>
* <td style="border:1px solid black;padding:5px;">Data</td>
* <td style="border:1px solid black;padding:5px;">Length</td>
* <td style="border:1px solid black;padding:5px;">Attribute data</td>
* </tr>
* </table>
*
* The application can obtain an array of system attributes by using @c sd_ble_gatts_sys_attr_get().
* The array is terminated by a CRC-16-CCITT checksum of the data in the array.
* @}
* @}
*/