46
46
#include < setup_payload/QRCodeSetupPayloadGenerator.h>
47
47
#include < setup_payload/SetupPayload.h>
48
48
49
- #include < app/clusters/identify-server/identify-server.h>
50
-
51
49
#include < platform/silabs/platformAbstraction/SilabsPlatform.h>
52
50
53
51
/* *********************************************************
60
58
#define APP_LIGHT_SWITCH 1
61
59
62
60
namespace {
63
-
64
61
constexpr chip::EndpointId kLightSwitchEndpoint = 1 ;
65
62
constexpr chip::EndpointId kGenericSwitchEndpoint = 2 ;
66
-
67
63
} // namespace
68
64
69
65
using namespace chip ;
70
66
using namespace chip ::app;
71
67
using namespace ::chip::DeviceLayer;
72
68
using namespace ::chip::DeviceLayer::Silabs;
73
69
74
- namespace {
75
-
76
- /* *********************************************************
77
- * Variable declarations
78
- *********************************************************/
79
-
80
- Clusters::Identify::EffectIdentifierEnum sIdentifyEffect = Clusters::Identify::EffectIdentifierEnum::kStopEffect ;
81
-
82
- /* *********************************************************
83
- * Identify Callbacks
84
- *********************************************************/
85
-
86
- namespace {
87
- void OnTriggerIdentifyEffectCompleted (chip::System::Layer * systemLayer, void * appState)
88
- {
89
- ChipLogProgress (Zcl, " Trigger Identify Complete" );
90
- sIdentifyEffect = Clusters::Identify::EffectIdentifierEnum::kStopEffect ;
91
-
92
- #if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
93
- AppTask::GetAppTask ().StopStatusLEDTimer ();
94
- #endif
95
- }
96
- } // namespace
97
-
98
- void OnTriggerIdentifyEffect (Identify * identify)
99
- {
100
- ChipLogProgress (Zcl, " Trigger Identify Effect" );
101
- sIdentifyEffect = identify->mCurrentEffectIdentifier ;
102
-
103
- if (identify->mCurrentEffectIdentifier == Clusters::Identify::EffectIdentifierEnum::kChannelChange )
104
- {
105
- ChipLogProgress (Zcl, " IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE - Not supported, use effect varriant %d" ,
106
- to_underlying (identify->mEffectVariant ));
107
- sIdentifyEffect = static_cast <Clusters::Identify::EffectIdentifierEnum>(identify->mEffectVariant );
108
- }
109
-
110
- #if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
111
- AppTask::GetAppTask ().StartStatusLEDTimer ();
112
- #endif
113
-
114
- switch (sIdentifyEffect )
115
- {
116
- case Clusters::Identify::EffectIdentifierEnum::kBlink :
117
- case Clusters::Identify::EffectIdentifierEnum::kBreathe :
118
- case Clusters::Identify::EffectIdentifierEnum::kOkay :
119
- (void ) chip::DeviceLayer::SystemLayer ().StartTimer (chip::System::Clock::Seconds16 (5 ), OnTriggerIdentifyEffectCompleted,
120
- identify);
121
- break ;
122
- case Clusters::Identify::EffectIdentifierEnum::kFinishEffect :
123
- (void ) chip::DeviceLayer::SystemLayer ().CancelTimer (OnTriggerIdentifyEffectCompleted, identify);
124
- (void ) chip::DeviceLayer::SystemLayer ().StartTimer (chip::System::Clock::Seconds16 (1 ), OnTriggerIdentifyEffectCompleted,
125
- identify);
126
- break ;
127
- case Clusters::Identify::EffectIdentifierEnum::kStopEffect :
128
- (void ) chip::DeviceLayer::SystemLayer ().CancelTimer (OnTriggerIdentifyEffectCompleted, identify);
129
- sIdentifyEffect = Clusters::Identify::EffectIdentifierEnum::kStopEffect ;
130
- break ;
131
- default :
132
- ChipLogProgress (Zcl, " No identifier effect" );
133
- }
134
- }
135
-
136
- Identify gIdentify = {
137
- chip::EndpointId{ 1 },
138
- AppTask::GetAppTask ().OnIdentifyStart ,
139
- AppTask::GetAppTask ().OnIdentifyStop ,
140
- Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator ,
141
- OnTriggerIdentifyEffect,
142
- };
143
-
144
- } // namespace
145
-
146
70
using namespace chip ::TLV;
147
71
using namespace ::chip::DeviceLayer;
148
72
@@ -161,7 +85,7 @@ CHIP_ERROR AppTask::Init()
161
85
GetLCD ().Init ((uint8_t *) " Light Switch" );
162
86
#endif
163
87
164
- err = BaseApplication::Init (& gIdentify );
88
+ err = BaseApplication::Init ();
165
89
if (err != CHIP_NO_ERROR)
166
90
{
167
91
SILABS_LOG (" BaseApplication::Init() failed" );
@@ -211,24 +135,6 @@ void AppTask::AppTaskMain(void * pvParameter)
211
135
}
212
136
}
213
137
214
- void AppTask::OnIdentifyStart (Identify * identify)
215
- {
216
- ChipLogProgress (Zcl, " onIdentifyStart" );
217
-
218
- #if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
219
- sAppTask .StartStatusLEDTimer ();
220
- #endif
221
- }
222
-
223
- void AppTask::OnIdentifyStop (Identify * identify)
224
- {
225
- ChipLogProgress (Zcl, " onIdentifyStop" );
226
-
227
- #if CHIP_DEVICE_CONFIG_ENABLE_SED == 1
228
- sAppTask .StopStatusLEDTimer ();
229
- #endif
230
- }
231
-
232
138
void AppTask::SwitchActionEventHandler (AppEvent * aEvent)
233
139
{
234
140
VerifyOrReturn (aEvent->Type == AppEvent::kEventType_Button );
0 commit comments