Skip to content

Commit

Permalink
[Silabs] feature/DIC feature support for thermostat app and window app (
Browse files Browse the repository at this point in the history
#29084)

* feature/DIC feature support for thermostat app and window app

* Restyled by whitespace

* Restyled by clang-format

* addressed review comments

* Restyled by clang-format

* addressed review comments

* addressed review comments

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Nov 17, 2023
1 parent e64ce4e commit 3183449
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
7 changes: 7 additions & 0 deletions examples/thermostat/silabs/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
#include <app/ConcreteAttributePath.h>
#include <lib/support/logging/CHIPLogging.h>

#ifdef DIC_ENABLE
#include "dic_control.h"
#endif // DIC_ENABLE

using namespace ::chip;
using namespace ::chip::app::Clusters;

Expand All @@ -46,5 +50,8 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath &
else if (clusterId == Thermostat::Id)
{
TempMgr().AttributeChangeHandler(attributePath.mEndpointId, attributeId, value, size);
#ifdef DIC_ENABLE
dic::control::AttributeHandler(attributePath.mEndpointId, attributeId);
#endif // DIC_ENABLE
}
}
23 changes: 22 additions & 1 deletion examples/window-app/silabs/src/WindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ using namespace ::chip::DeviceLayer::Silabs;
#define APP_STATE_LED 0
#define APP_ACTION_LED 1

#ifdef DIC_ENABLE
#define DECIMAL 10
#define MSG_SIZE 6
#include "dic.h"
#endif // DIC_ENABLE

using namespace ::chip::Credentials;
using namespace ::chip::DeviceLayer;
using namespace chip::app::Clusters::WindowCovering;
Expand Down Expand Up @@ -502,10 +508,25 @@ void WindowManager::Cover::CallbackPositionSet(intptr_t arg)
position.SetNonNull(data->percent100ths);

if (data->isTilt)
{
TiltPositionSet(data->mEndpointId, position);
#ifdef DIC_ENABLE
uint16_t value = data->percent100ths;
char buffer[MSG_SIZE];
itoa(value, buffer, DECIMAL);
dic_sendmsg("tilt/position set", (const char *) (buffer));
#endif // DIC_ENABLE
}
else
{
LiftPositionSet(data->mEndpointId, position);

#ifdef DIC_ENABLE
uint16_t value = data->percent100ths;
char buffer[MSG_SIZE];
itoa(value, buffer, DECIMAL);
dic_sendmsg("lift/position set", (const char *) (buffer));
#endif // DIC_ENABLE
}
chip::Platform::Delete(data);
}

Expand Down

0 comments on commit 3183449

Please sign in to comment.