Skip to content

Commit

Permalink
Merge branch 'master' into updateUI
Browse files Browse the repository at this point in the history
  • Loading branch information
jeonghwan7 authored Feb 6, 2023
2 parents f8ff17c + 238d606 commit 6290040
Show file tree
Hide file tree
Showing 109 changed files with 1,116 additions and 430 deletions.
2 changes: 1 addition & 1 deletion .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ labelPRBasedOnFilePath:
- src/darwin/*

efr32:
- src/platform/EFR32/*
- src/platform/efr32/*

esp32:
- src/platform/ESP32/*
Expand Down
4 changes: 2 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ darwin:
- examples/darwin-framework-tool/**/*

efr32:
- src/platform/EFR32/*
- src/platform/EFR32/**/*
- src/platform/efr32/*
- src/platform/efr32/**/*

esp32:
- src/platform/ESP32/*
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,30 @@ jobs:
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
--bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
"
- name: Run Tests using chip-repl
- name: Run Tests using chip-repl (skip slow)
timeout-minutes: 45
if: github.event_name == 'pull_request'
run: |
./scripts/run_in_build_env.sh \
"./scripts/tests/run_test_suite.py \
--run-yamltests-with-chip-repl \
--exclude-tags MANUAL \
--exclude-tags FLAKY \
--exclude-tags IN_DEVELOPMENT \
--exclude-tags SLOW \
run \
--iterations 1 \
--test-timeout-seconds 120 \
--all-clusters-app ./out/linux-x64-all-clusters-${BUILD_VARIANT}/chip-all-clusters-app \
--lock-app ./out/linux-x64-lock-${BUILD_VARIANT}/chip-lock-app \
--ota-provider-app ./out/linux-x64-ota-provider-${BUILD_VARIANT}/chip-ota-provider-app \
--ota-requestor-app ./out/linux-x64-ota-requestor-${BUILD_VARIANT}/chip-ota-requestor-app \
--tv-app ./out/linux-x64-tv-app-${BUILD_VARIANT}/chip-tv-app \
--bridge-app ./out/linux-x64-bridge-${BUILD_VARIANT}/chip-bridge-app \
"
- name: Run Tests using chip-repl (including slow)
timeout-minutes: 45
if: github.event_name == 'push'
run: |
./scripts/run_in_build_env.sh \
"./scripts/tests/run_test_suite.py \
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/esp32/build_app_and_commission.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ $ out/debug/chip-tool pairing ble-wifi 12345 MY_SSID MY_PASSWORD 20202021 3840
#### Commissioning the Ethernet device (ESP32-Ethernet-Kit)
```
$ out/debug/chip-tool pairing ethernet 12345 20202021 3840 device-remote-ip 5540
$ out/debug/chip-tool pairing onnetwork 12345 20202021
```
Note: In order to commission an ethernet device, from all-clusters-app enable
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ efr32_sdk("sdk") {
]

include_dirs = [
"${chip_root}/src/platform/silabs/EFR32",
"${chip_root}/src/platform/silabs/efr32",
"${efr32_project_dir}/include",
"${examples_plat_dir}",
"${chip_root}/src/lib",
Expand Down
2 changes: 1 addition & 1 deletion examples/chef/efr32/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import("//build_overrides/chip.gni")
import("${chip_root}/config/standalone/args.gni")
import("${chip_root}/src/platform/EFR32/args.gni")
import("${chip_root}/src/platform/efr32/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")

Expand Down
2 changes: 1 addition & 1 deletion examples/chef/efr32/build_for_wifi_args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ import("//build_overrides/chip.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/EFR32/wifi_args.gni")
import("${chip_root}/src/platform/efr32/wifi_args.gni")

chip_enable_ota_requestor = true
30 changes: 24 additions & 6 deletions examples/chip-tool/commands/common/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,27 @@ constexpr const char * kJsonCommandKey = "command";
constexpr const char * kJsonCommandSpecifierKey = "command_specifier";
constexpr const char * kJsonArgumentsKey = "arguments";

std::vector<std::string> GetArgumentsFromJson(Command * command, Json::Value & value, bool optional)
bool GetArgumentsFromJson(Command * command, Json::Value & value, bool optional, std::vector<std::string> & outArgs)
{
auto memberNames = value.getMemberNames();

std::vector<std::string> args;
for (size_t i = 0; i < command->GetArgumentsCount(); i++)
{
auto argName = command->GetArgumentName(i);
for (auto const & memberName : value.getMemberNames())
auto argName = command->GetArgumentName(i);
auto memberNamesIterator = memberNames.begin();
while (memberNamesIterator != memberNames.end())
{
auto memberName = *memberNamesIterator;
if (strcasecmp(argName, memberName.c_str()) != 0)
{
memberNamesIterator++;
continue;
}

if (command->GetArgumentIsOptional(i) != optional)
{
memberNamesIterator = memberNames.erase(memberNamesIterator);
continue;
}

Expand All @@ -66,10 +72,20 @@ std::vector<std::string> GetArgumentsFromJson(Command * command, Json::Value & v

auto argValue = value[memberName].asString();
args.push_back(std::move(argValue));
memberNamesIterator = memberNames.erase(memberNamesIterator);
break;
}
}
return args;

if (memberNames.size())
{
auto memberName = memberNames.front();
ChipLogError(chipTool, "The argument \"\%s\" is not supported.", memberName.c_str());
return false;
}

outArgs = args;
return true;
};

// Check for arguments with a starting '"' but no ending '"': those
Expand Down Expand Up @@ -542,8 +558,10 @@ bool Commands::DecodeArgumentsFromBase64EncodedJson(const char * json, std::vect
VerifyOrReturnValue(parsedArguments, false, ChipLogError(chipTool, "Error while parsing json."));
VerifyOrReturnValue(jsonArguments.isObject(), false, ChipLogError(chipTool, "Unexpected json type, expects and object."));

auto mandatoryArguments = GetArgumentsFromJson(command, jsonArguments, false /* addOptional */);
auto optionalArguments = GetArgumentsFromJson(command, jsonArguments, true /* addOptional */);
std::vector<std::string> mandatoryArguments;
std::vector<std::string> optionalArguments;
VerifyOrReturnValue(GetArgumentsFromJson(command, jsonArguments, false /* addOptional */, mandatoryArguments), false);
VerifyOrReturnValue(GetArgumentsFromJson(command, jsonArguments, true /* addOptional */, optionalArguments), false);

args.push_back(std::move(clusterName));
args.push_back(std::move(commandName));
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ efr32_executable("light_switch_app") {
]

if (use_wstk_leds) {
#sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || enable_openthread_cli ||
Expand Down
51 changes: 6 additions & 45 deletions examples/light-switch-app/silabs/SiWx917/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,49 +38,10 @@
/**********************************************************
* Defines
*********************************************************/

#define SL_SIMPLE_BUTTON_MODE_POLL 0U ///< BUTTON input capture using polling
#define SL_SIMPLE_BUTTON_MODE_POLL_AND_DEBOUNCE 1U ///< BUTTON input capture using polling and debouncing
#define SL_SIMPLE_BUTTON_MODE_INTERRUPT 2U ///< BUTTON input capture using interrupt

#define SL_SIMPLE_BUTTON_DISABLED 2U ///< BUTTON state is disabled
#define SL_SIMPLE_BUTTON_PRESSED 1U ///< BUTTON state is pressed
#define SL_SIMPLE_BUTTON_RELEASED 0U ///< BUTTON state is released

typedef uint8_t sl_button_mode_t; ///< BUTTON mode
typedef uint8_t sl_button_state_t; ///< BUTTON state
typedef struct sl_button sl_button_t;

/// A BUTTON instance
typedef struct sl_button
{
void * context; ///< The context for this BUTTON instance
void (*init)(const sl_button_t * handle); ///< Member function to initialize BUTTON instance
void (*poll)(const sl_button_t * handle); ///< Member function to poll BUTTON
void (*enable)(const sl_button_t * handle); ///< Member function to enable BUTTON
void (*disable)(const sl_button_t * handle); ///< Member function to disable BUTTON
sl_button_state_t (*get_state)(const sl_button_t * handle); ///< Member function to retrieve BUTTON state
} sl_button;

const sl_button_t sl_button_btn0 = {
.context = NULL,
.init = NULL,
.poll = NULL,
.enable = NULL,
.disable = NULL,
.get_state = NULL,
};
#define APP_FUNCTION_BUTTON &sl_button_btn0

const sl_button_t sl_button_btn1 = {
.context = NULL,
.init = NULL,
.poll = NULL,
.enable = NULL,
.disable = NULL,
.get_state = NULL,
};
#define APP_LIGHT_SWITCH &sl_button_btn1
// Button specific defines for SiWx917
#define SL_SIMPLE_BUTTON_PRESSED 1U
#define SIWx917_BTN0 0
#define SIWx917_BTN1 1

// Application-defined error codes in the CHIP_ERROR space.
#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01)
Expand Down Expand Up @@ -115,11 +76,11 @@ class AppTask : public BaseApplication
* @brief Event handler when a button is pressed
* Function posts an event for button processing
*
* @param buttonHandle APP_LIGHT_SWITCH or APP_FUNCTION_BUTTON
* @param button - btn0 or btn1
* @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED,
* SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED
*/
void ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction);
void ButtonEventHandler(uint8_t button, uint8_t btnAction);

/**
* @brief Callback called by the identify-server when an identify command is received
Expand Down
20 changes: 11 additions & 9 deletions examples/light-switch-app/silabs/SiWx917/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@

#define SYSTEM_STATE_LED &sl_led_led0

#define APP_FUNCTION_BUTTON &sl_button_btn0
#define APP_LIGHT_SWITCH &sl_button_btn1

namespace {

constexpr chip::EndpointId kLightSwitchEndpoint = 1;
Expand Down Expand Up @@ -258,14 +255,19 @@ void AppTask::SwitchActionEventHandler(AppEvent * aEvent)
}
}

void AppTask::ButtonEventHandler(const sl_button_t * buttonHandle, uint8_t btnAction)
void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction)
{
VerifyOrReturn(buttonHandle != NULL);

AppEvent button_event = {};
button_event.Type = AppEvent::kEventType_Button;
button_event.ButtonEvent.Action = btnAction;

button_event.Handler = SwitchActionEventHandler;
sAppTask.PostEvent(&button_event);
if (button == SIWx917_BTN1)
{
button_event.Handler = SwitchActionEventHandler;
sAppTask.PostEvent(&button_event);
}
else if (button == SIWx917_BTN0)
{
button_event.Handler = BaseApplication::ButtonHandler;
sAppTask.PostEvent(&button_event);
}
}
6 changes: 3 additions & 3 deletions examples/light-switch-app/silabs/SiWx917/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#define BLE_DEV_NAME "SiLabs-Light-Switch"

extern "C" void sl_button_on_change();
extern "C" void sl_button_on_change(uint8_t btn, uint8_t btnAction);

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down Expand Up @@ -81,7 +81,7 @@ int main(void)
appError(CHIP_ERROR_INTERNAL);
}

void sl_button_on_change()
void sl_button_on_change(uint8_t btn, uint8_t btnAction)
{
AppTask::GetAppTask().ButtonEventHandler(APP_LIGHT_SWITCH, SL_SIMPLE_BUTTON_PRESSED);
AppTask::GetAppTask().ButtonEventHandler(btn, btnAction);
}
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ efr32_sdk("sdk") {

include_dirs = [
"${chip_root}/examples/light-switch-app/silabs/common",
"${chip_root}/src/platform/silabs/EFR32",
"${chip_root}/src/platform/silabs/efr32",
"${efr32_project_dir}/include",
"${examples_plat_dir}",
"${chip_root}/src/lib",
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/silabs/efr32/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import("//build_overrides/chip.gni")
import("${chip_root}/config/standalone/args.gni")
import("${chip_root}/src/platform/silabs/EFR32/args.gni")
import("${chip_root}/src/platform/silabs/efr32/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import("${chip_root}/config/standalone/args.gni")

efr32_sdk_target = get_label_info(":sdk", "label_no_toolchain")
chip_enable_openthread = false
import("${chip_root}/src/platform/silabs/EFR32/wifi_args.gni")
import("${chip_root}/src/platform/silabs/efr32/wifi_args.gni")

chip_enable_ota_requestor = true
app_data_model = "${chip_root}/examples/light-switch-app/light-switch-common"
3 changes: 1 addition & 2 deletions examples/lighting-app/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ efr32_executable("lighting_app") {
]

if (use_wstk_leds) {
# TODO: Commentting for CCP till the bring up of this is done
#sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
sources += [ "${examples_plat_dir}/LEDWidget.cpp" ]
}

if (chip_enable_pw_rpc || chip_build_libshell || use_rs911x) {
Expand Down
14 changes: 14 additions & 0 deletions examples/lighting-app/silabs/SiWx917/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
/**********************************************************
* Defines
*********************************************************/
// Button specific defines for SiWx917
#define SL_SIMPLE_BUTTON_PRESSED 1
#define SIWx917_BTN0 0
#define SIWx917_BTN1 1

// Application-defined error codes in the CHIP_ERROR space.
#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01)
Expand Down Expand Up @@ -69,6 +73,16 @@ class AppTask : public BaseApplication

CHIP_ERROR StartAppTask();

/**
* @brief Event handler when a button is pressed
* Function posts an event for button processing
*
* @param button - btn0 or btn1
* @param btnAction button action - SL_SIMPLE_BUTTON_PRESSED,
* SL_SIMPLE_BUTTON_RELEASED or SL_SIMPLE_BUTTON_DISABLED
*/
void ButtonEventHandler(uint8_t button, uint8_t btnAction);

/**
* @brief Callback called by the identify-server when an identify command is received
*
Expand Down
Loading

0 comments on commit 6290040

Please sign in to comment.