Skip to content

Commit 3f1e18d

Browse files
committed
Silicon Labs Matter Extension v2.3.2
1 parent 578f76f commit 3f1e18d

File tree

181 files changed

+2611
-9866
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+2611
-9866
lines changed

examples/platform/silabs/BaseApplication.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,10 @@ void BaseApplication::ScheduleFactoryReset()
814814
{
815815
Provision::Manager::GetInstance().SetProvisionRequired(true);
816816
}
817+
#if SL_WIFI
818+
// Removing the matter services on factory reset
819+
chip::Dnssd::ServiceAdvertiser::Instance().RemoveServices();
820+
#endif // SL_WIFI
817821
PlatformMgr().HandleServerShuttingDown(); // HandleServerShuttingDown calls OnShutdown() which is only implemented for the
818822
// basic information cluster it seems. And triggers and Event flush, which is not
819823
// relevant when there are no fabrics left
@@ -867,10 +871,20 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t)
867871

868872
if (DIC_OK != dic_init(dic::control::subscribeCB))
869873
{
870-
ChipLogError(AppServer, "Failed to initialize DIC module\n");
874+
ChipLogError(AppServer, "dic_init failed");
871875
}
872876
}
873877
#endif // DIC_ENABLE
878+
#ifdef DISPLAY_ENABLED
879+
SilabsLCD::Screen_e screen;
880+
AppTask::GetLCD().GetScreen(screen);
881+
// Update the LCD screen with SSID and connected state
882+
if (screen == SilabsLCD::Screen_e::StatusScreen)
883+
{
884+
BaseApplication::UpdateLCDStatusScreen(false);
885+
AppTask::GetLCD().SetScreen(screen);
886+
}
887+
#endif // DISPLAY_ENABLED
874888
if ((event->ThreadConnectivityChange.Result == kConnectivity_Established) ||
875889
(event->InternetConnectivityChange.IPv6 == kConnectivity_Established))
876890
{
@@ -925,18 +939,8 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t)
925939
#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER && RS911X_WIFI */
926940
}
927941
break;
928-
929-
case DeviceEventType::kWiFiConnectivityChange: {
930-
#ifdef DISPLAY_ENABLED
931-
SilabsLCD::Screen_e screen;
932-
AppTask::GetLCD().GetScreen(screen);
933-
// Update the LCD screen with SSID and connected state
934-
VerifyOrReturn(screen == SilabsLCD::Screen_e::StatusScreen);
935-
BaseApplication::UpdateLCDStatusScreen(false);
936-
AppTask::GetLCD().SetScreen(screen);
937-
#endif // DISPLAY_ENABLED
938-
}
939-
break;
942+
default:
943+
break;
940944
}
941945
}
942946

examples/platform/silabs/DIC/matter_abs_interface/BUILD.gn

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ config("silabs_dic_config") {
2020
"${chip_root}/third_party/silabs/mqtt/stack",
2121
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/include",
2222
"${chip_root}/examples/platform/silabs/DIC/matter_abs_interface/include",
23-
]
23+
]
2424
}
25+
2526
source_set("silabs-dic") {
2627
sources = [
2728
"${chip_root}/examples/platform/silabs/DIC/matter_abs_interface/src/dic.cpp",
@@ -34,47 +35,51 @@ source_set("silabs-dic") {
3435
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_tls_mbedtls.c",
3536
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/src/altcp_tls_mbedtls_mem.c",
3637
]
38+
3739
public_deps = [
3840
"${chip_root}/src/inet",
3941
"${chip_root}/src/lwip",
4042
app_data_model,
4143
]
44+
4245
public_configs = [ ":silabs_dic_config" ]
4346
}
4447

4548
config("silabs_aws_sdk_ota_config") {
46-
include_dirs = [
47-
"${chip_root}/third_party/silabs/mqtt/stack",
48-
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/include",
49-
"${chip_root}/examples/platform/silabs/DIC/matter_abs_interface/include",
50-
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/ota_demo_core_mqtt",
51-
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/common/include",
52-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/include",
53-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/portable/os",
54-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/3rdparty/tinycbor/src",
55-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/coreJSON/source/include",
56-
]
57-
}
49+
include_dirs = [
50+
"${chip_root}/third_party/silabs/mqtt/stack",
51+
"${chip_root}/third_party/silabs/mqtt/mqtt_transport_interface/include",
52+
"${chip_root}/examples/platform/silabs/DIC/matter_abs_interface/include",
53+
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/ota_demo_core_mqtt",
54+
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/common/include",
55+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/include",
56+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/portable/os",
57+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/3rdparty/tinycbor/src",
58+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/coreJSON/source/include",
59+
]
60+
}
5861

59-
source_set("silabs-aws-sdk-ota") {
60-
sources = [
61-
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/ota_demo_core_mqtt/ota_demo_core_mqtt.c",
62-
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/common/src/mqtt_subscription_manager.c",
63-
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/common/src/pal.c",
64-
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/ota_demo_core_mqtt/ota.c",
65-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/ota_base64.c",
66-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/ota_interface.c",
67-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/ota_mqtt.c",
68-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/ota_cbor.c",
69-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/portable/os/ota_os_freertos.c",
70-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/coreJSON/source/core_json.c",
71-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/3rdparty/tinycbor/src/cborparser.c",
72-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/3rdparty/tinycbor/src/cborencoder.c",
73-
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/3rdparty/tinycbor/src/cborencoder_close_container_checked.c",
74-
]
75-
public_deps = [
76-
"${chip_root}/src/inet",
77-
"${chip_root}/src/lwip",
78-
]
79-
public_configs = [ ":silabs_aws_sdk_ota_config" ]
80-
}
62+
source_set("silabs-aws-sdk-ota") {
63+
sources = [
64+
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/common/src/mqtt_subscription_manager.c",
65+
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/common/src/pal.c",
66+
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/ota_demo_core_mqtt/ota.c",
67+
"${chip_root}/third_party/silabs/aws_ota_sdk/demos/ota/ota_demo_core_mqtt/ota_demo_core_mqtt.c",
68+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/3rdparty/tinycbor/src/cborencoder.c",
69+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/3rdparty/tinycbor/src/cborencoder_close_container_checked.c",
70+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/3rdparty/tinycbor/src/cborparser.c",
71+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/dependency/coreJSON/source/core_json.c",
72+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/ota_base64.c",
73+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/ota_cbor.c",
74+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/ota_interface.c",
75+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/ota_mqtt.c",
76+
"${chip_root}/third_party/silabs/aws_ota_sdk/ota-for-aws-iot-embedded-sdk/source/portable/os/ota_os_freertos.c",
77+
]
78+
79+
public_deps = [
80+
"${chip_root}/src/inet",
81+
"${chip_root}/src/lwip",
82+
83+
]
84+
public_configs = [ ":silabs_aws_sdk_ota_config" ]
85+
}

examples/platform/silabs/DIC/matter_abs_interface/include/dic.h

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @brief Matter abstraction layer for Direct Internet Connectivity.
44
*******************************************************************************
55
* # License
6-
* <b>Copyright 2020 Silicon Laboratories Inc.
6+
* <b>Copyright 2023 Silicon Laboratories Inc.
77
*www.silabs.com</b>
88
*******************************************************************************
99
*
@@ -20,45 +20,47 @@
2020

2121
#ifndef __DIC_H
2222
#define __DIC_H
23+
24+
#include <stdint.h>
25+
26+
#include "dic_config.h"
27+
2328
#ifdef __cplusplus
2429
extern "C" {
2530
#endif
2631
#include "mqtt.h"
27-
#include "stdint.h"
28-
typedef enum {
29-
DIC_OK = 0,
30-
DIC_ERR_INVAL,
31-
DIC_ERR_MEM,
32-
DIC_ERR_FAIL,
33-
DIC_ERR_CONN,
34-
DIC_ERR_PUBLISH,
32+
typedef enum
33+
{
34+
DIC_OK = 0,
35+
DIC_ERR_INVAL,
36+
DIC_ERR_MEM,
37+
DIC_ERR_FAIL,
38+
DIC_ERR_CONN,
39+
DIC_ERR_PUBLISH,
3540
} dic_err_t;
3641

37-
#define MQTT_QOS_0 0
38-
39-
typedef struct {
40-
uint8_t *dataP;
41-
uint16_t dataLen;
42+
typedef struct
43+
{
44+
uint8_t * dataP;
45+
uint16_t dataLen;
4246
} dic_buff_t;
4347

44-
typedef void (* dic_subscribe_cb)(void);
48+
typedef void (*dic_subscribe_cb)(void);
4549

4650
dic_err_t dic_init(dic_subscribe_cb subs_cb);
4751

48-
dic_err_t dic_mqtt_subscribe(mqtt_client_t *client, mqtt_incoming_publish_cb_t publish_cb, mqtt_incoming_data_cb_t data_cb, const char * topic, uint8_t qos);
49-
50-
dic_err_t dic_sendmsg(const char *subject, const char *content);
52+
dic_err_t dic_mqtt_subscribe(mqtt_client_t * client, mqtt_incoming_publish_cb_t publish_cb, mqtt_incoming_data_cb_t data_cb,
53+
const char * topic, uint8_t qos);
5154

55+
dic_err_t dic_sendmsg(const char * subject, const char * content);
5256

5357
#ifdef ENABLE_AWS_OTA_FEAT
5458

55-
#define AWS_OTA_TASK_STACK_SIZE 1024
56-
#define AWS_OTA_TASK_PRIORITY 1
57-
58-
typedef void (*callback_t)(const char * sub_topic, uint16_t top_len, const void *pload, uint16_t pLoadLength);
59-
struct sub_cb_info{
60-
char *sub_topic;
61-
callback_t cb;
59+
typedef void (*callback_t)(const char * sub_topic, uint16_t top_len, const void * pload, uint16_t pLoadLength);
60+
struct sub_cb_info
61+
{
62+
char * sub_topic;
63+
callback_t cb;
6264
};
6365

6466
int dic_init_status(void);
@@ -72,7 +74,7 @@ dic_err_t dic_aws_ota_subscribe(const char * topic, uint8_t qos, callback_t subs
7274
dic_err_t dic_aws_ota_process();
7375

7476
dic_err_t dic_aws_ota_close();
75-
#endif
77+
#endif // ENABLE_AWS_OTA_FEAT
7678

7779
#ifdef __cplusplus
7880
}

examples/platform/silabs/DIC/matter_abs_interface/include/dic_config.h

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @brief Matter abstraction layer for Direct Internet Connectivity.
44
*******************************************************************************
55
* # License
6-
* <b>Copyright 2020 Silicon Laboratories Inc.
6+
* <b>Copyright 2023 Silicon Laboratories Inc.
77
*www.silabs.com</b>
88
*******************************************************************************
99
*
@@ -21,31 +21,41 @@
2121
#ifndef __DIC_CONFIG_H
2222
#define __DIC_CONFIG_H
2323

24-
/*certificates*/
25-
#define USE_AWS 1
26-
#define USE_MOSQUITTO 0
24+
/* Instance configuration */
2725

28-
/* Task Configuration*/
26+
#ifndef SL_DIC_NVM_EMBED_CERT
27+
#define SL_DIC_NVM_EMBED_CERT (0)
28+
#endif
29+
30+
/* Task Configuration */
2931
#define DIC_TASK_NAME "DIC"
30-
#define DIC_TASK_STACK_SIZE (2*1024) //2k
31-
#define DIC_TASK_PRIORITY 5
32+
#define DIC_TASK_STACK_SIZE (2 * 1024) // 2k
33+
#define DIC_TASK_PRIORITY (5)
3234

33-
/* Network Configuration*/
34-
#define DIC_SERVER_PORT 8883
35+
/* Network Configuration */
36+
#define DIC_SERVER_HOST ""
37+
#define DIC_SERVER_PORT (8883)
3538

36-
#define DIC_KEEP_ALIVE 0
39+
#define DIC_KEEP_ALIVE (0)
3740

38-
#if USE_AWS
39-
#define DIC_CLIENT_ID "SQA_DIC_C2"
41+
/* MQTT Client Configuration */
42+
#define DIC_CLIENT_ID "sl_dic_client"
4043
#define DIC_CLIENT_USER NULL
4144
#define DIC_CLIENT_PASS NULL
4245

43-
#elif USE_MOSQUITTO
44-
45-
#define DIC_CLIENT_USER ""
46-
#define DIC_CLIENT_PASS ""
46+
#define MQTT_QOS_0 (0)
47+
#define MQTT_SUBSCRIBE_TOPIC "command"
4748

49+
/* MQTT Client Certification Configuration */
50+
#define DIC_CA_CERT_LENGTH (1212)
51+
#define DIC_DEV_CERT_LENGTH (1212)
52+
#define DIC_DEV_KEY_LENGTH (1212)
53+
#define DIC_HOSTNAME_LENGTH (55)
54+
#define DIC_CLIENTID_LENGTH (30)
4855

49-
#endif //USE_MOSQUITTO
56+
#ifdef ENABLE_AWS_OTA_FEAT
57+
#define AWS_OTA_TASK_STACK_SIZE (1024)
58+
#define AWS_OTA_TASK_PRIORITY (1)
59+
#endif // ENABLE_AWS_OTA_FEAT
5060

5161
#endif // __DIC_CONFIG_H

examples/platform/silabs/DIC/matter_abs_interface/include/dic_control.h

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @brief Matter abstraction layer for Direct Internet Connectivity.
44
*******************************************************************************
55
* # License
6-
* <b>Copyright 2020 Silicon Laboratories Inc.
6+
* <b>Copyright 2023 Silicon Laboratories Inc.
77
*www.silabs.com</b>
88
*******************************************************************************
99
*
@@ -22,27 +22,26 @@
2222

2323
#include <app-common/zap-generated/attributes/Accessors.h>
2424
#include <app-common/zap-generated/ids/Attributes.h>
25-
#include <lib/support/CHIPMemString.h>
26-
#include <zap-generated/gen_config.h>
2725
#include <app-common/zap-generated/ids/Clusters.h>
26+
#include <zap-generated/gen_config.h>
2827

29-
#define MQTT_SUBSCRIBE_TOPIC "command"
28+
#include "dic_config.h"
3029

3130
using namespace chip;
3231
using namespace ::chip::DeviceLayer;
3332

3433
namespace dic {
35-
namespace control {
36-
void dic_incoming_data_cb(void* arg, const char* topic, const uint8_t* data, uint16_t len, uint8_t flags);
34+
namespace control {
35+
void dic_incoming_data_cb(void * arg, const char * topic, const uint8_t * data, uint16_t len, uint8_t flags);
3736

38-
void SubscribeMQTT(intptr_t context);
37+
void SubscribeMQTT(intptr_t context);
3938

40-
void subscribeCB(void);
39+
void subscribeCB(void);
4140

42-
#ifdef ZCL_USING_THERMOSTAT_CLUSTER_SERVER
43-
void AttributeHandler(EndpointId endpointId, AttributeId attributeId);
44-
#endif //ZCL_USING_THERMOSTAT_CLUSTER_SERVER
41+
#ifdef ZCL_USING_THERMOSTAT_CLUSTER_SERVER
42+
void AttributeHandler(EndpointId endpointId, AttributeId attributeId);
43+
#endif // ZCL_USING_THERMOSTAT_CLUSTER_SERVER
4544

46-
}
47-
}
45+
} // namespace control
46+
} // namespace dic
4847
#endif //__DIC_CONTROL_H

0 commit comments

Comments
 (0)