/* Deletes all objects from the BLE host store. */
int ble_store_clear(void)
/* Deletes all objects from the BLE host store. */
int ble_store_clear(void)
{
    const uint8_t obj_types[] = {
        BLE_STORE_OBJ_TYPE_OUR_SEC,
        BLE_STORE_OBJ_TYPE_PEER_SEC,
        BLE_STORE_OBJ_TYPE_CCCD,
    };
    union ble_store_key key;
    int obj_type;
    int rc;
    int i;
    memset(&key, 0, sizeof key);
    for (i = 0; i < sizeof obj_types / sizeof obj_types[0]; i++) {
        obj_type = obj_types[i];
        do {
            rc = ble_store_delete(obj_type, &key);
        } while (rc == 0);
        if (rc != BLE_HS_ENOENT) {
            return rc;
        }
    }
    return 0;
}