Skip to content

importing uic z-wave/main #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 105 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
198c7fc
uic: UIC-3285: remove Z-Wave Portable Controller build support
Luisky Apr 15, 2024
9c2e2b4
uic: zpc: Pull request #2808: UIC-3309: Create ZPC C++ helper & updat…
silabs-borisl Sep 2, 2024
30cc01f
uic: zpc: Pull request #2827: blabbe cherry pick PR
silabs-borisl Sep 24, 2024
cc73e6b
uic: zpc: Pull request #2839: UIC-3490: Fix bug for zwave_command_cla…
Sep 27, 2024
02d0dc5
uic: UIC-3286: Partial revert of 4e0f7861e9f3eada27a36d06c057970bbb12…
Luisky Aug 20, 2024
cfa1b62
uic: zpc: UIC-3286: fix python warnings about regex string
Luisky Apr 15, 2024
832ba24
uic: UIC-3286: fix cargo warning about resolver in workspace
Luisky Jun 19, 2024
cd6072a
uic: UIC-3286: fix rustc unused warning
Luisky Jun 19, 2024
f05d5ab
uic: zpc: UIC-3286: use python3 explicitly because UnifySDK CI doesn'…
Luisky Jul 11, 2024
b2356d5
uic: zpc: Pull request #2853: UIC-3504: Updated Notification CC to su…
su-shanka Oct 7, 2024
dda56d6
uic: zpc: Pull request #2848: UIC-3403: Notification CC Push/Pull Dis…
su-shanka Oct 10, 2024
da19aed
uic: zpc: Pull request #2840: UIC-3181: Use emplace_node instead of a…
silabs-borisl Oct 11, 2024
1894f3f
uic: zpc: UIC-3277:Time Parameters CC
Thirsrin Oct 17, 2024
28bd1d4
libs2: SWPROT-8254: generate libs2 doc outside of CMake
Luisky Feb 7, 2024
c17aa2b
libs2: SWPROT-8720: update testFramework and fix missing semicolon in…
Luisky Mar 4, 2024
018e4ba
libs2: SWPROT-8720: remove test/dependencies/sdk670_headers from libs2
Luisky Mar 4, 2024
a85b7e5
libs2: SWPROT-8487: libs2: Optimize memory footprint by moving ROM ar…
ochavezmiranda Feb 26, 2024
a151fb9
libs2: SWPROT-8732: removed interface subfolder since we don't know w…
Luisky Jan 22, 2024
ee8a490
libs2: SWPROT-8732: remove Keil C51 references in new versions
Luisky Jan 22, 2024
516a650
libs2: SWPROT-8732: removed DEBUG_S2_INCL_FSM define as it's not used…
Luisky Jan 22, 2024
1e0e9ed
libs2: SWPROT-8732: Remove useless MACRO CTX_DEF
anrivoal Feb 2, 2024
1391f14
libs2: SWPROT-8732: Stop Wasting 32 bytes for storing zeroes
anrivoal Mar 7, 2024
05b4d3a
libs2: SWPROT-8732: Modernize CmakeLists.txt
anrivoal Feb 2, 2024
3ccde2f
libs2: SWPROT-8732: Typo on GOT_NONCE_REPORT
anrivoal Feb 21, 2024
54ab696
libs2: SWPROT-8732: renamed s2_default_evt_handler to s2_dummy_evt_ha…
anrivoal Feb 21, 2024
3f3f413
libs2: SWPROT-8732: Removed useless test in S2_application_command_ha…
anrivoal Feb 21, 2024
1b42e0d
libs2: doc: Fix misspelling in README
rzr Jul 18, 2023
091885c
libs2: doc: typo in README
anrivoal Jul 21, 2023
207fb1f
libs2: SWPROT-8732: remove assert and debugprint in libs2
Luisky Apr 3, 2024
9cea9da
libs2: SWPROT-8732: remove key scrambler functions that are only used…
Luisky Apr 3, 2024
62677c7
libs2: SWPROT-8732: remade the CMakeLists.txt to remove series1
Luisky Apr 3, 2024
00077da
libs2: SWPROT-8732: remove the generic subfolder of crypto/curve25519…
Luisky Apr 3, 2024
4b7441a
libs2: SWPROT-8732: removed cross_system_dir as it impedes readability
Luisky Apr 3, 2024
5857add
libs2: SWPROT-8732: Remove bigint in libs2 as bigint_add is only used…
Luisky Apr 5, 2024
2a65d24
libs2: SWPROT-8732: fix open source zw-protocol builds
Luisky Apr 5, 2024
4849823
libs2: SWPROT-8755: removed loosely related debugprint functions in l…
Luisky Apr 8, 2024
092a35a
libs2: SWPROT-8755: remove misc.h as it's never used in libs2
Luisky Apr 8, 2024
e191f64
libs2: SWPROT-8739: Introduce S2_command_handler to handle decrypted …
Thomasdjb Mar 8, 2024
31e2fec
libs2: SWPROT-8739: Move decrypt_return_code_t to S2.h
Thomasdjb Mar 12, 2024
4542c1c
libs2: SWPROT-8739: Move event_data_t and add function prototype
Thomasdjb Mar 12, 2024
fb23683
libs2: SWPROT-8739: Add S2 decrypt and inclusion functions
Thomasdjb Mar 12, 2024
bd0070e
libs2: libs2: SWPROT-8739: Add mock definition
Thomasdjb Apr 3, 2024
74b6fce
libs2: SWPROT-8732: Remove DPRINT
Thomasdjb Apr 9, 2024
3d987ff
libs2: SWPROT-8739: Add test
Thomasdjb Apr 15, 2024
f837bc4
libs2: NOJIRA: Add memcheck on unit tests
Thomasdjb Apr 15, 2024
e088c98
libs2: SWPROT-8739: Fix memory leak in tests
Thomasdjb Apr 15, 2024
252e971
libs2: SWPROT-8770: Correct uninitialized values in libS2
anrivoal Apr 24, 2024
26ffc2c
libs2: SWPROT-8921: Revert CommandHandler refactoring internal proposal
Thomasdjb Jun 24, 2024
a82bd91
uic: zpc: Pull request #2878: UIC-3404: Added unknown type support to…
su-shanka Oct 18, 2024
a0c4565
uic: zpc: Pull request #2845: UIC-3335: Add failsafe to tx queue so i…
silabs-borisl Oct 23, 2024
7aa2ee0
uic: zpc: Pull request #2880: Added Pull Mode and Probe Support to No…
su-shanka Oct 30, 2024
09a456e
uic: zpc: UIC-3406: Fixes Notification CC CTT testing issues
su-shanka Oct 30, 2024
4a61926
uic: zpc: UIC-3499: Avoid publishing unsupported commands as supported
silabs-borisl Sep 30, 2024
498f11e
uic: Pull request #2912: UIC-3589: Update ZPC serial decoder script t…
silabs-aydogane Dec 17, 2024
7ba3573
uic: UIC-3588: Add EnableNls MQTT command to enable NLS
silabs-aydogane Oct 8, 2024
d6dc4fc
libs2: SWPROT-8203: prevent unintentional wakeup
ochavezmiranda Nov 5, 2024
d7bbef3
libs2: SWPROT-8959: Add nls state to S2 context
Thomasdjb Jun 14, 2024
f54ee78
libs2: SWPROT-8667: Add NLS Support bit in KEX report frame
anrivoal Feb 2, 2024
a47a9a0
libs2: SWPROT-8667: Add S2V2 related defines
Thomasdjb Jun 19, 2024
82ec6f4
libs2: SWPROT-8667: Revert "SWPROT-8732: Remove useless MACRO CTX_DEF"
Thomasdjb Sep 5, 2024
e07f6d9
libs2: SWPROT-8667: Add S2_send_nls_state_set function
Thomasdjb Jun 19, 2024
b3ac305
libs2: SWPROT-8667: Add S2_send_nls_state_get function
Thomasdjb Jun 19, 2024
77cbc7e
libs2: SWPROT-8667: Add S2_send_nls_state_report function
Thomasdjb Jun 19, 2024
4bc21fe
libs2: SWPROT-8667: Add forward declaration
Thomasdjb Jun 19, 2024
cbb0d57
lisb2: SWPROT-8667: Add function S2_command_handler
Thomasdjb Jun 20, 2024
d7b24ec
libs2: SWPROT-8667: Add NLS_STATE_GET case
Thomasdjb Jun 20, 2024
c7de50d
libs2: SWPROT-8667: Add NLS_STATE_SET case
Thomasdjb Jun 20, 2024
99234db
libs2: SWPROT-8667: Add NLS_STATE_REPORT case and external function
Thomasdjb Jun 20, 2024
791f126
libs2: SWPROT-8667: Add NLS_NODE_LIST_GET case and external function
Thomasdjb Jul 12, 2024
2547d59
libs2: SWPROT-8667: Add NLS_NODE_LIST_REPORT case and external function
Thomasdjb Jul 12, 2024
591cf4a
libs2: SWPROT-8667: Fix ctxt call for S2_send_nls_state_report
Thomasdjb Aug 28, 2024
047823f
libs2: SWPROT-8667: Fix ctxt in case NLS_STATE_GET_V2
Thomasdjb Aug 28, 2024
45c01ba
libs2: SWPROT-8667: Fix ctxt in case NLS_STATE_SET_V2
Thomasdjb Aug 28, 2024
c9422e0
libs2: SWPROT-8667: Check command length before processing
Thomasdjb Jul 12, 2024
57d1f38
libs2: SWPROT-8667: Add NLS support bit to unit tests
Thomasdjb Jul 15, 2024
29a54e5
libs2: SWPROT-8667: Keep code in S2_application_command_handler accor…
Thomasdjb Aug 7, 2024
377475a
libs2: SWPROT-9039: Controller Echo KEX Report with NLS
Thomasdjb Sep 9, 2024
f2c1d1e
libs2: SWPROT-9039: Use local buffer instead of workbuf
Thomasdjb Sep 17, 2024
3c2b2c4
libs2: SWPROT-9039: Fix NLS State Report fields values
Thomasdjb Sep 17, 2024
9d6971b
libs2: SWPROT-9111: Slave NLS State storage
Thomasdjb Nov 6, 2024
7f6a034
libs2: SWPROT-9107: Fix Sonarqube issue
Thomasdjb Nov 13, 2024
d5605e0
libs2: SWPROT-9182: Forward correct status to upper layer
Thomasdjb Nov 29, 2024
3099265
uic: zpc: Pull request #2913: SWPROT-8900 zpc bulk changes for s2v2
silabs-aydogane Dec 17, 2024
a27049c
uic: zpc: UIC-3488: Fix logged size in frame generator
silabs-borisl Sep 17, 2024
2ebb145
uic: zpc: UIC-3488: Allow to specify manually bitmask's size we want …
silabs-borisl Sep 17, 2024
c72e336
uic: zpc: UIC-3488: Use multimap for resolver_function_map
silabs-borisl Sep 18, 2024
47ac926
uic: zpc: UIC-3488: set_version now accept a endpoint node
silabs-borisl Sep 18, 2024
ce328ad
uic: zpc: UIC-3488: Log updated attribute if set by the parser
silabs-borisl Oct 3, 2024
c7a4e17
uic: zpc: UIC-3488: Attribute store test are now in their own class
silabs-borisl Oct 15, 2024
70f391e
uic: zpc: UIC-3597: Remove zwave_controller_get_key_from_encapsulatio…
silabs-aydogane Jan 2, 2025
13ea92c
uic: zpc: UIC-3597: Remove zwave_store_nls_support dependency from zw…
silabs-aydogane Jan 2, 2025
3987502
uic: zpc: Pull request #2921: UIC-3595: Add unit test to zwave_tx mod…
silabs-aydogane Jan 6, 2025
5e6fdbd
uic: zpc: Pull request #2924: UIC-3596: ZWAPI unit tests for S2V2
silabs-aydogane Jan 6, 2025
2b37517
uic: zpc: Pull request #2931: UIC-3603: zwave module unit test
silabs-aydogane Jan 6, 2025
86462d0
uic: zpc: UIC-3615: Add unit test for zpc_attribute_store module
silabs-aydogane Jan 6, 2025
387d373
uic: zpc: Pull request #2929: UIC-3600: Add unit tests to zwave_trans…
silabs-aydogane Jan 7, 2025
66b11cd
uic: zpc: Pull request #2930: UIC-3601: Add unit test for zwave_comma…
silabs-aydogane Jan 7, 2025
67e9fee
uic: zpc: UIC-3616: Add unit test for ucl_mqtt module
silabs-aydogane Jan 6, 2025
a3e8c57
uic: zpc: Pull request #2932: UIC-3604: Add unit test for zpc_stdin m…
silabs-aydogane Jan 7, 2025
ba3528e
uic: zpc: UIC-3274: CRC16 Encapsulation
silabs-borisl Sep 23, 2024
303ca06
uic: zpc: UIC-3621: Add unit test to validate LR node bitmask layout
silabs-aydogane Jan 13, 2025
3c3f165
uic: zpc: SWPROT-9247: Implement "Get NLS Nodes" SAPI command
silabs-aydogane Jan 9, 2025
3e38cb5
uic: zpc: UIC-3570: Fix test compilation errors in Release mode
silabs-borisl Nov 29, 2024
e3137cf
uic: zpc: UIC-3625: FUNC_ID_SERIAL_API_STARTED received during ZPC in…
Luisky Sep 6, 2024
ff335f9
SWPROT-8953: docs: Update NEWS.md with refs
rzr Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
368 changes: 343 additions & 25 deletions .vscode/zpc.code-snippets

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
**Full Changelog**:
https://github.com/SiliconLabsSoftware/z-wave-protocol-controller/commits

## ver_1.6.1-RC0

Integrate internal changes progressively:

applications/zpc: uic#ver_1.7.0-unstable-84-gcb000bc912
applications/zpc/components/zwave/zwave_transports/s2/libs/zw-libs2: zw-libs2#zwave-sdk-7.21.0-ga-65-g3b7dcd7

## ver_1.6.0-RC4

This tag was added once CI was able to produce unsupported binaries:
Expand Down
1 change: 1 addition & 0 deletions applications/zpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"

members = [
"components/zwave_rust_proc_macros",
Expand Down
4 changes: 2 additions & 2 deletions applications/zpc/components/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions applications/zpc/components/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"

members = [
"zwave_rust_proc_macros",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ def zbON_OFF_CLUSTER_StartUpOnOff 0x00064003
def zbLEVEL_CLUSTER_LEVEL 0x00080000

scope 0 chain_reaction(1) clear_desired(0) {
r'zbON_OFF_CLUSTER_OnTime = if e'zbON_OFF 0 undefined
r'zbON_OFF_CLUSTER_OffWaitTime = if e'zbON_OFF 0 undefined
r'zbON_OFF_CLUSTER_StartUpOnOff = if e'zbON_OFF 0 undefined

r'zbON_OFF_CLUSTER_GlobalSceneControl = if (
( e'zbON_OFF & e'zbLEVEL_CLUSTER_LEVEL ) &
(1==r'zbON_OFF)) 1 undefined

// When simulating, the Reported value always follows the desired value.
// If no desired exist, start with value 1
r'zbON_OFF = if (simulate_on_off) (d'zbON_OFF or 1) undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,23 @@
//
///////////////////////////////////////////////////////////////////////////////
use std::env;
use std::path::PathBuf;
use std::process::Command;

fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();
//TODO I'm not quite sure how to set this in a nice way
//env::var_os("XML_FILE").unwrap();
let xml = PathBuf::from("../zwave_command_classes/assets/ZWave_custom_cmd_classes.xml");
assert!(xml.exists());
let xml_file = "../zwave_command_classes/assets/ZWave_custom_cmd_classes.xml";

let py = PathBuf::from("zwave_rust_cc_gen.py");
assert!(py.exists());

which::which("python3").expect("Python was not found");
let _ = Command::new("python3")
.arg(py.to_str().unwrap())
Command::new("python3")
.arg("zwave_rust_cc_gen.py")
.arg("--xml")
.arg(&xml.to_str().unwrap())
.arg(&xml_file)
.arg("--outdir")
.arg(&out_dir)
.output()
.expect(&format!("Failed to run python script {}", py.display()));
// println!("cargo:rerun-if-changed=zwave_rust_cc_gen.py");
println!("cargo:rerun-if-changed={}", py.to_str().unwrap());
.status()
.unwrap();
println!("cargo:rerun-if-changed=zwave_rust_cc_gen.py");
// there is an fingerprinting bug in cargo, the path is constructed wrong triggering rebuilds of this package
// println!("cargo:rerun-if-changed={:?}", &format!("{}/{}",std::env::var("CARGO_MANIFEST_DIR").unwrap(), xml_file));
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


################################# Generic name handling #########################
fix_chars = re.compile("[^0-9a-z]")
fix_chars = re.compile(r"[^0-9a-z]")
ns = ''


Expand Down
53 changes: 49 additions & 4 deletions applications/zpc/components/ucl_mqtt/src/zpc_node_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static sl_status_t ucl_node_state_discover_neighbors_command(
dotdot_endpoint_id_t endpoint,
uic_mqtt_dotdot_callback_call_type_t callback_type)
{
if (true == is_zpc_unid(unid)) {
if (is_zpc_unid(unid)) {
return SL_STATUS_NOT_SUPPORTED;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ static sl_status_t ucl_node_state_remove_offline_command(
dotdot_endpoint_id_t endpoint,
uic_mqtt_dotdot_callback_call_type_t callback_type)
{
if (true == is_zpc_unid(unid)) {
if (is_zpc_unid(unid)) {
return SL_STATUS_NOT_SUPPORTED;
}

Expand Down Expand Up @@ -132,7 +132,7 @@ static sl_status_t ucl_node_state_interview_command(
dotdot_endpoint_id_t endpoint,
uic_mqtt_dotdot_callback_call_type_t callback_type)
{
if (true == is_zpc_unid(unid)) {
if (is_zpc_unid(unid)) {
return SL_STATUS_NOT_SUPPORTED;
}

Expand Down Expand Up @@ -170,7 +170,7 @@ static sl_status_t ucl_node_state_discover_security_command(
dotdot_endpoint_id_t endpoint,
uic_mqtt_dotdot_callback_call_type_t callback_type)
{
if (true == is_zpc_unid(unid)) {
if (is_zpc_unid(unid)) {
return SL_STATUS_NOT_SUPPORTED;
}

Expand Down Expand Up @@ -199,6 +199,48 @@ static sl_status_t ucl_node_state_discover_security_command(
: SL_STATUS_NOT_SUPPORTED;
}

/**
* @brief Performs an enable NLS operation for a Unid/Endpoint
*
* @param unid UNID of the node to attempt to enable NLS
* @param endpoint Endpoint of the node. The State topic does not support
* endpoints so this variable will be ignored.
* is performed on a NodeID level, as all endpoints share the same radio.
* @param callback_type Dotdot MQTT Callback type
*
* @returns SL_STATUS_OK/SL_STATUS_FAIL to indicate support if callback_type is set to UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK
* sl_status_t code indicating the outcome of applying the command if callback_type is set to UIC_MQTT_DOTDOT_CALLBACK_TYPE_NORMAL
*/
static sl_status_t ucl_node_state_enable_nls_command(
const dotdot_unid_t unid,
dotdot_endpoint_id_t endpoint,
uic_mqtt_dotdot_callback_call_type_t callback_type)
{
if (is_zpc_unid(unid)) {
return SL_STATUS_NOT_SUPPORTED;
}

if (UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK == callback_type) {
// Enable NLS always supported unless the node is offline/unavailable
NodeStateNetworkStatus network_status = unify_attribute_store_node_state_get_status(
attribute_store_network_helper_get_node_id_node(unid)
);

sl_status_t support = SL_STATUS_OK;
if ((network_status == ZCL_NODE_STATE_NETWORK_STATUS_OFFLINE)
|| (network_status == ZCL_NODE_STATE_NETWORK_STATUS_UNAVAILABLE)) {
support = SL_STATUS_FAIL;
}
return support;
}

zwave_node_id_t node_id = 0x00;
if (SL_STATUS_OK == zwave_unid_to_node_id(unid, &node_id)) {
return zwave_store_nls_state(node_id, true, DESIRED_ATTRIBUTE);
}
return SL_STATUS_OK;
}

///////////////////////////////////////////////////////////////////////////////
// Init function shared with the component.
//////////////////////////////////////////////////////////////////////////////
Expand All @@ -216,5 +258,8 @@ sl_status_t zpc_node_state_init()
uic_mqtt_dotdot_state_discover_security_callback_set(
&ucl_node_state_discover_security_command);

uic_mqtt_dotdot_state_enable_nls_callback_set(
&ucl_node_state_enable_nls_command);

return SL_STATUS_OK;
}
84 changes: 84 additions & 0 deletions applications/zpc/components/ucl_mqtt/test/zpc_node_state_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ static uic_mqtt_dotdot_state_interview_callback_t interview_command = NULL;
static uic_mqtt_dotdot_state_discover_security_callback_t
discover_security_command
= NULL;
static uic_mqtt_dotdot_state_enable_nls_callback_t
enable_nls_command
= NULL;

// Stub functions
static void uic_mqtt_dotdot_state_remove_offline_callback_set_stub(
Expand Down Expand Up @@ -78,6 +81,13 @@ static void uic_mqtt_dotdot_state_discover_security_callback_set_stub(
discover_security_command = callback;
}

static void uic_mqtt_dotdot_state_enable_nls_callback_set_stub(
const uic_mqtt_dotdot_state_enable_nls_callback_t callback,
int cmock_num_calls)
{
enable_nls_command = callback;
}

/// Setup the test suite (called once before all test_xxx functions are called)
void suiteSetUp()
{
Expand All @@ -102,6 +112,7 @@ void setUp()
discover_neighbors_command = NULL;
interview_command = NULL;
discover_security_command = NULL;
enable_nls_command = NULL;

// Always respond with HomeID / NodeID from the simulated network
zwave_network_management_get_node_id_IgnoreAndReturn(zpc_node_id);
Expand All @@ -123,6 +134,9 @@ void setUp()
uic_mqtt_dotdot_state_discover_security_callback_set_Stub(
uic_mqtt_dotdot_state_discover_security_callback_set_stub);

uic_mqtt_dotdot_state_enable_nls_callback_set_Stub(
uic_mqtt_dotdot_state_enable_nls_callback_set_stub);

// Call init
TEST_ASSERT_EQUAL(SL_STATUS_OK, zpc_node_state_init());

Expand All @@ -131,6 +145,7 @@ void setUp()
TEST_ASSERT_NOT_NULL(discover_neighbors_command);
TEST_ASSERT_NOT_NULL(interview_command);
TEST_ASSERT_NOT_NULL(discover_security_command);
TEST_ASSERT_NOT_NULL(enable_nls_command);
}

/// Called after each and every test
Expand Down Expand Up @@ -218,3 +233,72 @@ void test_discover_security_command()
UIC_MQTT_DOTDOT_CALLBACK_TYPE_NORMAL));
TEST_ASSERT_TRUE(attribute_store_is_reported_defined(granted_keys_node));
}

void test_enable_nls_support_check()
{
// Set our node to online functional
NodeStateNetworkStatus network_status
= ZCL_NODE_STATE_NETWORK_STATUS_ONLINE_FUNCTIONAL;
attribute_store_set_child_reported(node_id_node,
DOTDOT_ATTRIBUTE_ID_STATE_NETWORK_STATUS,
&network_status,
sizeof(network_status));

// Enable NLS should be supported:
TEST_ASSERT_EQUAL(
SL_STATUS_OK,
enable_nls_command(supporting_node_unid,
endpoint_id,
UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK));

// Offline should not show this state command
network_status = ZCL_NODE_STATE_NETWORK_STATUS_OFFLINE;
attribute_store_set_child_reported(node_id_node,
DOTDOT_ATTRIBUTE_ID_STATE_NETWORK_STATUS,
&network_status,
sizeof(network_status));
TEST_ASSERT_EQUAL(
SL_STATUS_FAIL,
enable_nls_command(supporting_node_unid,
endpoint_id,
UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK));

// Unavailable should not show this state command
network_status = ZCL_NODE_STATE_NETWORK_STATUS_UNAVAILABLE;
attribute_store_set_child_reported(node_id_node,
DOTDOT_ATTRIBUTE_ID_STATE_NETWORK_STATUS,
&network_status,
sizeof(network_status));
TEST_ASSERT_EQUAL(
SL_STATUS_FAIL,
enable_nls_command(supporting_node_unid,
endpoint_id,
UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK));

// ZPC SHOULD not support this state command either
network_status = ZCL_NODE_STATE_NETWORK_STATUS_ONLINE_FUNCTIONAL;
attribute_store_set_child_reported(zpc_node_id_node,
DOTDOT_ATTRIBUTE_ID_STATE_NETWORK_STATUS,
&network_status,
sizeof(network_status));
TEST_ASSERT_EQUAL(
SL_STATUS_NOT_SUPPORTED,
enable_nls_command(zpc_unid,
zpc_endpoint_id,
UIC_MQTT_DOTDOT_CALLBACK_TYPE_SUPPORT_CHECK));
}

void test_enable_nls_command()
{
attribute_store_node_t target_node
= attribute_store_add_node(ATTRIBUTE_ZWAVE_NLS_STATE, node_id_node);
attribute_store_set_reported_number(target_node, 0);
attribute_store_set_desired_number(target_node, 0);

TEST_ASSERT_EQUAL(SL_STATUS_OK,
enable_nls_command(supporting_node_unid,
endpoint_id,
UIC_MQTT_DOTDOT_CALLBACK_TYPE_NORMAL));
TEST_ASSERT_EQUAL(0, attribute_store_get_reported_number(target_node));
TEST_ASSERT_EQUAL(1, attribute_store_get_desired_number(target_node));
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ add_library(
src/zpc_attribute_store_register_default_attribute_type_data.cpp
src/zpc_attribute_store_type_registration.cpp
src/zwave_association_toolbox.cpp
src/zwave_utils.c)
src/zwave_utils.c
src/zwave_frame_parser.cpp
src/zwave_frame_generator.cpp
)

target_include_directories(
zpc_attribute_store
Expand Down
Loading