Skip to content

Commit

Permalink
Address BLE configuration comments
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenCY committed Aug 11, 2021
1 parent 2957ceb commit 137fd1f
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 251 deletions.
2 changes: 1 addition & 1 deletion examples/lock-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ declare_args() {
chip_print_memory_usage = false

# PIN code for PASE session establishment.
setup_pin_code = 12345678
setup_pin_code = 20202021
}

p6_sdk_sources("lock_app_sdk_sources") {
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/p6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ Once P6 is up and running, we need to set up a device controller on Raspberry Pi
- Establish the secure session over BLE.

- chip-device-ctrl > ble-scan
- chip-device-ctrl > connect -ble 3840 12345678 1234
- chip-device-ctrl > connect -ble 3840 20202021 1234

Parameters:
1. Discriminator: 3840
2. Setup-pin-code: 12345678
2. Setup-pin-code: 20202021
3. Node ID: Optional.
If not passed in this command, then it is auto-generated by the controller and
displayed in the output of connect.
Expand Down
2 changes: 0 additions & 2 deletions examples/lock-app/p6/include/BoltLockManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#pragma once

#include <stdbool.h>
#include <stdint.h>

#include "AppEvent.h"
Expand All @@ -36,7 +35,6 @@ class BoltLockManager
{
kLock = 0,
kUnlock,

KInvalid
};

Expand Down
42 changes: 1 addition & 41 deletions examples/lock-app/p6/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

// Use a default pairing code if one hasn't been provisioned in flash.
#ifndef CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 12345678
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021
#endif
#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00

Expand Down Expand Up @@ -109,43 +109,3 @@
* A size, in bytes, of the individual debug event logging buffer.
*/
#define CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE (512)

/**
* CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL
*
* The interval (in units of 0.625ms) at which the device will send BLE advertisements while
* in fast advertising mode.
*
* 40 (25ms).
*/
#define CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL 40

/**
* CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL
*
* The interval (in units of 0.625ms) at which the device will send BLE advertisements while
* in slow advertisement mode.
*
* 800 (500ms).
*/
#define CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL 800

/**
* CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT
*
* The amount of time in miliseconds after which BLE should change his advertisements
* from fast interval to slow interval.
*
* 30000 (30 secondes).
*/
#define CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT (30 * 1000)

/**
* CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT
*
* The amount of time in miliseconds after which BLE advertisement should be disabled, counting
* from the moment of slow advertisement commencement.
*
* Defaults to 9000000 (15 minutes).
*/
#define CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT (15 * 60 * 1000)
2 changes: 1 addition & 1 deletion integrations/docker/images/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.35
0.4.36
4 changes: 2 additions & 2 deletions src/platform/P6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ static_library("P6") {
"WarmPlatformConfig.h",
"app_platform_cfg.c",
"app_platform_cfg.h",
"cycfg_bt_settings.c",
"cycfg_bt_settings.cpp",
"cycfg_bt_settings.h",
"cycfg_gap.c",
"cycfg_gap.cpp",
"cycfg_gap.h",
"cycfg_gatt_db.c",
"cycfg_gatt_db.h",
Expand Down
4 changes: 2 additions & 2 deletions src/platform/P6/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ void ConnectivityManagerImpl::_OnWiFiStationProvisionChange()
SystemLayer.ScheduleWork(DriveStationState, NULL);
}

void ConnectivityManagerImpl::DriveStationState(::chip::System::Layer * aLayer, void * aAppState, ::CHIP_ERROR aError)
void ConnectivityManagerImpl::DriveStationState(::chip::System::Layer * aLayer, void * aAppState)
{
sInstance.DriveStationState();
}

void ConnectivityManagerImpl::DriveAPState(::chip::System::Layer * aLayer, void * aAppState, ::CHIP_ERROR aError)
void ConnectivityManagerImpl::DriveAPState(::chip::System::Layer * aLayer, void * aAppState)
{
sInstance.DriveAPState();
}
Expand Down
4 changes: 2 additions & 2 deletions src/platform/P6/ConnectivityManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ class ConnectivityManagerImpl final : public ConnectivityManager,
BitFlags<Flags> mFlags;
bool eventcallback;

static void DriveStationState(::chip::System::Layer * aLayer, void * aAppState, ::CHIP_ERROR aError);
static void DriveAPState(::chip::System::Layer * aLayer, void * aAppState, ::CHIP_ERROR aError);
static void DriveStationState(::chip::System::Layer * aLayer, void * aAppState);
static void DriveAPState(::chip::System::Layer * aLayer, void * aAppState);
void DriveStationState(void);
void DriveAPState(void);
CHIP_ERROR ConfigureWiFiAP(void);
Expand Down
99 changes: 0 additions & 99 deletions src/platform/P6/GroupKeyStoreImpl.cpp

This file was deleted.

87 changes: 0 additions & 87 deletions src/platform/P6/GroupKeyStoreImpl.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
* Runtime Bluetooth stack configuration parameters.
*
*******************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif

#include "cycfg_bt_settings.h"
#include "cycfg_gap.h"

Expand Down Expand Up @@ -288,3 +292,7 @@ const wiced_bt_cfg_settings_t wiced_bt_cfg_settings =
.default_ble_power_level = CY_BT_TX_POWER /* Default LE power level */
};
#endif

#ifdef __cplusplus
}
#endif
12 changes: 6 additions & 6 deletions src/platform/P6/cycfg_gap.c → src/platform/P6/cycfg_gap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ const uint8_t cy_bt_adv_packet_elem_2[16] = { 0x5B, 0x19, 0xBA, 0xE4, 0
wiced_bt_ble_advert_elem_t cy_bt_adv_packet_data[] = {
/* Flags */
{
.advert_type = BTM_BLE_ADVERT_TYPE_FLAG,
.len = 1,
.p_data = (uint8_t *) cy_bt_adv_packet_elem_0,
.len = 1,
.advert_type = BTM_BLE_ADVERT_TYPE_FLAG,
},
/* Complete local name */
{
.advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE,
.len = 7,
.p_data = (uint8_t *) cy_bt_adv_packet_elem_1,
.len = 7,
.advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE,
},
/* Complete list of 128-bit UUIDs available */
{
.advert_type = BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE,
.len = 16,
.p_data = (uint8_t *) cy_bt_adv_packet_elem_2,
.len = 16,
.advert_type = BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE,
},
};
14 changes: 8 additions & 6 deletions src/platform/P6/cycfg_gap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "cycfg_gatt_db.h"
#include "stdint.h"
#include "wiced_bt_ble.h"
#include <platform/CHIPDeviceConfig.h>

/* Silicon generated 'Company assigned' part of device address */
#define CY_BT_SILICON_DEVICE_ADDRESS_EN 0
Expand Down Expand Up @@ -65,13 +66,14 @@
/* Advertisement settings */
#define CY_BT_CHANNEL_MAP (BTM_BLE_ADVERT_CHNL_37 | BTM_BLE_ADVERT_CHNL_38 | BTM_BLE_ADVERT_CHNL_39)

#define CY_BT_HIGH_DUTY_ADV_MIN_INTERVAL 48
#define CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL 48
#define CY_BT_HIGH_DUTY_ADV_DURATION 60
#define CY_BT_HIGH_DUTY_ADV_MIN_INTERVAL CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MIN
#define CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MAX
#define CY_BT_HIGH_DUTY_ADV_DURATION CHIP_DEVICE_CONFIG_BLE_ADVERTISING_INTERVAL_CHANGE_TIME / 1000

#define CY_BT_LOW_DUTY_ADV_MIN_INTERVAL 1638
#define CY_BT_LOW_DUTY_ADV_MAX_INTERVAL 1638
#define CY_BT_LOW_DUTY_ADV_DURATION 30
#define CY_BT_LOW_DUTY_ADV_MIN_INTERVAL CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MIN
#define CY_BT_LOW_DUTY_ADV_MAX_INTERVAL CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX
#define CY_BT_LOW_DUTY_ADV_DURATION \
(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_TIMEOUT - CHIP_DEVICE_CONFIG_BLE_ADVERTISING_INTERVAL_CHANGE_TIME) / 1000

#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL 400
#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL 800
Expand Down

0 comments on commit 137fd1f

Please sign in to comment.