Skip to content

Commit

Permalink
Merge branch 'master' into 30727-add-evse-to-all_clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesharrow authored Dec 14, 2023
2 parents d1937b7 + 7173769 commit 03043f5
Show file tree
Hide file tree
Showing 149 changed files with 3,005 additions and 2,498 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/examples-openiotsdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
/tmp/bloat_reports/
- name: "Test: shell example"
if: steps.build_shell.outcome == 'success'
if: github.event_name == 'workflow_dispatch' && steps.build_shell.outcome == 'success'
run: |
scripts/run_in_python_env.sh out/venv \
'scripts/examples/openiotsdk_example.sh --no-activate -C test shell'
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
/tmp/bloat_reports/
- name: "Test: tv-app example"
if: steps.build_tv_app.outcome == 'success'
if: github.event_name == 'workflow_dispatch' && steps.build_tv_app.outcome == 'success'
timeout-minutes: 10
run: |
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME up
Expand All @@ -125,7 +125,7 @@ jobs:
/tmp/bloat_reports/
- name: "Test: all-clusters-app example"
if: steps.build_all_clusters_app.outcome == 'success'
if: github.event_name == 'workflow_dispatch' && steps.build_all_clusters_app.outcome == 'success'
timeout-minutes: 5
run: |
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME up
Expand Down Expand Up @@ -161,15 +161,15 @@ jobs:
scripts/examples/gn_build_example.sh examples/ota-provider-app/linux/ out/ota-provider chip_config_network_layer_ble=false
- name: "Test: lock-app example (mbedtls)"
if: steps.build_lock_app_mbedtls.outcome == 'success'
if: github.event_name == 'workflow_dispatch' && steps.build_lock_app_mbedtls.outcome == 'success'
run: |
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME up
scripts/run_in_python_env.sh out/venv \
'scripts/run_in_ns.sh ${TEST_NETWORK_NAME}ns scripts/examples/openiotsdk_example.sh --no-activate -C test -n ${TEST_NETWORK_NAME}tap lock-app'
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME down
- name: "Test: ota-requestor-app example"
if: steps.build_ota_requestor_app.outcome == 'success' && steps.build_ota_provider_app.outcome == 'success'
if: github.event_name == 'workflow_dispatch' && steps.build_ota_requestor_app.outcome == 'success' && steps.build_ota_provider_app.outcome == 'success'
timeout-minutes: 30
run: |
mkdir out/binaries
Expand All @@ -182,7 +182,7 @@ jobs:
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME down
- name: "Test: unit-tests (mbedtls)"
if: steps.build_unit_tests_mbedtls.outcome == 'success'
if: github.event_name == 'workflow_dispatch' && steps.build_unit_tests_mbedtls.outcome == 'success'
run: |
scripts/run_in_python_env.sh out/venv \
'scripts/examples/openiotsdk_example.sh --no-activate -C test unit-tests'
Expand All @@ -199,7 +199,7 @@ jobs:
/tmp/bloat_reports/
- name: "Test: lock-app example (psa)"
if: steps.build_lock_app_psa.outcome == 'success'
if: github.event_name == 'workflow_dispatch' && steps.build_lock_app_psa.outcome == 'success'
run: |
scripts/setup/openiotsdk/network_setup.sh -n $TEST_NETWORK_NAME up
scripts/run_in_python_env.sh out/venv \
Expand All @@ -212,7 +212,7 @@ jobs:
scripts/examples/openiotsdk_example.sh -b psa unit-tests
- name: "Test: unit-tests (psa)"
if: steps.build_unit_tests_psa.outcome == 'success'
if: github.event_name == 'workflow_dispatch' && steps.build_unit_tests_psa.outcome == 'success'
run: |
scripts/run_in_python_env.sh out/venv \
'scripts/examples/openiotsdk_example.sh --no-activate -C test unit-tests'
1 change: 1 addition & 0 deletions config/telink/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ matter_add_gn_arg_bool ("chip_enable_openthread" CONFIG_NET_L2_
matter_add_gn_arg_bool ("chip_openthread_ftd" CONFIG_OPENTHREAD_FTD)
matter_add_gn_arg_bool ("chip_config_network_layer_ble" CONFIG_BT)
matter_add_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_NET_IPV4)
matter_add_gn_arg_bool ("chip_enable_nfc" CONFIG_CHIP_NFC_COMMISSIONING)
matter_add_gn_arg_bool ("chip_enable_ota_requestor" CONFIG_CHIP_OTA_REQUESTOR)
matter_add_gn_arg_bool ("chip_enable_bootloader_mcuboot" CONFIG_BOOTLOADER_MCUBOOT)
matter_add_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS)
Expand Down
13 changes: 13 additions & 0 deletions config/telink/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ config CHIP_APP_LOG_LEVEL
option only within the application. To set the logging level for the
Matter stack, use the MATTER_LOG_LEVEL configuration option.

config CHIP_NFC_COMMISSIONING
bool "Share onboarding payload in NFC tag"
default n
imply I2C
imply ST25DVXXKC
imply NFC
imply NFC_NDEF
imply NFC_NDEF_MSG
imply NFC_NDEF_RECORD
imply NFC_NDEF_URI_REC
imply NFC_NDEF_URI_MSG
help
Enables sharing the onboarding payload in the NFC tag.

# See config/zephyr/Kconfig for full definition
config CHIP_OTA_REQUESTOR
Expand Down
4 changes: 4 additions & 0 deletions config/telink/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ config NVS_LOOKUP_CACHE_SIZE
config SETTINGS_NVS_SECTOR_SIZE_MULT
default 1

# Set sector counter of NVS
config SETTINGS_NVS_SECTOR_COUNT
default 10

# Enable OpenThread

config NET_L2_OPENTHREAD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,13 @@ class PairOnNetworkLongImInvokeCommand(
DiscoveryFilterType.LONG_DISCRIMINATOR
) {
override fun runCommand() {
currentCommissioner()
.pairDevice(
getNodeId(),
getRemoteAddr().address.hostAddress,
MATTER_PORT,
getDiscriminator(),
getSetupPINCode(),
)
currentCommissioner().setCompletionListener(this)
waitCompleteMs(getTimeoutMillis())

runBlocking {
try {
val identifyTime: UShort = 1u
val identifyCluster = IdentifyCluster(controller = currentCommissioner(), endpointId = 0u)

// By running command identify, we are implicitly requesting CASE to be established if it's
// not already present.
identifyCluster.identify(identifyTime)
logger.log(Level.INFO, "Invoke command succeeded")
} catch (ex: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,14 @@ class PairOnNetworkLongImReadCommand(controller: MatterController, credsIssue: C
DiscoveryFilterType.LONG_DISCRIMINATOR
) {
override fun runCommand() {
currentCommissioner()
.pairDevice(
getNodeId(),
getRemoteAddr().address.hostAddress,
MATTER_PORT,
getDiscriminator(),
getSetupPINCode(),
)
currentCommissioner().setCompletionListener(this)
waitCompleteMs(getTimeoutMillis())

runBlocking {
try {
val basicInformationCluster =
BasicInformationCluster(controller = currentCommissioner(), endpointId = DEFAULT_ENDPOINT)
val vendorName = basicInformationCluster.readVendorNameAttribute()

// By running command readVendorIDAttribute, we are implicitly requesting CASE to be
// established if it's not already present.
val vendorId = basicInformationCluster.readVendorIDAttribute()
logger.log(Level.INFO, "Read command succeeded, Verdor Name:${vendorName} (ID:${vendorId})")
} catch (ex: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,13 @@ class PairOnNetworkLongImWriteCommand(
DiscoveryFilterType.LONG_DISCRIMINATOR
) {
override fun runCommand() {
currentCommissioner()
.pairDevice(
getNodeId(),
getRemoteAddr().address.hostAddress,
MATTER_PORT,
getDiscriminator(),
getSetupPINCode(),
)
currentCommissioner().setCompletionListener(this)
waitCompleteMs(getTimeoutMillis())

runBlocking {
try {
val basicInformationCluster =
BasicInformationCluster(controller = currentCommissioner(), endpointId = DEFAULT_ENDPOINT)

// By running command writeNodeLabelAttribute, we are implicitly requesting CASE to be
// established if it's not already present.
basicInformationCluster.writeNodeLabelAttribute("Test Node Label")
logger.log(Level.INFO, "Write command succeeded")

Expand Down
2 changes: 2 additions & 0 deletions examples/lighting-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
# Disable CHIP shell support
CONFIG_CHIP_LIB_SHELL=n

CONFIG_CHIP_NFC_COMMISSIONING=n

# Disable factory data support
CONFIG_CHIP_FACTORY_DATA=n
CONFIG_CHIP_FACTORY_DATA_BUILD=n
Expand Down
4 changes: 2 additions & 2 deletions examples/lit-icd-app/lit-icd-common/lit-icd-server-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1740,8 +1740,8 @@ endpoint 0 {
callback attribute registeredClients;
callback attribute ICDCounter;
callback attribute clientsSupportedPerFabric;
callback attribute userActiveModeTriggerHint;
callback attribute userActiveModeTriggerInstruction;
ram attribute userActiveModeTriggerHint default = 0x110D;
ram attribute userActiveModeTriggerInstruction default = "Restart the application";
callback attribute generatedCommandList;
callback attribute acceptedCommandList;
callback attribute eventList;
Expand Down
8 changes: 4 additions & 4 deletions examples/lit-icd-app/lit-icd-common/lit-icd-server-app.zap
Original file line number Diff line number Diff line change
Expand Up @@ -3494,10 +3494,10 @@
"side": "server",
"type": "UserActiveModeTriggerBitmap",
"included": 1,
"storageOption": "External",
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"defaultValue": "0x110D",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand All @@ -3510,10 +3510,10 @@
"side": "server",
"type": "char_string",
"included": 1,
"storageOption": "External",
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": null,
"defaultValue": "Restart the application",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down
5 changes: 3 additions & 2 deletions examples/lock-app/telink/include/LockSettingsStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <../Zephyr/ZephyrConfig.h>
#include <AppConfig.h>
#include <LockManager.h>

#if LOCK_MANAGER_CONFIG_USE_NVM_CREDENTIAL_STORAGE
namespace chip {
Expand All @@ -28,13 +29,13 @@ class LockSettingsStorage : ZephyrConfig
{
public:
static const ZephyrConfig::Key kConfigKey_LockUser;
static const ZephyrConfig::Key kConfigKey_Credential;
static const ZephyrConfig::Key kConfigKey_LockUserName;
static const ZephyrConfig::Key kConfigKey_CredentialData;
static const ZephyrConfig::Key kConfigKey_UserCredentials;
static const ZephyrConfig::Key kConfigKey_WeekDaySchedules;
static const ZephyrConfig::Key kConfigKey_YearDaySchedules;
static const ZephyrConfig::Key kConfigKey_HolidaySchedules;
static const char * kConfigKey_Credential[kNumCredentialTypes];
static const char * kConfigKey_CredentialData[kNumCredentialTypes];
};
} // namespace Internal
} // namespace DeviceLayer
Expand Down
36 changes: 25 additions & 11 deletions examples/lock-app/telink/src/LockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ bool LockManager::LockAction(int32_t appSource, Action_t aAction, OperationSourc
}
else
{
status = true;
LOG_INF("Lock Action: Lock is already locked. No action performed");
}
break;
Expand Down Expand Up @@ -181,6 +182,7 @@ bool LockManager::LockAction(int32_t appSource, Action_t aAction, OperationSourc
}
else
{
status = true;
LOG_INF("Unlock Action: Lock is already unlocked. no action performed");
}
break;
Expand All @@ -205,6 +207,7 @@ bool LockManager::LockAction(int32_t appSource, Action_t aAction, OperationSourc
}
else
{
status = true;
LOG_INF("Unbolt Action: Lock is already in unbolt state. no action performed");
}
break;
Expand Down Expand Up @@ -244,6 +247,7 @@ bool LockManager::LockAction(int32_t appSource, Action_t aAction, OperationSourc
}
else
{
status = true;
LOG_INF("Lock Action: Lock is already locked. No action performed");
}
break;
Expand Down Expand Up @@ -302,6 +306,7 @@ bool LockManager::LockAction(int32_t appSource, Action_t aAction, OperationSourc
}
else
{
status = true;
LOG_INF("Unlock Action: Lock is already unlocked. no action performed");
}
break;
Expand All @@ -325,6 +330,7 @@ bool LockManager::LockAction(int32_t appSource, Action_t aAction, OperationSourc
}
else
{
status = true;
LOG_INF("Unbolt Action: Lock is already in unbolt state. no action performed");
}
break;
Expand Down Expand Up @@ -426,15 +432,9 @@ bool LockManager::ReadConfigValues()
ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_LockUser, reinterpret_cast<uint8_t *>(&mLockUsers),
sizeof(EmberAfPluginDoorLockUserInfo) * ArraySize(mLockUsers), outLen);

ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_Credential, reinterpret_cast<uint8_t *>(&mLockCredentials),
sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials * kNumCredentialTypes, outLen);

ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_LockUserName, reinterpret_cast<uint8_t *>(mUserNames),
sizeof(mUserNames), outLen);

ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_CredentialData, reinterpret_cast<uint8_t *>(mCredentialData),
sizeof(mCredentialData), outLen);

ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_UserCredentials, reinterpret_cast<uint8_t *>(mCredentials),
sizeof(CredentialStruct) * LockParams.numberOfUsers * LockParams.numberOfCredentialsPerUser,
outLen);
Expand All @@ -453,6 +453,17 @@ bool LockManager::ReadConfigValues()
reinterpret_cast<uint8_t *>(&(mHolidaySchedule)),
sizeof(EmberAfPluginDoorLockHolidaySchedule) * LockParams.numberOfHolidaySchedules, outLen);

for (uint8_t i = 0; i < kNumCredentialTypes; i++)
{
ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_Credential[i],
reinterpret_cast<uint8_t *>(&mLockCredentials[i]),
sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials, outLen);

ZephyrConfig::ReadConfigValueBin(LockSettingsStorage::kConfigKey_CredentialData[i],
reinterpret_cast<uint8_t *>(mCredentialData[i]), kMaxCredentials * kMaxCredentialSize,
outLen);
}

return true;
}
#endif
Expand Down Expand Up @@ -654,16 +665,19 @@ bool LockManager::SetCredential(chip::EndpointId endpointId, uint16_t credential
chip::ByteSpan{ mCredentialData[to_underlying(credentialType)][credentialIndex], credentialData.size() };

#if LOCK_MANAGER_CONFIG_USE_NVM_CREDENTIAL_STORAGE
CHIP_ERROR err;

// Save credential information in NVM flash
CHIP_ERROR err = ZephyrConfig::WriteConfigValueBin(
LockSettingsStorage::kConfigKey_Credential, reinterpret_cast<const uint8_t *>(&mLockCredentials),
sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials * kNumCredentialTypes);
err = ZephyrConfig::WriteConfigValueBin(LockSettingsStorage::kConfigKey_Credential[to_underlying(credentialType)],
reinterpret_cast<const uint8_t *>(&mLockCredentials[to_underlying(credentialType)]),
sizeof(EmberAfPluginDoorLockCredentialInfo) * kMaxCredentials);
if (err != CHIP_NO_ERROR)
ChipLogError(
Zcl, "Failed to write kConfigKey_Credential. User data will be resetted during reboot. Not enough storage space \n");

err = ZephyrConfig::WriteConfigValueBin(LockSettingsStorage::kConfigKey_CredentialData,
reinterpret_cast<const uint8_t *>(&mCredentialData), sizeof(mCredentialData));
err = ZephyrConfig::WriteConfigValueBin(LockSettingsStorage::kConfigKey_CredentialData[to_underlying(credentialType)],
reinterpret_cast<const uint8_t *>(&mCredentialData[to_underlying(credentialType)]),
kMaxCredentials * kMaxCredentialSize);
if (err != CHIP_NO_ERROR)
ChipLogError(
Zcl,
Expand Down
26 changes: 18 additions & 8 deletions examples/lock-app/telink/src/LockSettingsStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,26 @@ namespace Internal {
(key); \
static_assert(sizeof(key) <= SETTINGS_MAX_NAME_LEN, "Config key too long: " key)

#define CONFIG_KEY_CREDENTIAL(type) (NAMESPACE_CONFIG "credential-" type)
#define CONFIG_KEY_CREDENTIAL_DATA(type) (NAMESPACE_CONFIG "credential-" type "-data")

#define NAMESPACE_CONFIG CHIP_DEVICE_CONFIG_SETTINGS_KEY "/cfg/"

const ZephyrConfig::Key LockSettingsStorage::kConfigKey_LockUser = CONFIG_KEY(NAMESPACE_CONFIG "lock-user");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_Credential = CONFIG_KEY(NAMESPACE_CONFIG "credential");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_LockUserName = CONFIG_KEY(NAMESPACE_CONFIG "lock-user-name");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_CredentialData = CONFIG_KEY(NAMESPACE_CONFIG "credential-data");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_UserCredentials = CONFIG_KEY(NAMESPACE_CONFIG "user-credentials");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_WeekDaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "week-day-schedules");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_YearDaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "year-day-schedules");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_HolidaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "holiday-schedules");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_LockUser = CONFIG_KEY(NAMESPACE_CONFIG "lock-user");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_LockUserName = CONFIG_KEY(NAMESPACE_CONFIG "lock-user-name");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_UserCredentials = CONFIG_KEY(NAMESPACE_CONFIG "user-credentials");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_WeekDaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "week-day-schedules");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_YearDaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "year-day-schedules");
const ZephyrConfig::Key LockSettingsStorage::kConfigKey_HolidaySchedules = CONFIG_KEY(NAMESPACE_CONFIG "holiday-schedules");
const char * LockSettingsStorage::kConfigKey_Credential[kNumCredentialTypes] = {
CONFIG_KEY_CREDENTIAL("programming-pin"), CONFIG_KEY_CREDENTIAL("pin"), CONFIG_KEY_CREDENTIAL("rfid"),
CONFIG_KEY_CREDENTIAL("finger-print"), CONFIG_KEY_CREDENTIAL("finger-vein"), CONFIG_KEY_CREDENTIAL("face")
};
const char * LockSettingsStorage::kConfigKey_CredentialData[kNumCredentialTypes] = {
CONFIG_KEY_CREDENTIAL_DATA("programming-pin"), CONFIG_KEY_CREDENTIAL_DATA("pin"), CONFIG_KEY_CREDENTIAL_DATA("rfid"),
CONFIG_KEY_CREDENTIAL_DATA("finger-print"), CONFIG_KEY_CREDENTIAL_DATA("finger-vein"), CONFIG_KEY_CREDENTIAL_DATA("face")
};

} // namespace Internal
} // namespace DeviceLayer
} // namespace chip
Expand Down
Loading

0 comments on commit 03043f5

Please sign in to comment.