diff --git a/BUILD.gn b/BUILD.gn
index 93b78b19ad3085..5fe7f008e7ac14 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -222,7 +222,6 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {
# Build the p6 lock app example.
enable_p6_lock_app_build = enable_p6_builds
-
# Build the qpgxxxx lock app example.
enable_qpg_lock_app_build = enable_qpg_builds && !is_debug
diff --git a/config/p6/toolchain/BUILD.gn b/config/p6/toolchain/BUILD.gn
index 82efe2cb30bcc4..fac6c94e118cb2 100644
--- a/config/p6/toolchain/BUILD.gn
+++ b/config/p6/toolchain/BUILD.gn
@@ -24,4 +24,3 @@ arm_toolchain("p6_lock_app") {
treat_warnings_as_errors = false
}
}
-
diff --git a/examples/lock-app/p6/BUILD.gn b/examples/lock-app/p6/BUILD.gn
index 3f3525fd0ff391..c8be4368e95ef3 100644
--- a/examples/lock-app/p6/BUILD.gn
+++ b/examples/lock-app/p6/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Project CHIP Authors
+# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -44,13 +44,9 @@ p6_sdk_sources("lock_app_sdk_sources") {
"CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}",
]
- sources = [
- "${p6_project_dir}/include/CHIPProjectConfig.h",
- #"${p6_project_dir}/include/FreeRTOSConfig.h",
- ]
+ sources = [ "${p6_project_dir}/include/CHIPProjectConfig.h" ]
- public_configs = ["${chip_root}/third_party/p6:p6_sdk_config"]
- #public_configs += ["${chip_root}/third_party/p6:project_configs"]
+ public_configs = [ "${chip_root}/third_party/p6:p6_sdk_config" ]
}
p6_executable("lock_app") {
@@ -80,14 +76,13 @@ p6_executable("lock_app") {
sources = [
"${examples_plat_dir}/LEDWidget.cpp",
- "${examples_plat_dir}/Service.cpp",
"${examples_plat_dir}/init_p6Platform.cpp",
+ "${p6_project_dir}/include/CHIPProjectConfig.h",
"src/AppTask.cpp",
"src/BoltLockManager.cpp",
"src/ButtonHandler.cpp",
"src/ZclCallbacks.cpp",
"src/main.cpp",
- "${p6_project_dir}/include/CHIPProjectConfig.h",
]
output_dir = root_out_dir
diff --git a/examples/lock-app/p6/README.md b/examples/lock-app/p6/README.md
index ab89303dd7d062..0f5a5f5d5a19d8 100644
--- a/examples/lock-app/p6/README.md
+++ b/examples/lock-app/p6/README.md
@@ -21,21 +21,24 @@ An example showing the use of Matter on the Infineon CY8CKIT-062S2-43012 board.
## Introduction
The P6 lock example provides a demonstration of a door lock control device,
-built using Matter and the Infineon Modustoolbox SDK. It can be controlled by
-a Matter controller over Wi-Fi network.
+built using Matter and the Infineon Modustoolbox SDK. It can be controlled by a
+Matter controller over Wi-Fi network.
-The P6 device can be commissioned over Bluetooth Low Energy where the device
-and the Matter controller will exchange security information with the Rendezvous
-procedure. Wi-Fi Network credentials are then provided to the P6 device
-which will then join the network.
+The P6 device can be commissioned over Bluetooth Low Energy where the device and
+the Matter controller will exchange security information with the Rendezvous
+procedure. Wi-Fi Network credentials are then provided to the P6 device which
+will then join the network.
## Building
-- Download [Modustoolbox Software](https://www.cypress.com/products/modustoolbox)
-- Install some additional tools (likely already present for Matter developers):
- $ sudo apt install gcc g++ clang ninja-build python python3-venv libssl-dev libavahi-client-dev libglib2.0-dev git cmake python3-pip
+- Download
+ [Modustoolbox Software](https://www.cypress.com/products/modustoolbox)
+- Install some additional tools (likely already present for Matter
+ developers): \$ sudo apt install gcc g++ clang ninja-build python
+ python3-venv libssl-dev libavahi-client-dev libglib2.0-dev git cmake
+ python3-pip
- Supported hardware:
[CY8CKIT-062S2-43012](https://www.cypress.com/CY8CKIT-062S2-43012)
@@ -50,30 +53,31 @@ which will then join the network.
$ cd ~/connectedhomeip
$ rm -rf out/
-
## Flashing the Application
-- Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the `MODE SELECT`
- button. `KITPROG3 STATUS` LED is ON confirms board is in proper mode.
+- Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the
+ `MODE SELECT` button. `KITPROG3 STATUS` LED is ON confirms board is in
+ proper mode.
- On the command line:
$ cd ~/connectedhomeip
$ python3 out/debug/p6_lock_app/chip-p6-lock-example.flash.py
-
+
## Commissioning and cluster control
+
Commissioning can be carried out using BLE.
### Setting up Python Controller
-Once P6 is up and running, we need to set up a device controller on Raspberry Pi 4 to perform
-commissioning and cluster control.
+Once P6 is up and running, we need to set up a device controller on Raspberry Pi
+4 to perform commissioning and cluster control.
- Set up python controller.
@@ -84,7 +88,7 @@ commissioning and cluster control.
$ source ./out/python_env/bin/activate
$ chip-device-ctrl
-
+
### Commissioning over BLE
@@ -104,9 +108,9 @@ commissioning and cluster control.
We have chosen a random node ID which is 1234.
- Add credentials of the Wi-Fi network you want the P6 to connect to, using
- the `AddWiFiNetwork` command and then enable the P6 to connect to it
- using `EnableWiFiNetwork` command. In this example, we have used `WIFI_SSID`
- and `WIFI_PASSWORD` as the SSID and passphrase respectively.
+ the `AddWiFiNetwork` command and then enable the P6 to connect to it using
+ `EnableWiFiNetwork` command. In this example, we have used `WIFI_SSID` and
+ `WIFI_PASSWORD` as the SSID and passphrase respectively.
- chip-device-ctrl > zcl NetworkCommissioning AddWiFiNetwork 1234 0 0 ssid=str:WIFI_SSID credentials=str:WIFI_PASSWORD breadcrumb=0 timeoutMs=1000
@@ -123,8 +127,9 @@ commissioning and cluster control.
#### Notes
-Raspberry Pi 4 BLE connection issues can be avoided by running the following commands.
-These power cycle the BlueTooth hardware and disable BR/EDR mode.
+
+Raspberry Pi 4 BLE connection issues can be avoided by running the following
+commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.
$ sudo btmgmt -i hci0 power off
$ sudo btmgmt -i hci0 bredr off
@@ -141,9 +146,8 @@ These power cycle the BlueTooth hardware and disable BR/EDR mode.
`chip-device-ctrl > zcl OnOff On 1234 1 0`
-- Cluster OnOff can also be done using the `USER_BTN1` button on the board. This
- button is configured with `APP_LOCK_BUTTON` in `include/AppConfig.h`. Press
- `USER_BTN1` on the board to toggle between lock and unlock states. The
- Lock/Unlock status of door can be observed with 'LED9' on the board. This LED
- is configured with `LOCK_STATE_LED` in `include/AppConfig.h`.
-
+- Cluster OnOff can also be done using the `USER_BTN1` button on the board.
+ This button is configured with `APP_LOCK_BUTTON` in `include/AppConfig.h`.
+ Press `USER_BTN1` on the board to toggle between lock and unlock states. The
+ Lock/Unlock status of door can be observed with 'LED9' on the board. This
+ LED is configured with `LOCK_STATE_LED` in `include/AppConfig.h`.
diff --git a/examples/lock-app/p6/args.gni b/examples/lock-app/p6/args.gni
index a87d3ad8b99e2e..86b71606eb7c53 100644
--- a/examples/lock-app/p6/args.gni
+++ b/examples/lock-app/p6/args.gni
@@ -16,5 +16,5 @@ import("//build_overrides/chip.gni")
import("//build_overrides/pigweed.gni")
import("${chip_root}/src/platform/P6/args.gni")
-p6_target_project = get_label_info(":lock_app_sdk_sources", "label_no_toolchain")
-
+p6_target_project =
+ get_label_info(":lock_app_sdk_sources", "label_no_toolchain")
diff --git a/examples/lock-app/p6/include/AppConfig.h b/examples/lock-app/p6/include/AppConfig.h
old mode 100755
new mode 100644
index dccd73ae5b8370..a711c21097ccb7
--- a/examples/lock-app/p6/include/AppConfig.h
+++ b/examples/lock-app/p6/include/AppConfig.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
@@ -58,7 +58,7 @@ extern "C" {
void appError(int err);
void P6Log(const char * aFormat, ...);
-#define P6_LOG(...) P6Log(__VA_ARGS__)
+#define P6_LOG(...) P6Log(__VA_ARGS__)
#ifdef __cplusplus
}
diff --git a/examples/lock-app/p6/include/AppEvent.h b/examples/lock-app/p6/include/AppEvent.h
index 6ccad9021736a9..0024c8e54bc9e0 100644
--- a/examples/lock-app/p6/include/AppEvent.h
+++ b/examples/lock-app/p6/include/AppEvent.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/examples/lock-app/p6/include/AppTask.h b/examples/lock-app/p6/include/AppTask.h
index 0a01b1eb09f3a0..4108c8c20dbd0f 100755
--- a/examples/lock-app/p6/include/AppTask.h
+++ b/examples/lock-app/p6/include/AppTask.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
@@ -41,6 +41,7 @@ class AppTask
void PostEvent(const AppEvent * event);
void ButtonEventHandler(uint8_t btnIdx, uint8_t btnAction);
+ void UpdateClusterState(void);
private:
friend AppTask & GetAppTask(void);
@@ -59,8 +60,6 @@ class AppTask
static void LockActionEventHandler(AppEvent * aEvent);
static void TimerEventHandler(TimerHandle_t xTimer);
- static void UpdateClusterState(void);
-
void StartTimer(uint32_t aTimeoutMs);
enum Function_t
diff --git a/examples/lock-app/p6/include/BoltLockManager.h b/examples/lock-app/p6/include/BoltLockManager.h
index 84466db6ad4098..26f9c201fa8892 100644
--- a/examples/lock-app/p6/include/BoltLockManager.h
+++ b/examples/lock-app/p6/include/BoltLockManager.h
@@ -1,5 +1,6 @@
/*
*
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
diff --git a/examples/lock-app/p6/include/ButtonHandler.h b/examples/lock-app/p6/include/ButtonHandler.h
index eaa22648cf44bf..8334a7a7f61e56 100644
--- a/examples/lock-app/p6/include/ButtonHandler.h
+++ b/examples/lock-app/p6/include/ButtonHandler.h
@@ -21,9 +21,10 @@
#include
#include "FreeRTOS.h"
+#include "cyhal.h"
#include "timers.h" // provides FreeRTOS timer support
-#define GPIO_INTERRUPT_PRIORITY (5)
+#define GPIO_INTERRUPT_PRIORITY (5)
class ButtonHandler
{
@@ -32,7 +33,7 @@ class ButtonHandler
private:
static void GpioInit(void);
- static void lockbuttonIsr(void *handler_arg, cyhal_gpio_event_t event);
- static void functionbuttonIsr(void *handler_arg, cyhal_gpio_event_t event);
+ static void lockbuttonIsr(void * handler_arg, cyhal_gpio_event_t event);
+ static void functionbuttonIsr(void * handler_arg, cyhal_gpio_event_t event);
static void TimerCallback(TimerHandle_t xTimer);
};
diff --git a/examples/lock-app/p6/include/CHIPProjectConfig.h b/examples/lock-app/p6/include/CHIPProjectConfig.h
index 04c658da361ab3..ff31e318f76f05 100644
--- a/examples/lock-app/p6/include/CHIPProjectConfig.h
+++ b/examples/lock-app/p6/include/CHIPProjectConfig.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
diff --git a/examples/lock-app/p6/src/AppTask.cpp b/examples/lock-app/p6/src/AppTask.cpp
old mode 100755
new mode 100644
index 5d65117a7fc774..43618f7cfd3e6b
--- a/examples/lock-app/p6/src/AppTask.cpp
+++ b/examples/lock-app/p6/src/AppTask.cpp
@@ -1,7 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
- * Copyright (c) 2019 Google LLC.
+ * Copyright (c) 2021 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,25 +24,19 @@
#include "LEDWidget.h"
#include "OnboardingCodesUtil.h"
#include "Server.h"
-#include "Service.h"
#include "qrcodegen.h"
#include
#include
#include
+#include
#include
#include
#include
#include
+#include
+#include
#include
#include
-#include
-#if CHIP_ENABLE_OPENTHREAD
-#include
-#include
-#include
-#endif
-#include
-#include
#define FACTORY_RESET_TRIGGER_TIMEOUT 3000
#define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 3000
@@ -52,7 +45,7 @@
#define APP_EVENT_QUEUE_SIZE 10
namespace {
-
+
TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer.
static TaskHandle_t sAppTaskHandle;
@@ -69,7 +62,7 @@ static bool sHaveServiceConnectivity = false;
StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)];
StaticTask_t appTaskStruct;
-}
+} // namespace
using namespace chip::TLV;
using namespace ::chip::DeviceLayer;
@@ -96,8 +89,6 @@ int AppTask::StartAppTask()
return err;
}
-
-
int AppTask::Init()
{
CHIP_ERROR err = CHIP_NO_ERROR;
@@ -172,7 +163,6 @@ void AppTask::AppTaskMain(void * pvParameter)
}
P6_LOG("App Task started");
- SetDeviceName("P6LockDemo._chip._udp.local.");
while (true)
{
@@ -217,8 +207,7 @@ void AppTask::AppTaskMain(void * pvParameter)
{
sStatusLED.Set(true);
}
- else if (sIsWiFiStationEnabled && sIsWiFiStationProvisioned &&
- (!sIsWiFiStationConnected || !sHaveServiceConnectivity))
+ else if (sIsWiFiStationEnabled && sIsWiFiStationProvisioned && (!sIsWiFiStationConnected || !sHaveServiceConnectivity))
{
sStatusLED.Blink(950, 50);
}
@@ -461,7 +450,7 @@ void AppTask::ActionCompleted(BoltLockManager::Action_t aAction)
if (sAppTask.mSyncClusterToButtonAction)
{
- UpdateClusterState();
+ sAppTask.UpdateClusterState();
sAppTask.mSyncClusterToButtonAction = false;
}
}
@@ -504,8 +493,8 @@ void AppTask::UpdateClusterState(void)
uint8_t newValue = !BoltLockMgr().IsUnlocked();
// write the new on/off value
- EmberAfStatus status = emberAfWriteAttribute(1, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
- (uint8_t *) &newValue, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
+ EmberAfStatus status = emberAfWriteAttribute(1, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, CLUSTER_MASK_SERVER, &newValue,
+ ZCL_BOOLEAN_ATTRIBUTE_TYPE);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
P6_LOG("ERR: updating on/off %x", status);
@@ -518,5 +507,5 @@ void vApplicationStackOverflowHook(TaskHandle_t pxTask, char * pcTaskName)
/* Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
function is called if a stack overflow is detected. */
- printf( "ERROR: stack overflow with task %s\r\n", pcTaskName );
+ printf("ERROR: stack overflow with task %s\r\n", pcTaskName);
}
diff --git a/examples/lock-app/p6/src/BoltLockManager.cpp b/examples/lock-app/p6/src/BoltLockManager.cpp
index 188d53fb887c6b..3477dca315be7a 100644
--- a/examples/lock-app/p6/src/BoltLockManager.cpp
+++ b/examples/lock-app/p6/src/BoltLockManager.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
@@ -219,8 +219,7 @@ void BoltLockManager::ActuatorMovementTimerEventHandler(AppEvent * aEvent)
lock->mAutoLockTimerArmed = true;
- P6_LOG("Auto Re-lock enabled. Will be triggered in %lu seconds",
- lock->mAutoLockDuration);
+ P6_LOG("Auto Re-lock enabled. Will be triggered in %lu seconds", lock->mAutoLockDuration);
}
}
}
diff --git a/examples/lock-app/p6/src/ButtonHandler.cpp b/examples/lock-app/p6/src/ButtonHandler.cpp
index 925f2449284e5b..3d226048ca91fc 100644
--- a/examples/lock-app/p6/src/ButtonHandler.cpp
+++ b/examples/lock-app/p6/src/ButtonHandler.cpp
@@ -16,13 +16,13 @@
* limitations under the License.
*/
-#include "AppConfig.h"
#include "ButtonHandler.h"
+#include "AppConfig.h"
#include "AppTask.h"
-#define BUTTON_COUNT 2
+#define BUTTON_COUNT 2
-TimerHandle_t buttonTimers[BUTTON_COUNT]; // FreeRTOS timers used for debouncing
+TimerHandle_t buttonTimers[BUTTON_COUNT]; // FreeRTOS timers used for debouncing
// buttons. Array to hold handles to
// the created timers.
@@ -47,12 +47,12 @@ void ButtonHandler::GpioInit(void)
cy_rslt_t result = CY_RSLT_SUCCESS;
// Set up button GPIOs to input with pullups.
result = cyhal_gpio_init(APP_LOCK_BUTTON, CYHAL_GPIO_DIR_INPUT, CYHAL_GPIO_DRIVE_PULLUP, CYBSP_BTN_OFF);
- if(result != CY_RSLT_SUCCESS)
+ if (result != CY_RSLT_SUCCESS)
{
printf(" cyhal_gpio_init failed for APP_LOCK_BUTTON\r\n");
}
result = cyhal_gpio_init(APP_FUNCTION_BUTTON, CYHAL_GPIO_DIR_INPUT, CYHAL_GPIO_DRIVE_PULLUP, CYBSP_BTN_OFF);
- if(result != CY_RSLT_SUCCESS)
+ if (result != CY_RSLT_SUCCESS)
{
printf(" cyhal_gpio_init failed for APP_FUNCTION_BUTTON\r\n");
}
@@ -62,13 +62,13 @@ void ButtonHandler::GpioInit(void)
cyhal_gpio_enable_event(APP_LOCK_BUTTON, CYHAL_GPIO_IRQ_FALL, GPIO_INTERRUPT_PRIORITY, true);
cyhal_gpio_enable_event(APP_FUNCTION_BUTTON, CYHAL_GPIO_IRQ_FALL, GPIO_INTERRUPT_PRIORITY, true);
}
-void ButtonHandler::lockbuttonIsr(void *handler_arg, cyhal_gpio_event_t event)
+void ButtonHandler::lockbuttonIsr(void * handler_arg, cyhal_gpio_event_t event)
{
portBASE_TYPE taskWoken = pdFALSE;
xTimerStartFromISR(buttonTimers[APP_LOCK_BUTTON_IDX], &taskWoken);
}
-void ButtonHandler::functionbuttonIsr(void *handler_arg, cyhal_gpio_event_t event)
+void ButtonHandler::functionbuttonIsr(void * handler_arg, cyhal_gpio_event_t event)
{
portBASE_TYPE taskWoken = pdFALSE;
xTimerStartFromISR(buttonTimers[APP_FUNCTION_BUTTON_IDX], &taskWoken);
@@ -79,8 +79,8 @@ void ButtonHandler::TimerCallback(TimerHandle_t xTimer)
// Get the button index of the expired timer and call button event helper.
uint32_t timerId;
uint8_t buttonevent = 0;
- timerId = (uint32_t) pvTimerGetTimerID(xTimer);
- if(timerId)
+ timerId = (uint32_t) pvTimerGetTimerID(xTimer);
+ if (timerId)
{
buttonevent = cyhal_gpio_read(APP_FUNCTION_BUTTON);
}
diff --git a/examples/lock-app/p6/src/ZclCallbacks.cpp b/examples/lock-app/p6/src/ZclCallbacks.cpp
old mode 100755
new mode 100644
index f90ac6388875b5..2156c9475a91ce
--- a/examples/lock-app/p6/src/ZclCallbacks.cpp
+++ b/examples/lock-app/p6/src/ZclCallbacks.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,14 +21,15 @@
*/
#include "AppConfig.h"
+#include "AppTask.h"
#include "BoltLockManager.h"
#include
+#include
+#include
#include
#include
#include
-#include
-#include
using namespace ::chip;
@@ -74,5 +75,5 @@ void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId
*/
void emberAfOnOffClusterInitCallback(EndpointId endpoint)
{
- // TODO: implement any additional Cluster Server init actions
+ GetAppTask().UpdateClusterState();
}
diff --git a/examples/lock-app/p6/src/main.cpp b/examples/lock-app/p6/src/main.cpp
old mode 100755
new mode 100644
index 7dfe634682bcd3..7abd1bd194a9c2
--- a/examples/lock-app/p6/src/main.cpp
+++ b/examples/lock-app/p6/src/main.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
@@ -25,7 +25,6 @@
#include
#include
-#include
#include
#include
@@ -38,19 +37,6 @@
#include "DataModelHandler.h"
#include "Server.h"
#include "init_p6Platform.h"
-#if CHIP_ENABLE_OPENTHREAD
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#endif // CHIP_ENABLE_OPENTHREAD
using namespace ::chip;
using namespace ::chip::Inet;
@@ -74,7 +60,6 @@ void appError(int err)
extern "C" void vApplicationIdleHook(void)
{
// FreeRTOS Idle callback
-
}
// ================================================================================
@@ -91,7 +76,7 @@ int main(void)
// Init Chip memory management before the stack
chip::Platform::MemoryInit();
- //chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init();
+ // chip::DeviceLayer::PersistedStorage::KeyValueStoreMgrImpl().Init();
ret = PlatformMgr().InitChipStack();
if (ret != CHIP_NO_ERROR)
@@ -117,7 +102,7 @@ int main(void)
vTaskStartScheduler();
chip::Platform::MemoryShutdown();
-
+
// Should never get here.
P6_LOG("vTaskStartScheduler() failed");
appError(ret);
diff --git a/examples/platform/p6/LEDWidget.cpp b/examples/platform/p6/LEDWidget.cpp
index a0cb23c62faf36..6d428f47fd2269 100644
--- a/examples/platform/p6/LEDWidget.cpp
+++ b/examples/platform/p6/LEDWidget.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
@@ -19,9 +19,9 @@
#include "LEDWidget.h"
-#include
#include "cybsp.h"
#include "cyhal.h"
+#include
void LEDWidget::Init(int ledNum)
{
@@ -31,7 +31,7 @@ void LEDWidget::Init(int ledNum)
mLedNum = ledNum;
mState = CYBSP_LED_STATE_OFF;
- cyhal_gpio_init((cyhal_gpio_t)ledNum, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_OFF);
+ cyhal_gpio_init((cyhal_gpio_t) ledNum, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_OFF);
}
void LEDWidget::Invert(void)
@@ -77,7 +77,7 @@ void LEDWidget::DoSet(bool state)
{
if (mState != state)
{
- cyhal_gpio_write((cyhal_gpio_t)mLedNum, ((state) ? CYBSP_LED_STATE_ON : CYBSP_LED_STATE_OFF));
+ cyhal_gpio_write((cyhal_gpio_t) mLedNum, ((state) ? CYBSP_LED_STATE_ON : CYBSP_LED_STATE_OFF));
}
mState = state;
}
diff --git a/examples/platform/p6/LEDWidget.h b/examples/platform/p6/LEDWidget.h
index be2185ae1e4967..7bf5963d390ee4 100644
--- a/examples/platform/p6/LEDWidget.h
+++ b/examples/platform/p6/LEDWidget.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
diff --git a/examples/platform/p6/Service.cpp b/examples/platform/p6/Service.cpp
deleted file mode 100644
index 70cf5eb72511c0..00000000000000
--- a/examples/platform/p6/Service.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *
- * Copyright (c) 2020 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Service.h"
-
-#include "AppConfig.h"
-#include "FreeRTOS.h"
-#include "task.h"
-#include
-#include
-
-#include "lwip/err.h"
-#include "lwip/sockets.h"
-#include "lwip/sys.h"
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if CHIP_ENABLE_OPENTHREAD
-#include
-#include
-#include
-#include
-#include
-#include
-#endif
-
-using namespace ::chip;
-using namespace ::chip::Inet;
-using namespace ::chip::Transport;
-using namespace ::chip::DeviceLayer;
-
-static char sDeviceName[128] = { 0 };
-// Hardcode UDP BroadcastPort. Temporary use for demo with OTBR
-constexpr uint16_t kUDPBroadcastPort = 23367;
-
-void SetDeviceName(const char * newDeviceName)
-{
- strncpy(sDeviceName, newDeviceName, sizeof(sDeviceName) - 1);
-}
-
-void PublishService()
-{
- /*
- chip::Inet::IPAddress addr;
- if (!ConnectivityMgrImpl().IsThreadAttached())
- {
- return;
- }
- ThreadStackMgrImpl().LockThreadStack();
- otError error = OT_ERROR_NONE;
- otMessageInfo messageInfo;
- otUdpSocket mSocket;
- otMessage * message = nullptr;
-
- memset(&mSocket, 0, sizeof(mSocket));
- memset(&messageInfo, 0, sizeof(messageInfo));
-
- // Use mesh local EID by default, if we have GUA, use that IP address.
- memcpy(&messageInfo.mSockAddr, otThreadGetMeshLocalEid(ThreadStackMgrImpl().OTInstance()), sizeof(messageInfo.mSockAddr));
-
- // Select a address to send
- const otNetifAddress * otAddrs = otIp6GetUnicastAddresses(ThreadStackMgrImpl().OTInstance());
- for (const otNetifAddress * otAddr = otAddrs; otAddr != NULL; otAddr = otAddr->mNext)
- {
- addr = chip::DeviceLayer::Internal::ToIPAddress(otAddr->mAddress);
- if (otAddr->mValid && addr.IsIPv6GlobalUnicast())
- {
- memcpy(&messageInfo.mSockAddr, &(otAddr->mAddress), sizeof(otAddr->mAddress));
- break;
- }
- }
-
- message = otUdpNewMessage(ThreadStackMgrImpl().OTInstance(), nullptr);
- otIp6AddressFromString("ff03::1", &messageInfo.mPeerAddr);
- messageInfo.mPeerPort = kUDPBroadcastPort;
- otMessageAppend(message, sDeviceName, static_cast(strlen(sDeviceName)));
-
- error = otUdpSend(ThreadStackMgrImpl().OTInstance(), &mSocket, message, &messageInfo);
-
- if (error != OT_ERROR_NONE && message != nullptr)
- {
- otMessageFree(message);
- EFR32_LOG("Failed to otUdpSend: %d", error);
- }
- ThreadStackMgrImpl().UnlockThreadStack();
- */
-}
-
-void StartDefaultThreadNetwork(void)
-{
- /*
- // Set default thread network Info and enable/start thread
-
- chip::DeviceLayer::Internal::DeviceNetworkInfo deviceNetworkInfo;
- memset(&deviceNetworkInfo, 0, sizeof(deviceNetworkInfo));
- const char * networkName = "OpenThread";
- const uint8_t masterKey[chip::DeviceLayer::Internal::kThreadMasterKeyLength] = {
- 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
- };
- const uint8_t threadMeshPrefix[chip::DeviceLayer::Internal::kThreadMeshPrefixLength] = { 0xfd, 0xde, 0xad, 0x00,
- 0xbe, 0xef, 0x00, 0x00 };
-
- const uint8_t extendedPanId[chip::DeviceLayer::Internal::kThreadExtendedPANIdLength] = { 0xDE, 0xAD, 0x00, 0xBE,
- 0xEF, 0x00, 0xCA, 0xFE };
- memcpy(deviceNetworkInfo.ThreadNetworkName, networkName, strlen(networkName));
- memcpy(deviceNetworkInfo.ThreadExtendedPANId, extendedPanId, sizeof(extendedPanId));
- deviceNetworkInfo.FieldPresent.ThreadExtendedPANId = true;
- memcpy(deviceNetworkInfo.ThreadMasterKey, masterKey, sizeof(masterKey));
- deviceNetworkInfo.FieldPresent.ThreadMeshPrefix = true;
- memcpy(deviceNetworkInfo.ThreadMeshPrefix, threadMeshPrefix, sizeof(threadMeshPrefix));
- deviceNetworkInfo.ThreadPANId = 0x1234;
- deviceNetworkInfo.ThreadChannel = 11;
-
- chip::DeviceLayer::ThreadStackMgr().SetThreadEnabled(false);
- chip::DeviceLayer::ThreadStackMgr().SetThreadProvision(deviceNetworkInfo);
- chip::DeviceLayer::ThreadStackMgr().SetThreadEnabled(true);
- */
-}
diff --git a/examples/platform/p6/Service.h b/examples/platform/p6/Service.h
deleted file mode 100644
index 14abfb0e1d2189..00000000000000
--- a/examples/platform/p6/Service.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- *
- * Copyright (c) 2020 Project CHIP Authors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-void SetDeviceName(const char * newDeviceName);
-void PublishService();
-void StartDefaultThreadNetwork(void);
diff --git a/examples/platform/p6/args.gni b/examples/platform/p6/args.gni
index 1726b62a75d86b..bbab38b1a34ff2 100644
--- a/examples/platform/p6/args.gni
+++ b/examples/platform/p6/args.gni
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Project CHIP Authors
+# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/examples/platform/p6/init_p6Platform.cpp b/examples/platform/p6/init_p6Platform.cpp
index 871c0a31235ab3..47019d9309336d 100644
--- a/examples/platform/p6/init_p6Platform.cpp
+++ b/examples/platform/p6/init_p6Platform.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
@@ -46,14 +46,14 @@ extern "C" {
#include "sl_malloc.h"
#endif // OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE
#endif // CHIP_ENABLE_OPENTHREAD
-#include
-#include
#include
+#include
+#include
void init_p6Platform(void)
{
/* Initialize the board support package */
- cybsp_init() ;
+ cybsp_init();
/* Initialize retarget-io to use the debug UART port */
cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX, CY_RETARGET_IO_BAUDRATE);
diff --git a/examples/platform/p6/init_p6Platform.h b/examples/platform/p6/init_p6Platform.h
index c2ebe9d7169387..504b548f16cd2a 100644
--- a/examples/platform/p6/init_p6Platform.h
+++ b/examples/platform/p6/init_p6Platform.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/gn_build.sh b/gn_build.sh
index 05c8f8abf123bd..b1a6840c7979fd 100755
--- a/gn_build.sh
+++ b/gn_build.sh
@@ -136,7 +136,6 @@ else
echo "(cd $CHIP_ROOT/examples/lock-app/efr32; gn gen out/debug; ninja -C out/debug)"
fi
-
echo
# P6 Build setup
diff --git a/src/lwip/BUILD.gn b/src/lwip/BUILD.gn
index 44a0982724f024..864c0fe0485997 100644
--- a/src/lwip/BUILD.gn
+++ b/src/lwip/BUILD.gn
@@ -31,7 +31,7 @@ if (lwip_platform == "") {
assert(lwip_platform == "external" || lwip_platform == "standalone" ||
lwip_platform == "cc13x2_26x2" || lwip_platform == "efr32" ||
lwip_platform == "k32w" || lwip_platform == "qpg" ||
- lwip_platform == "mbed" || lwip_platform == "p6" ,
+ lwip_platform == "mbed" || lwip_platform == "p6",
"Unsupported lwIP platform: ${lwip_platform}")
if (lwip_platform != "external") {
diff --git a/src/lwip/p6/lwipopts.h b/src/lwip/p6/lwipopts.h
index cfd35dd8aff090..b1cf5b859604dd 100644
--- a/src/lwip/p6/lwipopts.h
+++ b/src/lwip/p6/lwipopts.h
@@ -58,11 +58,10 @@
#define LWIP_TCP_KEEPALIVE (1)
#define LWIP_SOCKET 1
-#define LWIP_NETCONN (1)
+#define LWIP_NETCONN (1)
#define LWIP_FREERTOS_USE_STATIC_TCPIP_TASK 0
-
// TODO: seems like this is unnecessary on Thread-only platforms
#define LWIP_RAW 1
#define MEMP_NUM_RAW_PCB (5)
@@ -72,10 +71,10 @@
#define LWIP_HAVE_LOOPIF (0)
-#define LWIP_NETIF_API 1
+#define LWIP_NETIF_API 1
// TODO: not sure why this is disabled
#define LWIP_NETIF_LOOPBACK (0)
-#define PBUF_LINK_HLEN (WHD_PHYSICAL_HEADER)
+#define PBUF_LINK_HLEN (WHD_PHYSICAL_HEADER)
#define MEMP_NUM_NETCONN (16)
@@ -199,11 +198,11 @@
#define LWIP_DBG_TYPES_ON \
(LWIP_DBG_ON | LWIP_DBG_TRACE) /* (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) */
-#define LWIP_RAND rand
-#define LWIP_NETIF_LINK_CALLBACK 1
-#define LWIP_NETIF_STATUS_CALLBACK 1
-#define LWIP_NETIF_EXT_STATUS_CALLBACK 1
-#define LWIP_NETIF_REMOVE_CALLBACK 1
-#define netifapi_dhcp_release_and_stop(n) netifapi_dhcp_release(n)
+#define LWIP_RAND rand
+#define LWIP_NETIF_LINK_CALLBACK 1
+#define LWIP_NETIF_STATUS_CALLBACK 1
+#define LWIP_NETIF_EXT_STATUS_CALLBACK 1
+#define LWIP_NETIF_REMOVE_CALLBACK 1
+#define netifapi_dhcp_release_and_stop(n) netifapi_dhcp_release(n)
#endif /* __LWIPOPTS_H__ */
diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn
index 48ac195a8feddc..d158f27b025dda 100644
--- a/src/platform/BUILD.gn
+++ b/src/platform/BUILD.gn
@@ -148,7 +148,7 @@ if (chip_device_platform != "none") {
defines += [
"CHIP_DEVICE_LAYER_TARGET_P6=1",
"CHIP_DEVICE_LAYER_TARGET=P6",
- ]
+ ]
} else if (chip_device_platform == "linux") {
defines += [
"CHIP_DEVICE_LAYER_TARGET_LINUX=1",
diff --git a/src/platform/P6/BLEManagerImpl.cpp b/src/platform/P6/BLEManagerImpl.cpp
old mode 100755
new mode 100644
index 55f904e2125267..01b64181bae2ff
--- a/src/platform/P6/BLEManagerImpl.cpp
+++ b/src/platform/P6/BLEManagerImpl.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2020 Nest Labs, Inc.
* All rights reserved.
*
@@ -34,18 +34,17 @@
#include
extern "C" {
-#include "cycfg_gatt_db.h"
-#include "cycfg_bt_settings.h"
#include "app_platform_cfg.h"
+#include "cycfg_bt_settings.h"
+#include "cycfg_gatt_db.h"
}
-#include "wiced_bt_stack.h"
#include "cy_utils.h"
+#include "wiced_bt_stack.h"
#include
#include
-
using namespace ::chip;
using namespace ::chip::Ble;
@@ -53,7 +52,6 @@ namespace chip {
namespace DeviceLayer {
namespace Internal {
-
namespace {
const ChipBleUUID chipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F,
0x9D, 0x11 } };
@@ -63,17 +61,13 @@ const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0
} // unnamed namespace
-
-
BLEManagerImpl BLEManagerImpl::sInstance;
wiced_bt_gatt_status_t app_gatts_callback(wiced_bt_gatt_evt_t event, wiced_bt_gatt_event_data_t * p_data);
-
-wiced_result_t BLEManagerImpl::BLEManagerCallback(wiced_bt_management_evt_t event,
- wiced_bt_management_evt_data_t *p_event_data)
+wiced_result_t BLEManagerImpl::BLEManagerCallback(wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t * p_event_data)
{
- switch(event)
+ switch (event)
{
case BTM_ENABLED_EVT:
// Post a event to _OnPlatformEvent.
@@ -91,7 +85,7 @@ wiced_result_t BLEManagerImpl::BLEManagerCallback(wiced_bt_management_evt_t even
break;
}
- return WICED_BT_SUCCESS;
+ return WICED_BT_SUCCESS;
}
CHIP_ERROR BLEManagerImpl::_Init()
@@ -107,7 +101,7 @@ CHIP_ERROR BLEManagerImpl::_Init()
// Initialize the Bluetooth stack with a callback function and stack
// configuration structure */
- if(WICED_SUCCESS != wiced_bt_stack_init (BLEManagerCallback, &wiced_bt_cfg_settings))
+ if (WICED_SUCCESS != wiced_bt_stack_init(BLEManagerCallback, &wiced_bt_cfg_settings))
{
printf("Error initializing BT stack\n");
CY_ASSERT(0);
@@ -122,10 +116,10 @@ CHIP_ERROR BLEManagerImpl::_Init()
{
mFlags.Set(Flags::kFlag_AdvertisingEnabled, false);
}
- mNumCons = 0;
+ mNumCons = 0;
memset(mCons, 0, sizeof(mCons));
memset(mDeviceName, 0, sizeof(mDeviceName));
-
+
ChipLogProgress(DeviceLayer, "BLEManagerImpl::Init() complete");
PlatformMgr().ScheduleWork(DriveBLEState, 0);
@@ -134,7 +128,6 @@ CHIP_ERROR BLEManagerImpl::_Init()
return err;
}
-
CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val)
{
CHIP_ERROR err = CHIP_NO_ERROR;
@@ -217,8 +210,8 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName)
}
else
{
- wiced_bt_cfg_settings.device_name[0] = 0;
- mDeviceName[0] = 0;
+ wiced_bt_cfg_settings.device_name[0] = 0;
+ mDeviceName[0] = 0;
mFlags.Set(Flags::kFlag_DeviceNameSet, false);
}
@@ -234,7 +227,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
{
switch (event->Type)
{
-
+
case DeviceEventType::kP6BLEEnabledEvt:
mFlags.Set(Flags::kFlag_StackInitialized, true);
PlatformMgr().ScheduleWork(DriveBLEState, 0);
@@ -320,7 +313,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId)
uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const
{
- CHIPoBLEConState *p_conn;
+ CHIPoBLEConState * p_conn;
/* Check if target connection state exists. */
p_conn = BLEManagerImpl::sInstance.GetConnectionState(conId);
@@ -437,7 +430,6 @@ void BLEManagerImpl::DriveBLEState(void)
advChange.CHIPoBLEAdvertisingChange.Result = kActivity_Started;
PlatformMgr().PostEvent(&advChange);
}
-
}
}
@@ -604,7 +596,8 @@ wiced_bt_gatt_status_t BLEManagerImpl::HandleGattServiceWrite(uint16_t conn_id,
/*
* Process MTU request received from the GATT client
*/
-wiced_bt_gatt_status_t BLEManagerImpl::HandleGattServiceMtuReq(wiced_bt_gatt_attribute_request_t * p_data, CHIPoBLEConState *p_conn)
+wiced_bt_gatt_status_t BLEManagerImpl::HandleGattServiceMtuReq(wiced_bt_gatt_attribute_request_t * p_data,
+ CHIPoBLEConState * p_conn)
{
p_data->data.mtu = p_conn->Mtu;
@@ -632,7 +625,8 @@ wiced_bt_gatt_status_t BLEManagerImpl::HandleGattServiceIndCfm(uint16_t conn_id,
/*
* Process GATT attribute requests
*/
-wiced_bt_gatt_status_t BLEManagerImpl::HandleGattServiceRequestEvent(wiced_bt_gatt_attribute_request_t * p_request, CHIPoBLEConState *p_conn)
+wiced_bt_gatt_status_t BLEManagerImpl::HandleGattServiceRequestEvent(wiced_bt_gatt_attribute_request_t * p_request,
+ CHIPoBLEConState * p_conn)
{
wiced_bt_gatt_status_t result = WICED_BT_GATT_INVALID_PDU;
@@ -664,7 +658,8 @@ wiced_bt_gatt_status_t BLEManagerImpl::HandleGattServiceRequestEvent(wiced_bt_ga
/*
* Handle GATT connection events from the stack
*/
-wiced_bt_gatt_status_t BLEManagerImpl::HandleGattConnectEvent(wiced_bt_gatt_connection_status_t * p_conn_status, CHIPoBLEConState *p_conn)
+wiced_bt_gatt_status_t BLEManagerImpl::HandleGattConnectEvent(wiced_bt_gatt_connection_status_t * p_conn_status,
+ CHIPoBLEConState * p_conn)
{
if (p_conn_status->connected)
{
@@ -715,7 +710,7 @@ wiced_bt_gatt_status_t BLEManagerImpl::HandleGattConnectEvent(wiced_bt_gatt_conn
wiced_bt_gatt_status_t app_gatts_callback(wiced_bt_gatt_evt_t event, wiced_bt_gatt_event_data_t * p_data)
{
uint16_t conn_id;
- BLEManagerImpl::CHIPoBLEConState *p_conn;
+ BLEManagerImpl::CHIPoBLEConState * p_conn;
/* Check parameter. */
if (!p_data)
@@ -793,7 +788,7 @@ void BLEManagerImpl::SetAdvertisingData(void)
uint16_t deviceDiscriminator = 0;
uint8_t localDeviceNameLen;
uint8_t service_data[9];
- uint8_t *p = service_data;
+ uint8_t * p = service_data;
#if 0
uint8_t *rpa = wiced_btm_get_private_bda();
@@ -817,8 +812,9 @@ void BLEManagerImpl::SetAdvertisingData(void)
localDeviceNameLen = strlen(sInstance.mDeviceName);
strncpy((char *) app_gap_device_name, sInstance.mDeviceName, sizeof(app_gap_device_name));
- app_gatt_db_ext_attr_tbl[0].cur_len =
- app_gatt_db_ext_attr_tbl[0].max_len < strlen(sInstance.mDeviceName) ? app_gatt_db_ext_attr_tbl[0].max_len : strlen(sInstance.mDeviceName);
+ app_gatt_db_ext_attr_tbl[0].cur_len = app_gatt_db_ext_attr_tbl[0].max_len < strlen(sInstance.mDeviceName)
+ ? app_gatt_db_ext_attr_tbl[0].max_len
+ : strlen(sInstance.mDeviceName);
ChipLogProgress(DeviceLayer, "SetAdvertisingData: device name set: %s", sInstance.mDeviceName);
}
@@ -840,11 +836,11 @@ void BLEManagerImpl::SetAdvertisingData(void)
/* Second element is the service data for CHIP service */
adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_SERVICE_DATA;
adv_elem[num_elem].len = sizeof(service_data);
- adv_elem[num_elem].p_data = service_data;
+ adv_elem[num_elem].p_data = service_data;
num_elem++;
UINT8_TO_STREAM(p, chip_service_uuid[0]);
UINT8_TO_STREAM(p, chip_service_uuid[1]);
- UINT8_TO_STREAM(p, 0); // CHIP BLE Opcode == 0x00 (Uncommissioned)
+ UINT8_TO_STREAM(p, 0); // CHIP BLE Opcode == 0x00 (Uncommissioned)
UINT16_TO_STREAM(p, deviceDiscriminator);
UINT8_TO_STREAM(p, mDeviceIdInfo.DeviceVendorId[0]);
UINT8_TO_STREAM(p, mDeviceIdInfo.DeviceVendorId[1]);
@@ -853,7 +849,7 @@ void BLEManagerImpl::SetAdvertisingData(void)
adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE;
adv_elem[num_elem].len = localDeviceNameLen;
- adv_elem[num_elem].p_data = (uint8_t*)sInstance.mDeviceName;
+ adv_elem[num_elem].p_data = (uint8_t *) sInstance.mDeviceName;
num_elem++;
wiced_bt_ble_set_raw_advertisement_data(num_elem, adv_elem);
@@ -862,7 +858,7 @@ void BLEManagerImpl::SetAdvertisingData(void)
num_elem = 0;
adv_elem[num_elem].advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE;
adv_elem[num_elem].len = localDeviceNameLen;
- adv_elem[num_elem].p_data = (uint8_t*)sInstance.mDeviceName;
+ adv_elem[num_elem].p_data = (uint8_t *) sInstance.mDeviceName;
num_elem++;
wiced_bt_ble_set_raw_scan_response_data(num_elem, adv_elem);
@@ -871,16 +867,15 @@ void BLEManagerImpl::SetAdvertisingData(void)
ChipLogProgress(DeviceLayer, "BLEManagerImpl::SetAdvertisingData err:%ld", err);
}
-
BLEManagerImpl::CHIPoBLEConState * BLEManagerImpl::AllocConnectionState(uint16_t conId)
{
for (uint16_t i = 0; i < kMaxConnections; i++)
{
if (mCons[i].connected == false)
{
- mCons[i].ConId = conId;
- mCons[i].Mtu = wiced_bt_cfg_settings.gatt_cfg.max_mtu_size;
- mCons[i].connected = false;
+ mCons[i].ConId = conId;
+ mCons[i].Mtu = wiced_bt_cfg_settings.gatt_cfg.max_mtu_size;
+ mCons[i].connected = false;
mNumCons++;
diff --git a/src/platform/P6/BLEManagerImpl.h b/src/platform/P6/BLEManagerImpl.h
old mode 100755
new mode 100644
index 027b1319d7addc..023fddd9a7eb4e
--- a/src/platform/P6/BLEManagerImpl.h
+++ b/src/platform/P6/BLEManagerImpl.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -69,15 +69,17 @@ class BLEManagerImpl final : public BLEManager,
// ===== Members that implement virtual methods on BlePlatformDelegate.
- bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId) override;
- bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId) override;
+ bool SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId,
+ const Ble::ChipBleUUID * charId) override;
+ bool UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId,
+ const Ble::ChipBleUUID * charId) override;
bool CloseConnection(BLE_CONNECTION_OBJECT conId) override;
uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override;
bool SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId,
System::PacketBufferHandle data) override;
bool SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId,
System::PacketBufferHandle data) override;
- bool SendReadRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId,
+ bool SendReadRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId,
System::PacketBufferHandle data) override;
bool SendReadResponse(BLE_CONNECTION_OBJECT conId, BLE_READ_REQUEST_CONTEXT requestContext, const Ble::ChipBleUUID * svcId,
const Ble::ChipBleUUID * charId) override;
@@ -97,13 +99,14 @@ class BLEManagerImpl final : public BLEManager,
// ===== Private members reserved for use by this class only.
enum class Flags : uint16_t
{
- kFlag_AsyncInitCompleted = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
- kFlag_AdvertisingEnabled = 0x0002, /**< The application has enabled CHIPoBLE advertising. */
- kFlag_FastAdvertisingEnabled = 0x0004, /**< The application has enabled fast advertising. */
- kFlag_Advertising = 0x0008, /**< The system is currently CHIPoBLE advertising. */
- kFlag_AdvertisingRefreshNeeded = 0x0010, /**< The advertising state/configuration has changed, but the SoftDevice has yet to be updated. */
- kFlag_DeviceNameSet = 0x0020,
- kFlag_StackInitialized = 0x0040,
+ kFlag_AsyncInitCompleted = 0x0001, /**< One-time asynchronous initialization actions have been performed. */
+ kFlag_AdvertisingEnabled = 0x0002, /**< The application has enabled CHIPoBLE advertising. */
+ kFlag_FastAdvertisingEnabled = 0x0004, /**< The application has enabled fast advertising. */
+ kFlag_Advertising = 0x0008, /**< The system is currently CHIPoBLE advertising. */
+ kFlag_AdvertisingRefreshNeeded =
+ 0x0010, /**< The advertising state/configuration has changed, but the SoftDevice has yet to be updated. */
+ kFlag_DeviceNameSet = 0x0020,
+ kFlag_StackInitialized = 0x0040,
};
enum
@@ -113,10 +116,10 @@ class BLEManagerImpl final : public BLEManager,
struct CHIPoBLEConState
{
- //System::PacketBuffer * PendingIndBuf;
+ // System::PacketBuffer * PendingIndBuf;
uint16_t ConId;
uint16_t Mtu;
- bool connected;
+ bool connected;
};
CHIPoBLEConState mCons[kMaxConnections];
@@ -128,14 +131,14 @@ class BLEManagerImpl final : public BLEManager,
void DriveBLEState(void);
void SetAdvertisingData(void);
- wiced_bt_gatt_status_t HandleGattConnectEvent(wiced_bt_gatt_connection_status_t * p_conn_status, CHIPoBLEConState *p_conn);
+ wiced_bt_gatt_status_t HandleGattConnectEvent(wiced_bt_gatt_connection_status_t * p_conn_status, CHIPoBLEConState * p_conn);
wiced_bt_gatt_status_t HandleGattServiceRead(uint16_t conn_id, wiced_bt_gatt_read_t * p_read_data);
wiced_bt_gatt_status_t HandleGattServiceWrite(uint16_t conn_id, wiced_bt_gatt_write_t * p_data);
- wiced_bt_gatt_status_t HandleGattServiceMtuReq(wiced_bt_gatt_attribute_request_t * p_data, CHIPoBLEConState *p_conn);
+ wiced_bt_gatt_status_t HandleGattServiceMtuReq(wiced_bt_gatt_attribute_request_t * p_data, CHIPoBLEConState * p_conn);
wiced_bt_gatt_status_t HandleGattServiceIndCfm(uint16_t conn_id, uint16_t handle);
- wiced_bt_gatt_status_t HandleGattServiceRequestEvent(wiced_bt_gatt_attribute_request_t * p_request, CHIPoBLEConState *p_conn);
+ wiced_bt_gatt_status_t HandleGattServiceRequestEvent(wiced_bt_gatt_attribute_request_t * p_request, CHIPoBLEConState * p_conn);
- static wiced_result_t BLEManagerCallback(wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t *p_event_data);
+ static wiced_result_t BLEManagerCallback(wiced_bt_management_evt_t event, wiced_bt_management_evt_data_t * p_event_data);
CHIPoBLEConState * AllocConnectionState(uint16_t conId);
CHIPoBLEConState * GetConnectionState(uint16_t conId);
diff --git a/src/platform/P6/BUILD.gn b/src/platform/P6/BUILD.gn
index 9dab9689785319..0e11e1cd7e0be6 100644
--- a/src/platform/P6/BUILD.gn
+++ b/src/platform/P6/BUILD.gn
@@ -25,46 +25,44 @@ if (chip_enable_openthread) {
static_library("P6") {
sources = [
- "BLEManagerImpl.cpp",
- "BLEManagerImpl.h",
- "BlePlatformConfig.h",
- "CHIPDevicePlatformConfig.h",
- "CHIPDevicePlatformEvent.h",
- "CHIPPlatformConfig.h",
- "ConfigurationManagerImpl.cpp",
- "ConfigurationManagerImpl.h",
- "ConnectivityManagerImpl.cpp",
- "ConnectivityManagerImpl.h",
- "DeviceNetworkProvisioningDelegateImpl.cpp",
- "DeviceNetworkProvisioningDelegateImpl.h",
- #"P6/Entropy.cpp",
- "InetPlatformConfig.h",
- "Logging.cpp",
- "LwIPCoreLock.cpp",
- #"P6/MdnsImpl.cpp",
- "P6Config.cpp",
- "P6Config.h",
- "P6Utils.cpp",
- "P6Utils.h",
- "PlatformManagerImpl.cpp",
- "PlatformManagerImpl.h",
- "SoftwareUpdateManagerImpl.cpp",
- "SoftwareUpdateManagerImpl.h",
- "SystemPlatformConfig.h",
- "WarmPlatformConfig.h",
- "../FreeRTOS/SystemTimeSupport.cpp",
- "KeyValueStoreManagerImpl.cpp",
- "KeyValueStoreManagerImpl.h",
- "MTBKeyValueStore.cpp",
- "MTBKeyValueStore.h",
- "app_platform_cfg.c",
- "app_platform_cfg.h",
- "cycfg_bt_settings.c",
- "cycfg_bt_settings.h",
- "cycfg_gap.c",
- "cycfg_gap.h",
- "cycfg_gatt_db.c",
- "cycfg_gatt_db.h",
+ "../FreeRTOS/SystemTimeSupport.cpp",
+ "BLEManagerImpl.cpp",
+ "BLEManagerImpl.h",
+ "BlePlatformConfig.h",
+ "CHIPDevicePlatformConfig.h",
+ "CHIPDevicePlatformEvent.h",
+ "CHIPPlatformConfig.h",
+ "ConfigurationManagerImpl.cpp",
+ "ConfigurationManagerImpl.h",
+ "ConnectivityManagerImpl.cpp",
+ "ConnectivityManagerImpl.h",
+ "DeviceNetworkProvisioningDelegateImpl.cpp",
+ "DeviceNetworkProvisioningDelegateImpl.h",
+ "InetPlatformConfig.h",
+ "KeyValueStoreManagerImpl.cpp",
+ "KeyValueStoreManagerImpl.h",
+ "Logging.cpp",
+ "LwIPCoreLock.cpp",
+ "MTBKeyValueStore.cpp",
+ "MTBKeyValueStore.h",
+ "P6Config.cpp",
+ "P6Config.h",
+ "P6Utils.cpp",
+ "P6Utils.h",
+ "PlatformManagerImpl.cpp",
+ "PlatformManagerImpl.h",
+ "SoftwareUpdateManagerImpl.cpp",
+ "SoftwareUpdateManagerImpl.h",
+ "SystemPlatformConfig.h",
+ "WarmPlatformConfig.h",
+ "app_platform_cfg.c",
+ "app_platform_cfg.h",
+ "cycfg_bt_settings.c",
+ "cycfg_bt_settings.h",
+ "cycfg_gap.c",
+ "cycfg_gap.h",
+ "cycfg_gatt_db.c",
+ "cycfg_gatt_db.h",
]
deps = [ "${chip_root}/src/lib/mdns:platform_header" ]
diff --git a/src/platform/P6/BlePlatformConfig.h b/src/platform/P6/BlePlatformConfig.h
index 7bc886c0d93659..4c955cf46294b9 100644
--- a/src/platform/P6/BlePlatformConfig.h
+++ b/src/platform/P6/BlePlatformConfig.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
diff --git a/src/platform/P6/CHIPDevicePlatformConfig.h b/src/platform/P6/CHIPDevicePlatformConfig.h
index fd666530ae733c..eaff8c2413eb46 100644
--- a/src/platform/P6/CHIPDevicePlatformConfig.h
+++ b/src/platform/P6/CHIPDevicePlatformConfig.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/CHIPDevicePlatformEvent.h b/src/platform/P6/CHIPDevicePlatformEvent.h
index df65dafcf4eec7..383e3b239b2965 100644
--- a/src/platform/P6/CHIPDevicePlatformEvent.h
+++ b/src/platform/P6/CHIPDevicePlatformEvent.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -40,13 +40,12 @@ enum
kP6SystemEvent = kRange_PublicPlatformSpecific,
};
-
/**
* Enumerates internal platform-specific event types.
*/
enum InternalPlatformSpecificEventTypes
{
- //TODO: maybe need remove this and handle BLEEnabledEvt direct
+ // TODO: maybe need remove this and handle BLEEnabledEvt direct
// from BLEManagerImpl::BLEManagerCallback.
kP6BLEEnabledEvt = kRange_InternalPlatformSpecific,
kP6BLEDisabledEvt
diff --git a/src/platform/P6/CHIPPlatformConfig.h b/src/platform/P6/CHIPPlatformConfig.h
index 33ec498a5c7496..7622576cf71141 100644
--- a/src/platform/P6/CHIPPlatformConfig.h
+++ b/src/platform/P6/CHIPPlatformConfig.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/ConfigurationManagerImpl.cpp b/src/platform/P6/ConfigurationManagerImpl.cpp
index 93a86f3b0872bf..fc212d813b7051 100644
--- a/src/platform/P6/ConfigurationManagerImpl.cpp
+++ b/src/platform/P6/ConfigurationManagerImpl.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -65,11 +65,11 @@ CHIP_ERROR ConfigurationManagerImpl::_Init()
CHIP_ERROR ConfigurationManagerImpl::_GetPrimaryWiFiMACAddress(uint8_t * buf)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
+ CHIP_ERROR err = CHIP_NO_ERROR;
cy_rslt_t result = CY_RSLT_SUCCESS;
cy_wcm_mac_t mac;
result = cy_wcm_get_mac_addr(CY_WCM_INTERFACE_TYPE_STA, &mac, 1);
- if ( result != CY_RSLT_SUCCESS )
+ if (result != CY_RSLT_SUCCESS)
{
err = CHIP_ERROR_INTERNAL;
ChipLogError(DeviceLayer, "_GetPrimaryWiFiMACAddress failed: %ld", result);
@@ -99,15 +99,15 @@ void ConfigurationManagerImpl::_InitiateFactoryReset()
CHIP_ERROR ConfigurationManagerImpl::_ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value)
{
- uint32_t in = 0;
+ uint32_t in = 0;
CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key, &in, 4);
- value = in;
+ value = in;
return err;
}
CHIP_ERROR ConfigurationManagerImpl::_WritePersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t value)
{
- return PersistedStorage::KeyValueStoreMgr().Put(key, static_cast(&value), 4);
+ return PersistedStorage::KeyValueStoreMgr().Put(key, static_cast(&value), 4);
}
void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg)
diff --git a/src/platform/P6/ConfigurationManagerImpl.h b/src/platform/P6/ConfigurationManagerImpl.h
index 367ffc7d01ac98..880cf5f3a5a92c 100644
--- a/src/platform/P6/ConfigurationManagerImpl.h
+++ b/src/platform/P6/ConfigurationManagerImpl.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/ConnectivityManagerImpl.cpp b/src/platform/P6/ConnectivityManagerImpl.cpp
index 5237dc6504de50..c9203e73f7b03f 100644
--- a/src/platform/P6/ConnectivityManagerImpl.cpp
+++ b/src/platform/P6/ConnectivityManagerImpl.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -35,9 +35,9 @@
#include
#include
-#include
-#include
#include "lwip/opt.h"
+#include
+#include
#if !CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
#error "WiFi Station support must be enabled when building for PSoC6"
@@ -64,8 +64,8 @@ ConnectivityManager::WiFiStationMode ConnectivityManagerImpl::_GetWiFiStationMod
CHIP_ERROR ConnectivityManagerImpl::_SetWiFiStationMode(WiFiStationMode val)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
- VerifyOrExit(val != kWiFiStationMode_NotSupported, err = CHIP_ERROR_INVALID_ARGUMENT);
+ CHIP_ERROR err = CHIP_NO_ERROR;
+ VerifyOrExit(val != kWiFiStationMode_NotSupported, err = CHIP_ERROR_INVALID_ARGUMENT);
if (val != kWiFiStationMode_ApplicationControlled)
{
mWiFiStationMode = val;
@@ -73,8 +73,8 @@ CHIP_ERROR ConnectivityManagerImpl::_SetWiFiStationMode(WiFiStationMode val)
}
if (mWiFiStationMode != val)
{
- ChipLogProgress(DeviceLayer, "WiFi station mode change: %s -> %s", WiFiStationModeToStr(mWiFiStationMode),
- WiFiStationModeToStr(val));
+ ChipLogProgress(DeviceLayer, "WiFi station mode change: %s -> %s", WiFiStationModeToStr(mWiFiStationMode),
+ WiFiStationModeToStr(val));
}
mWiFiStationMode = val;
@@ -103,7 +103,7 @@ void ConnectivityManagerImpl::_ClearWiFiStationProvision(void)
SystemLayer.ScheduleWork(DriveStationState, NULL);
SystemLayer.ScheduleWork(DriveAPState, NULL);
- }
+ }
}
CHIP_ERROR ConnectivityManagerImpl::_SetWiFiAPMode(WiFiAPMode val)
@@ -171,12 +171,11 @@ CHIP_ERROR ConnectivityManagerImpl::_GetAndLogWifiStatsCounters(void)
ChipLogProgress(DeviceLayer,
"Wifi-Telemetry\n"
"BSSID: %02x:%02x:%02x:%02x:%02x:%02x\n"
- "RSSI: %d\n"
+ "RSSI: %d\n"
"Channel: %d\n"
- "Channel Width: %d Mhz\n",
- ap_info.BSSID[0], ap_info.BSSID[1], ap_info.BSSID[2],
- ap_info.BSSID[3], ap_info.BSSID[4], ap_info.BSSID[5],
- ap_info.signal_strength, ap_info.channel, ap_info.channel_width);
+ "Channel Width: %d Mhz\n",
+ ap_info.BSSID[0], ap_info.BSSID[1], ap_info.BSSID[2], ap_info.BSSID[3], ap_info.BSSID[4], ap_info.BSSID[5],
+ ap_info.signal_strength, ap_info.channel, ap_info.channel_width);
exit:
return CHIP_NO_ERROR;
}
@@ -206,10 +205,12 @@ CHIP_ERROR ConnectivityManagerImpl::_Init()
// Set a default station configuration.
wifi_config_t wifiConfig;
memset(&wifiConfig, 0, sizeof(wifiConfig));
- memcpy(wifiConfig.sta.ssid, CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID, min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID), sizeof(wifiConfig.sta.ssid)));
- memcpy(wifiConfig.sta.password, CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD, min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD), sizeof(wifiConfig.sta.password)));
+ memcpy(wifiConfig.sta.ssid, CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID,
+ min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_SSID), sizeof(wifiConfig.sta.ssid)));
+ memcpy(wifiConfig.sta.password, CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD,
+ min(strlen(CHIP_DEVICE_CONFIG_DEFAULT_STA_PASSWORD), sizeof(wifiConfig.sta.password)));
wifiConfig.sta.security = CHIP_DEVICE_CONFIG_DEFAULT_STA_SECURITY;
- err = Internal::P6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifiConfig);
+ err = Internal::P6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifiConfig);
if (err != CY_RSLT_SUCCESS)
{
ChipLogError(DeviceLayer, "p6_wifi_set_config() failed: %s", chip::ErrorStr(err));
@@ -228,50 +229,48 @@ CHIP_ERROR ConnectivityManagerImpl::_Init()
return err;
}
-void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
-{
-}
+void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) {}
-void ConnectivityManagerImpl::wlan_event_cb(cy_wcm_event_t event, cy_wcm_event_data_t *event_data)
+void ConnectivityManagerImpl::wlan_event_cb(cy_wcm_event_t event, cy_wcm_event_data_t * event_data)
{
switch (event)
{
- case CY_WCM_EVENT_CONNECTING:
- ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_CONNECTING");
- ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Connecting);
- break;
- case CY_WCM_EVENT_CONNECTED:
- ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_CONNECTED");
- ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Connecting_Succeeded);
- ConnectivityMgrImpl().DriveStationState();
- break;
- case CY_WCM_EVENT_CONNECT_FAILED:
- ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_CONNECT_FAILED");
- ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Connecting_Failed);
- ConnectivityMgrImpl().DriveStationState();
- break;
- case CY_WCM_EVENT_RECONNECTED:
- ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_RECONNECTED");
- ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Connecting_Succeeded);
- ConnectivityMgrImpl().DriveStationState();
- break;
- case CY_WCM_EVENT_DISCONNECTED:
- ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_DISCONNECTED");
- ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Disconnecting);
- break;
- case CY_WCM_EVENT_IP_CHANGED:
- ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_IP_CHANGED");
- ConnectivityMgrImpl().OnIPAddressAvailable();
- break;
- case CY_WCM_EVENT_STA_JOINED_SOFTAP:
- ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_STA_JOINED_SOFTAP");
- break;
- case CY_WCM_EVENT_STA_LEFT_SOFTAP:
- ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_STA_LEFT_SOFTAP");
- break;
- default:
- ChipLogProgress(DeviceLayer, "UnSupported Event");
- break;
+ case CY_WCM_EVENT_CONNECTING:
+ ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_CONNECTING");
+ ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Connecting);
+ break;
+ case CY_WCM_EVENT_CONNECTED:
+ ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_CONNECTED");
+ ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Connecting_Succeeded);
+ ConnectivityMgrImpl().DriveStationState();
+ break;
+ case CY_WCM_EVENT_CONNECT_FAILED:
+ ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_CONNECT_FAILED");
+ ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Connecting_Failed);
+ ConnectivityMgrImpl().DriveStationState();
+ break;
+ case CY_WCM_EVENT_RECONNECTED:
+ ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_RECONNECTED");
+ ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Connecting_Succeeded);
+ ConnectivityMgrImpl().DriveStationState();
+ break;
+ case CY_WCM_EVENT_DISCONNECTED:
+ ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_DISCONNECTED");
+ ConnectivityMgrImpl().ChangeWiFiStationState(kWiFiStationState_Disconnecting);
+ break;
+ case CY_WCM_EVENT_IP_CHANGED:
+ ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_IP_CHANGED");
+ ConnectivityMgrImpl().OnIPAddressAvailable();
+ break;
+ case CY_WCM_EVENT_STA_JOINED_SOFTAP:
+ ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_STA_JOINED_SOFTAP");
+ break;
+ case CY_WCM_EVENT_STA_LEFT_SOFTAP:
+ ChipLogProgress(DeviceLayer, "CY_WCM_EVENT_STA_LEFT_SOFTAP");
+ break;
+ default:
+ ChipLogProgress(DeviceLayer, "UnSupported Event");
+ break;
}
}
void ConnectivityManagerImpl::_OnWiFiScanDone()
@@ -313,13 +312,12 @@ void ConnectivityManagerImpl::ChangeWiFiAPState(WiFiAPState newState)
}
}
-#define INITIALISER_IPV4_ADDRESS1( addr_var, addr_val ) addr_var = { CY_WCM_IP_VER_V4, { .v4 = (uint32_t)(addr_val) } }
-#define MAKE_IPV4_ADDRESS1(a, b, c, d) ((((uint32_t) d) << 24) | (((uint32_t) c) << 16) | (((uint32_t) b) << 8) |((uint32_t) a))
-static const cy_wcm_ip_setting_t ap_mode_ip_settings =
-{
- INITIALISER_IPV4_ADDRESS1( .ip_address, MAKE_IPV4_ADDRESS1( 192, 168, 0, 2 )),
- INITIALISER_IPV4_ADDRESS1( .gateway, MAKE_IPV4_ADDRESS1( 192, 168, 0, 2 ) ),
- INITIALISER_IPV4_ADDRESS1( .netmask, MAKE_IPV4_ADDRESS1( 255, 255, 255, 0 )),
+#define INITIALISER_IPV4_ADDRESS1(addr_var, addr_val) addr_var = { CY_WCM_IP_VER_V4, { .v4 = (uint32_t)(addr_val) } }
+#define MAKE_IPV4_ADDRESS1(a, b, c, d) ((((uint32_t) d) << 24) | (((uint32_t) c) << 16) | (((uint32_t) b) << 8) | ((uint32_t) a))
+static const cy_wcm_ip_setting_t ap_mode_ip_settings = {
+ INITIALISER_IPV4_ADDRESS1(.ip_address, MAKE_IPV4_ADDRESS1(192, 168, 0, 2)),
+ INITIALISER_IPV4_ADDRESS1(.gateway, MAKE_IPV4_ADDRESS1(192, 168, 0, 2)),
+ INITIALISER_IPV4_ADDRESS1(.netmask, MAKE_IPV4_ADDRESS1(255, 255, 255, 0)),
};
CHIP_ERROR ConnectivityManagerImpl::ConfigureWiFiAP()
@@ -330,12 +328,12 @@ CHIP_ERROR ConnectivityManagerImpl::ConfigureWiFiAP()
memset(&wifiConfig.ap, 0, sizeof(wifi_config_ap_t));
snprintf((char *) wifiConfig.ap.ssid, sizeof(wifiConfig.ap.ssid), "%s-%04X-%04X", CHIP_DEVICE_CONFIG_WIFI_AP_SSID_PREFIX,
CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID, CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID);
- memcpy(wifiConfig.ap.password, CHIP_DEVICE_CONFIG_WIFI_AP_PASSWORD,strlen(CHIP_DEVICE_CONFIG_WIFI_AP_PASSWORD));
- wifiConfig.ap.channel = CHIP_DEVICE_CONFIG_WIFI_AP_CHANNEL;
- wifiConfig.ap.security = CHIP_DEVICE_CONFIG_WIFI_AP_SECURITY;
+ memcpy(wifiConfig.ap.password, CHIP_DEVICE_CONFIG_WIFI_AP_PASSWORD, strlen(CHIP_DEVICE_CONFIG_WIFI_AP_PASSWORD));
+ wifiConfig.ap.channel = CHIP_DEVICE_CONFIG_WIFI_AP_CHANNEL;
+ wifiConfig.ap.security = CHIP_DEVICE_CONFIG_WIFI_AP_SECURITY;
wifiConfig.ap.ip_settings.ip_address = ap_mode_ip_settings.ip_address;
- wifiConfig.ap.ip_settings.netmask = ap_mode_ip_settings.netmask;
- wifiConfig.ap.ip_settings.gateway = ap_mode_ip_settings.gateway;
+ wifiConfig.ap.ip_settings.netmask = ap_mode_ip_settings.netmask;
+ wifiConfig.ap.ip_settings.gateway = ap_mode_ip_settings.gateway;
ChipLogProgress(DeviceLayer, "Configuring WiFi AP: SSID %s, channel %u", wifiConfig.ap.ssid, wifiConfig.ap.channel);
err = Internal::P6Utils::p6_wifi_set_config(WIFI_IF_AP, &wifiConfig);
@@ -375,7 +373,7 @@ void ConnectivityManagerImpl::DriveAPState()
{
ChangeWiFiAPState(kWiFiAPState_Deactivating);
}
- // If the AP interface is not under application control...
+ // If the AP interface is not under application control...
if (mWiFiAPMode != kWiFiAPMode_ApplicationControlled)
{
// Determine the target (desired) state for AP interface...
@@ -428,7 +426,7 @@ void ConnectivityManagerImpl::DriveAPState()
{
targetState = kWiFiAPState_NotActive;
}
-
+
// If the current AP state does not match the target state...
if (mWiFiAPState != targetState)
{
@@ -585,11 +583,11 @@ void ConnectivityManagerImpl::DriveStationState()
void ConnectivityManagerImpl::UpdateInternetConnectivityState(void)
{
- bool haveIPv4Conn = false;
- bool haveIPv6Conn = false;
- const bool hadIPv4Conn = mFlags.Has(ConnectivityFlags::kHaveIPv4InternetConnectivity);
- const bool hadIPv6Conn = mFlags.Has(ConnectivityFlags::kHaveIPv6InternetConnectivity);
- struct netif *net_interface = NULL;
+ bool haveIPv4Conn = false;
+ bool haveIPv6Conn = false;
+ const bool hadIPv4Conn = mFlags.Has(ConnectivityFlags::kHaveIPv4InternetConnectivity);
+ const bool hadIPv6Conn = mFlags.Has(ConnectivityFlags::kHaveIPv6InternetConnectivity);
+ struct netif * net_interface = NULL;
IPAddress addr;
bool stationConnected;
Internal::P6Utils::IsStationConnected(stationConnected);
@@ -598,7 +596,7 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void)
// If the WiFi station is currently in the connected state...
if ((mWiFiStationState == kWiFiStationState_Connected) || stationConnected)
{
- net_interface = cy_lwip_get_interface(CY_LWIP_STA_NW_INTERFACE);
+ net_interface = cy_lwip_get_interface(CY_LWIP_STA_NW_INTERFACE);
if (net_interface != NULL && netif_is_up(net_interface) && netif_is_link_up(net_interface))
{
if (!ip4_addr_isany(netif_ip4_addr(net_interface)) && !ip4_addr_isany(netif_ip4_gw(net_interface)))
@@ -613,7 +611,8 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void)
// address (2000::/3) that is in the valid state. If such an address is found...
for (uint8_t i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++)
{
- if (ip6_addr_islinklocal(netif_ip6_addr(net_interface, i)) && ip6_addr_isvalid(netif_ip6_addr_state(net_interface, i)))
+ if (ip6_addr_islinklocal(netif_ip6_addr(net_interface, i)) &&
+ ip6_addr_isvalid(netif_ip6_addr_state(net_interface, i)))
{
haveIPv6Conn = true;
ChipDeviceEvent event;
@@ -649,7 +648,6 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void)
ChipLogProgress(DeviceLayer, "%s Internet connectivity %s", "IPv6", (haveIPv6Conn) ? "ESTABLISHED" : "LOST");
}
}
-
}
CHIP_ERROR ConnectivityManagerImpl::OnIPAddressAvailable(void)
@@ -661,15 +659,15 @@ CHIP_ERROR ConnectivityManagerImpl::OnIPAddressAvailable(void)
CHIP_ERROR ConnectivityManagerImpl::WiFi_init(void)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
+ CHIP_ERROR err = CHIP_NO_ERROR;
cy_rslt_t result = CY_RSLT_SUCCESS;
- err = Internal::P6Utils::StartWiFiLayer();
+ err = Internal::P6Utils::StartWiFiLayer();
SuccessOrExit(err);
/* Register event callback */
if (eventcallback == false)
{
result = cy_wcm_register_event_callback(ConnectivityManagerImpl::wlan_event_cb);
- if( result != CY_RSLT_SUCCESS )
+ if (result != CY_RSLT_SUCCESS)
{
ChipLogError(DeviceLayer, "cy_wcm_register_event_callback failed....! \r\n");
err = CHIP_ERROR_INTERNAL;
@@ -684,7 +682,7 @@ CHIP_ERROR ConnectivityManagerImpl::WiFi_init(void)
CHIP_ERROR ConnectivityManagerImpl::ping_thread()
{
CHIP_ERROR err = CHIP_NO_ERROR;
- err = Internal::P6Utils::ping_init();
+ err = Internal::P6Utils::ping_init();
return err;
}
diff --git a/src/platform/P6/ConnectivityManagerImpl.h b/src/platform/P6/ConnectivityManagerImpl.h
index be34bfc3648bb6..b7b08454f06918 100644
--- a/src/platform/P6/ConnectivityManagerImpl.h
+++ b/src/platform/P6/ConnectivityManagerImpl.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -29,8 +29,8 @@
#endif
#include
-#include
#include
+#include
namespace Inet {
class IPAddress;
@@ -58,6 +58,7 @@ class ConnectivityManagerImpl final : public ConnectivityManager,
// Allow the ConnectivityManager interface class to delegate method calls to
// the implementation methods provided by this class.
friend class ConnectivityManager;
+
public:
CHIP_ERROR ping_thread(void);
@@ -119,20 +120,20 @@ class ConnectivityManagerImpl final : public ConnectivityManager,
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 DriveAPState(::chip::System::Layer * aLayer, void * aAppState, ::CHIP_ERROR aError);
void DriveStationState(void);
void DriveAPState(void);
CHIP_ERROR ConfigureWiFiAP(void);
void ChangeWiFiAPState(WiFiAPState newState);
void UpdateInternetConnectivityState(void);
- static void wlan_event_cb(cy_wcm_event_t event, cy_wcm_event_data_t *event_data);
+ static void wlan_event_cb(cy_wcm_event_t event, cy_wcm_event_data_t * event_data);
CHIP_ERROR WiFi_init(void);
CHIP_ERROR OnIPAddressAvailable(void);
};
inline bool ConnectivityManagerImpl::_IsWiFiStationApplicationControlled(void)
{
- return mWiFiStationMode == kWiFiStationMode_ApplicationControlled;
+ return mWiFiStationMode == kWiFiStationMode_ApplicationControlled;
}
inline bool ConnectivityManagerImpl::_IsWiFiStationConnected(void)
diff --git a/src/platform/P6/DeviceNetworkProvisioningDelegateImpl.cpp b/src/platform/P6/DeviceNetworkProvisioningDelegateImpl.cpp
index 70ba5b547ad0ac..83a1eceefce0c9 100644
--- a/src/platform/P6/DeviceNetworkProvisioningDelegateImpl.cpp
+++ b/src/platform/P6/DeviceNetworkProvisioningDelegateImpl.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,8 @@ CHIP_ERROR DeviceNetworkProvisioningDelegateImpl::_ProvisionWiFiNetwork(const ch
// Set the wifi configuration
wifi_config_t wifi_config;
- Internal::P6Utils::populate_wifi_config_t(&wifi_config, WIFI_IF_STA, (const cy_wcm_ssid_t*)ssid, (const cy_wcm_passphrase_t*)passwd, CHIP_DEVICE_CONFIG_DEFAULT_STA_SECURITY);
+ Internal::P6Utils::populate_wifi_config_t(&wifi_config, WIFI_IF_STA, (const cy_wcm_ssid_t *) ssid,
+ (const cy_wcm_passphrase_t *) passwd, CHIP_DEVICE_CONFIG_DEFAULT_STA_SECURITY);
rslt = Internal::P6Utils::p6_wifi_set_config(WIFI_IF_STA, &wifi_config);
if (rslt != CY_RSLT_SUCCESS)
diff --git a/src/platform/P6/DeviceNetworkProvisioningDelegateImpl.h b/src/platform/P6/DeviceNetworkProvisioningDelegateImpl.h
index 6e89a78e2110b2..776b0bc28d777d 100644
--- a/src/platform/P6/DeviceNetworkProvisioningDelegateImpl.h
+++ b/src/platform/P6/DeviceNetworkProvisioningDelegateImpl.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/platform/P6/Entropy.cpp b/src/platform/P6/Entropy.cpp
index c2d28917bc441a..a87488c79a11df 100644
--- a/src/platform/P6/Entropy.cpp
+++ b/src/platform/P6/Entropy.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -42,8 +42,8 @@ int GetEntropy_P6(uint8_t * buf, size_t bufSize)
while (bufSize > 0)
{
uint32_t val = cyhal_trng_generate(&trng);
- size_t n = chip::min(bufSize, sizeof(uint32_t));
- memcpy(buf, static_cast(&val), n);
+ size_t n = chip::min(bufSize, sizeof(uint32_t));
+ memcpy(buf, static_cast(&val), n);
buf += n;
bufSize -= n;
diff --git a/src/platform/P6/GroupKeyStoreImpl.cpp b/src/platform/P6/GroupKeyStoreImpl.cpp
index 40f8523e8999a6..b82467eba84bbd 100644
--- a/src/platform/P6/GroupKeyStoreImpl.cpp
+++ b/src/platform/P6/GroupKeyStoreImpl.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/GroupKeyStoreImpl.h b/src/platform/P6/GroupKeyStoreImpl.h
index ae2478fedbcb21..258c5cebd512e0 100644
--- a/src/platform/P6/GroupKeyStoreImpl.h
+++ b/src/platform/P6/GroupKeyStoreImpl.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,8 +22,8 @@
*/
#include
-#include
#include
+#include
namespace chip {
namespace DeviceLayer {
diff --git a/src/platform/P6/InetPlatformConfig.h b/src/platform/P6/InetPlatformConfig.h
index 9b408a62d22438..f9c4389a17bb93 100644
--- a/src/platform/P6/InetPlatformConfig.h
+++ b/src/platform/P6/InetPlatformConfig.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/KeyValueStoreManagerImpl.cpp b/src/platform/P6/KeyValueStoreManagerImpl.cpp
index b1292dd49beaff..2923d0b4dfa3d7 100644
--- a/src/platform/P6/KeyValueStoreManagerImpl.cpp
+++ b/src/platform/P6/KeyValueStoreManagerImpl.cpp
@@ -21,8 +21,8 @@
* Platform-specific key value storage implementation for P6
*/
-#include
#include "cy_result.h"
+#include
#if defined(__GNUC__)
#pragma GCC diagnostic pop
@@ -37,12 +37,13 @@ KeyValueStoreManagerImpl KeyValueStoreManagerImpl::sInstance;
KeyValueStoreManagerImpl::KeyValueStoreManagerImpl()
{
cy_rslt_t result = mtb_key_value_store_init(&kvstore_obj);
- init_success = (CY_RSLT_SUCCESS == result) ? true : false;
+ init_success = (CY_RSLT_SUCCESS == result) ? true : false;
}
-CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size, size_t offset_bytes) const
+CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size,
+ size_t offset_bytes) const
{
- uint8_t *local_value;
+ uint8_t * local_value;
uint32_t actual_size;
uint32_t size;
cy_rslt_t result;
@@ -53,7 +54,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t
}
// Get the value size
- result = mtb_kvstore_read(const_cast(&kvstore_obj), key, NULL, &actual_size);
+ result = mtb_kvstore_read(const_cast(&kvstore_obj), key, NULL, &actual_size);
if ((result != CY_RSLT_SUCCESS) || (value == NULL))
{
@@ -69,7 +70,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t
{
size = actual_size;
- local_value = (uint8_t*)malloc(actual_size);
+ local_value = (uint8_t *) malloc(actual_size);
if (local_value == NULL)
{
@@ -80,18 +81,18 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t
{
size = value_size;
- local_value = (uint8_t*)value;
+ local_value = (uint8_t *) value;
if (actual_size < value_size)
{
// They may ask for more than what was originally stored, so we need to zero out the
// entire value to account for that.
- memset(&((uint8_t*)value)[actual_size], 0, value_size - actual_size);
+ memset(&((uint8_t *) value)[actual_size], 0, value_size - actual_size);
}
}
// Read the value
- result = mtb_kvstore_read(const_cast(&kvstore_obj), key, local_value, &size);
+ result = mtb_kvstore_read(const_cast(&kvstore_obj), key, local_value, &size);
if (result != CY_RSLT_SUCCESS)
{
@@ -126,18 +127,18 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t
CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, size_t value_size)
{
- if(!init_success)
+ if (!init_success)
{
return CHIP_ERROR_WELL_UNINITIALIZED;
}
- cy_rslt_t result = mtb_kvstore_write(&kvstore_obj, key, static_cast(value), value_size);
+ cy_rslt_t result = mtb_kvstore_write(&kvstore_obj, key, static_cast(value), value_size);
return _convert_cy_rslt_to_chip(result);
}
CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key)
{
- if(!init_success)
+ if (!init_success)
{
return CHIP_ERROR_WELL_UNINITIALIZED;
}
@@ -148,23 +149,23 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key)
CHIP_ERROR KeyValueStoreManagerImpl::_convert_cy_rslt_to_chip(cy_rslt_t err) const
{
- switch(err)
+ switch (err)
{
- case CY_RSLT_SUCCESS:
- return CHIP_NO_ERROR;
- case MTB_KVSTORE_BAD_PARAM_ERROR:
- return CHIP_ERROR_INVALID_ARGUMENT;
- case MTB_KVSTORE_STORAGE_FULL_ERROR: // Can't find a better CHIP error to translate this into
- case MTB_KVSTORE_MEM_ALLOC_ERROR:
- return CHIP_ERROR_BUFFER_TOO_SMALL;
- case MTB_KVSTORE_INVALID_DATA_ERROR:
- case MTB_KVSTORE_ERASED_DATA_ERROR:
- return CHIP_ERROR_INTEGRITY_CHECK_FAILED;
- case MTB_KVSTORE_ITEM_NOT_FOUND_ERROR:
- return CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
- case MTB_KVSTORE_ALIGNMENT_ERROR:
- default:
- return CHIP_ERROR_INTERNAL;
+ case CY_RSLT_SUCCESS:
+ return CHIP_NO_ERROR;
+ case MTB_KVSTORE_BAD_PARAM_ERROR:
+ return CHIP_ERROR_INVALID_ARGUMENT;
+ case MTB_KVSTORE_STORAGE_FULL_ERROR: // Can't find a better CHIP error to translate this into
+ case MTB_KVSTORE_MEM_ALLOC_ERROR:
+ return CHIP_ERROR_BUFFER_TOO_SMALL;
+ case MTB_KVSTORE_INVALID_DATA_ERROR:
+ case MTB_KVSTORE_ERASED_DATA_ERROR:
+ return CHIP_ERROR_INTEGRITY_CHECK_FAILED;
+ case MTB_KVSTORE_ITEM_NOT_FOUND_ERROR:
+ return CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
+ case MTB_KVSTORE_ALIGNMENT_ERROR:
+ default:
+ return CHIP_ERROR_INTERNAL;
}
return CHIP_ERROR_INTERNAL;
}
diff --git a/src/platform/P6/LwIPCoreLock.cpp b/src/platform/P6/LwIPCoreLock.cpp
index 0e22d210d63380..531777c8c009f4 100644
--- a/src/platform/P6/LwIPCoreLock.cpp
+++ b/src/platform/P6/LwIPCoreLock.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/MTBKeyValueStore.cpp b/src/platform/P6/MTBKeyValueStore.cpp
index a09d6f3291435d..b596abac73ea26 100644
--- a/src/platform/P6/MTBKeyValueStore.cpp
+++ b/src/platform/P6/MTBKeyValueStore.cpp
@@ -28,13 +28,13 @@ static cyhal_flash_block_info_t block_info;
static cyhal_flash_t flash_obj;
static mtb_kvstore_bd_t block_device;
-cy_rslt_t mtb_key_value_store_init(mtb_kvstore_t *kvstore_obj)
+cy_rslt_t mtb_key_value_store_init(mtb_kvstore_t * kvstore_obj)
{
cyhal_flash_info_t flash_info;
// Initialize the block device
cy_rslt_t result = cyhal_flash_init(&flash_obj);
- if(CY_RSLT_SUCCESS != result)
+ if (CY_RSLT_SUCCESS != result)
{
return result;
}
@@ -52,7 +52,7 @@ cy_rslt_t mtb_key_value_store_init(mtb_kvstore_t *kvstore_obj)
// Initialize the kv-store library
result = mtb_kvstore_init(kvstore_obj, block_info.start_address, block_info.size, &block_device);
- if(CY_RSLT_SUCCESS != result)
+ if (CY_RSLT_SUCCESS != result)
{
cyhal_flash_free(&flash_obj);
}
@@ -60,49 +60,47 @@ cy_rslt_t mtb_key_value_store_init(mtb_kvstore_t *kvstore_obj)
return result;
}
-uint32_t bd_read_size(void* context, uint32_t addr)
+uint32_t bd_read_size(void * context, uint32_t addr)
{
return 1;
}
-uint32_t bd_program_size(void* context, uint32_t addr)
+uint32_t bd_program_size(void * context, uint32_t addr)
{
return block_info.page_size;
}
-uint32_t bd_erase_size(void* context, uint32_t addr)
+uint32_t bd_erase_size(void * context, uint32_t addr)
{
return block_info.sector_size;
}
-cy_rslt_t bd_read(void* context, uint32_t addr, uint32_t length, uint8_t* buf)
+cy_rslt_t bd_read(void * context, uint32_t addr, uint32_t length, uint8_t * buf)
{
- memcpy(buf, (const uint8_t*)(addr), length);
+ memcpy(buf, (const uint8_t *) (addr), length);
return CY_RSLT_SUCCESS;
}
-cy_rslt_t bd_program(void* context, uint32_t addr, uint32_t length, const uint8_t* buf)
+cy_rslt_t bd_program(void * context, uint32_t addr, uint32_t length, const uint8_t * buf)
{
uint32_t prog_size = bd_program_size(context, addr);
CY_ASSERT(0 == (length % prog_size));
cy_rslt_t result = CY_RSLT_SUCCESS;
- for (uint32_t loc = addr; (result == CY_RSLT_SUCCESS) && (loc < addr + length);
- loc += prog_size, buf += prog_size)
+ for (uint32_t loc = addr; (result == CY_RSLT_SUCCESS) && (loc < addr + length); loc += prog_size, buf += prog_size)
{
- result = cyhal_flash_program((cyhal_flash_t*)context, loc, (const uint32_t*)buf);
+ result = cyhal_flash_program((cyhal_flash_t *) context, loc, (const uint32_t *) buf);
}
return result;
}
-cy_rslt_t bd_erase(void* context, uint32_t addr, uint32_t length)
+cy_rslt_t bd_erase(void * context, uint32_t addr, uint32_t length)
{
uint32_t erase_size = bd_erase_size(context, addr);
CY_ASSERT(0 == (length % erase_size));
cy_rslt_t result = CY_RSLT_SUCCESS;
- for (uint32_t loc = addr; (result == CY_RSLT_SUCCESS) && (loc < addr + length);
- loc += erase_size)
+ for (uint32_t loc = addr; (result == CY_RSLT_SUCCESS) && (loc < addr + length); loc += erase_size)
{
- result = cyhal_flash_erase((cyhal_flash_t*)context, loc);
+ result = cyhal_flash_erase((cyhal_flash_t *) context, loc);
}
return result;
}
diff --git a/src/platform/P6/MTBKeyValueStore.h b/src/platform/P6/MTBKeyValueStore.h
index 5f4be1e815482a..f6dd99aa33a283 100644
--- a/src/platform/P6/MTBKeyValueStore.h
+++ b/src/platform/P6/MTBKeyValueStore.h
@@ -25,13 +25,13 @@
#pragma once
#include "cy_result.h"
-#include "mtb_kvstore.h"
#include "cyhal_flash.h"
+#include "mtb_kvstore.h"
-cy_rslt_t mtb_key_value_store_init(mtb_kvstore_t *kvstore_obj);
-uint32_t bd_read_size(void* context, uint32_t addr);
-uint32_t bd_program_size(void* context, uint32_t addr);
-uint32_t bd_erase_size(void* context, uint32_t addr);
-cy_rslt_t bd_read(void* context, uint32_t addr, uint32_t length, uint8_t* buf);
-cy_rslt_t bd_program(void* context, uint32_t addr, uint32_t length, const uint8_t* buf);
-cy_rslt_t bd_erase(void* context, uint32_t addr, uint32_t length);
+cy_rslt_t mtb_key_value_store_init(mtb_kvstore_t * kvstore_obj);
+uint32_t bd_read_size(void * context, uint32_t addr);
+uint32_t bd_program_size(void * context, uint32_t addr);
+uint32_t bd_erase_size(void * context, uint32_t addr);
+cy_rslt_t bd_read(void * context, uint32_t addr, uint32_t length, uint8_t * buf);
+cy_rslt_t bd_program(void * context, uint32_t addr, uint32_t length, const uint8_t * buf);
+cy_rslt_t bd_erase(void * context, uint32_t addr, uint32_t length);
diff --git a/src/platform/P6/P6Config.cpp b/src/platform/P6/P6Config.cpp
index 1923e75408ce08..d85059859f77f0 100644
--- a/src/platform/P6/P6Config.cpp
+++ b/src/platform/P6/P6Config.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019-2020 Google LLC.
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
@@ -57,9 +57,9 @@ const P6Config::Key P6Config::kConfigKey_ProductRevision = { kConfigNamespac
const P6Config::Key P6Config::kConfigKey_ManufacturingDate = { kConfigNamespace_ChipFactory, "mfg-date" };
const P6Config::Key P6Config::kConfigKey_SetupPinCode = { kConfigNamespace_ChipFactory, "pin-code" };
const P6Config::Key P6Config::kConfigKey_SetupDiscriminator = { kConfigNamespace_ChipFactory, "discriminator" };
-const P6Config::Key P6Config::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
-const P6Config::Key P6Config::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
-const P6Config::Key P6Config::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };
+const P6Config::Key P6Config::kConfigKey_RegulatoryLocation = { kConfigNamespace_ChipConfig, "regulatory-location" };
+const P6Config::Key P6Config::kConfigKey_CountryCode = { kConfigNamespace_ChipConfig, "country-code" };
+const P6Config::Key P6Config::kConfigKey_Breadcrumb = { kConfigNamespace_ChipConfig, "breadcrumb" };
// Keys stored in the chip-config namespace
const P6Config::Key P6Config::kConfigKey_FabricId = { kConfigNamespace_ChipConfig, "fabric-id" };
@@ -81,10 +81,10 @@ const char P6Config::kGroupKeyNamePrefix[] = "gk-";
CHIP_ERROR P6Config::ReadConfigValue(Key key, bool & val)
{
bool in;
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
- CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key_str, static_cast(&in), sizeof(bool));
- val = in;
+ CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key_str, static_cast(&in), sizeof(bool));
+ val = in;
if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
{
err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND;
@@ -95,10 +95,10 @@ CHIP_ERROR P6Config::ReadConfigValue(Key key, bool & val)
CHIP_ERROR P6Config::ReadConfigValue(Key key, uint32_t & val)
{
uint32_t in;
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
- CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key_str, static_cast(&in), 4);
- val = in;
+ CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key_str, static_cast(&in), 4);
+ val = in;
if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
{
err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND;
@@ -109,10 +109,10 @@ CHIP_ERROR P6Config::ReadConfigValue(Key key, uint32_t & val)
CHIP_ERROR P6Config::ReadConfigValue(Key key, uint64_t & val)
{
uint64_t in;
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
- CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key_str, static_cast(&in), 8);
- val = in;
+ CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key_str, static_cast(&in), 8);
+ val = in;
if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
{
err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND;
@@ -122,7 +122,7 @@ CHIP_ERROR P6Config::ReadConfigValue(Key key, uint64_t & val)
CHIP_ERROR P6Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key_str, buf, bufSize, &outLen);
if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
@@ -134,7 +134,7 @@ CHIP_ERROR P6Config::ReadConfigValueStr(Key key, char * buf, size_t bufSize, siz
CHIP_ERROR P6Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
CHIP_ERROR err = PersistedStorage::KeyValueStoreMgr().Get(key_str, buf, bufSize, &outLen);
if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
@@ -146,59 +146,58 @@ CHIP_ERROR P6Config::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize,
CHIP_ERROR P6Config::WriteConfigValue(Key key, bool val)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
- return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), sizeof(bool));
+ return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), sizeof(bool));
}
CHIP_ERROR P6Config::WriteConfigValue(Key key, uint32_t val)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
- return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), 4);
+ return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), 4);
}
CHIP_ERROR P6Config::WriteConfigValue(Key key, uint64_t val)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
- return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), 8);
+ return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&val), 8);
}
CHIP_ERROR P6Config::WriteConfigValueStr(Key key, const char * str)
{
- size_t size = strlen(str) + 1;
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ size_t size = strlen(str) + 1;
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
return PersistedStorage::KeyValueStoreMgr().Put(key_str, str, size);
}
CHIP_ERROR P6Config::WriteConfigValueStr(Key key, const char * str, size_t strLen)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
return PersistedStorage::KeyValueStoreMgr().Put(key_str, str, strLen);
}
CHIP_ERROR P6Config::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
- return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&data), dataLen);
+ return PersistedStorage::KeyValueStoreMgr().Put(key_str, static_cast(&data), dataLen);
}
CHIP_ERROR P6Config::ClearConfigValue(Key key)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
return PersistedStorage::KeyValueStoreMgr().Delete(key_str);
}
bool P6Config::ConfigValueExists(Key key)
{
- char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = {0};
+ char key_str[MTB_KVSTORE_MAX_KEY_SIZE] = { 0 };
key.to_str(key_str, MTB_KVSTORE_MAX_KEY_SIZE);
- if(PersistedStorage::KeyValueStoreMgr().Get(key_str, NULL, 0) ==
- CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
+ if (PersistedStorage::KeyValueStoreMgr().Get(key_str, NULL, 0) == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)
{
return false;
}
@@ -209,13 +208,24 @@ bool P6Config::ConfigValueExists(Key key)
// Clear out keys in config namespace
CHIP_ERROR P6Config::FactoryResetConfig(void)
{
- const Key *config_keys[] = {&kConfigKey_FabricId, &kConfigKey_ServiceConfig, &kConfigKey_PairedAccountId, &kConfigKey_ServiceId, &kConfigKey_GroupKeyIndex, &kConfigKey_LastUsedEpochKeyId, &kConfigKey_FailSafeArmed, &kConfigKey_WiFiStationSecType, &kConfigKey_OperationalDeviceId, &kConfigKey_OperationalDeviceCert, &kConfigKey_OperationalDeviceICACerts, &kConfigKey_OperationalDevicePrivateKey};
-
- for(uint32_t i = 0; i < (sizeof(config_keys)/sizeof(config_keys[0])); i++)
+ const Key * config_keys[] = { &kConfigKey_FabricId,
+ &kConfigKey_ServiceConfig,
+ &kConfigKey_PairedAccountId,
+ &kConfigKey_ServiceId,
+ &kConfigKey_GroupKeyIndex,
+ &kConfigKey_LastUsedEpochKeyId,
+ &kConfigKey_FailSafeArmed,
+ &kConfigKey_WiFiStationSecType,
+ &kConfigKey_OperationalDeviceId,
+ &kConfigKey_OperationalDeviceCert,
+ &kConfigKey_OperationalDeviceICACerts,
+ &kConfigKey_OperationalDevicePrivateKey };
+
+ for (uint32_t i = 0; i < (sizeof(config_keys) / sizeof(config_keys[0])); i++)
{
CHIP_ERROR err = ClearConfigValue(*config_keys[i]);
// Something unexpected happened
- if(err != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND && err != CHIP_NO_ERROR)
+ if (err != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND && err != CHIP_NO_ERROR)
{
return err;
}
diff --git a/src/platform/P6/P6Config.h b/src/platform/P6/P6Config.h
index 6be3e563597d51..c02b480377117f 100644
--- a/src/platform/P6/P6Config.h
+++ b/src/platform/P6/P6Config.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019-2020 Google LLC.
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
@@ -27,8 +27,8 @@
#include
-#include
#include
+#include
namespace chip {
namespace DeviceLayer {
@@ -107,14 +107,14 @@ struct P6Config::Key
const char * Namespace;
const char * Name;
- CHIP_ERROR to_str(char *buf, size_t buf_size) const;
+ CHIP_ERROR to_str(char * buf, size_t buf_size) const;
size_t len() const;
bool operator==(const Key & other) const;
};
-inline CHIP_ERROR P6Config::Key::to_str(char *buf, size_t buf_size) const
+inline CHIP_ERROR P6Config::Key::to_str(char * buf, size_t buf_size) const
{
- if(buf_size < len() + 1)
+ if (buf_size < len() + 1)
{
return CHIP_ERROR_BUFFER_TOO_SMALL;
}
diff --git a/src/platform/P6/P6Utils.cpp b/src/platform/P6/P6Utils.cpp
index 171201fbd0560d..ff282412a60e60 100644
--- a/src/platform/P6/P6Utils.cpp
+++ b/src/platform/P6/P6Utils.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -24,24 +24,24 @@
/* this file behaves like a config.h, comes first */
#include
+#include
+#include
#include
#include
#include
#include
-#include
-#include
-#include "lwip/opt.h"
-#include "lwip/mem.h"
-#include "lwip/raw.h"
#include "lwip/icmp.h"
-#include "lwip/netif.h"
-#include "lwip/sys.h"
-#include "lwip/timeouts.h"
+#include "lwip/inet.h"
#include "lwip/inet_chksum.h"
+#include "lwip/mem.h"
+#include "lwip/netif.h"
+#include "lwip/opt.h"
#include "lwip/prot/ip4.h"
+#include "lwip/raw.h"
#include "lwip/sockets.h"
-#include "lwip/inet.h"
+#include "lwip/sys.h"
+#include "lwip/timeouts.h"
using namespace ::chip::DeviceLayer::Internal;
using chip::DeviceLayer::Internal::DeviceNetworkInfo;
@@ -52,12 +52,12 @@ static bool wcm_init_done;
/** ping delay - in milliseconds */
#ifndef PING_DELAY
-#define PING_DELAY 2000
+#define PING_DELAY 2000
#endif
/** ping identifier - must fit on a u16_t */
#ifndef PING_ID
-#define PING_ID 0xAFAF
+#define PING_ID 0xAFAF
#endif
/** ping additional data size to include in the packet */
@@ -71,20 +71,20 @@ static bool wcm_init_done;
#endif
/* Ping IP Header len for IPv4 */
-#define IP_HDR_LEN 20
+#define IP_HDR_LEN 20
/* Ping Response length */
-#define PING_RESPONSE_LEN 64
+#define PING_RESPONSE_LEN 64
/* Enable Ping via Socket API or RAW API */
-#define PING_USE_SOCKETS 1
+#define PING_USE_SOCKETS 1
/* ping variables */
-static const ip_addr_t* ping_target;
+static const ip_addr_t * ping_target;
static u16_t ping_seq_num;
static u32_t ping_time;
#if !PING_USE_SOCKETS
-static struct raw_pcb *ping_pcb;
+static struct raw_pcb * ping_pcb;
#endif /* PING_USE_SOCKETS */
typedef struct
@@ -93,7 +93,6 @@ typedef struct
uint8_t data[PING_DATA_SIZE];
} icmp_packet_t;
-
CHIP_ERROR P6Utils::IsAPEnabled(bool & apEnabled)
{
apEnabled = (WiFiMode == WIFI_MODE_AP || WiFiMode == WIFI_MODE_APSTA);
@@ -103,19 +102,20 @@ CHIP_ERROR P6Utils::IsAPEnabled(bool & apEnabled)
bool P6Utils::IsStationProvisioned(void)
{
wifi_config_t stationConfig;
- return (p6_wifi_get_config(WIFI_IF_STA, &stationConfig) == CY_RSLT_SUCCESS && strlen((const char*)stationConfig.sta.ssid) != 0);
+ return (p6_wifi_get_config(WIFI_IF_STA, &stationConfig) == CY_RSLT_SUCCESS &&
+ strlen((const char *) stationConfig.sta.ssid) != 0);
}
CHIP_ERROR P6Utils::IsStationConnected(bool & connected)
{
CHIP_ERROR err = CHIP_NO_ERROR;
- connected = cy_wcm_is_connected_to_ap();
+ connected = cy_wcm_is_connected_to_ap();
return err;
}
CHIP_ERROR P6Utils::StartWiFiLayer(void)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
+ CHIP_ERROR err = CHIP_NO_ERROR;
cy_rslt_t result = CY_RSLT_SUCCESS;
cy_wcm_config_t wcm_config;
@@ -200,42 +200,41 @@ const char * P6Utils::WiFiModeToStr(wifi_mode_t wifiMode)
return "(unknown)";
}
}
-cy_rslt_t P6Utils::p6_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf)
+cy_rslt_t P6Utils::p6_wifi_set_config(wifi_interface_t interface, wifi_config_t * conf)
{
if (interface == WIFI_IF_STA)
{
populate_wifi_config_t(&wifi_conf, interface, &conf->sta.ssid, &conf->sta.password, conf->sta.security);
- ChipLogProgress(DeviceLayer, "STA %s : [%s] [%s] \r\n",
- __func__, wifi_conf.sta.ssid, wifi_conf.sta.password);
+ ChipLogProgress(DeviceLayer, "STA %s : [%s] [%s] \r\n", __func__, wifi_conf.sta.ssid, wifi_conf.sta.password);
}
- else
- {
+ else
+ {
populate_wifi_config_t(&wifi_conf, interface, &conf->ap.ssid, &conf->ap.password, conf->ap.security);
- wifi_conf.ap.channel = conf->ap.channel;
+ wifi_conf.ap.channel = conf->ap.channel;
wifi_conf.ap.ip_settings.ip_address = conf->ap.ip_settings.ip_address;
- wifi_conf.ap.ip_settings.netmask = conf->ap.ip_settings.netmask;
- wifi_conf.ap.ip_settings.gateway = conf->ap.ip_settings.gateway;
- ChipLogProgress(DeviceLayer, "AP %s : [%s] [%s] channel %d\r\n", __func__,
- wifi_conf.ap.ssid, wifi_conf.ap.password, wifi_conf.ap.channel);
- }
- return CY_RSLT_SUCCESS;
+ wifi_conf.ap.ip_settings.netmask = conf->ap.ip_settings.netmask;
+ wifi_conf.ap.ip_settings.gateway = conf->ap.ip_settings.gateway;
+ ChipLogProgress(DeviceLayer, "AP %s : [%s] [%s] channel %d\r\n", __func__, wifi_conf.ap.ssid, wifi_conf.ap.password,
+ wifi_conf.ap.channel);
+ }
+ return CY_RSLT_SUCCESS;
}
-cy_rslt_t P6Utils::p6_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf)
+cy_rslt_t P6Utils::p6_wifi_get_config(wifi_interface_t interface, wifi_config_t * conf)
{
if (interface == WIFI_IF_STA)
- {
+ {
populate_wifi_config_t(conf, interface, &wifi_conf.sta.ssid, &wifi_conf.sta.password, wifi_conf.sta.security);
}
else
- {
+ {
populate_wifi_config_t(conf, interface, &wifi_conf.ap.ssid, &wifi_conf.ap.password, wifi_conf.ap.security);
- conf->ap.channel = wifi_conf.ap.channel;
+ conf->ap.channel = wifi_conf.ap.channel;
conf->ap.ip_settings.ip_address = wifi_conf.ap.ip_settings.ip_address;
- conf->ap.ip_settings.netmask = wifi_conf.ap.ip_settings.netmask;
- conf->ap.ip_settings.gateway = wifi_conf.ap.ip_settings.gateway;
- ChipLogProgress(DeviceLayer, "AP %s [%s] [%s] channel %d\r\n", __func__,
- wifi_conf.ap.ssid, wifi_conf.ap.password, wifi_conf.ap.channel);
+ conf->ap.ip_settings.netmask = wifi_conf.ap.ip_settings.netmask;
+ conf->ap.ip_settings.gateway = wifi_conf.ap.ip_settings.gateway;
+ ChipLogProgress(DeviceLayer, "AP %s [%s] [%s] channel %d\r\n", __func__, wifi_conf.ap.ssid, wifi_conf.ap.password,
+ wifi_conf.ap.channel);
}
return CY_RSLT_SUCCESS;
}
@@ -248,7 +247,7 @@ CHIP_ERROR P6Utils::GetWiFiStationProvision(Internal::DeviceNetworkInfo & netInf
err = p6_wifi_get_config(WIFI_IF_STA, &stationConfig);
SuccessOrExit(err);
ChipLogProgress(DeviceLayer, "GetWiFiStationProvision");
- VerifyOrExit(strlen((const char *)stationConfig.sta.ssid) != 0, err = CHIP_ERROR_INCORRECT_STATE);
+ VerifyOrExit(strlen((const char *) stationConfig.sta.ssid) != 0, err = CHIP_ERROR_INCORRECT_STATE);
netInfo.NetworkId = kWiFiStationNetworkId;
netInfo.FieldPresent.NetworkId = true;
@@ -294,7 +293,7 @@ CHIP_ERROR P6Utils::SetWiFiStationProvision(const Internal::DeviceNetworkInfo &
}
// Initialize an P6 wifi_config_t structure based on the new provision information.
- populate_wifi_config_t(&wifiConfig, WIFI_IF_STA, (cy_wcm_ssid_t*)wifiSSID, (cy_wcm_passphrase_t*)netInfo.WiFiKey);
+ populate_wifi_config_t(&wifiConfig, WIFI_IF_STA, (cy_wcm_ssid_t *) wifiSSID, (cy_wcm_passphrase_t *) netInfo.WiFiKey);
// Configure the P6 WiFi interface.
err = p6_wifi_set_config(WIFI_IF_STA, &wifiConfig);
@@ -323,7 +322,7 @@ CHIP_ERROR P6Utils::ClearWiFiStationProvision(void)
CHIP_ERROR P6Utils::p6_wifi_disconnect(void)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
+ CHIP_ERROR err = CHIP_NO_ERROR;
cy_rslt_t result = CY_RSLT_SUCCESS;
ChipLogProgress(DeviceLayer, "p6_wifi_disconnect");
result = cy_wcm_disconnect_ap();
@@ -337,23 +336,21 @@ CHIP_ERROR P6Utils::p6_wifi_disconnect(void)
CHIP_ERROR P6Utils::p6_wifi_connect(void)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
+ CHIP_ERROR err = CHIP_NO_ERROR;
cy_rslt_t result = CY_RSLT_SUCCESS;
wifi_config_t stationConfig;
cy_wcm_connect_params_t connect_param;
cy_wcm_ip_address_t ip_addr;
-
+
p6_wifi_get_config(WIFI_IF_STA, &stationConfig);
memset(&connect_param, 0, sizeof(cy_wcm_connect_params_t));
memset(&ip_addr, 0, sizeof(cy_wcm_ip_address_t));
- memcpy(&connect_param.ap_credentials.SSID, &stationConfig.sta.ssid, strlen((char *)stationConfig.sta.ssid));
- memcpy(&connect_param.ap_credentials.password, &stationConfig.sta.password, strlen((char *)stationConfig.sta.password));
+ memcpy(&connect_param.ap_credentials.SSID, &stationConfig.sta.ssid, strlen((char *) stationConfig.sta.ssid));
+ memcpy(&connect_param.ap_credentials.password, &stationConfig.sta.password, strlen((char *) stationConfig.sta.password));
connect_param.ap_credentials.security = stationConfig.sta.security;
- ChipLogProgress(DeviceLayer, "p6_wifi_connect ssid %s pass %s sec %d \r\n",
- connect_param.ap_credentials.SSID,
- connect_param.ap_credentials.password,
- connect_param.ap_credentials.security);
+ ChipLogProgress(DeviceLayer, "p6_wifi_connect ssid %s pass %s sec %d \r\n", connect_param.ap_credentials.SSID,
+ connect_param.ap_credentials.password, connect_param.ap_credentials.security);
result = cy_wcm_connect_ap(&connect_param, &ip_addr);
if (result != CY_RSLT_SUCCESS)
@@ -364,18 +361,17 @@ CHIP_ERROR P6Utils::p6_wifi_connect(void)
return err;
}
-#define INITIALISER_IPV4_ADDRESS1( addr_var, addr_val ) addr_var = { CY_WCM_IP_VER_V4, { .v4 = (uint32_t)(addr_val) } }
-#define MAKE_IPV4_ADDRESS1(a, b, c, d) ((((uint32_t) d) << 24) | (((uint32_t) c) << 16) | (((uint32_t) b) << 8) |((uint32_t) a))
-static const cy_wcm_ip_setting_t ap_mode_ip_settings2 =
-{
- INITIALISER_IPV4_ADDRESS1( .ip_address, MAKE_IPV4_ADDRESS1( 192, 168, 0, 2 )),
- INITIALISER_IPV4_ADDRESS1( .gateway, MAKE_IPV4_ADDRESS1( 192, 168, 0, 2 ) ),
- INITIALISER_IPV4_ADDRESS1( .netmask, MAKE_IPV4_ADDRESS1( 255, 255, 255, 0 )),
+#define INITIALISER_IPV4_ADDRESS1(addr_var, addr_val) addr_var = { CY_WCM_IP_VER_V4, { .v4 = (uint32_t)(addr_val) } }
+#define MAKE_IPV4_ADDRESS1(a, b, c, d) ((((uint32_t) d) << 24) | (((uint32_t) c) << 16) | (((uint32_t) b) << 8) | ((uint32_t) a))
+static const cy_wcm_ip_setting_t ap_mode_ip_settings2 = {
+ INITIALISER_IPV4_ADDRESS1(.ip_address, MAKE_IPV4_ADDRESS1(192, 168, 0, 2)),
+ INITIALISER_IPV4_ADDRESS1(.gateway, MAKE_IPV4_ADDRESS1(192, 168, 0, 2)),
+ INITIALISER_IPV4_ADDRESS1(.netmask, MAKE_IPV4_ADDRESS1(255, 255, 255, 0)),
};
CHIP_ERROR P6Utils::p6_start_ap(void)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
+ CHIP_ERROR err = CHIP_NO_ERROR;
cy_rslt_t result = CY_RSLT_SUCCESS;
wifi_config_t stationConfig;
@@ -384,17 +380,16 @@ CHIP_ERROR P6Utils::p6_start_ap(void)
cy_wcm_ap_config_t ap_conf;
memset(&ap_conf, 0, sizeof(cy_wcm_ap_config_t));
- memcpy(ap_conf.ap_credentials.SSID, &stationConfig.ap.ssid, strlen((const char *)stationConfig.ap.ssid));
- memcpy(ap_conf.ap_credentials.password, &stationConfig.ap.password, strlen((const char *)stationConfig.ap.password));
+ memcpy(ap_conf.ap_credentials.SSID, &stationConfig.ap.ssid, strlen((const char *) stationConfig.ap.ssid));
+ memcpy(ap_conf.ap_credentials.password, &stationConfig.ap.password, strlen((const char *) stationConfig.ap.password));
memcpy(&ap_conf.ip_settings, &stationConfig.ap.ip_settings, sizeof(stationConfig.ap.ip_settings));
ap_conf.ap_credentials.security = stationConfig.ap.security;
- ap_conf.channel = stationConfig.ap.channel;
- ChipLogProgress(DeviceLayer, "p6_start_ap %s %s \r\n", ap_conf.ap_credentials.SSID,
- ap_conf.ap_credentials.password);
+ ap_conf.channel = stationConfig.ap.channel;
+ ChipLogProgress(DeviceLayer, "p6_start_ap %s %s \r\n", ap_conf.ap_credentials.SSID, ap_conf.ap_credentials.password);
/* Start AP */
result = cy_wcm_start_ap(&ap_conf);
- if( result != CY_RSLT_SUCCESS )
+ if (result != CY_RSLT_SUCCESS)
{
ChipLogError(DeviceLayer, "cy_wcm_start_ap() failed result %ld", result);
err = CHIP_ERROR_INTERNAL;
@@ -402,7 +397,7 @@ CHIP_ERROR P6Utils::p6_start_ap(void)
/* Link Local IPV6 AP address for AP */
cy_wcm_ip_address_t ipv6_addr;
result = cy_wcm_get_ipv6_addr(CY_WCM_INTERFACE_TYPE_AP, CY_WCM_IPV6_LINK_LOCAL, &ipv6_addr, 1);
- if( result != CY_RSLT_SUCCESS )
+ if (result != CY_RSLT_SUCCESS)
{
ChipLogError(DeviceLayer, "cy_wcm_get_ipv6_addr() failed result %ld", result);
err = CHIP_ERROR_INTERNAL;
@@ -412,11 +407,11 @@ CHIP_ERROR P6Utils::p6_start_ap(void)
CHIP_ERROR P6Utils::p6_stop_ap(void)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
+ CHIP_ERROR err = CHIP_NO_ERROR;
cy_rslt_t result = CY_RSLT_SUCCESS;
/* Stop AP */
result = cy_wcm_stop_ap();
- if( result != CY_RSLT_SUCCESS )
+ if (result != CY_RSLT_SUCCESS)
{
ChipLogError(DeviceLayer, "cy_wcm_stop_ap failed result %ld", result);
err = CHIP_ERROR_INTERNAL;
@@ -424,26 +419,27 @@ CHIP_ERROR P6Utils::p6_stop_ap(void)
return err;
}
-void P6Utils::populate_wifi_config_t(wifi_config_t *wifi_config, wifi_interface_t interface, const cy_wcm_ssid_t *ssid, const cy_wcm_passphrase_t *password, cy_wcm_security_t security)
+void P6Utils::populate_wifi_config_t(wifi_config_t * wifi_config, wifi_interface_t interface, const cy_wcm_ssid_t * ssid,
+ const cy_wcm_passphrase_t * password, cy_wcm_security_t security)
{
CY_ASSERT(wifi_config != NULL);
// Use interface param to determine which config to fill out
- if(interface == WIFI_IF_STA || interface == WIFI_IF_STA_AP)
+ if (interface == WIFI_IF_STA || interface == WIFI_IF_STA_AP)
{
memset(&wifi_config->sta, 0, sizeof(wifi_config_sta_t));
- memcpy(wifi_config->sta.ssid, ssid, chip::min(strlen((char*)ssid) + 1, sizeof(cy_wcm_ssid_t)));
- memcpy(wifi_config->sta.password, password, chip::min(strlen((char*)password) + 1, sizeof(cy_wcm_ssid_t)));
+ memcpy(wifi_config->sta.ssid, ssid, chip::min(strlen((char *) ssid) + 1, sizeof(cy_wcm_ssid_t)));
+ memcpy(wifi_config->sta.password, password, chip::min(strlen((char *) password) + 1, sizeof(cy_wcm_ssid_t)));
wifi_config->sta.security = security;
}
- if(interface == WIFI_IF_AP || interface == WIFI_IF_STA_AP)
+ if (interface == WIFI_IF_AP || interface == WIFI_IF_STA_AP)
{
memset(&wifi_config->ap, 0, sizeof(wifi_config_ap_t));
- memcpy(wifi_config->ap.ssid, ssid, chip::min(strlen((char*)ssid) + 1, sizeof(cy_wcm_ssid_t)));
- memcpy(wifi_config->ap.password, password, chip::min(strlen((char*)password) + 1, sizeof(cy_wcm_ssid_t)));
+ memcpy(wifi_config->ap.ssid, ssid, chip::min(strlen((char *) ssid) + 1, sizeof(cy_wcm_ssid_t)));
+ memcpy(wifi_config->ap.password, password, chip::min(strlen((char *) password) + 1, sizeof(cy_wcm_ssid_t)));
wifi_config->ap.security = security;
- }
+ }
}
/* Ping implementation
@@ -460,19 +456,19 @@ static void print_ip4(uint32_t ip)
printf("Addr = %d.%d.%d.%d\n", bytes[0], bytes[1], bytes[2], bytes[3]);
}
-static void ping_prepare_echo(icmp_packet_t *iecho, uint16_t len)
+static void ping_prepare_echo(icmp_packet_t * iecho, uint16_t len)
{
int i;
ICMPH_TYPE_SET(&iecho->hdr, ICMP_ECHO);
ICMPH_CODE_SET(&iecho->hdr, 0);
iecho->hdr.chksum = 0;
- iecho->hdr.id = PING_ID;
- iecho->hdr.seqno = htons(++(ping_seq_num));
+ iecho->hdr.id = PING_ID;
+ iecho->hdr.seqno = htons(++(ping_seq_num));
/* fill the additional data buffer with some data */
- for ( i = 0; i < (int)sizeof(iecho->data); i++ )
+ for (i = 0; i < (int) sizeof(iecho->data); i++)
{
- iecho->data[i] = (uint8_t)i;
+ iecho->data[i] = (uint8_t) i;
}
iecho->hdr.chksum = inet_chksum(iecho, len);
@@ -481,55 +477,54 @@ static void ping_prepare_echo(icmp_packet_t *iecho, uint16_t len)
/* Ping using socket API */
#if PING_USE_SOCKETS
-static err_t ping_send(int s, const ip_addr_t *addr)
+static err_t ping_send(int s, const ip_addr_t * addr)
{
int err;
icmp_packet_t iecho;
struct sockaddr_in to;
- ping_prepare_echo(&iecho, (u16_t)sizeof(icmp_packet_t));
+ ping_prepare_echo(&iecho, (u16_t) sizeof(icmp_packet_t));
printf("\r\nPinging to Gateway ");
- print_ip4(addr->u_addr.ip4.addr);
-
+ print_ip4(addr->u_addr.ip4.addr);
+
/* Send the ping request */
- to.sin_len = sizeof(to);
- to.sin_family = AF_INET;
+ to.sin_len = sizeof(to);
+ to.sin_family = AF_INET;
inet_addr_from_ip4addr(&to.sin_addr, ip_2_ip4(addr));
- err = lwip_sendto(s, &iecho, sizeof(icmp_packet_t), 0, (struct sockaddr*)&to, sizeof(to));
+ err = lwip_sendto(s, &iecho, sizeof(icmp_packet_t), 0, (struct sockaddr *) &to, sizeof(to));
return (err ? ERR_OK : ERR_VAL);
}
static void ping_recv(int s)
{
- char buf[PING_RESPONSE_LEN];
- int fromlen;
- int len;
- struct sockaddr_in from;
- struct ip_hdr* iphdr;
- struct icmp_echo_hdr* iecho;
+ char buf[PING_RESPONSE_LEN];
+ int fromlen;
+ int len;
+ struct sockaddr_in from;
+ struct ip_hdr * iphdr;
+ struct icmp_echo_hdr * iecho;
do
{
- len = lwip_recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr*) &from, (socklen_t*) &fromlen);
+ len = lwip_recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr *) &from, (socklen_t *) &fromlen);
if (len >= (int) (sizeof(struct ip_hdr) + sizeof(struct icmp_echo_hdr)))
{
iphdr = (struct ip_hdr *) buf;
iecho = (struct icmp_echo_hdr *) (buf + (IPH_HL(iphdr) * 4));
- if ((iecho->id == PING_ID) &&
- (iecho->seqno == htons(ping_seq_num)) &&
- (ICMPH_TYPE(iecho) == ICMP_ER))
+ if ((iecho->id == PING_ID) && (iecho->seqno == htons(ping_seq_num)) && (ICMPH_TYPE(iecho) == ICMP_ER))
{
- printf("Ping was successful Elapsed time : %" U32_F " ms\n", sys_now()-ping_time);
+ printf("Ping was successful Elapsed time : %" U32_F " ms\n", sys_now() - ping_time);
return; /* Echo reply received - return success */
}
}
} while (len > 0);
- if (len == 0) {
- printf("ping: recv - %" U32_F " ms - timeout\r\n", (sys_now()-ping_time));
+ if (len == 0)
+ {
+ printf("ping: recv - %" U32_F " ms - timeout\r\n", (sys_now() - ping_time));
}
}
@@ -542,12 +537,13 @@ static void ping_socket()
int timeout = PING_RCV_TIMEO;
#else
struct timeval timeout;
- timeout.tv_sec = PING_RCV_TIMEO/1000;
- timeout.tv_usec = (PING_RCV_TIMEO%1000)*1000;
+ timeout.tv_sec = PING_RCV_TIMEO / 1000;
+ timeout.tv_usec = (PING_RCV_TIMEO % 1000) * 1000;
#endif
- s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP);
- if (s < 0) {
+ s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP);
+ if (s < 0)
+ {
return;
}
@@ -558,12 +554,12 @@ static void ping_socket()
while (1)
{
if (ping_send(s, ping_target) == ERR_OK)
- {
+ {
ping_time = sys_now();
ping_recv(s);
}
- else
- {
+ else
+ {
printf("ping: send error");
}
sys_msleep(PING_DELAY);
@@ -572,22 +568,23 @@ static void ping_socket()
#else
/* Ping using the raw ip */
-static u8_t ping_recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr)
+static u8_t ping_recv_raw(void * arg, struct raw_pcb * pcb, struct pbuf * p, const ip_addr_t * addr)
{
- struct icmp_echo_hdr* iecho;
+ struct icmp_echo_hdr * iecho;
LWIP_UNUSED_ARG(arg);
LWIP_UNUSED_ARG(pcb);
LWIP_UNUSED_ARG(addr);
LWIP_ASSERT("p != NULL", p != NULL);
- if ((p->tot_len >= (IP_HDR_LEN + sizeof(struct icmp_echo_hdr))) &&
- pbuf_header(p, -IP_HDR_LEN) == 0) {
+ if ((p->tot_len >= (IP_HDR_LEN + sizeof(struct icmp_echo_hdr))) && pbuf_header(p, -IP_HDR_LEN) == 0)
+ {
- iecho = (struct icmp_echo_hdr *)p->payload;
+ iecho = (struct icmp_echo_hdr *) p->payload;
- if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num))) {
+ if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num)))
+ {
- printf("Ping was successful Elapsed time : %" U32_F " ms\n", sys_now()-ping_time);
+ printf("Ping was successful Elapsed time : %" U32_F " ms\n", sys_now() - ping_time);
/* do some ping result processing */
pbuf_free(p);
@@ -600,24 +597,26 @@ static u8_t ping_recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p, const
return 0; /* don't eat the packet */
}
-static void ping_send_raw(struct raw_pcb *raw, const ip_addr_t *addr)
+static void ping_send_raw(struct raw_pcb * raw, const ip_addr_t * addr)
{
- struct pbuf *p;
- icmp_packet_t *iecho;
+ struct pbuf * p;
+ icmp_packet_t * iecho;
size_t ping_size = sizeof(icmp_packet_t);
printf("\r\nPinging to Gateway ");
print_ip4(addr->u_addr.ip4.addr);
LWIP_ASSERT("ping_size <= 0xffff", ping_size <= 0xffff);
- p = pbuf_alloc(PBUF_IP, (u16_t)ping_size, PBUF_RAM);
- if (!p) {
+ p = pbuf_alloc(PBUF_IP, (u16_t) ping_size, PBUF_RAM);
+ if (!p)
+ {
return;
}
- if ((p->len == p->tot_len) && (p->next == NULL)) {
- iecho = (icmp_packet_t *)p->payload;
+ if ((p->len == p->tot_len) && (p->next == NULL))
+ {
+ iecho = (icmp_packet_t *) p->payload;
- ping_prepare_echo(iecho, (u16_t)ping_size);
+ ping_prepare_echo(iecho, (u16_t) ping_size);
raw_sendto(raw, p, addr);
ping_time = sys_now();
@@ -625,9 +624,9 @@ static void ping_send_raw(struct raw_pcb *raw, const ip_addr_t *addr)
pbuf_free(p);
}
-static void ping_timeout(void *arg)
+static void ping_timeout(void * arg)
{
- struct raw_pcb *pcb = (struct raw_pcb*)arg;
+ struct raw_pcb * pcb = (struct raw_pcb *) arg;
LWIP_ASSERT("ping_timeout: no pcb given!", pcb != NULL);
@@ -650,10 +649,10 @@ void ping_raw(void)
CHIP_ERROR P6Utils::ping_init(void)
{
- CHIP_ERROR err = CHIP_NO_ERROR;
- struct netif *net_interface = NULL;
- net_interface = cy_lwip_get_interface(CY_LWIP_STA_NW_INTERFACE);
- ping_target = &net_interface->gw;
+ CHIP_ERROR err = CHIP_NO_ERROR;
+ struct netif * net_interface = NULL;
+ net_interface = cy_lwip_get_interface(CY_LWIP_STA_NW_INTERFACE);
+ ping_target = &net_interface->gw;
/* Ping to Gateway address */
if (ping_target)
diff --git a/src/platform/P6/P6Utils.h b/src/platform/P6/P6Utils.h
index 1f2f8e78f77249..d7850735c53372 100644
--- a/src/platform/P6/P6Utils.h
+++ b/src/platform/P6/P6Utils.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -20,42 +20,47 @@
#pragma once
#include "platform/internal/DeviceNetworkInfo.h"
-#include
#include
+#include
-typedef struct {
- cy_wcm_ssid_t ssid; /**< SSID of the Wi-Fi network to join; should be a null-terminated string. */
- cy_wcm_passphrase_t password; /**< Password needed to join the AP; should be a null-terminated string. */
- cy_wcm_security_t security; /**< Wi-Fi Security. @see cy_wcm_security_t. */
- cy_wcm_mac_t BSSID;
- cy_wcm_ip_setting_t *static_ip_settings;
+typedef struct
+{
+ cy_wcm_ssid_t ssid; /**< SSID of the Wi-Fi network to join; should be a null-terminated string. */
+ cy_wcm_passphrase_t password; /**< Password needed to join the AP; should be a null-terminated string. */
+ cy_wcm_security_t security; /**< Wi-Fi Security. @see cy_wcm_security_t. */
+ cy_wcm_mac_t BSSID;
+ cy_wcm_ip_setting_t * static_ip_settings;
} wifi_config_sta_t;
-typedef struct {
- cy_wcm_ssid_t ssid; /**< SSID of the Wi-Fi network to join; should be a null-terminated string. */
- cy_wcm_passphrase_t password; /**< Password needed to join the AP; should be a null-terminated string. */
- cy_wcm_security_t security; /**< Wi-Fi Security. @see cy_wcm_security_t. */
- uint8_t channel;
- cy_wcm_ip_setting_t ip_settings;
+typedef struct
+{
+ cy_wcm_ssid_t ssid; /**< SSID of the Wi-Fi network to join; should be a null-terminated string. */
+ cy_wcm_passphrase_t password; /**< Password needed to join the AP; should be a null-terminated string. */
+ cy_wcm_security_t security; /**< Wi-Fi Security. @see cy_wcm_security_t. */
+ uint8_t channel;
+ cy_wcm_ip_setting_t ip_settings;
} wifi_config_ap_t;
-typedef struct {
+typedef struct
+{
wifi_config_sta_t sta; /**< configuration of STA */
- wifi_config_ap_t ap; /**< configuration of AP */
+ wifi_config_ap_t ap; /**< configuration of AP */
} wifi_config_t;
-typedef enum {
- WIFI_MODE_NULL = 0, /**< null mode */
- WIFI_MODE_STA, /**< WiFi station mode */
- WIFI_MODE_AP, /**< WiFi soft-AP mode */
- WIFI_MODE_APSTA, /**< WiFi station + soft-AP mode */
+typedef enum
+{
+ WIFI_MODE_NULL = 0, /**< null mode */
+ WIFI_MODE_STA, /**< WiFi station mode */
+ WIFI_MODE_AP, /**< WiFi soft-AP mode */
+ WIFI_MODE_APSTA, /**< WiFi station + soft-AP mode */
WIFI_MODE_MAX
} wifi_mode_t;
-typedef enum {
- WIFI_IF_STA = CY_WCM_INTERFACE_TYPE_STA,
- WIFI_IF_AP = CY_WCM_INTERFACE_TYPE_AP,
- WIFI_IF_STA_AP = CY_WCM_INTERFACE_TYPE_AP_STA,
+typedef enum
+{
+ WIFI_IF_STA = CY_WCM_INTERFACE_TYPE_STA,
+ WIFI_IF_AP = CY_WCM_INTERFACE_TYPE_AP,
+ WIFI_IF_STA_AP = CY_WCM_INTERFACE_TYPE_AP_STA,
} wifi_interface_t;
namespace chip {
@@ -81,15 +86,16 @@ class P6Utils
static CHIP_ERROR GetWiFiStationProvision(Internal::DeviceNetworkInfo & netInfo, bool includeCredentials);
static CHIP_ERROR SetWiFiStationProvision(const Internal::DeviceNetworkInfo & netInfo);
static CHIP_ERROR ClearWiFiStationProvision(void);
- static cy_rslt_t p6_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
- static cy_rslt_t p6_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf);
+ static cy_rslt_t p6_wifi_get_config(wifi_interface_t interface, wifi_config_t * conf);
+ static cy_rslt_t p6_wifi_set_config(wifi_interface_t interface, wifi_config_t * conf);
static CHIP_ERROR p6_wifi_disconnect(void);
static CHIP_ERROR p6_wifi_connect(void);
static CHIP_ERROR p6_start_ap(void);
static CHIP_ERROR p6_stop_ap(void);
// Fills out some common fields in a wifi_config_t. Use interface param to
// select whether sta or ap config is populated.
- static void populate_wifi_config_t(wifi_config_t *wifi_config, wifi_interface_t interface, const cy_wcm_ssid_t *ssid, const cy_wcm_passphrase_t *password, cy_wcm_security_t security = CY_WCM_SECURITY_OPEN);
+ static void populate_wifi_config_t(wifi_config_t * wifi_config, wifi_interface_t interface, const cy_wcm_ssid_t * ssid,
+ const cy_wcm_passphrase_t * password, cy_wcm_security_t security = CY_WCM_SECURITY_OPEN);
static CHIP_ERROR OnIPAddressAvailable(void);
static CHIP_ERROR ping_init(void);
};
diff --git a/src/platform/P6/PlatformManagerImpl.cpp b/src/platform/P6/PlatformManagerImpl.cpp
index dafb7ad9883047..168cc7560231c1 100644
--- a/src/platform/P6/PlatformManagerImpl.cpp
+++ b/src/platform/P6/PlatformManagerImpl.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
@@ -38,7 +38,6 @@ extern CHIP_ERROR InitLwIPCoreLock(void);
PlatformManagerImpl PlatformManagerImpl::sInstance;
-
CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
{
CHIP_ERROR err;
diff --git a/src/platform/P6/PlatformManagerImpl.h b/src/platform/P6/PlatformManagerImpl.h
index ae1d2ac9462faa..8f3559bd80b3d4 100644
--- a/src/platform/P6/PlatformManagerImpl.h
+++ b/src/platform/P6/PlatformManagerImpl.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/SoftwareUpdateManagerImpl.cpp b/src/platform/P6/SoftwareUpdateManagerImpl.cpp
index 73e6ad76457fce..eabccdae3f4a71 100644
--- a/src/platform/P6/SoftwareUpdateManagerImpl.cpp
+++ b/src/platform/P6/SoftwareUpdateManagerImpl.cpp
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
diff --git a/src/platform/P6/SoftwareUpdateManagerImpl.h b/src/platform/P6/SoftwareUpdateManagerImpl.h
index efaee7ff59bbf7..fe42c52df70edd 100644
--- a/src/platform/P6/SoftwareUpdateManagerImpl.h
+++ b/src/platform/P6/SoftwareUpdateManagerImpl.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
diff --git a/src/platform/P6/SystemPlatformConfig.h b/src/platform/P6/SystemPlatformConfig.h
index ff4f5d115f415c..775f4717ff6e57 100644
--- a/src/platform/P6/SystemPlatformConfig.h
+++ b/src/platform/P6/SystemPlatformConfig.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/WarmPlatformConfig.h b/src/platform/P6/WarmPlatformConfig.h
index 6e4c258f76d560..04d4100324f3cd 100644
--- a/src/platform/P6/WarmPlatformConfig.h
+++ b/src/platform/P6/WarmPlatformConfig.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright (c) 2020 Project CHIP Authors
+ * Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2018 Nest Labs, Inc.
* All rights reserved.
*
diff --git a/src/platform/P6/app_platform_cfg.c b/src/platform/P6/app_platform_cfg.c
old mode 100755
new mode 100644
index bfc35b37a6c113..d4c9c66110bf8c
--- a/src/platform/P6/app_platform_cfg.c
+++ b/src/platform/P6/app_platform_cfg.c
@@ -1,43 +1,43 @@
/*******************************************************************************
-* (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
-*******************************************************************************
-* This software, including source code, documentation and related materials
-* ("Software"), is owned by Cypress Semiconductor Corporation or one of its
-* subsidiaries ("Cypress") and is protected by and subject to worldwide patent
-* protection (United States and foreign), United States copyright laws and
-* international treaty provisions. Therefore, you may use this Software only
-* as provided in the license agreement accompanying the software package from
-* which you obtained this Software ("EULA").
-*
-* If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
-* non-transferable license to copy, modify, and compile the Software source
-* code solely for use in connection with Cypress's integrated circuit products.
-* Any reproduction, modification, translation, compilation, or representation
-* of this Software except as specified above is prohibited without the express
-* written permission of Cypress.
-*
-* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
-* reserves the right to make changes to the Software without notice. Cypress
-* does not assume any liability arising out of the application or use of the
-* Software or any product or circuit described in the Software. Cypress does
-* not authorize its products for use in any products where a malfunction or
-* failure of the Cypress product may reasonably be expected to result in
-* significant property damage, injury or death ("High Risk Product"). By
-* including Cypress's product in a High Risk Product, the manufacturer of such
-* system or application assumes all risk of such use and in doing so agrees to
-* indemnify Cypress against all liability.
-*******************************************************************************/
+ * (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *******************************************************************************
+ * This software, including source code, documentation and related materials
+ * ("Software"), is owned by Cypress Semiconductor Corporation or one of its
+ * subsidiaries ("Cypress") and is protected by and subject to worldwide patent
+ * protection (United States and foreign), United States copyright laws and
+ * international treaty provisions. Therefore, you may use this Software only
+ * as provided in the license agreement accompanying the software package from
+ * which you obtained this Software ("EULA").
+ *
+ * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+ * non-transferable license to copy, modify, and compile the Software source
+ * code solely for use in connection with Cypress's integrated circuit products.
+ * Any reproduction, modification, translation, compilation, or representation
+ * of this Software except as specified above is prohibited without the express
+ * written permission of Cypress.
+ *
+ * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+ * reserves the right to make changes to the Software without notice. Cypress
+ * does not assume any liability arising out of the application or use of the
+ * Software or any product or circuit described in the Software. Cypress does
+ * not authorize its products for use in any products where a malfunction or
+ * failure of the Cypress product may reasonably be expected to result in
+ * significant property damage, injury or death ("High Risk Product"). By
+ * including Cypress's product in a High Risk Product, the manufacturer of such
+ * system or application assumes all risk of such use and in doing so agrees to
+ * indemnify Cypress against all liability.
+ *******************************************************************************/
/*******************************************************************************
-* File Name: app_platform_cfg.c
-* Version: 1.0
-*
-* Description:
-* Runtime Bluetooth stack configuration parameters
-*
-*******************************************************************************/
+ * File Name: app_platform_cfg.c
+ * Version: 1.0
+ *
+ * Description:
+ * Runtime Bluetooth stack configuration parameters
+ *
+ *******************************************************************************/
#include "app_platform_cfg.h"
#include "wiced_bt_dev.h"
@@ -72,29 +72,28 @@ const cybt_platform_config_t bt_platform_cfg_settings =
.bt_power_pin = CYBSP_BT_POWER,
.sleep_mode =
{
- #if (bt_0_power_0_ENABLED == 1)
- #if (CYCFG_BT_LP_ENABLED == 1)
+#if (bt_0_power_0_ENABLED == 1)
+#if (CYCFG_BT_LP_ENABLED == 1)
.sleep_mode_enabled = CYCFG_BT_LP_ENABLED,
.device_wakeup_pin = CYCFG_BT_DEV_WAKE_GPIO,
.host_wakeup_pin = CYCFG_BT_HOST_WAKE_GPIO,
.device_wake_polarity = CYCFG_BT_DEV_WAKE_POLARITY,
.host_wake_polarity = CYCFG_BT_HOST_WAKE_IRQ_EVENT
- #else
+#else
.sleep_mode_enabled = WICED_FALSE
- #endif
- #else
+#endif
+#else
.sleep_mode_enabled = WICED_TRUE,
.device_wakeup_pin = CYBSP_BT_DEVICE_WAKE,
.host_wakeup_pin = CYBSP_BT_HOST_WAKE,
.device_wake_polarity = CYBT_WAKE_ACTIVE_LOW,
.host_wake_polarity = CYBT_WAKE_ACTIVE_LOW
- #endif
+#endif
}
},
.task_mem_pool_size = 2048
};
-
/* [] END OF FILE */
diff --git a/src/platform/P6/app_platform_cfg.h b/src/platform/P6/app_platform_cfg.h
old mode 100755
new mode 100644
index f2b72f932d10bb..41111e5e312010
--- a/src/platform/P6/app_platform_cfg.h
+++ b/src/platform/P6/app_platform_cfg.h
@@ -1,43 +1,43 @@
/*******************************************************************************
-* (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
-*******************************************************************************
-* This software, including source code, documentation and related materials
-* ("Software"), is owned by Cypress Semiconductor Corporation or one of its
-* subsidiaries ("Cypress") and is protected by and subject to worldwide patent
-* protection (United States and foreign), United States copyright laws and
-* international treaty provisions. Therefore, you may use this Software only
-* as provided in the license agreement accompanying the software package from
-* which you obtained this Software ("EULA").
-*
-* If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
-* non-transferable license to copy, modify, and compile the Software source
-* code solely for use in connection with Cypress's integrated circuit products.
-* Any reproduction, modification, translation, compilation, or representation
-* of this Software except as specified above is prohibited without the express
-* written permission of Cypress.
-*
-* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
-* reserves the right to make changes to the Software without notice. Cypress
-* does not assume any liability arising out of the application or use of the
-* Software or any product or circuit described in the Software. Cypress does
-* not authorize its products for use in any products where a malfunction or
-* failure of the Cypress product may reasonably be expected to result in
-* significant property damage, injury or death ("High Risk Product"). By
-* including Cypress's product in a High Risk Product, the manufacturer of such
-* system or application assumes all risk of such use and in doing so agrees to
-* indemnify Cypress against all liability.
-*******************************************************************************/
+ * (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *******************************************************************************
+ * This software, including source code, documentation and related materials
+ * ("Software"), is owned by Cypress Semiconductor Corporation or one of its
+ * subsidiaries ("Cypress") and is protected by and subject to worldwide patent
+ * protection (United States and foreign), United States copyright laws and
+ * international treaty provisions. Therefore, you may use this Software only
+ * as provided in the license agreement accompanying the software package from
+ * which you obtained this Software ("EULA").
+ *
+ * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+ * non-transferable license to copy, modify, and compile the Software source
+ * code solely for use in connection with Cypress's integrated circuit products.
+ * Any reproduction, modification, translation, compilation, or representation
+ * of this Software except as specified above is prohibited without the express
+ * written permission of Cypress.
+ *
+ * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+ * reserves the right to make changes to the Software without notice. Cypress
+ * does not assume any liability arising out of the application or use of the
+ * Software or any product or circuit described in the Software. Cypress does
+ * not authorize its products for use in any products where a malfunction or
+ * failure of the Cypress product may reasonably be expected to result in
+ * significant property damage, injury or death ("High Risk Product"). By
+ * including Cypress's product in a High Risk Product, the manufacturer of such
+ * system or application assumes all risk of such use and in doing so agrees to
+ * indemnify Cypress against all liability.
+ *******************************************************************************/
/*******************************************************************************
-* File Name: app_platform_cfg.h
-* Version: 1.0
-*
-* Description:
-* Header file for runtime Bluetooth stack configuration parameters
-*
-*******************************************************************************/
+ * File Name: app_platform_cfg.h
+ * Version: 1.0
+ *
+ * Description:
+ * Header file for runtime Bluetooth stack configuration parameters
+ *
+ *******************************************************************************/
#ifndef APP_PLATFORM_CFG_H_
#define APP_PLATFORM_CFG_H_
@@ -49,5 +49,4 @@ extern const cybt_platform_config_t bt_platform_cfg_settings;
#endif /* APP_BT_CFG_H_ */
-
/* [] END OF FILE */
diff --git a/src/platform/P6/args.gni b/src/platform/P6/args.gni
index 9901480943157a..de5234e0979df3 100644
--- a/src/platform/P6/args.gni
+++ b/src/platform/P6/args.gni
@@ -25,19 +25,8 @@ mbedtls_target = "${p6_sdk_build_root}:p6_build"
chip_device_platform = "p6"
lwip_platform = "p6"
-#lwip_ipv6 = true
-#lwip_ipv4 = true
-#lwip_api = true
-#lwip_ethernet = true
chip_inet_config_enable_ipv4 = true
chip_inet_config_enable_dns_resolver = false
chip_build_tests = false
-
-#openthread_external_mbedtls = mbedtls_target
-#openthread_project_core_config_file = "openthread-core-p6-config.h"
-#openthread_core_config_platform_check_file = "openthread-core-p6-config-check.h"
-#openthread_core_config_deps = [ "${chip_root}/third_party/openthread/platforms/p6:libopenthread-p6-config" ]
-
-#openthread_external_platform = "${chip_root}/third_party/openthread/platforms/p6:libopenthread-p6"
diff --git a/src/platform/P6/cy_wcm.h b/src/platform/P6/cy_wcm.h
index 34448f2f88f786..0e987f16bf1cc5 100644
--- a/src/platform/P6/cy_wcm.h
+++ b/src/platform/P6/cy_wcm.h
@@ -1,7 +1,7 @@
#ifndef CY_WCM_SHIM
#define CY_WCM_SHIM
-// Shim to get cy wcm code to compile using the (older) CHIP-provided lwip.
+// Shim to get cy wcm code to compile using the (older) CHIP-provided lwip.
struct ifreq
{
char ifr_name[6];
diff --git a/src/platform/P6/cycfg_bt_settings.c b/src/platform/P6/cycfg_bt_settings.c
old mode 100755
new mode 100644
index 8280a3703e9bb5..3e8c6f59714c18
--- a/src/platform/P6/cycfg_bt_settings.c
+++ b/src/platform/P6/cycfg_bt_settings.c
@@ -1,147 +1,175 @@
-/***************************************************************************//**
-* File Name: cycfg_bt_settings.c
-*
-* Description:
-* Runtime Bluetooth stack configuration parameters.
-* This file should not be modified. It was automatically generated by
-* Bluetooth Configurator 2.40.0.4650
-*
-********************************************************************************
-* Copyright 2021 Cypress Semiconductor Corporation
-* SPDX-License-Identifier: Apache-2.0
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*******************************************************************************/
+/***************************************************************************/ /**
+ * File Name: cycfg_bt_settings.c
+ *
+ * Description:
+ * Runtime Bluetooth stack configuration parameters.
+ * This file should not be modified. It was
+ *automatically generated by Bluetooth
+ *Configurator 2.40.0.4650
+ *
+ ********************************************************************************
+ * Copyright 2021 Cypress Semiconductor Corporation
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the
+ *"License"); you may not use this file except in
+ *compliance with the License. You may obtain a copy
+ *of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in
+ *writing, software distributed under the License is
+ *distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
+ *OR CONDITIONS OF ANY KIND, either express or
+ *implied. See the License for the specific language
+ *governing permissions and limitations under the
+ *License.
+ *******************************************************************************/
#include "cycfg_bt_settings.h"
#include "cycfg_gap.h"
-#include "wiced_bt_dev.h"
#include "wiced_bt_ble.h"
-#include "wiced_bt_gatt.h"
#include "wiced_bt_cfg.h"
+#include "wiced_bt_dev.h"
+#include "wiced_bt_gatt.h"
-#if !defined (WICED_BTSTACK_VERSION_MAJOR)
- #define WICED_BTSTACK_VERSION_MAJOR (2)
+#if !defined(WICED_BTSTACK_VERSION_MAJOR)
+#define WICED_BTSTACK_VERSION_MAJOR (2)
#endif
-
/*****************************************************************************
* wiced_bt core stack configuration
****************************************************************************/
#if (WICED_BTSTACK_VERSION_MAJOR >= 3)
- /* BLE scan settings */
- const wiced_bt_cfg_ble_scan_settings_t cy_bt_cfg_scan_settings =
- {
- .scan_mode = CY_BT_SCAN_MODE, /* BLE scan mode (BTM_BLE_SCAN_MODE_PASSIVE, BTM_BLE_SCAN_MODE_ACTIVE, or BTM_BLE_SCAN_MODE_NONE) */
-
- /* Advertisement scan configuration */
- .high_duty_scan_interval = CY_BT_HIGH_DUTY_SCAN_INTERVAL, /* High duty scan interval (in slots (1 slot = 0.625 ms)) */
- .high_duty_scan_window = CY_BT_HIGH_DUTY_SCAN_WINDOW, /* High duty scan window (in slots (1 slot = 0.625 ms)) */
- .high_duty_scan_duration = CY_BT_HIGH_DUTY_SCAN_DURATION, /* High duty scan duration in seconds (0 for infinite) */
-
- .low_duty_scan_interval = CY_BT_LOW_DUTY_SCAN_INTERVAL, /* Low duty scan interval (in slots (1 slot = 0.625 ms)) */
- .low_duty_scan_window = CY_BT_LOW_DUTY_SCAN_WINDOW, /* Low duty scan window (in slots (1 slot = 0.625 ms)) */
- .low_duty_scan_duration = CY_BT_LOW_DUTY_SCAN_DURATION, /* Low duty scan duration in seconds (0 for infinite) */
-
- /* Connection scan configuration */
- .high_duty_conn_scan_interval = CY_BT_HIGH_DUTY_CONN_SCAN_INTERVAL, /* High duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) */
- .high_duty_conn_scan_window = CY_BT_HIGH_DUTY_CONN_SCAN_WINDOW, /* High duty cycle connection scan window (in slots (1 slot = 0.625 ms)) */
- .high_duty_conn_duration = CY_BT_HIGH_DUTY_CONN_SCAN_DURATION, /* High duty cycle connection duration in seconds (0 for infinite) */
-
- .low_duty_conn_scan_interval = CY_BT_LOW_DUTY_CONN_SCAN_INTERVAL, /* Low duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) */
- .low_duty_conn_scan_window = CY_BT_LOW_DUTY_CONN_SCAN_WINDOW, /* Low duty cycle connection scan window (in slots (1 slot = 0.625 ms)) */
- .low_duty_conn_duration = CY_BT_LOW_DUTY_CONN_SCAN_DURATION, /* Low duty cycle connection duration in seconds (0 for infinite) */
-
- /* Connection configuration */
- .conn_min_interval = CY_BT_CONN_MIN_INTERVAL, /* Minimum connection interval (in slots (1 slot = 1.25 ms)) */
- .conn_max_interval = CY_BT_CONN_MAX_INTERVAL, /* Maximum connection interval (in slots (1 slot = 1.25 ms)) */
- .conn_latency = CY_BT_CONN_LATENCY, /* Connection latency */
- .conn_supervision_timeout = CY_BT_CONN_SUPERVISION_TIMEOUT, /* Connection link supervision timeout (in 10 ms) */
- };
-
- /* BLE advertisement settings */
- const wiced_bt_cfg_ble_advert_settings_t cy_bt_cfg_adv_settings =
- {
- .channel_map = CY_BT_CHANNEL_MAP, /* Advertising channel map (mask of BTM_BLE_ADVERT_CHNL_37, BTM_BLE_ADVERT_CHNL_38, BTM_BLE_ADVERT_CHNL_39) */
-
- .high_duty_min_interval = CY_BT_HIGH_DUTY_ADV_MIN_INTERVAL, /* High duty undirected connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */
- .high_duty_max_interval = CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL, /* High duty undirected connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */
- .high_duty_duration = CY_BT_HIGH_DUTY_ADV_DURATION, /* High duty undirected connectable advertising duration in seconds (0 for infinite) */
-
- .low_duty_min_interval = CY_BT_LOW_DUTY_ADV_MIN_INTERVAL, /* Low duty undirected connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */
- .low_duty_max_interval = CY_BT_LOW_DUTY_ADV_MAX_INTERVAL, /* Low duty undirected connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */
- .low_duty_duration = CY_BT_LOW_DUTY_ADV_DURATION, /* Low duty undirected connectable advertising duration in seconds (0 for infinite) */
-
- .high_duty_directed_min_interval = CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL, /* High duty directed connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */
- .high_duty_directed_max_interval = CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL, /* High duty directed connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */
+/* BLE scan settings */
+const wiced_bt_cfg_ble_scan_settings_t cy_bt_cfg_scan_settings = {
+ .scan_mode =
+ CY_BT_SCAN_MODE, /* BLE scan mode (BTM_BLE_SCAN_MODE_PASSIVE, BTM_BLE_SCAN_MODE_ACTIVE, or BTM_BLE_SCAN_MODE_NONE) */
+
+ /* Advertisement scan configuration */
+ .high_duty_scan_interval = CY_BT_HIGH_DUTY_SCAN_INTERVAL, /* High duty scan interval (in slots (1 slot = 0.625 ms)) */
+ .high_duty_scan_window = CY_BT_HIGH_DUTY_SCAN_WINDOW, /* High duty scan window (in slots (1 slot = 0.625 ms)) */
+ .high_duty_scan_duration = CY_BT_HIGH_DUTY_SCAN_DURATION, /* High duty scan duration in seconds (0 for infinite) */
+
+ .low_duty_scan_interval = CY_BT_LOW_DUTY_SCAN_INTERVAL, /* Low duty scan interval (in slots (1 slot = 0.625 ms)) */
+ .low_duty_scan_window = CY_BT_LOW_DUTY_SCAN_WINDOW, /* Low duty scan window (in slots (1 slot = 0.625 ms)) */
+ .low_duty_scan_duration = CY_BT_LOW_DUTY_SCAN_DURATION, /* Low duty scan duration in seconds (0 for infinite) */
+
+ /* Connection scan configuration */
+ .high_duty_conn_scan_interval =
+ CY_BT_HIGH_DUTY_CONN_SCAN_INTERVAL, /* High duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) */
+ .high_duty_conn_scan_window =
+ CY_BT_HIGH_DUTY_CONN_SCAN_WINDOW, /* High duty cycle connection scan window (in slots (1 slot = 0.625 ms)) */
+ .high_duty_conn_duration =
+ CY_BT_HIGH_DUTY_CONN_SCAN_DURATION, /* High duty cycle connection duration in seconds (0 for infinite) */
+
+ .low_duty_conn_scan_interval =
+ CY_BT_LOW_DUTY_CONN_SCAN_INTERVAL, /* Low duty cycle connection scan interval (in slots (1 slot = 0.625 ms)) */
+ .low_duty_conn_scan_window =
+ CY_BT_LOW_DUTY_CONN_SCAN_WINDOW, /* Low duty cycle connection scan window (in slots (1 slot = 0.625 ms)) */
+ .low_duty_conn_duration =
+ CY_BT_LOW_DUTY_CONN_SCAN_DURATION, /* Low duty cycle connection duration in seconds (0 for infinite) */
+
+ /* Connection configuration */
+ .conn_min_interval = CY_BT_CONN_MIN_INTERVAL, /* Minimum connection interval (in slots (1 slot = 1.25 ms)) */
+ .conn_max_interval = CY_BT_CONN_MAX_INTERVAL, /* Maximum connection interval (in slots (1 slot = 1.25 ms)) */
+ .conn_latency = CY_BT_CONN_LATENCY, /* Connection latency */
+ .conn_supervision_timeout = CY_BT_CONN_SUPERVISION_TIMEOUT, /* Connection link supervision timeout (in 10 ms) */
+};
+
+/* BLE advertisement settings */
+const wiced_bt_cfg_ble_advert_settings_t cy_bt_cfg_adv_settings = {
+ .channel_map = CY_BT_CHANNEL_MAP, /* Advertising channel map (mask of BTM_BLE_ADVERT_CHNL_37, BTM_BLE_ADVERT_CHNL_38,
+ BTM_BLE_ADVERT_CHNL_39) */
+
+ .high_duty_min_interval = CY_BT_HIGH_DUTY_ADV_MIN_INTERVAL, /* High duty undirected connectable minimum advertising interval (in
+ slots (1 slot = 0.625 ms)) */
+ .high_duty_max_interval = CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL, /* High duty undirected connectable maximum advertising interval (in
+ slots (1 slot = 0.625 ms)) */
+ .high_duty_duration =
+ CY_BT_HIGH_DUTY_ADV_DURATION, /* High duty undirected connectable advertising duration in seconds (0 for infinite) */
+
+ .low_duty_min_interval = CY_BT_LOW_DUTY_ADV_MIN_INTERVAL, /* Low duty undirected connectable minimum advertising interval (in
+ slots (1 slot = 0.625 ms)) */
+ .low_duty_max_interval = CY_BT_LOW_DUTY_ADV_MAX_INTERVAL, /* Low duty undirected connectable maximum advertising interval (in
+ slots (1 slot = 0.625 ms)) */
+ .low_duty_duration =
+ CY_BT_LOW_DUTY_ADV_DURATION, /* Low duty undirected connectable advertising duration in seconds (0 for infinite) */
+
+ .high_duty_directed_min_interval =
+ CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL, /* High duty directed connectable minimum advertising interval (in slots (1 slot
+ = 0.625 ms)) */
+ .high_duty_directed_max_interval =
+ CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL, /* High duty directed connectable maximum advertising interval (in slots (1 slot
+ = 0.625 ms)) */
+
+ .low_duty_directed_min_interval = CY_BT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL, /* Low duty directed connectable minimum advertising
+ interval (in slots (1 slot = 0.625 ms)) */
+ .low_duty_directed_max_interval = CY_BT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL, /* Low duty directed connectable maximum advertising
+ interval (in slots (1 slot = 0.625 ms)) */
+ .low_duty_directed_duration =
+ CY_BT_LOW_DUTY_DIRECTED_ADV_DURATION, /* Low duty directed connectable advertising duration in seconds (0 for infinite) */
+
+ .high_duty_nonconn_min_interval = CY_BT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL, /* High duty non-connectable minimum advertising
+ interval (in slots (1 slot = 0.625 ms)) */
+ .high_duty_nonconn_max_interval = CY_BT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL, /* High duty non-connectable maximum advertising
+ interval (in slots (1 slot = 0.625 ms)) */
+ .high_duty_nonconn_duration =
+ CY_BT_HIGH_DUTY_NONCONN_ADV_DURATION, /* High duty non-connectable advertising duration in seconds (0 for infinite) */
+
+ .low_duty_nonconn_min_interval = CY_BT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL, /* Low duty non-connectable minimum advertising
+ interval (in slots (1 slot = 0.625 ms)) */
+ .low_duty_nonconn_max_interval = CY_BT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL, /* Low duty non-connectable maximum advertising
+ interval (in slots (1 slot = 0.625 ms)) */
+ .low_duty_nonconn_duration =
+ CY_BT_LOW_DUTY_NONCONN_ADV_DURATION /* Low duty non-connectable advertising duration in seconds (0 for infinite) */
+};
+
+/* BLE configuration settings */
+const wiced_bt_cfg_ble_t cy_bt_cfg_ble = {
+ .ble_max_simultaneous_links =
+ (CY_BT_CLIENT_MAX_LINKS +
+ CY_BT_SERVER_MAX_LINKS), /* Max number for simultaneous connections for a layer, profile, protocol */
+ .ble_max_rx_pdu_size = CY_BT_L2CAP_MTU_SIZE, /* Maximum size allowed for any received L2CAP PDU
+ * Minimum value - 65 (to support SM)
+ * Maximum GATT MTU over legacy bearers shall be set to <= this value
+ * Maximum MPS for EATT channels shall be set to <= this value */
+ .appearance = CY_BT_APPEARANCE, /* GATT appearance (see gatt_appearance_e) */
+ .rpa_refresh_timeout = CY_BT_RPA_TIMEOUT, /* Interval of random address refreshing - secs */
+ .host_addr_resolution_db_size = 5, /* LE Address Resolution DB settings - effective only for pre 4.2 controller */
+ .p_ble_scan_cfg = &cy_bt_cfg_scan_settings, /* BLE scan settings */
+ .p_ble_advert_cfg = &cy_bt_cfg_adv_settings, /* BLE advertisement settings */
+ .default_ble_power_level = CY_BT_TX_POWER, /* Default LE power level, Refer lm_TxPwrTable table for the power range */
+};
+
+/* GATT settings */
+const wiced_bt_cfg_gatt_t cy_bt_cfg_gatt = {
+ .max_db_service_modules = 0, /* Maximum number of service modules in the DB*/
+ .max_eatt_bearers = 0, /* Maximum number of allowed gatt bearers */
+};
- .low_duty_directed_min_interval = CY_BT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL, /* Low duty directed connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */
- .low_duty_directed_max_interval = CY_BT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL, /* Low duty directed connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */
- .low_duty_directed_duration = CY_BT_LOW_DUTY_DIRECTED_ADV_DURATION, /* Low duty directed connectable advertising duration in seconds (0 for infinite) */
-
- .high_duty_nonconn_min_interval = CY_BT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL, /* High duty non-connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */
- .high_duty_nonconn_max_interval = CY_BT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL, /* High duty non-connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */
- .high_duty_nonconn_duration = CY_BT_HIGH_DUTY_NONCONN_ADV_DURATION, /* High duty non-connectable advertising duration in seconds (0 for infinite) */
-
- .low_duty_nonconn_min_interval = CY_BT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL, /* Low duty non-connectable minimum advertising interval (in slots (1 slot = 0.625 ms)) */
- .low_duty_nonconn_max_interval = CY_BT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL, /* Low duty non-connectable maximum advertising interval (in slots (1 slot = 0.625 ms)) */
- .low_duty_nonconn_duration = CY_BT_LOW_DUTY_NONCONN_ADV_DURATION /* Low duty non-connectable advertising duration in seconds (0 for infinite) */
- };
-
- /* BLE configuration settings */
- const wiced_bt_cfg_ble_t cy_bt_cfg_ble = {
- .ble_max_simultaneous_links = (CY_BT_CLIENT_MAX_LINKS + CY_BT_SERVER_MAX_LINKS), /* Max number for simultaneous connections for a layer, profile, protocol */
- .ble_max_rx_pdu_size = CY_BT_L2CAP_MTU_SIZE, /* Maximum size allowed for any received L2CAP PDU
- * Minimum value - 65 (to support SM)
- * Maximum GATT MTU over legacy bearers shall be set to <= this value
- * Maximum MPS for EATT channels shall be set to <= this value */
- .appearance = CY_BT_APPEARANCE, /* GATT appearance (see gatt_appearance_e) */
- .rpa_refresh_timeout = CY_BT_RPA_TIMEOUT, /* Interval of random address refreshing - secs */
- .host_addr_resolution_db_size = 5, /* LE Address Resolution DB settings - effective only for pre 4.2 controller */
- .p_ble_scan_cfg = &cy_bt_cfg_scan_settings, /* BLE scan settings */
- .p_ble_advert_cfg = &cy_bt_cfg_adv_settings, /* BLE advertisement settings */
- .default_ble_power_level = CY_BT_TX_POWER, /* Default LE power level, Refer lm_TxPwrTable table for the power range */
- };
-
- /* GATT settings */
- const wiced_bt_cfg_gatt_t cy_bt_cfg_gatt = {
- .max_db_service_modules = 0, /* Maximum number of service modules in the DB*/
- .max_eatt_bearers = 0, /* Maximum number of allowed gatt bearers */
- };
-
/* Application-managed L2CAP protocol configuration */
- const wiced_bt_cfg_l2cap_application_t cy_bt_cfg_l2cap =
- {
- .max_app_l2cap_psms = CY_BT_L2CAP_MAX_LE_PSM, /* Maximum number of application-managed PSMs */
- .max_app_l2cap_channels = CY_BT_L2CAP_MAX_LE_CHANNELS, /* Maximum number of application-managed channels */
- .max_app_l2cap_le_fixed_channels = 0, /* Maximum number of application-managed fixed channels supported */
- };
-
- /* Bluetooth stack configuration */
- const wiced_bt_cfg_settings_t wiced_bt_cfg_settings =
- {
- .device_name = (uint8_t*)app_gap_device_name, /* Local device name (NULL terminated) */
- .security_required = CY_BT_SECURITY_LEVEL, /* BTM_SEC_BEST_EFFORT is recommended choice for most applications,
- * to connect to the widest range of devices. Allows stack to choose
- * the highest level of security possible between the two devices */
- .p_ble_cfg = &cy_bt_cfg_ble, /* BLE related configuration */
- .p_gatt_cfg = &cy_bt_cfg_gatt, /* GATT settings */
- .p_l2cap_app_cfg = &cy_bt_cfg_l2cap, /* Application-managed L2CAP protocol configuration */
- };
+const wiced_bt_cfg_l2cap_application_t cy_bt_cfg_l2cap = {
+ .max_app_l2cap_psms = CY_BT_L2CAP_MAX_LE_PSM, /* Maximum number of application-managed PSMs */
+ .max_app_l2cap_channels = CY_BT_L2CAP_MAX_LE_CHANNELS, /* Maximum number of application-managed channels */
+ .max_app_l2cap_le_fixed_channels = 0, /* Maximum number of application-managed fixed channels supported */
+};
+
+/* Bluetooth stack configuration */
+const wiced_bt_cfg_settings_t wiced_bt_cfg_settings = {
+ .device_name = (uint8_t *) app_gap_device_name, /* Local device name (NULL terminated) */
+ .security_required = CY_BT_SECURITY_LEVEL, /* BTM_SEC_BEST_EFFORT is recommended choice for most applications,
+ * to connect to the widest range of devices. Allows stack to choose
+ * the highest level of security possible between the two devices */
+ .p_ble_cfg = &cy_bt_cfg_ble, /* BLE related configuration */
+ .p_gatt_cfg = &cy_bt_cfg_gatt, /* GATT settings */
+ .p_l2cap_app_cfg = &cy_bt_cfg_l2cap, /* Application-managed L2CAP protocol configuration */
+};
#else
- /* Bluetooth stack configuration */
- const wiced_bt_cfg_settings_t wiced_bt_cfg_settings =
+/* Bluetooth stack configuration */
+const wiced_bt_cfg_settings_t wiced_bt_cfg_settings =
{
.device_name = (uint8_t*)app_gap_device_name, /* Local device name (NULL terminated) */
.device_class = {0x00, 0x00, 0x00}, /* Local device class */
diff --git a/src/platform/P6/cycfg_bt_settings.h b/src/platform/P6/cycfg_bt_settings.h
old mode 100755
new mode 100644
index 1723e81af5fb01..06d3be9ea962dd
--- a/src/platform/P6/cycfg_bt_settings.h
+++ b/src/platform/P6/cycfg_bt_settings.h
@@ -1,28 +1,3 @@
-/***************************************************************************//**
-* File Name: cycfg_bt_settings.h
-*
-* Description:
-* Bluetooth Configurator configuration.
-* This file should not be modified. It was automatically generated by
-* Bluetooth Configurator 2.40.0.4650
-*
-********************************************************************************
-* Copyright 2021 Cypress Semiconductor Corporation
-* SPDX-License-Identifier: Apache-2.0
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*******************************************************************************/
-
#if !defined(CYCFG_BT_SETTINGS_H)
#define CYCFG_BT_SETTINGS_H
@@ -31,8 +6,6 @@
extern const wiced_bt_cfg_settings_t wiced_bt_cfg_settings;
-
#endif /* CYCFG_BT_SETTINGS_H */
/* [] END OF FILE */
-
diff --git a/src/platform/P6/cycfg_gap.c b/src/platform/P6/cycfg_gap.c
old mode 100755
new mode 100644
index ea5c422197277e..834feee25401c6
--- a/src/platform/P6/cycfg_gap.c
+++ b/src/platform/P6/cycfg_gap.c
@@ -1,56 +1,29 @@
-/***************************************************************************//**
-* File Name: cycfg_gap.c
-*
-* Description:
-* BLE device's GAP configuration.
-* This file should not be modified. It was automatically generated by
-* Bluetooth Configurator 2.40.0.4650
-*
-********************************************************************************
-* Copyright 2021 Cypress Semiconductor Corporation
-* SPDX-License-Identifier: Apache-2.0
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*******************************************************************************/
-
#include "cycfg_gap.h"
/* Device address */
-const wiced_bt_device_address_t cy_bt_device_address = {0x00, 0xA0, 0x50, 0x00, 0x00, 0x00};
+const wiced_bt_device_address_t cy_bt_device_address = { 0x00, 0xA0, 0x50, 0x00, 0x00, 0x00 };
-const uint8_t cy_bt_adv_packet_elem_0[1] = { 0x06 };
-const uint8_t cy_bt_adv_packet_elem_1[7] = { 0x62, 0x6C, 0x65, 0x50, 0x72, 0x6F, 0x76 };
-const uint8_t cy_bt_adv_packet_elem_2[16] = { 0x5B, 0x19, 0xBA, 0xE4, 0xE4, 0x52, 0xA9, 0x96, 0xF1, 0x4A, 0x84, 0xC8, 0x09, 0x4D, 0xC0, 0x21 };
-wiced_bt_ble_advert_elem_t cy_bt_adv_packet_data[] =
-{
+const uint8_t cy_bt_adv_packet_elem_0[1] = { 0x06 };
+const uint8_t cy_bt_adv_packet_elem_1[7] = { 0x62, 0x6C, 0x65, 0x50, 0x72, 0x6F, 0x76 };
+const uint8_t cy_bt_adv_packet_elem_2[16] = { 0x5B, 0x19, 0xBA, 0xE4, 0xE4, 0x52, 0xA9, 0x96,
+ 0xF1, 0x4A, 0x84, 0xC8, 0x09, 0x4D, 0xC0, 0x21 };
+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,
+ .advert_type = BTM_BLE_ADVERT_TYPE_FLAG,
+ .len = 1,
+ .p_data = (uint8_t *) cy_bt_adv_packet_elem_0,
},
/* Complete local name */
{
- .advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE,
- .len = 7,
- .p_data = (uint8_t*)cy_bt_adv_packet_elem_1,
+ .advert_type = BTM_BLE_ADVERT_TYPE_NAME_COMPLETE,
+ .len = 7,
+ .p_data = (uint8_t *) cy_bt_adv_packet_elem_1,
},
/* 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,
+ .advert_type = BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE,
+ .len = 16,
+ .p_data = (uint8_t *) cy_bt_adv_packet_elem_2,
},
};
-
-
diff --git a/src/platform/P6/cycfg_gap.h b/src/platform/P6/cycfg_gap.h
old mode 100755
new mode 100644
index f3bbc62f305702..231eaab908e413
--- a/src/platform/P6/cycfg_gap.h
+++ b/src/platform/P6/cycfg_gap.h
@@ -1,128 +1,101 @@
-/***************************************************************************//**
-* File Name: cycfg_gap.h
-*
-* Description:
-* Definitions for GAP configuration.
-* This file should not be modified. It was automatically generated by
-* Bluetooth Configurator 2.40.0.4650
-*
-********************************************************************************
-* Copyright 2021 Cypress Semiconductor Corporation
-* SPDX-License-Identifier: Apache-2.0
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*******************************************************************************/
-
#if !defined(CYCFG_GAP_H)
#define CYCFG_GAP_H
+#include "cycfg_gatt_db.h"
#include "stdint.h"
#include "wiced_bt_ble.h"
-#include "cycfg_gatt_db.h"
/* Silicon generated 'Company assigned' part of device address */
-#define CY_BT_SILICON_DEVICE_ADDRESS_EN 0
+#define CY_BT_SILICON_DEVICE_ADDRESS_EN 0
/* Appearance */
-#define CY_BT_APPEARANCE 0
+#define CY_BT_APPEARANCE 0
/* TX Power Level */
-#define CY_BT_TX_POWER 0
+#define CY_BT_TX_POWER 0
/* Interval of random address refreshing */
-#define CY_BT_RPA_TIMEOUT 0
+#define CY_BT_RPA_TIMEOUT 0
/* Maximum attribute length */
-#define CY_BT_MAX_ATTR_LEN 512
+#define CY_BT_MAX_ATTR_LEN 512
/* Maximum attribute MTU size */
-#define CY_BT_MTU_SIZE 23
+#define CY_BT_MTU_SIZE 23
/* Maximum connections */
-#define CY_BT_SERVER_MAX_LINKS 1
-#define CY_BT_CLIENT_MAX_LINKS 0
+#define CY_BT_SERVER_MAX_LINKS 1
+#define CY_BT_CLIENT_MAX_LINKS 0
/* BLE white list size */
-#define CY_BT_WHITE_LIST_SIZE 0
+#define CY_BT_WHITE_LIST_SIZE 0
/* L2CAP configuration */
-#define CY_BT_L2CAP_MAX_LE_PSM 1
-#define CY_BT_L2CAP_MAX_LE_CHANNELS 1
-#define CY_BT_L2CAP_MTU_SIZE 517
+#define CY_BT_L2CAP_MAX_LE_PSM 1
+#define CY_BT_L2CAP_MAX_LE_CHANNELS 1
+#define CY_BT_L2CAP_MTU_SIZE 517
/* Security level */
-#define CY_BT_SECURITY_LEVEL BTM_SEC_BEST_EFFORT
+#define CY_BT_SECURITY_LEVEL BTM_SEC_BEST_EFFORT
/* Scan configuration */
-#define CY_BT_SCAN_MODE BTM_BLE_SCAN_MODE_PASSIVE
+#define CY_BT_SCAN_MODE BTM_BLE_SCAN_MODE_PASSIVE
-#define CY_BT_HIGH_DUTY_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_INTERVAL
-#define CY_BT_HIGH_DUTY_SCAN_WINDOW WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_WINDOW
-#define CY_BT_HIGH_DUTY_SCAN_DURATION 5
+#define CY_BT_HIGH_DUTY_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_INTERVAL
+#define CY_BT_HIGH_DUTY_SCAN_WINDOW WICED_BT_CFG_DEFAULT_HIGH_DUTY_SCAN_WINDOW
+#define CY_BT_HIGH_DUTY_SCAN_DURATION 5
-#define CY_BT_LOW_DUTY_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_INTERVAL
-#define CY_BT_LOW_DUTY_SCAN_WINDOW WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_WINDOW
-#define CY_BT_LOW_DUTY_SCAN_DURATION 60
+#define CY_BT_LOW_DUTY_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_INTERVAL
+#define CY_BT_LOW_DUTY_SCAN_WINDOW WICED_BT_CFG_DEFAULT_LOW_DUTY_SCAN_WINDOW
+#define CY_BT_LOW_DUTY_SCAN_DURATION 60
-#define CY_BT_HIGH_DUTY_CONN_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_INTERVAL
-#define CY_BT_HIGH_DUTY_CONN_SCAN_WINDOW WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_WINDOW
-#define CY_BT_HIGH_DUTY_CONN_SCAN_DURATION 30
+#define CY_BT_HIGH_DUTY_CONN_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_INTERVAL
+#define CY_BT_HIGH_DUTY_CONN_SCAN_WINDOW WICED_BT_CFG_DEFAULT_HIGH_DUTY_CONN_SCAN_WINDOW
+#define CY_BT_HIGH_DUTY_CONN_SCAN_DURATION 30
-#define CY_BT_LOW_DUTY_CONN_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_INTERVAL
-#define CY_BT_LOW_DUTY_CONN_SCAN_WINDOW WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_WINDOW
-#define CY_BT_LOW_DUTY_CONN_SCAN_DURATION 30
+#define CY_BT_LOW_DUTY_CONN_SCAN_INTERVAL WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_INTERVAL
+#define CY_BT_LOW_DUTY_CONN_SCAN_WINDOW WICED_BT_CFG_DEFAULT_LOW_DUTY_CONN_SCAN_WINDOW
+#define CY_BT_LOW_DUTY_CONN_SCAN_DURATION 30
/* Connection configuration */
-#define CY_BT_CONN_MIN_INTERVAL WICED_BT_CFG_DEFAULT_CONN_MIN_INTERVAL
-#define CY_BT_CONN_MAX_INTERVAL WICED_BT_CFG_DEFAULT_CONN_MAX_INTERVAL
-#define CY_BT_CONN_LATENCY WICED_BT_CFG_DEFAULT_CONN_LATENCY
-#define CY_BT_CONN_SUPERVISION_TIMEOUT WICED_BT_CFG_DEFAULT_CONN_SUPERVISION_TIMEOUT
+#define CY_BT_CONN_MIN_INTERVAL WICED_BT_CFG_DEFAULT_CONN_MIN_INTERVAL
+#define CY_BT_CONN_MAX_INTERVAL WICED_BT_CFG_DEFAULT_CONN_MAX_INTERVAL
+#define CY_BT_CONN_LATENCY WICED_BT_CFG_DEFAULT_CONN_LATENCY
+#define CY_BT_CONN_SUPERVISION_TIMEOUT WICED_BT_CFG_DEFAULT_CONN_SUPERVISION_TIMEOUT
/* 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_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 48
+#define CY_BT_HIGH_DUTY_ADV_MAX_INTERVAL 48
+#define CY_BT_HIGH_DUTY_ADV_DURATION 60
-#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 1638
+#define CY_BT_LOW_DUTY_ADV_MAX_INTERVAL 1638
+#define CY_BT_LOW_DUTY_ADV_DURATION 30
-#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL 400
-#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL 800
+#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MIN_INTERVAL 400
+#define CY_BT_HIGH_DUTY_DIRECTED_ADV_MAX_INTERVAL 800
-#define CY_BT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL 48
-#define CY_BT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL 48
-#define CY_BT_LOW_DUTY_DIRECTED_ADV_DURATION 30
+#define CY_BT_LOW_DUTY_DIRECTED_ADV_MIN_INTERVAL 48
+#define CY_BT_LOW_DUTY_DIRECTED_ADV_MAX_INTERVAL 48
+#define CY_BT_LOW_DUTY_DIRECTED_ADV_DURATION 30
-#define CY_BT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL 160
-#define CY_BT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL 160
-#define CY_BT_HIGH_DUTY_NONCONN_ADV_DURATION 30
-
-#define CY_BT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL 2048
-#define CY_BT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL 2048
-#define CY_BT_LOW_DUTY_NONCONN_ADV_DURATION 30
+#define CY_BT_HIGH_DUTY_NONCONN_ADV_MIN_INTERVAL 160
+#define CY_BT_HIGH_DUTY_NONCONN_ADV_MAX_INTERVAL 160
+#define CY_BT_HIGH_DUTY_NONCONN_ADV_DURATION 30
+#define CY_BT_LOW_DUTY_NONCONN_ADV_MIN_INTERVAL 2048
+#define CY_BT_LOW_DUTY_NONCONN_ADV_MAX_INTERVAL 2048
+#define CY_BT_LOW_DUTY_NONCONN_ADV_DURATION 30
/* Advertisement and scan response packets defines */
-#define CY_BT_ADV_PACKET_DATA_SIZE 3
+#define CY_BT_ADV_PACKET_DATA_SIZE 3
/* cy_bt_device_name is obsolete. Use app_gap_device_name instead. */
-#define cy_bt_device_name app_gap_device_name
+#define cy_bt_device_name app_gap_device_name
/* External definitions */
extern const wiced_bt_device_address_t cy_bt_device_address;
extern wiced_bt_ble_advert_elem_t cy_bt_adv_packet_data[];
#endif /* CYCFG_GAP_H */
-
diff --git a/src/platform/P6/cycfg_gatt_db.c b/src/platform/P6/cycfg_gatt_db.c
old mode 100755
new mode 100644
index 4ddff3be351937..be718a3f162bcc
--- a/src/platform/P6/cycfg_gatt_db.c
+++ b/src/platform/P6/cycfg_gatt_db.c
@@ -1,52 +1,63 @@
-/***************************************************************************//**
-* File Name: cycfg_gatt_db.c
-* Version: 2.1
-*
-* Description:
-* BLE device's GATT database and device configuration.
-*
-********************************************************************************
-* Copyright 2020 Cypress Semiconductor Corporation
-* SPDX-License-Identifier: Apache-2.0
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*******************************************************************************/
+/*******************************************************************************
+ * (c) 2020, Cypress Semiconductor Corporation. All rights reserved.
+ *******************************************************************************
+ * This software, including source code, documentation and related materials
+ * ("Software"), is owned by Cypress Semiconductor Corporation or one of its
+ * subsidiaries ("Cypress") and is protected by and subject to worldwide patent
+ * protection (United States and foreign), United States copyright laws and
+ * international treaty provisions. Therefore, you may use this Software only
+ * as provided in the license agreement accompanying the software package from
+ * which you obtained this Software ("EULA").
+ *
+ * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+ * non-transferable license to copy, modify, and compile the Software source
+ * code solely for use in connection with Cypress's integrated circuit products.
+ * Any reproduction, modification, translation, compilation, or representation
+ * of this Software except as specified above is prohibited without the express
+ * written permission of Cypress.
+ *
+ * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+ * reserves the right to make changes to the Software without notice. Cypress
+ * does not assume any liability arising out of the application or use of the
+ * Software or any product or circuit described in the Software. Cypress does
+ * not authorize its products for use in any products where a malfunction or
+ * failure of the Cypress product may reasonably be expected to result in
+ * significant property damage, injury or death ("High Risk Product"). By
+ * including Cypress's product in a High Risk Product, the manufacturer of such
+ * system or application assumes all risk of such use and in doing so agrees to
+ * indemnify Cypress against all liability.
+ *******************************************************************************/
+
+/*******************************************************************************
+ * File Name: cycfg_gatt_db.c
+ * Version: 2.1
+ *
+ * Description:
+ * BLE device's GATT database and device configuration.
+ *
+ *******************************************************************************/
#include "cycfg_gatt_db.h"
-#include "wiced_bt_uuid.h"
#include "wiced_bt_gatt.h"
+#include "wiced_bt_uuid.h"
/*************************************************************************************
-* GATT server definitions
-*************************************************************************************/
+ * GATT server definitions
+ *************************************************************************************/
-const uint8_t gatt_database[] =
-{
+const uint8_t gatt_database[] = {
/* Primary Service: Generic Access */
PRIMARY_SERVICE_UUID16(HDLS_GAP, __UUID_SERVICE_GENERIC_ACCESS),
/* Characteristic: Device Name */
- CHARACTERISTIC_UUID16(HDLC_GAP_DEVICE_NAME,
- HDLC_GAP_DEVICE_NAME_VALUE,
- __UUID_CHARACTERISTIC_DEVICE_NAME,
- LEGATTDB_CHAR_PROP_READ,
- LEGATTDB_PERM_READABLE),
+ CHARACTERISTIC_UUID16(HDLC_GAP_DEVICE_NAME, HDLC_GAP_DEVICE_NAME_VALUE, __UUID_CHARACTERISTIC_DEVICE_NAME,
+ LEGATTDB_CHAR_PROP_READ, LEGATTDB_PERM_READABLE),
/* Characteristic: Appearance */
- CHARACTERISTIC_UUID16(HDLC_GAP_APPEARANCE,
- HDLC_GAP_APPEARANCE_VALUE,
- __UUID_CHARACTERISTIC_APPEARANCE,
- LEGATTDB_CHAR_PROP_READ, LEGATTDB_PERM_READABLE),
+ CHARACTERISTIC_UUID16(HDLC_GAP_APPEARANCE, HDLC_GAP_APPEARANCE_VALUE, __UUID_CHARACTERISTIC_APPEARANCE, LEGATTDB_CHAR_PROP_READ,
+ LEGATTDB_PERM_READABLE),
/* Primary Service: Generic Attribute */
PRIMARY_SERVICE_UUID16(HDLS_GATT, __UUID_SERVICE_GENERIC_ATTRIBUTE),
@@ -55,21 +66,16 @@ const uint8_t gatt_database[] =
PRIMARY_SERVICE_UUID16(HDLS_CHIP_SERVICE, __UUID16_CHIPoBLEService),
/* Characteristic: C1 */
- CHARACTERISTIC_UUID128_WRITABLE(HDLC_CHIP_SERVICE_CHAR_C1,
- HDLC_CHIP_SERVICE_CHAR_C1_VALUE,
- __UUID128_CHIPoBLEChar_C1,
+ CHARACTERISTIC_UUID128_WRITABLE(HDLC_CHIP_SERVICE_CHAR_C1, HDLC_CHIP_SERVICE_CHAR_C1_VALUE, __UUID128_CHIPoBLEChar_C1,
LEGATTDB_CHAR_PROP_WRITE,
LEGATTDB_PERM_VARIABLE_LENGTH | LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_REQ),
/* Characteristic: C2 */
- CHARACTERISTIC_UUID128_WRITABLE(HDLC_CHIP_SERVICE_CHAR_C2,
- HDLC_CHIP_SERVICE_CHAR_C2_VALUE,
- __UUID128_CHIPoBLEChar_C2,
+ CHARACTERISTIC_UUID128_WRITABLE(HDLC_CHIP_SERVICE_CHAR_C2, HDLC_CHIP_SERVICE_CHAR_C2_VALUE, __UUID128_CHIPoBLEChar_C2,
LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY,
LEGATTDB_PERM_RELIABLE_WRITE | LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITABLE),
/* Descriptor: Client Characteristic Configuration */
- CHAR_DESCRIPTOR_UUID16_WRITABLE(HDLD_CHIP_SERVICE_RX_CLIENT_CHAR_CONFIG,
- __UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION,
+ CHAR_DESCRIPTOR_UUID16_WRITABLE(HDLD_CHIP_SERVICE_RX_CLIENT_CHAR_CONFIG, __UUID_DESCRIPTOR_CLIENT_CHARACTERISTIC_CONFIGURATION,
LEGATTDB_PERM_AUTH_READABLE | LEGATTDB_PERM_WRITE_REQ),
};
@@ -80,26 +86,32 @@ const uint16_t gatt_database_len = sizeof(gatt_database);
* GATT Initial Value Arrays
************************************************************************************/
-uint8_t app_gap_device_name[kMaxDeviceNameLength] = { 'I', 'F', 'X', ' ', 'C', 'H', 'I', 'P' };
-uint8_t app_gap_appearance[] = {0x00, 0x00, };
-uint8_t app_chip_service_char_tx_client_char_config[] = {0x00, 0x00, };
+uint8_t app_gap_device_name[kMaxDeviceNameLength] = { 'I', 'F', 'X', ' ', 'C', 'H', 'I', 'P' };
+uint8_t app_gap_appearance[] = {
+ 0x00,
+ 0x00,
+};
+uint8_t app_chip_service_char_tx_client_char_config[] = {
+ 0x00,
+ 0x00,
+};
- /************************************************************************************
+/************************************************************************************
* GATT Lookup Table
************************************************************************************/
-gatt_db_lookup_table_t app_gatt_db_ext_attr_tbl[] =
-{
+gatt_db_lookup_table_t app_gatt_db_ext_attr_tbl[] = {
/* { attribute handle, maxlen, curlen, attribute data } */
{ HDLC_GAP_DEVICE_NAME_VALUE, sizeof(app_gap_device_name), sizeof(app_gap_device_name), app_gap_device_name },
{ HDLC_GAP_APPEARANCE_VALUE, sizeof(app_gap_appearance), sizeof(app_gap_appearance), app_gap_appearance },
- { HDLD_CHIP_SERVICE_RX_CLIENT_CHAR_CONFIG, sizeof(app_chip_service_char_tx_client_char_config), sizeof(app_chip_service_char_tx_client_char_config), app_chip_service_char_tx_client_char_config },
+ { HDLD_CHIP_SERVICE_RX_CLIENT_CHAR_CONFIG, sizeof(app_chip_service_char_tx_client_char_config),
+ sizeof(app_chip_service_char_tx_client_char_config), app_chip_service_char_tx_client_char_config },
};
/* Number of Lookup Table entries */
const uint16_t app_gatt_db_ext_attr_tbl_size = (sizeof(app_gatt_db_ext_attr_tbl) / sizeof(gatt_db_lookup_table_t));
/* Number of GATT initial value arrays entries */
-const uint16_t app_gap_device_name_len = (sizeof(app_gap_device_name));
-const uint16_t app_gap_appearance_len = (sizeof(app_gap_appearance));
+const uint16_t app_gap_device_name_len = (sizeof(app_gap_device_name));
+const uint16_t app_gap_appearance_len = (sizeof(app_gap_appearance));
const uint16_t app_chip_service_char_tx_client_char_config_len = (sizeof(app_chip_service_char_tx_client_char_config));
diff --git a/third_party/p6/BUILD.gn b/third_party/p6/BUILD.gn
index 3f03baddcf68e3..2cae9602b59511 100644
--- a/third_party/p6/BUILD.gn
+++ b/third_party/p6/BUILD.gn
@@ -25,54 +25,58 @@ assert(p6_target_project != "", "p6_target_project must be specified")
# Add includes, cflags, asmflags, etc in config
config("p6_sdk_config") {
# Pull out includes from generated json
- # Treat these includes as system includes, so warnings in them are not fatal.
+ # Treat these includes as system includes, so warnings in them are not fatal.
_include_dirs = []
foreach(inc, mtb_json.includes) {
# Strip off leading -I part
- _include_dirs += ["/" + rebase_path(string_replace(inc, "-I", "", 1), "/", "${p6_sdk_build_root}/repo/")]
+ _include_dirs += [ "/" + rebase_path(string_replace(inc, "-I", "", 1),
+ "/",
+ "${p6_sdk_build_root}/repo/") ]
}
# Also add project include path (passed in from project build)
proj_path = get_label_info(p6_target_project, "dir")
- _include_dirs += ["/" + rebase_path("${proj_path}/include", "/", ".")]
+ _include_dirs += [ "/" + rebase_path("${proj_path}/include", "/", ".") ]
cflags = []
foreach(include_dir, _include_dirs) {
- cflags += ["-isystem" + include_dir]
+ cflags += [ "-isystem" + include_dir ]
}
# Pull out defines from generated json
defines = []
foreach(def, mtb_json.defines) {
# Strip off leading -D part
- defines += [string_replace(def, "-D", "", 1)]
+ defines += [ string_replace(def, "-D", "", 1) ]
}
# Pull out static libs (.a files) from generated json
libs = []
foreach(lib, mtb_json.libs) {
- libs += ["/" + rebase_path(lib, "/", "${p6_sdk_build_root}/repo/")]
+ libs += [ "/" + rebase_path(lib, "/", "${p6_sdk_build_root}/repo/") ]
}
cflags_c = mtb_json.cflags
cflags_cc = mtb_json.cxxflags
asmflags = mtb_json.asflags
- ldflags = filter_exclude(mtb_json.ldflags, ["-T*"])
+ ldflags = filter_exclude(mtb_json.ldflags, [ "-T*" ])
# Pull out linker flags with paths (-T flags) and make paths absolute
- linker_script_flags = filter_include(mtb_json.ldflags, ["-T*"])
+ linker_script_flags = filter_include(mtb_json.ldflags, [ "-T*" ])
foreach(flag, linker_script_flags) {
- ldflags += ["-T/" + rebase_path(string_replace(flag, "-T", "", 1), "/", "${p6_sdk_build_root}/repo/")]
+ ldflags += [ "-T/" + rebase_path(string_replace(flag, "-T", "", 1),
+ "/",
+ "${p6_sdk_build_root}/repo/") ]
}
# --specs=nano.specs is getting added twice and causing compile issues so remove from cxx flags here.
- cflags_c -= ["--specs=nano.specs"]
- cflags_cc -= ["--specs=nano.specs"]
- asmflags -= ["--specs=nano.specs"]
- ldflags -= ["--specs=nano.specs"]
+ cflags_c -= [ "--specs=nano.specs" ]
+ cflags_cc -= [ "--specs=nano.specs" ]
+ asmflags -= [ "--specs=nano.specs" ]
+ ldflags -= [ "--specs=nano.specs" ]
}
group("p6_build") {
- public_configs = [":p6_sdk_config"]
+ public_configs = [ ":p6_sdk_config" ]
public_deps = [ p6_target_project ]
}
diff --git a/third_party/p6/p6_executable.gni b/third_party/p6/p6_executable.gni
index 9b33442c8fe7b1..5771e19b4cad01 100644
--- a/third_party/p6/p6_executable.gni
+++ b/third_party/p6/p6_executable.gni
@@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import("//build_overrides/chip.gni")
import("//build/toolchain/flashable_executable.gni")
+import("//build_overrides/chip.gni")
import("p6_board.gni")
@@ -24,27 +24,31 @@ template("p6_executable") {
objcopy_image_format = "ihex"
objcopy = "arm-none-eabi-objcopy"
- #Copy flashing dependencies to the output directory so that the output
- #is collectively self-contained; this allows flashing to work reliably
- #even if the build and flashing steps take place on different machines
- #or in different containers.
+ #Copy flashing dependencies to the output directory so that the output
+ #is collectively self-contained; this allows flashing to work reliably
+ #even if the build and flashing steps take place on different machines
+ #or in different containers.
flashing_runtime_target = target_name + ".flashing_runtime"
copy(flashing_runtime_target) {
- sources = [
- "${chip_root}/scripts/flashing/p6_firmware_utils.py",
- "${chip_root}/scripts/flashing/firmware_utils.py",
- ]
- outputs = [ "${root_out_dir}/{{source_file_part}}" ]
+ sources = [
+ "${chip_root}/scripts/flashing/firmware_utils.py",
+ "${chip_root}/scripts/flashing/p6_firmware_utils.py",
+ ]
+ outputs = [ "${root_out_dir}/{{source_file_part}}" ]
}
flashing_script_generator =
- "${chip_root}/scripts/flashing/gen_flashing_script.py"
+ "${chip_root}/scripts/flashing/gen_flashing_script.py"
flashing_script_name = output_base_name + ".flash.py"
- flashing_options = [ "p6", "--device", "${p6_board}" ]
+ flashing_options = [
+ "p6",
+ "--device",
+ "${p6_board}",
+ ]
flashable_executable(target_name) {
- forward_variables_from(invoker, "*")
- data_deps = [ ":${flashing_runtime_target}" ]
+ forward_variables_from(invoker, "*")
+ data_deps = [ ":${flashing_runtime_target}" ]
}
}
diff --git a/third_party/p6/p6_sdk.gni b/third_party/p6/p6_sdk.gni
index fbc125696bed48..e8eb6ca0b3c7fe 100644
--- a/third_party/p6/p6_sdk.gni
+++ b/third_party/p6/p6_sdk.gni
@@ -16,18 +16,26 @@ import("//build_overrides/chip.gni")
import("//build_overrides/jlink.gni")
import("//build_overrides/mbedtls.gni")
-import("p6_board.gni")
import("//build_overrides/p6.gni")
+import("p6_board.gni")
# TODO: Don't hardcode config/toolchain
# TODO: Convert to GN action?
-if(is_debug) {
+if (is_debug) {
debug_str = "Debug"
-}
-else {
+} else {
debug_str = "Release"
}
-mtb_json = exec_script("$p6_sdk_build_root/repo/make_gni.py", ["${p6_board}", "-c", debug_str, "-t", "GCC_ARM"], "json", [])
+mtb_json = exec_script("$p6_sdk_build_root/repo/make_gni.py",
+ [
+ "${p6_board}",
+ "-c",
+ debug_str,
+ "-t",
+ "GCC_ARM",
+ ],
+ "json",
+ [])
# Defines an p6 SDK build target.
#
@@ -35,7 +43,6 @@ mtb_json = exec_script("$p6_sdk_build_root/repo/make_gni.py", ["${p6_board}", "-
# sources - The sources files to build.
#
template("p6_sdk_sources") {
-
if (defined(invoker.p6_project_dir)) {
p6_project_dir = invoker.p6_project_dir
}
@@ -48,7 +55,7 @@ template("p6_sdk_sources") {
if (defined(invoker.include_dirs)) {
include_dirs += invoker.include_dirs
}
- include_dirs += ["${p6_project_dir}/include"]
+ include_dirs += [ "${p6_project_dir}/include" ]
defines = []
if (defined(invoker.defines)) {
@@ -67,17 +74,23 @@ template("p6_sdk_sources") {
# Pull out c sources from generated json
foreach(src, mtb_json.c_source) {
- sources += [rebase_path(src, "${p6_project_dir}", "${p6_sdk_build_root}/repo/")]
+ sources += [ rebase_path(src,
+ "${p6_project_dir}",
+ "${p6_sdk_build_root}/repo/") ]
}
# Pull out cpp sources from generated json
foreach(src, mtb_json.cxx_source) {
- sources += [rebase_path(src, "${p6_project_dir}", "${p6_sdk_build_root}/repo/")]
+ sources += [ rebase_path(src,
+ "${p6_project_dir}",
+ "${p6_sdk_build_root}/repo/") ]
}
# Pull out .S files from generated json
foreach(asm, mtb_json.asm_source) {
- sources += [rebase_path(asm, "${p6_project_dir}", "${p6_sdk_build_root}/repo/")]
+ sources += [ rebase_path(asm,
+ "${p6_project_dir}",
+ "${p6_sdk_build_root}/repo/") ]
}
public_deps = []
@@ -92,7 +105,7 @@ template("p6_sdk_sources") {
#"${segger_rtt_root}:segger_rtt_syscalls",
]
- public_configs = [":project_configs"]
+ public_configs = [ ":project_configs" ]
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
diff --git a/third_party/p6/repo/configs/FreeRTOSConfig.h b/third_party/p6/repo/configs/FreeRTOSConfig.h
index ffd0fe671d6bde..e9f80425ec10c6 100644
--- a/third_party/p6/repo/configs/FreeRTOSConfig.h
+++ b/third_party/p6/repo/configs/FreeRTOSConfig.h
@@ -47,60 +47,59 @@
/* Ensure stdint is only used by the compiler, and not the assembler. */
#ifdef __ICCARM__
- #include
- extern uint32_t SystemCoreClock;
+#include
+extern uint32_t SystemCoreClock;
#endif
#include "cycfg_system.h"
-
-#define configUSE_PREEMPTION 1
-
-#define configCPU_CLOCK_HZ SystemCoreClock
-#define configTICK_RATE_HZ 1000u
-#define configMAX_PRIORITIES 7
-#define configMINIMAL_STACK_SIZE 128
-#define configMAX_TASK_NAME_LEN 16
-#define configUSE_16_BIT_TICKS 0
-#define configIDLE_SHOULD_YIELD 1
-#define configUSE_MUTEXES 1
-#define configUSE_RECURSIVE_MUTEXES 1
-#define configUSE_COUNTING_SEMAPHORES 1
-#define configQUEUE_REGISTRY_SIZE 10
-#define configUSE_NEWLIB_REENTRANT 1
-#define configENABLE_BACKWARD_COMPATIBILITY 1
+#define configUSE_PREEMPTION 1
+
+#define configCPU_CLOCK_HZ SystemCoreClock
+#define configTICK_RATE_HZ 1000u
+#define configMAX_PRIORITIES 7
+#define configMINIMAL_STACK_SIZE 128
+#define configMAX_TASK_NAME_LEN 16
+#define configUSE_16_BIT_TICKS 0
+#define configIDLE_SHOULD_YIELD 1
+#define configUSE_MUTEXES 1
+#define configUSE_RECURSIVE_MUTEXES 1
+#define configUSE_COUNTING_SEMAPHORES 1
+#define configQUEUE_REGISTRY_SIZE 10
+#define configUSE_NEWLIB_REENTRANT 1
+#define configENABLE_BACKWARD_COMPATIBILITY 1
/* Memory allocation related definitions. */
-#define configSUPPORT_STATIC_ALLOCATION 1
-#define configSUPPORT_DYNAMIC_ALLOCATION 1
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( CY_SRAM_SIZE - (64 * 1024)))
+#define configSUPPORT_STATIC_ALLOCATION 1
+#define configSUPPORT_DYNAMIC_ALLOCATION 1
+#define configTOTAL_HEAP_SIZE ((size_t)(CY_SRAM_SIZE - (64 * 1024)))
/* Hook function related definitions. */
-#define configUSE_IDLE_HOOK 0
-#define configUSE_TICK_HOOK 0
-#define configCHECK_FOR_STACK_OVERFLOW 2
+#define configUSE_IDLE_HOOK 0
+#define configUSE_TICK_HOOK 0
+#define configCHECK_FOR_STACK_OVERFLOW 2
-#define configUSE_MALLOC_FAILED_HOOK 1
-#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
-#define configUSE_APPLICATION_TASK_TAG 0
+#define configUSE_MALLOC_FAILED_HOOK 1
+#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
+#define configUSE_APPLICATION_TASK_TAG 0
/* Run time and task stats gathering related definitions. */
-#define configGENERATE_RUN_TIME_STATS 0
-#define configUSE_TRACE_FACILITY 1
+#define configGENERATE_RUN_TIME_STATS 0
+#define configUSE_TRACE_FACILITY 1
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 16
/* Co-routine related definitions. */
-#define configUSE_CO_ROUTINES 0
-#define configMAX_CO_ROUTINE_PRIORITIES 2
+#define configUSE_CO_ROUTINES 0
+#define configMAX_CO_ROUTINE_PRIORITIES 2
/* Software timer related definitions. */
-#define configUSE_TIMERS 1
-#define configTIMER_TASK_PRIORITY 2
-#define configTIMER_QUEUE_LENGTH 10
-#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY 2
+#define configTIMER_QUEUE_LENGTH 10
+#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2)
/* Queue Creation Fix to not use static queue */
-#define LWIP_FREERTOS_USE_STATIC_TCPIP_QUEUE 0
+#define LWIP_FREERTOS_USE_STATIC_TCPIP_QUEUE 0
/*
Interrupt nesting behavior configuration.
@@ -134,63 +133,67 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html
*/
/* Put KERNEL_INTERRUPT_PRIORITY in top __NVIC_PRIO_BITS bits of CM4 register */
-#define configKERNEL_INTERRUPT_PRIORITY 0xFF
+#define configKERNEL_INTERRUPT_PRIORITY 0xFF
/*
Put MAX_SYSCALL_INTERRUPT_PRIORITY in top __NVIC_PRIO_BITS bits of CM4 register
NOTE For IAR compiler make sure that changes of this macro is reflected in
file portable\IAR\CM4F\portasm.s in PendSV_Handler: routine
*/
-#define configMAX_SYSCALL_INTERRUPT_PRIORITY 0x3F
+#define configMAX_SYSCALL_INTERRUPT_PRIORITY 0x3F
/* configMAX_API_CALL_INTERRUPT_PRIORITY is a new name for configMAX_SYSCALL_INTERRUPT_PRIORITY
that is used by newer ports only. The two are equivalent. */
-#define configMAX_API_CALL_INTERRUPT_PRIORITY configMAX_SYSCALL_INTERRUPT_PRIORITY
+#define configMAX_API_CALL_INTERRUPT_PRIORITY configMAX_SYSCALL_INTERRUPT_PRIORITY
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
-#define INCLUDE_vTaskPrioritySet 1
-#define INCLUDE_uxTaskPriorityGet 1
-#define INCLUDE_vTaskDelete 1
-#define INCLUDE_vTaskCleanUpResources 1
-#define INCLUDE_vTaskSuspend 1
-#define INCLUDE_vTaskDelayUntil 1
-#define INCLUDE_vTaskDelay 1
-#define INCLUDE_xTaskIsTaskFinished 1
-#define INCLUDE_xTimerPendFunctionCall 1
+#define INCLUDE_vTaskPrioritySet 1
+#define INCLUDE_uxTaskPriorityGet 1
+#define INCLUDE_vTaskDelete 1
+#define INCLUDE_vTaskCleanUpResources 1
+#define INCLUDE_vTaskSuspend 1
+#define INCLUDE_vTaskDelayUntil 1
+#define INCLUDE_vTaskDelay 1
+#define INCLUDE_xTaskIsTaskFinished 1
+#define INCLUDE_xTimerPendFunctionCall 1
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
-#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
+#define configASSERT(x) \
+ if ((x) == 0) \
+ { \
+ taskDISABLE_INTERRUPTS(); \
+ for (;;) \
+ ; \
+ }
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names - or at least those used in the unmodified vector table. */
-#define vPortSVCHandler SVC_Handler
-#define xPortPendSVHandler PendSV_Handler
+#define vPortSVCHandler SVC_Handler
+#define xPortPendSVHandler PendSV_Handler
#define xPortSysTickHandler SysTick_Handler
/* Dynamic Memory Allocation Schemes */
-#define HEAP_ALLOCATION_TYPE1 (1) /* heap_1.c*/
-#define HEAP_ALLOCATION_TYPE2 (2) /* heap_2.c*/
-#define HEAP_ALLOCATION_TYPE3 (3) /* heap_3.c*/
-#define HEAP_ALLOCATION_TYPE4 (4) /* heap_4.c*/
-#define HEAP_ALLOCATION_TYPE5 (5) /* heap_5.c*/
-#define NO_HEAP_ALLOCATION (0)
-
-#define configHEAP_ALLOCATION_SCHEME (HEAP_ALLOCATION_TYPE3)
-
-#if defined(CY_CFG_PWR_SYS_IDLE_MODE) && \
- ((CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_SLEEP) || \
- (CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_DEEPSLEEP))
-extern void vApplicationSleep( uint32_t xExpectedIdleTime );
-#define portSUPPRESS_TICKS_AND_SLEEP( xIdleTime ) vApplicationSleep( xIdleTime )
-#define configUSE_TICKLESS_IDLE 2
+#define HEAP_ALLOCATION_TYPE1 (1) /* heap_1.c*/
+#define HEAP_ALLOCATION_TYPE2 (2) /* heap_2.c*/
+#define HEAP_ALLOCATION_TYPE3 (3) /* heap_3.c*/
+#define HEAP_ALLOCATION_TYPE4 (4) /* heap_4.c*/
+#define HEAP_ALLOCATION_TYPE5 (5) /* heap_5.c*/
+#define NO_HEAP_ALLOCATION (0)
+
+#define configHEAP_ALLOCATION_SCHEME (HEAP_ALLOCATION_TYPE3)
+
+#if defined(CY_CFG_PWR_SYS_IDLE_MODE) && \
+ ((CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_SLEEP) || (CY_CFG_PWR_SYS_IDLE_MODE == CY_CFG_PWR_MODE_DEEPSLEEP))
+extern void vApplicationSleep(uint32_t xExpectedIdleTime);
+#define portSUPPRESS_TICKS_AND_SLEEP(xIdleTime) vApplicationSleep(xIdleTime)
+#define configUSE_TICKLESS_IDLE 2
#else
-#define configUSE_TICKLESS_IDLE 0
+#define configUSE_TICKLESS_IDLE 0
#endif
/* Deep Sleep Latency Configuration */
#if CY_CFG_PWR_DEEPSLEEP_LATENCY > 0
-#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP CY_CFG_PWR_DEEPSLEEP_LATENCY
+#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP CY_CFG_PWR_DEEPSLEEP_LATENCY
#endif
#endif /* FREERTOS_CONFIG_H */
-
diff --git a/third_party/p6/repo/configs/iot_config.h b/third_party/p6/repo/configs/iot_config.h
index 138a30703ea563..c63f67e833fbf2 100644
--- a/third_party/p6/repo/configs/iot_config.h
+++ b/third_party/p6/repo/configs/iot_config.h
@@ -71,52 +71,56 @@
/**
* @brief Default thread priority for the threads created by AWS IoT Device SDK.
*/
-#define IOT_THREAD_DEFAULT_PRIORITY ( CY_RTOS_PRIORITY_NORMAL )
+#define IOT_THREAD_DEFAULT_PRIORITY (CY_RTOS_PRIORITY_NORMAL)
/**
* @brief Default thread stack size for the threads created by AWS IoT Device SDK.
* The stack size may be tuned to suit the desired use case.
*/
-#define IOT_THREAD_DEFAULT_STACK_SIZE ( 2048 )
+#define IOT_THREAD_DEFAULT_STACK_SIZE (2048)
/**
- * @brief Default wait time (in milliseconds) to receive keep-alive responses from the MQTT broker. This value may be adjusted to suit the use case and network environment.
- * Refer aws-iot-device-sdk-embedded-C/doc/lib/mqtt.txt for additional info.
+ * @brief Default wait time (in milliseconds) to receive keep-alive responses from the MQTT broker. This value may be adjusted to
+ * suit the use case and network environment. Refer aws-iot-device-sdk-embedded-C/doc/lib/mqtt.txt for additional info.
*/
-#define IOT_MQTT_RESPONSE_WAIT_MS ( 5000U )
+#define IOT_MQTT_RESPONSE_WAIT_MS (5000U)
/**
* \cond
* @brief Macros to enable/disable asserts in the IoT Device SDK library.
* Asserts are disabled by default; to enable asserts, modify these macros to 1.
*/
-#define IOT_CONTAINERS_ENABLE_ASSERTS ( 0 )
-#define IOT_MQTT_ENABLE_ASSERTS ( 0 )
-#define IOT_TASKPOOL_ENABLE_ASSERTS ( 0 )
-#define AWS_IOT_SHADOW_ENABLE_ASSERTS ( 0 )
-#define AWS_IOT_DEFENDER_ENABLE_ASSERTS ( 0 )
-#define AWS_IOT_JOBS_ENABLE_ASSERTS ( 0 )
+#define IOT_CONTAINERS_ENABLE_ASSERTS (0)
+#define IOT_MQTT_ENABLE_ASSERTS (0)
+#define IOT_TASKPOOL_ENABLE_ASSERTS (0)
+#define AWS_IOT_SHADOW_ENABLE_ASSERTS (0)
+#define AWS_IOT_DEFENDER_ENABLE_ASSERTS (0)
+#define AWS_IOT_JOBS_ENABLE_ASSERTS (0)
/**
* \endcond
*/
/**
- * @brief Insert program diagnostics. This function should have the same signature as [assert](https://pubs.opengroup.org/onlinepubs/9699919799/functions/assert.html)
+ * @brief Insert program diagnostics. This function should have the same signature as
+ * [assert](https://pubs.opengroup.org/onlinepubs/9699919799/functions/assert.html)
*/
-#if (IOT_CONTAINERS_ENABLE_ASSERTS == 1) || (IOT_MQTT_ENABLE_ASSERTS == 1) || (IOT_TASKPOOL_ENABLE_ASSERTS == 1) || (AWS_IOT_SHADOW_ENABLE_ASSERTS == 1) || (AWS_IOT_DEFENDER_ENABLE_ASSERTS == 1) || (AWS_IOT_JOBS_ENABLE_ASSERTS == 1)
-#define Iot_DefaultAssert assert
+#if (IOT_CONTAINERS_ENABLE_ASSERTS == 1) || (IOT_MQTT_ENABLE_ASSERTS == 1) || (IOT_TASKPOOL_ENABLE_ASSERTS == 1) || \
+ (AWS_IOT_SHADOW_ENABLE_ASSERTS == 1) || (AWS_IOT_DEFENDER_ENABLE_ASSERTS == 1) || (AWS_IOT_JOBS_ENABLE_ASSERTS == 1)
+#define Iot_DefaultAssert assert
#else
#define Iot_DefaultAssert
#endif
/**
- * @brief Memory allocation. This function should have the same signature as [malloc](http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html)
+ * @brief Memory allocation. This function should have the same signature as
+ * [malloc](http://pubs.opengroup.org/onlinepubs/9699919799/functions/malloc.html)
*/
-#define Iot_DefaultMalloc malloc
+#define Iot_DefaultMalloc malloc
/**
- * @brief Free memory. This function should have the same signature as [free](http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html)
+ * @brief Free memory. This function should have the same signature as
+ * [free](http://pubs.opengroup.org/onlinepubs/9699919799/functions/free.html)
*/
-#define Iot_DefaultFree free
+#define Iot_DefaultFree free
/**
* \cond
@@ -124,15 +128,15 @@
* Refer aws-iot-device-sdk-embedded-C/libraries/standard/common/include/iot_logging.h
* for supported log levels.
*/
-#define IOT_LOG_LEVEL_GLOBAL IOT_LOG_ERROR
-#define IOT_LOG_LEVEL_DEMO IOT_LOG_ERROR
-#define IOT_LOG_LEVEL_PLATFORM IOT_LOG_ERROR
-#define IOT_LOG_LEVEL_NETWORK IOT_LOG_ERROR
-#define IOT_LOG_LEVEL_TASKPOOL IOT_LOG_ERROR
-#define IOT_LOG_LEVEL_MQTT IOT_LOG_ERROR
-#define AWS_IOT_LOG_LEVEL_SHADOW IOT_LOG_ERROR
-#define AWS_IOT_LOG_LEVEL_DEFENDER IOT_LOG_ERROR
-#define AWS_IOT_LOG_LEVEL_JOBS IOT_LOG_ERROR
+#define IOT_LOG_LEVEL_GLOBAL IOT_LOG_ERROR
+#define IOT_LOG_LEVEL_DEMO IOT_LOG_ERROR
+#define IOT_LOG_LEVEL_PLATFORM IOT_LOG_ERROR
+#define IOT_LOG_LEVEL_NETWORK IOT_LOG_ERROR
+#define IOT_LOG_LEVEL_TASKPOOL IOT_LOG_ERROR
+#define IOT_LOG_LEVEL_MQTT IOT_LOG_ERROR
+#define AWS_IOT_LOG_LEVEL_SHADOW IOT_LOG_ERROR
+#define AWS_IOT_LOG_LEVEL_DEFENDER IOT_LOG_ERROR
+#define AWS_IOT_LOG_LEVEL_JOBS IOT_LOG_ERROR
/**
* \endcond
*/
diff --git a/third_party/p6/repo/configs/mbedtls_user_config.h b/third_party/p6/repo/configs/mbedtls_user_config.h
index fef18fc19135f2..59fd91eb79a638 100644
--- a/third_party/p6/repo/configs/mbedtls_user_config.h
+++ b/third_party/p6/repo/configs/mbedtls_user_config.h
@@ -29,7 +29,6 @@
#ifndef MBEDTLS_USER_CONFIG_HEADER
#define MBEDTLS_USER_CONFIG_HEADER
-
/**
* \def MBEDTLS_HAVE_TIME_DATE
*
@@ -51,7 +50,6 @@
*/
#undef MBEDTLS_HAVE_TIME_DATE
-
/**
* \def MBEDTLS_PLATFORM_EXIT_ALT
*
@@ -139,7 +137,6 @@
*/
#undef MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
-
/**
* \def MBEDTLS_PK_PARSE_EC_EXTENDED
*
@@ -154,10 +151,8 @@
*/
#undef MBEDTLS_PK_PARSE_EC_EXTENDED
-
#undef MBEDTLS_FS_IO
-
/**
* \def MBEDTLS_NO_PLATFORM_ENTROPY
*
@@ -376,7 +371,6 @@
*/
#undef MBEDTLS_SSL_EXPORT_KEYS
-
/**
* \def MBEDTLS_SSL_TRUNCATED_HMAC
*
@@ -711,9 +705,9 @@
#undef MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
/**
- * Allow SHA-1 in the default TLS configuration for certificate signing if
+ * Allow SHA-1 in the default TLS configuration for certificate signing if
* enabled in the application Makefile.
- *
+ *
* Without this build-time option, SHA-1 support must be activated explicitly
* through mbedtls_ssl_conf_cert_profile. Turning on this option is not
* recommended because of it is possible to generate SHA-1 collisions, however
@@ -725,7 +719,7 @@
*
*/
#ifdef CY_MQTT_ENABLE_SECURE_TEST_MOSQUITTO_SUPPORT
- #define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
+#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_CERTIFICATES
#endif
#endif /* MBEDTLS_USER_CONFIG_HEADER */
diff --git a/third_party/p6/repo/configs/mqtt_client_config.h b/third_party/p6/repo/configs/mqtt_client_config.h
index 7ba863a9e14aa2..1ffcd7c376abc9 100644
--- a/third_party/p6/repo/configs/mqtt_client_config.h
+++ b/third_party/p6/repo/configs/mqtt_client_config.h
@@ -1,42 +1,42 @@
/******************************************************************************
-* File Name: mqtt_client_config.h
-*
-* Description: This file contains all the configuration macros used by the
-* MQTT client in this example.
-*
-* Related Document: See README.md
-*
-*******************************************************************************
-* (c) 2020-2021, Cypress Semiconductor Corporation. All rights reserved.
-*******************************************************************************
-* This software, including source code, documentation and related materials
-* ("Software"), is owned by Cypress Semiconductor Corporation or one of its
-* subsidiaries ("Cypress") and is protected by and subject to worldwide patent
-* protection (United States and foreign), United States copyright laws and
-* international treaty provisions. Therefore, you may use this Software only
-* as provided in the license agreement accompanying the software package from
-* which you obtained this Software ("EULA").
-*
-* If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
-* non-transferable license to copy, modify, and compile the Software source
-* code solely for use in connection with Cypress's integrated circuit products.
-* Any reproduction, modification, translation, compilation, or representation
-* of this Software except as specified above is prohibited without the express
-* written permission of Cypress.
-*
-* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
-* reserves the right to make changes to the Software without notice. Cypress
-* does not assume any liability arising out of the application or use of the
-* Software or any product or circuit described in the Software. Cypress does
-* not authorize its products for use in any products where a malfunction or
-* failure of the Cypress product may reasonably be expected to result in
-* significant property damage, injury or death ("High Risk Product"). By
-* including Cypress's product in a High Risk Product, the manufacturer of such
-* system or application assumes all risk of such use and in doing so agrees to
-* indemnify Cypress against all liability.
-*******************************************************************************/
+ * File Name: mqtt_client_config.h
+ *
+ * Description: This file contains all the configuration macros used by the
+ * MQTT client in this example.
+ *
+ * Related Document: See README.md
+ *
+ *******************************************************************************
+ * (c) 2020-2021, Cypress Semiconductor Corporation. All rights reserved.
+ *******************************************************************************
+ * This software, including source code, documentation and related materials
+ * ("Software"), is owned by Cypress Semiconductor Corporation or one of its
+ * subsidiaries ("Cypress") and is protected by and subject to worldwide patent
+ * protection (United States and foreign), United States copyright laws and
+ * international treaty provisions. Therefore, you may use this Software only
+ * as provided in the license agreement accompanying the software package from
+ * which you obtained this Software ("EULA").
+ *
+ * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+ * non-transferable license to copy, modify, and compile the Software source
+ * code solely for use in connection with Cypress's integrated circuit products.
+ * Any reproduction, modification, translation, compilation, or representation
+ * of this Software except as specified above is prohibited without the express
+ * written permission of Cypress.
+ *
+ * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+ * reserves the right to make changes to the Software without notice. Cypress
+ * does not assume any liability arising out of the application or use of the
+ * Software or any product or circuit described in the Software. Cypress does
+ * not authorize its products for use in any products where a malfunction or
+ * failure of the Cypress product may reasonably be expected to result in
+ * significant property damage, injury or death ("High Risk Product"). By
+ * including Cypress's product in a High Risk Product, the manufacturer of such
+ * system or application assumes all risk of such use and in doing so agrees to
+ * indemnify Cypress against all liability.
+ *******************************************************************************/
#ifndef MQTT_CLIENT_CONFIG_H_
#define MQTT_CLIENT_CONFIG_H_
@@ -44,117 +44,117 @@
#include "iot_mqtt.h"
/*******************************************************************************
-* Macros
-********************************************************************************/
+ * Macros
+ ********************************************************************************/
/* MQTT Broker/Server address and port used for the MQTT connection. */
-#define MQTT_BROKER_ADDRESS "MY_AWS_IOT_ENDPOINT_ADDRESS"
-#define MQTT_PORT 8883
+#define MQTT_BROKER_ADDRESS "MY_AWS_IOT_ENDPOINT_ADDRESS"
+#define MQTT_PORT 8883
-/* Set this macro to 1 if the MQTT Broker being used is hosted by AWS IoT
+/* Set this macro to 1 if the MQTT Broker being used is hosted by AWS IoT
* Core service, else 0.
*/
-#define AWS_IOT_MQTT_MODE ( 1 )
+#define AWS_IOT_MQTT_MODE (1)
-/* Set this macro to 1 if a secure (TLS) connection to the MQTT Broker is
+/* Set this macro to 1 if a secure (TLS) connection to the MQTT Broker is
* required to be established, else 0.
*/
-#define MQTT_SECURE_CONNECTION ( 1 )
+#define MQTT_SECURE_CONNECTION (1)
-/* The MQTT topic on which the LED control messages will be published and
+/* The MQTT topic on which the LED control messages will be published and
* subscribed.
*/
-#define MQTT_TOPIC "ledstatus"
+#define MQTT_TOPIC "ledstatus"
-/* Configuration for the 'Last Will and Testament (LWT)'. It is an MQTT message
- * that will be published by the MQTT broker if the MQTT connection is
- * unexpectedly closed. This configuration is sent to the MQTT broker during
- * MQTT connect operation and the MQTT broker will publish the Will message on
+/* Configuration for the 'Last Will and Testament (LWT)'. It is an MQTT message
+ * that will be published by the MQTT broker if the MQTT connection is
+ * unexpectedly closed. This configuration is sent to the MQTT broker during
+ * MQTT connect operation and the MQTT broker will publish the Will message on
* the Will topic when it recognizes an unexpected disconnection from the client.
- *
+ *
* If you want to use the last will message, set this macro to 1, else 0.
*/
-#define ENABLE_LWT_MESSAGE ( 0 )
+#define ENABLE_LWT_MESSAGE (0)
#if ENABLE_LWT_MESSAGE
- #define MQTT_WILL_TOPIC_NAME MQTT_TOPIC "/will"
- #define MQTT_WILL_MESSAGE ("MQTT client unexpectedly disconnected!")
+#define MQTT_WILL_TOPIC_NAME MQTT_TOPIC "/will"
+#define MQTT_WILL_MESSAGE ("MQTT client unexpectedly disconnected!")
#endif
/* Set the QoS that is associated with the MQTT publish, and subscribe messages.
- * Valid choices are 0, and 1. The MQTT library currently does not support
+ * Valid choices are 0, and 1. The MQTT library currently does not support
* QoS 2, and hence should not be used in this macro.
*/
-#define MQTT_MESSAGES_QOS ( 1 )
+#define MQTT_MESSAGES_QOS (1)
/* Configure the user credentials to be sent as part of MQTT CONNECT packet */
-#define MQTT_USERNAME "User"
-#define MQTT_PASSWORD ""
+#define MQTT_USERNAME "User"
+#define MQTT_PASSWORD ""
/* The timeout in milliseconds for MQTT operations in this example. */
-#define MQTT_TIMEOUT_MS ( 5000 )
+#define MQTT_TIMEOUT_MS (5000)
/* The keep-alive interval in seconds used for MQTT ping request. */
-#define MQTT_KEEP_ALIVE_SECONDS ( 60 )
+#define MQTT_KEEP_ALIVE_SECONDS (60)
/* A unique client identifier to be used for every MQTT connection. */
-#define MQTT_CLIENT_IDENTIFIER "psoc6-mqtt-client"
+#define MQTT_CLIENT_IDENTIFIER "psoc6-mqtt-client"
-/* Every active MQTT connection must have a unique client identifier. If you
- * are using the above 'MQTT_CLIENT_IDENTIFIER' as client ID for multiple MQTT
+/* Every active MQTT connection must have a unique client identifier. If you
+ * are using the above 'MQTT_CLIENT_IDENTIFIER' as client ID for multiple MQTT
* connections simultaneously, set this macro to 1. The device will then
- * generate a unique client identifier by appending a timestamp to the
+ * generate a unique client identifier by appending a timestamp to the
* 'MQTT_CLIENT_IDENTIFIER' string. Example: 'psoc6-mqtt-client5927'
*/
-#define GENERATE_UNIQUE_CLIENT_ID ( 1 )
+#define GENERATE_UNIQUE_CLIENT_ID (1)
/* The longest client identifier that an MQTT server must accept (as defined
* by the MQTT 3.1.1 spec) is 23 characters. Add 1 to include the length of the
* NULL terminator.
*/
-#define MQTT_CLIENT_IDENTIFIER_MAX_LEN ( 24 )
+#define MQTT_CLIENT_IDENTIFIER_MAX_LEN (24)
/* MQTT messages which are published and subscribed on the MQTT_TOPIC that
* controls the device (user LED in this example) state.
*/
-#define MQTT_DEVICE_ON_MESSAGE "TURN ON"
-#define MQTT_DEVICE_OFF_MESSAGE "TURN OFF"
+#define MQTT_DEVICE_ON_MESSAGE "TURN ON"
+#define MQTT_DEVICE_OFF_MESSAGE "TURN OFF"
-/* As per Internet Assigned Numbers Authority (IANA) the port numbers assigned
+/* As per Internet Assigned Numbers Authority (IANA) the port numbers assigned
* for MQTT protocol are 1883 for non-secure connections and 8883 for secure
* connections. In some cases there is a need to use other ports for MQTT like
- * port 443 (which is reserved for HTTPS). Application Layer Protocol
- * Negotiation (ALPN) is an extension to TLS that allows many protocols to be
- * used over a secure connection. The ALPN ProtocolNameList specifies the
+ * port 443 (which is reserved for HTTPS). Application Layer Protocol
+ * Negotiation (ALPN) is an extension to TLS that allows many protocols to be
+ * used over a secure connection. The ALPN ProtocolNameList specifies the
* protocols that the client would like to use to communicate over TLS.
- *
+ *
* This macro specifies the ALPN Protocol Name to be used that is supported
* by the MQTT broker in use.
- * Note: For AWS IoT, currently "x-amzn-mqtt-ca" is the only supported ALPN
+ * Note: For AWS IoT, currently "x-amzn-mqtt-ca" is the only supported ALPN
* ProtocolName and it is only supported on port 443.
*/
-#define MQTT_ALPN_PROTOCOL_NAME "x-amzn-mqtt-ca"
+#define MQTT_ALPN_PROTOCOL_NAME "x-amzn-mqtt-ca"
/* Configure the below credentials in case of a secure MQTT connection. */
/* PEM-encoded client certificate */
-#define CLIENT_CERTIFICATE \
-"-----BEGIN CERTIFICATE-----\n" \
-"........base64 data........\n" \
-"-----END CERTIFICATE-----"
+#define CLIENT_CERTIFICATE \
+ "-----BEGIN CERTIFICATE-----\n" \
+ "........base64 data........\n" \
+ "-----END CERTIFICATE-----"
/* PEM-encoded client private key */
-#define CLIENT_PRIVATE_KEY \
-"-----BEGIN RSA PRIVATE KEY-----\n" \
-"..........base64 data..........\n" \
-"-----END RSA PRIVATE KEY-----"
+#define CLIENT_PRIVATE_KEY \
+ "-----BEGIN RSA PRIVATE KEY-----\n" \
+ "..........base64 data..........\n" \
+ "-----END RSA PRIVATE KEY-----"
/* PEM-encoded Root CA certificate */
-#define ROOT_CA_CERTIFICATE \
-"-----BEGIN CERTIFICATE-----\n" \
-"........base64 data........\n" \
-"-----END CERTIFICATE-----"
+#define ROOT_CA_CERTIFICATE \
+ "-----BEGIN CERTIFICATE-----\n" \
+ "........base64 data........\n" \
+ "-----END CERTIFICATE-----"
/******************************************************************************
-* Global Variables
-*******************************************************************************/
+ * Global Variables
+ *******************************************************************************/
extern IotMqttNetworkInfo_t networkInfo;
extern IotMqttConnectInfo_t connectionInfo;
diff --git a/third_party/p6/repo/configs/wifi_config.h b/third_party/p6/repo/configs/wifi_config.h
index cebe3252b5a97d..332e430e4c793f 100644
--- a/third_party/p6/repo/configs/wifi_config.h
+++ b/third_party/p6/repo/configs/wifi_config.h
@@ -1,42 +1,42 @@
/******************************************************************************
-* File Name: wifi_config.h
-*
-* Description: This file contains the configuration macros required for the
-* Wi-Fi connection.
-*
-* Related Document: See README.md
-*
-*******************************************************************************
-* (c) 2020-2021, Cypress Semiconductor Corporation. All rights reserved.
-*******************************************************************************
-* This software, including source code, documentation and related materials
-* ("Software"), is owned by Cypress Semiconductor Corporation or one of its
-* subsidiaries ("Cypress") and is protected by and subject to worldwide patent
-* protection (United States and foreign), United States copyright laws and
-* international treaty provisions. Therefore, you may use this Software only
-* as provided in the license agreement accompanying the software package from
-* which you obtained this Software ("EULA").
-*
-* If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
-* non-transferable license to copy, modify, and compile the Software source
-* code solely for use in connection with Cypress's integrated circuit products.
-* Any reproduction, modification, translation, compilation, or representation
-* of this Software except as specified above is prohibited without the express
-* written permission of Cypress.
-*
-* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
-* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
-* reserves the right to make changes to the Software without notice. Cypress
-* does not assume any liability arising out of the application or use of the
-* Software or any product or circuit described in the Software. Cypress does
-* not authorize its products for use in any products where a malfunction or
-* failure of the Cypress product may reasonably be expected to result in
-* significant property damage, injury or death ("High Risk Product"). By
-* including Cypress's product in a High Risk Product, the manufacturer of such
-* system or application assumes all risk of such use and in doing so agrees to
-* indemnify Cypress against all liability.
-*******************************************************************************/
+ * File Name: wifi_config.h
+ *
+ * Description: This file contains the configuration macros required for the
+ * Wi-Fi connection.
+ *
+ * Related Document: See README.md
+ *
+ *******************************************************************************
+ * (c) 2020-2021, Cypress Semiconductor Corporation. All rights reserved.
+ *******************************************************************************
+ * This software, including source code, documentation and related materials
+ * ("Software"), is owned by Cypress Semiconductor Corporation or one of its
+ * subsidiaries ("Cypress") and is protected by and subject to worldwide patent
+ * protection (United States and foreign), United States copyright laws and
+ * international treaty provisions. Therefore, you may use this Software only
+ * as provided in the license agreement accompanying the software package from
+ * which you obtained this Software ("EULA").
+ *
+ * If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
+ * non-transferable license to copy, modify, and compile the Software source
+ * code solely for use in connection with Cypress's integrated circuit products.
+ * Any reproduction, modification, translation, compilation, or representation
+ * of this Software except as specified above is prohibited without the express
+ * written permission of Cypress.
+ *
+ * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
+ * reserves the right to make changes to the Software without notice. Cypress
+ * does not assume any liability arising out of the application or use of the
+ * Software or any product or circuit described in the Software. Cypress does
+ * not authorize its products for use in any products where a malfunction or
+ * failure of the Cypress product may reasonably be expected to result in
+ * significant property damage, injury or death ("High Risk Product"). By
+ * including Cypress's product in a High Risk Product, the manufacturer of such
+ * system or application assumes all risk of such use and in doing so agrees to
+ * indemnify Cypress against all liability.
+ *******************************************************************************/
#ifndef WIFI_CONFIG_H_
#define WIFI_CONFIG_H_
@@ -44,23 +44,23 @@
#include "cy_wcm.h"
/*******************************************************************************
-* Macros
-********************************************************************************/
+ * Macros
+ ********************************************************************************/
/* SSID of the Wi-Fi Access Point to which the MQTT client connects. */
-#define WIFI_SSID "MY_WIFI_SSID"
+#define WIFI_SSID "MY_WIFI_SSID"
/* Passkey of the above mentioned Wi-Fi SSID. */
-#define WIFI_PASSWORD "MY_WIFI_PASSWORD"
+#define WIFI_PASSWORD "MY_WIFI_PASSWORD"
/* Security type of the Wi-Fi access point. See 'cy_wcm_security_t' structure
* in "cy_wcm.h" for more details.
*/
-#define WIFI_SECURITY CY_WCM_SECURITY_WPA2_AES_PSK
+#define WIFI_SECURITY CY_WCM_SECURITY_WPA2_AES_PSK
/* Maximum Wi-Fi re-connection limit. */
-#define MAX_WIFI_CONN_RETRIES (10u)
+#define MAX_WIFI_CONN_RETRIES (10u)
/* Wi-Fi re-connection time interval in milliseconds. */
-#define WIFI_CONN_RETRY_INTERVAL_MS (2000)
+#define WIFI_CONN_RETRY_INTERVAL_MS (2000)
#endif /* WIFI_CONFIG_H_ */