apache-mynewt-bot commented on PR #1372: URL: https://github.com/apache/mynewt-nimble/pull/1372#issuecomment-1259428694
<!-- style-bot --> ## Style check summary ### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md) #### apps/privacy_central/src/main.c <details> ```diff @@ -82,64 +82,64 @@ { static struct ble_gap_conn_desc conn_desc; switch (event->type) { - case BLE_GAP_EVENT_CONNECT: - if (event->connect.status == 0) { - console_printf("Connection was established\n"); - conn_handle = event->connect.conn_handle; - /* - * This function initiates the pairing if the devices are not - * bonded yet or starts encryption if they are. - */ - ble_gap_security_initiate(event->connect.conn_handle); - } else { - console_printf("Connection failed, error code: %i\n", + case BLE_GAP_EVENT_CONNECT: + if (event->connect.status == 0) { + console_printf("Connection was established\n"); + conn_handle = event->connect.conn_handle; + /* + * This function initiates the pairing if the devices are not + * bonded yet or starts encryption if they are. + */ + ble_gap_security_initiate(event->connect.conn_handle); + } else { + console_printf("Connection failed, error code: %i\n", event->connect.status); - } - break; - case BLE_GAP_EVENT_DISCONNECT: - console_printf("Disconnected, reason code: %i\n", + } + break; + case BLE_GAP_EVENT_DISCONNECT: + console_printf("Disconnected, reason code: %i\n", event->disconnect.reason); - /* - * After disconnecting peer's identity should be resolved, - * so we can connect directly to it. - */ - ble_gap_connect(g_own_addr_type, &peer_id_addr, 10000, + /* + * After disconnecting peer's identity should be resolved, + * so we can connect directly to it. + */ + ble_gap_connect(g_own_addr_type, &peer_id_addr, 10000, NULL, conn_event, NULL); - break; - case BLE_GAP_EVENT_PASSKEY_ACTION: - console_printf("passkey action event; action=%d\n", + break; + case BLE_GAP_EVENT_PASSKEY_ACTION: + console_printf("passkey action event; action=%d\n", event->passkey.params.action); - if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) { - console_printf("Confirm or deny key: %lu\n", - (unsigned long) event->passkey.params.numcmp); - } - break; - case BLE_GAP_EVENT_PARING_COMPLETE: - console_printf("Pairing attempt finished, pairing %s\n", + if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) { + console_printf("Confirm or deny key: %lu\n", + (unsigned long) event->passkey.params.numcmp); + } + break; + case BLE_GAP_EVENT_PARING_COMPLETE: + console_printf("Pairing attempt finished, pairing %s\n", event->pairing_complete.status == 0 ? "successful" : "failed"); + ble_gap_terminate(event->connect.conn_handle, 0x13); + break; + case BLE_GAP_EVENT_ENC_CHANGE: + console_printf("Encryption change, status: %d\n", + event->enc_change.status); + /* + * If the user does not confirm or deny the passkeys + * at a given time, encryption change will be timed out. + * In that case we disconnect. + */ + if (event->enc_change.status == BLE_HS_ETIMEOUT) { ble_gap_terminate(event->connect.conn_handle, 0x13); - break; - case BLE_GAP_EVENT_ENC_CHANGE: - console_printf("Encryption change, status: %d\n", - event->enc_change.status); - /* - * If the user does not confirm or deny the passkeys - * at a given time, encryption change will be timed out. - * In that case we disconnect. - */ - if (event->enc_change.status == BLE_HS_ETIMEOUT) { - ble_gap_terminate(event->connect.conn_handle, 0x13); - } - break; - case BLE_GAP_EVENT_IDENTITY_RESOLVED: - console_printf("Identity resolved\n"); - ble_gap_conn_find(event->identity_resolved.conn_handle, &conn_desc); - peer_id_addr = conn_desc.peer_id_addr; - break; - default: - MODLOG_DFLT(ERROR, "GAP event not handled," + } + break; + case BLE_GAP_EVENT_IDENTITY_RESOLVED: + console_printf("Identity resolved\n"); + ble_gap_conn_find(event->identity_resolved.conn_handle, &conn_desc); + peer_id_addr = conn_desc.peer_id_addr; + break; + default: + MODLOG_DFLT(ERROR, "GAP event not handled," "event code: %u\n", event->type); - break; + break; } return 0; } @@ -149,7 +149,7 @@ { /* predef_uuid stores information about UUID of device that we connect to */ const ble_uuid128_t predef_uuid = - BLE_UUID128_INIT(0x92, 0x98, 0xae, 0x44, 0x47, 0x90, 0xfa, 0x83, + BLE_UUID128_INIT(0x92, 0x98, 0xae, 0x44, 0x47, 0x90, 0xfa, 0x83, 0x32, 0x4c, 0xb5, 0xaa, 0x6f, 0xaa, 0x8c, 0x72); struct ble_hs_adv_fields parsed_fields; int uuid_cmp_result; ``` </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
