Coverage Report

Created: 2025-06-24 06:17

/src/connectedhomeip/src/app/clusters/smoke-co-alarm-server/smoke-co-alarm-server.cpp
Line
Count
Source (jump to first uncovered line)
1
/**
2
 *
3
 *    Copyright (c) 2023 Project CHIP Authors
4
 *
5
 *    Licensed under the Apache License, Version 2.0 (the "License");
6
 *    you may not use this file except in compliance with the License.
7
 *    You may obtain a copy of the License at
8
 *
9
 *        http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 *    Unless required by applicable law or agreed to in writing, software
12
 *    distributed under the License is distributed on an "AS IS" BASIS,
13
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 *    See the License for the specific language governing permissions and
15
 *    limitations under the License.
16
 */
17
18
/**
19
 * @file
20
 *   Routines for the Smoke CO Alarm Server plugin.
21
 *
22
 */
23
24
#include "smoke-co-alarm-server.h"
25
26
#include <app-common/zap-generated/attributes/Accessors.h>
27
#include <app/EventLogging.h>
28
29
using namespace chip;
30
using namespace chip::app;
31
using namespace chip::app::Clusters::SmokeCoAlarm;
32
using namespace chip::app::Clusters::SmokeCoAlarm::Attributes;
33
using chip::Protocols::InteractionModel::Status;
34
35
SmokeCoAlarmServer SmokeCoAlarmServer::sInstance;
36
37
/**********************************************************
38
 * SmokeCoAlarmServer public methods
39
 *********************************************************/
40
41
SmokeCoAlarmServer & SmokeCoAlarmServer::Instance()
42
0
{
43
0
    return sInstance;
44
0
}
45
46
void SmokeCoAlarmServer::SetExpressedStateByPriority(EndpointId endpointId,
47
                                                     const std::array<ExpressedStateEnum, kPriorityOrderLength> & priorityOrder)
48
0
{
49
0
    for (ExpressedStateEnum priority : priorityOrder)
50
0
    {
51
0
        AlarmStateEnum alarmState          = AlarmStateEnum::kNormal;
52
0
        EndOfServiceEnum endOfServiceState = EndOfServiceEnum::kNormal;
53
0
        bool active                        = false;
54
0
        bool success                       = false;
55
56
0
        switch (priority)
57
0
        {
58
0
        case ExpressedStateEnum::kSmokeAlarm:
59
0
            success = GetSmokeState(endpointId, alarmState);
60
0
            break;
61
0
        case ExpressedStateEnum::kCOAlarm:
62
0
            success = GetCOState(endpointId, alarmState);
63
0
            break;
64
0
        case ExpressedStateEnum::kBatteryAlert:
65
0
            success = GetBatteryAlert(endpointId, alarmState);
66
0
            break;
67
0
        case ExpressedStateEnum::kTesting:
68
0
            success = GetTestInProgress(endpointId, active);
69
0
            break;
70
0
        case ExpressedStateEnum::kHardwareFault:
71
0
            success = GetHardwareFaultAlert(endpointId, active);
72
0
            break;
73
0
        case ExpressedStateEnum::kEndOfService:
74
0
            success = GetEndOfServiceAlert(endpointId, endOfServiceState);
75
0
            break;
76
0
        case ExpressedStateEnum::kInterconnectSmoke:
77
0
            success = GetInterconnectSmokeAlarm(endpointId, alarmState);
78
0
            break;
79
0
        case ExpressedStateEnum::kInterconnectCO:
80
0
            success = GetInterconnectCOAlarm(endpointId, alarmState);
81
0
            break;
82
0
        default:
83
0
            break;
84
0
        }
85
86
0
        if (success && ((alarmState != AlarmStateEnum::kNormal) || (endOfServiceState != EndOfServiceEnum::kNormal) || active))
87
0
        {
88
0
            SetExpressedState(endpointId, priority);
89
0
            return;
90
0
        }
91
0
    }
92
93
0
    SetExpressedState(endpointId, ExpressedStateEnum::kNormal);
94
0
}
95
96
bool SmokeCoAlarmServer::RequestSelfTest(EndpointId endpointId)
97
0
{
98
0
    ExpressedStateEnum expressedState;
99
0
    VerifyOrReturnValue(GetExpressedState(endpointId, expressedState), false);
100
101
    // If the value is busy then return busy
102
0
    if (expressedState == ExpressedStateEnum::kSmokeAlarm || expressedState == ExpressedStateEnum::kCOAlarm ||
103
0
        expressedState == ExpressedStateEnum::kTesting || expressedState == ExpressedStateEnum::kInterconnectSmoke ||
104
0
        expressedState == ExpressedStateEnum::kInterconnectCO)
105
0
    {
106
0
        return false;
107
0
    }
108
109
0
    VerifyOrReturnValue(SetTestInProgress(endpointId, true), false);
110
0
    SetExpressedState(endpointId, ExpressedStateEnum::kTesting);
111
112
0
    emberAfPluginSmokeCoAlarmSelfTestRequestCommand(endpointId);
113
114
0
    return true;
115
0
}
116
117
bool SmokeCoAlarmServer::SetSmokeState(EndpointId endpointId, AlarmStateEnum newSmokeState)
118
0
{
119
0
    AlarmStateEnum alarmState;
120
0
    VerifyOrReturnValue(GetAttribute(endpointId, SmokeState::Id, SmokeState::Get, alarmState), false);
121
0
    VerifyOrReturnValue(alarmState != newSmokeState, true);
122
123
0
    VerifyOrReturnValue(SetAttribute(endpointId, SmokeState::Id, SmokeState::Set, newSmokeState), false);
124
0
    if (newSmokeState == AlarmStateEnum::kWarning || newSmokeState == AlarmStateEnum::kCritical)
125
0
    {
126
0
        Events::SmokeAlarm::Type event{ newSmokeState };
127
0
        SendEvent(endpointId, event);
128
0
    }
129
130
0
    if (newSmokeState == AlarmStateEnum::kCritical)
131
0
    {
132
0
        SetDeviceMuted(endpointId, MuteStateEnum::kNotMuted);
133
0
    }
134
135
0
    return true;
136
0
}
137
138
bool SmokeCoAlarmServer::SetCOState(EndpointId endpointId, AlarmStateEnum newCOState)
139
0
{
140
0
    AlarmStateEnum alarmState;
141
0
    VerifyOrReturnValue(GetAttribute(endpointId, COState::Id, COState::Get, alarmState), false);
142
0
    VerifyOrReturnValue(alarmState != newCOState, true);
143
144
0
    VerifyOrReturnValue(SetAttribute(endpointId, COState::Id, COState::Set, newCOState), false);
145
0
    if (newCOState == AlarmStateEnum::kWarning || newCOState == AlarmStateEnum::kCritical)
146
0
    {
147
0
        Events::COAlarm::Type event{ newCOState };
148
0
        SendEvent(endpointId, event);
149
0
    }
150
151
0
    if (newCOState == AlarmStateEnum::kCritical)
152
0
    {
153
0
        SetDeviceMuted(endpointId, MuteStateEnum::kNotMuted);
154
0
    }
155
156
0
    return true;
157
0
}
158
159
bool SmokeCoAlarmServer::SetBatteryAlert(EndpointId endpointId, AlarmStateEnum newBatteryAlert)
160
0
{
161
0
    AlarmStateEnum alarmState;
162
0
    VerifyOrReturnValue(GetAttribute(endpointId, BatteryAlert::Id, BatteryAlert::Get, alarmState), false);
163
0
    VerifyOrReturnValue(alarmState != newBatteryAlert, true);
164
165
0
    VerifyOrReturnValue(SetAttribute(endpointId, BatteryAlert::Id, BatteryAlert::Set, newBatteryAlert), false);
166
0
    if (newBatteryAlert == AlarmStateEnum::kWarning || newBatteryAlert == AlarmStateEnum::kCritical)
167
0
    {
168
0
        Events::LowBattery::Type event{ newBatteryAlert };
169
0
        SendEvent(endpointId, event);
170
0
    }
171
172
0
    if (newBatteryAlert == AlarmStateEnum::kCritical)
173
0
    {
174
0
        SetDeviceMuted(endpointId, MuteStateEnum::kNotMuted);
175
0
    }
176
177
0
    return true;
178
0
}
179
180
bool SmokeCoAlarmServer::SetDeviceMuted(EndpointId endpointId, MuteStateEnum newDeviceMuted)
181
0
{
182
0
    MuteStateEnum deviceMuted;
183
0
    VerifyOrReturnValue(GetAttribute(endpointId, DeviceMuted::Id, DeviceMuted::Get, deviceMuted), false);
184
0
    VerifyOrReturnValue(deviceMuted != newDeviceMuted, true);
185
186
0
    if (newDeviceMuted == MuteStateEnum::kMuted)
187
0
    {
188
0
        AlarmStateEnum alarmState;
189
190
        // If the attribute has been read and the attribute is Critical, return false
191
192
0
        bool success = GetSmokeState(endpointId, alarmState);
193
0
        VerifyOrReturnValue(!success || alarmState != AlarmStateEnum::kCritical, false);
194
195
0
        success = GetCOState(endpointId, alarmState);
196
0
        VerifyOrReturnValue(!success || alarmState != AlarmStateEnum::kCritical, false);
197
198
0
        success = GetBatteryAlert(endpointId, alarmState);
199
0
        VerifyOrReturnValue(!success || alarmState != AlarmStateEnum::kCritical, false);
200
201
0
        success = GetInterconnectSmokeAlarm(endpointId, alarmState);
202
0
        VerifyOrReturnValue(!success || alarmState != AlarmStateEnum::kCritical, false);
203
204
0
        success = GetInterconnectCOAlarm(endpointId, alarmState);
205
0
        VerifyOrReturnValue(!success || alarmState != AlarmStateEnum::kCritical, false);
206
0
    }
207
208
0
    VerifyOrReturnValue(SetAttribute(endpointId, DeviceMuted::Id, DeviceMuted::Set, newDeviceMuted), false);
209
0
    if (newDeviceMuted == MuteStateEnum::kMuted)
210
0
    {
211
0
        Events::AlarmMuted::Type event{};
212
0
        SendEvent(endpointId, event);
213
0
    }
214
0
    else if (newDeviceMuted == MuteStateEnum::kNotMuted)
215
0
    {
216
0
        Events::MuteEnded::Type event{};
217
0
        SendEvent(endpointId, event);
218
0
    }
219
220
0
    return true;
221
0
}
222
223
bool SmokeCoAlarmServer::SetTestInProgress(EndpointId endpointId, bool newTestInProgress)
224
0
{
225
0
    bool active;
226
0
    VerifyOrReturnValue(GetAttribute(endpointId, TestInProgress::Id, TestInProgress::Get, active), false);
227
0
    VerifyOrReturnValue(active != newTestInProgress, true);
228
229
0
    VerifyOrReturnValue(SetAttribute(endpointId, TestInProgress::Id, TestInProgress::Set, newTestInProgress), false);
230
0
    if (!newTestInProgress)
231
0
    {
232
0
        Events::SelfTestComplete::Type event{};
233
0
        SendEvent(endpointId, event);
234
0
    }
235
236
0
    return true;
237
0
}
238
239
bool SmokeCoAlarmServer::SetHardwareFaultAlert(EndpointId endpointId, bool newHardwareFaultAlert)
240
0
{
241
0
    bool active;
242
0
    VerifyOrReturnValue(GetAttribute(endpointId, HardwareFaultAlert::Id, HardwareFaultAlert::Get, active), false);
243
0
    VerifyOrReturnValue(active != newHardwareFaultAlert, true);
244
245
0
    VerifyOrReturnValue(SetAttribute(endpointId, HardwareFaultAlert::Id, HardwareFaultAlert::Set, newHardwareFaultAlert), false);
246
0
    if (newHardwareFaultAlert)
247
0
    {
248
0
        Events::HardwareFault::Type event{};
249
0
        SendEvent(endpointId, event);
250
0
    }
251
252
0
    return true;
253
0
}
254
255
bool SmokeCoAlarmServer::SetEndOfServiceAlert(EndpointId endpointId, EndOfServiceEnum newEndOfServiceAlert)
256
0
{
257
0
    EndOfServiceEnum endOfServiceState;
258
0
    VerifyOrReturnValue(GetAttribute(endpointId, EndOfServiceAlert::Id, EndOfServiceAlert::Get, endOfServiceState), false);
259
0
    VerifyOrReturnValue(endOfServiceState != newEndOfServiceAlert, true);
260
261
0
    VerifyOrReturnValue(SetAttribute(endpointId, EndOfServiceAlert::Id, EndOfServiceAlert::Set, newEndOfServiceAlert), false);
262
0
    if (newEndOfServiceAlert == EndOfServiceEnum::kExpired)
263
0
    {
264
0
        Events::EndOfService::Type event{};
265
0
        SendEvent(endpointId, event);
266
0
    }
267
268
0
    return true;
269
0
}
270
271
bool SmokeCoAlarmServer::SetInterconnectSmokeAlarm(EndpointId endpointId, AlarmStateEnum newInterconnectSmokeAlarm)
272
0
{
273
0
    AlarmStateEnum alarmState;
274
0
    VerifyOrReturnValue(GetAttribute(endpointId, InterconnectSmokeAlarm::Id, InterconnectSmokeAlarm::Get, alarmState), false);
275
0
    VerifyOrReturnValue(alarmState != newInterconnectSmokeAlarm, true);
276
277
0
    VerifyOrReturnValue(
278
0
        SetAttribute(endpointId, InterconnectSmokeAlarm::Id, InterconnectSmokeAlarm::Set, newInterconnectSmokeAlarm), false);
279
0
    if (newInterconnectSmokeAlarm == AlarmStateEnum::kWarning || newInterconnectSmokeAlarm == AlarmStateEnum::kCritical)
280
0
    {
281
0
        Events::InterconnectSmokeAlarm::Type event{ newInterconnectSmokeAlarm };
282
0
        SendEvent(endpointId, event);
283
0
    }
284
285
0
    if (newInterconnectSmokeAlarm == AlarmStateEnum::kCritical)
286
0
    {
287
0
        SetDeviceMuted(endpointId, MuteStateEnum::kNotMuted);
288
0
    }
289
290
0
    return true;
291
0
}
292
293
bool SmokeCoAlarmServer::SetInterconnectCOAlarm(EndpointId endpointId, AlarmStateEnum newInterconnectCOAlarm)
294
0
{
295
0
    AlarmStateEnum alarmState;
296
0
    VerifyOrReturnValue(GetAttribute(endpointId, InterconnectCOAlarm::Id, InterconnectCOAlarm::Get, alarmState), false);
297
0
    VerifyOrReturnValue(alarmState != newInterconnectCOAlarm, true);
298
299
0
    VerifyOrReturnValue(SetAttribute(endpointId, InterconnectCOAlarm::Id, InterconnectCOAlarm::Set, newInterconnectCOAlarm), false);
300
0
    if (newInterconnectCOAlarm == AlarmStateEnum::kWarning || newInterconnectCOAlarm == AlarmStateEnum::kCritical)
301
0
    {
302
0
        Events::InterconnectCOAlarm::Type event{ newInterconnectCOAlarm };
303
0
        SendEvent(endpointId, event);
304
0
    }
305
306
0
    if (newInterconnectCOAlarm == AlarmStateEnum::kCritical)
307
0
    {
308
0
        SetDeviceMuted(endpointId, MuteStateEnum::kNotMuted);
309
0
    }
310
311
0
    return true;
312
0
}
313
314
bool SmokeCoAlarmServer::SetContaminationState(EndpointId endpointId, ContaminationStateEnum newContaminationState)
315
0
{
316
0
    ContaminationStateEnum contaminationState;
317
0
    VerifyOrReturnValue(GetAttribute(endpointId, ContaminationState::Id, ContaminationState::Get, contaminationState), false);
318
0
    VerifyOrReturnValue(contaminationState != newContaminationState, true);
319
320
0
    VerifyOrReturnValue(SetAttribute(endpointId, ContaminationState::Id, ContaminationState::Set, newContaminationState), false);
321
322
0
    return true;
323
0
}
324
325
bool SmokeCoAlarmServer::SetSmokeSensitivityLevel(EndpointId endpointId, SensitivityEnum newSmokeSensitivityLevel)
326
0
{
327
0
    SensitivityEnum sensitivity;
328
0
    VerifyOrReturnValue(GetAttribute(endpointId, SmokeSensitivityLevel::Id, SmokeSensitivityLevel::Get, sensitivity), false);
329
0
    VerifyOrReturnValue(sensitivity != newSmokeSensitivityLevel, true);
330
331
0
    VerifyOrReturnValue(SetAttribute(endpointId, SmokeSensitivityLevel::Id, SmokeSensitivityLevel::Set, newSmokeSensitivityLevel),
332
0
                        false);
333
334
0
    return true;
335
0
}
336
337
bool SmokeCoAlarmServer::GetExpressedState(chip ::EndpointId endpointId, ExpressedStateEnum & expressedState)
338
0
{
339
0
    return GetAttribute(endpointId, ExpressedState::Id, ExpressedState::Get, expressedState);
340
0
}
341
342
bool SmokeCoAlarmServer::GetSmokeState(EndpointId endpointId, AlarmStateEnum & smokeState)
343
0
{
344
0
    return GetAttribute(endpointId, SmokeState::Id, SmokeState::Get, smokeState);
345
0
}
346
347
bool SmokeCoAlarmServer::GetCOState(EndpointId endpointId, AlarmStateEnum & coState)
348
0
{
349
0
    return GetAttribute(endpointId, COState::Id, COState::Get, coState);
350
0
}
351
352
bool SmokeCoAlarmServer::GetBatteryAlert(EndpointId endpointId, AlarmStateEnum & batteryAlert)
353
0
{
354
0
    return GetAttribute(endpointId, BatteryAlert::Id, BatteryAlert::Get, batteryAlert);
355
0
}
356
357
bool SmokeCoAlarmServer::GetDeviceMuted(EndpointId endpointId, MuteStateEnum & deviceMuted)
358
0
{
359
0
    return GetAttribute(endpointId, DeviceMuted::Id, DeviceMuted::Get, deviceMuted);
360
0
}
361
362
bool SmokeCoAlarmServer::GetTestInProgress(EndpointId endpointId, bool & testInProgress)
363
0
{
364
0
    return GetAttribute(endpointId, TestInProgress::Id, TestInProgress::Get, testInProgress);
365
0
}
366
367
bool SmokeCoAlarmServer::GetHardwareFaultAlert(EndpointId endpointId, bool & hardwareFaultAlert)
368
0
{
369
0
    return GetAttribute(endpointId, HardwareFaultAlert::Id, HardwareFaultAlert::Get, hardwareFaultAlert);
370
0
}
371
372
bool SmokeCoAlarmServer::GetEndOfServiceAlert(EndpointId endpointId, EndOfServiceEnum & endOfServiceAlert)
373
0
{
374
0
    return GetAttribute(endpointId, EndOfServiceAlert::Id, EndOfServiceAlert::Get, endOfServiceAlert);
375
0
}
376
377
bool SmokeCoAlarmServer::GetInterconnectSmokeAlarm(EndpointId endpointId, AlarmStateEnum & interconnectSmokeAlarm)
378
0
{
379
0
    return GetAttribute(endpointId, InterconnectSmokeAlarm::Id, InterconnectSmokeAlarm::Get, interconnectSmokeAlarm);
380
0
}
381
382
bool SmokeCoAlarmServer::GetInterconnectCOAlarm(EndpointId endpointId, AlarmStateEnum & interconnectCOAlarm)
383
0
{
384
0
    return GetAttribute(endpointId, InterconnectCOAlarm::Id, InterconnectCOAlarm::Get, interconnectCOAlarm);
385
0
}
386
387
bool SmokeCoAlarmServer::GetContaminationState(EndpointId endpointId, ContaminationStateEnum & contaminationState)
388
0
{
389
0
    return GetAttribute(endpointId, ContaminationState::Id, ContaminationState::Get, contaminationState);
390
0
}
391
392
bool SmokeCoAlarmServer::GetSmokeSensitivityLevel(EndpointId endpointId, SensitivityEnum & smokeSensitivityLevel)
393
0
{
394
0
    return GetAttribute(endpointId, SmokeSensitivityLevel::Id, SmokeSensitivityLevel::Get, smokeSensitivityLevel);
395
0
}
396
397
bool SmokeCoAlarmServer::GetExpiryDate(EndpointId endpointId, uint32_t & expiryDate)
398
0
{
399
0
    return GetAttribute(endpointId, ExpiryDate::Id, ExpiryDate::Get, expiryDate);
400
0
}
401
402
chip::BitFlags<Feature> SmokeCoAlarmServer::GetFeatures(EndpointId endpointId)
403
0
{
404
0
    chip::BitFlags<Feature> featureMap;
405
0
    if (!GetAttribute(endpointId, FeatureMap::Id, FeatureMap::Get, *featureMap.RawStorage()))
406
0
    {
407
0
        ChipLogError(Zcl, "Unable to get the Smoke CO Alarm feature map: attribute read error");
408
0
        featureMap.ClearAll();
409
0
    }
410
0
    return featureMap;
411
0
}
412
413
/**********************************************************
414
 * SmokeCoAlarmServer private methods
415
 *********************************************************/
416
417
void SmokeCoAlarmServer::SetExpressedState(EndpointId endpointId, ExpressedStateEnum newExpressedState)
418
0
{
419
0
    ExpressedStateEnum expressedState;
420
0
    VerifyOrReturn(GetAttribute(endpointId, ExpressedState::Id, ExpressedState::Get, expressedState));
421
0
    VerifyOrReturn(expressedState != newExpressedState);
422
423
0
    VerifyOrReturn(SetAttribute(endpointId, ExpressedState::Id, ExpressedState::Set, newExpressedState));
424
0
    if (newExpressedState == ExpressedStateEnum::kNormal)
425
0
    {
426
0
        Events::AllClear::Type event{};
427
0
        SendEvent(endpointId, event);
428
0
    }
429
0
}
430
431
void SmokeCoAlarmServer::HandleRemoteSelfTestRequest(CommandHandler * commandObj, const ConcreteCommandPath & commandPath)
432
0
{
433
0
    EndpointId endpointId = commandPath.mEndpointId;
434
435
0
    ExpressedStateEnum expressedState;
436
0
    VerifyOrReturn(GetExpressedState(endpointId, expressedState), commandObj->AddStatus(commandPath, Status::Failure));
437
438
    // If the value is busy then return busy
439
0
    if (expressedState == ExpressedStateEnum::kSmokeAlarm || expressedState == ExpressedStateEnum::kCOAlarm ||
440
0
        expressedState == ExpressedStateEnum::kTesting || expressedState == ExpressedStateEnum::kInterconnectSmoke ||
441
0
        expressedState == ExpressedStateEnum::kInterconnectCO)
442
0
    {
443
0
        commandObj->AddStatus(commandPath, Status::Busy);
444
0
        return;
445
0
    }
446
447
0
    VerifyOrReturn(SetTestInProgress(endpointId, true), commandObj->AddStatus(commandPath, Status::Failure));
448
0
    SetExpressedState(endpointId, ExpressedStateEnum::kTesting);
449
450
0
    emberAfPluginSmokeCoAlarmSelfTestRequestCommand(endpointId);
451
452
0
    commandObj->AddStatus(commandPath, Status::Success);
453
0
}
454
455
template <typename T>
456
void SmokeCoAlarmServer::SendEvent(EndpointId endpointId, T & event)
457
0
{
458
0
    EventNumber eventNumber;
459
0
    auto err = LogEvent(event, endpointId, eventNumber);
460
461
0
    if (CHIP_NO_ERROR != err)
462
0
    {
463
0
        ChipLogError(Zcl, "Failed to log event: err=%" CHIP_ERROR_FORMAT ", event_id=" ChipLogFormatMEI, err.Format(),
464
0
                     ChipLogValueMEI(event.GetEventId()));
465
0
    }
466
0
}
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::SmokeAlarm::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::SmokeAlarm::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::COAlarm::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::COAlarm::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::LowBattery::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::LowBattery::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::AlarmMuted::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::AlarmMuted::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::MuteEnded::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::MuteEnded::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::SelfTestComplete::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::SelfTestComplete::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::HardwareFault::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::HardwareFault::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::EndOfService::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::EndOfService::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::InterconnectSmokeAlarm::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::InterconnectSmokeAlarm::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::InterconnectCOAlarm::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::InterconnectCOAlarm::Type&)
Unexecuted instantiation: void SmokeCoAlarmServer::SendEvent<chip::app::Clusters::SmokeCoAlarm::Events::AllClear::Type>(unsigned short, chip::app::Clusters::SmokeCoAlarm::Events::AllClear::Type&)
467
468
template <typename T>
469
bool SmokeCoAlarmServer::GetAttribute(EndpointId endpointId, AttributeId attributeId,
470
                                      Status (*getFn)(EndpointId endpointId, T * value), T & value) const
471
0
{
472
0
    Status status          = getFn(endpointId, &value);
473
0
    bool success           = (Status::Success == status);
474
0
    bool unsupportedStatus = (Status::UnsupportedAttribute == status);
475
476
0
    if (unsupportedStatus)
477
0
    {
478
0
        ChipLogProgress(Zcl, "Read unsupported SmokeCOAlarm attribute: attribute=" ChipLogFormatMEI, ChipLogValueMEI(attributeId));
479
0
    }
480
0
    else if (!success)
481
0
    {
482
0
        ChipLogError(Zcl, "Failed to read SmokeCOAlarm attribute: attribute=" ChipLogFormatMEI ", status=0x%x",
483
0
                     ChipLogValueMEI(attributeId), to_underlying(status));
484
0
    }
485
0
    return success;
486
0
}
Unexecuted instantiation: bool SmokeCoAlarmServer::GetAttribute<chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum*), chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum&) const
Unexecuted instantiation: bool SmokeCoAlarmServer::GetAttribute<chip::app::Clusters::SmokeCoAlarm::MuteStateEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::MuteStateEnum*), chip::app::Clusters::SmokeCoAlarm::MuteStateEnum&) const
Unexecuted instantiation: bool SmokeCoAlarmServer::GetAttribute<bool>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, bool*), bool&) const
Unexecuted instantiation: bool SmokeCoAlarmServer::GetAttribute<chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum*), chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum&) const
Unexecuted instantiation: bool SmokeCoAlarmServer::GetAttribute<chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum*), chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum&) const
Unexecuted instantiation: bool SmokeCoAlarmServer::GetAttribute<chip::app::Clusters::SmokeCoAlarm::SensitivityEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::SensitivityEnum*), chip::app::Clusters::SmokeCoAlarm::SensitivityEnum&) const
Unexecuted instantiation: bool SmokeCoAlarmServer::GetAttribute<chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum*), chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum&) const
Unexecuted instantiation: bool SmokeCoAlarmServer::GetAttribute<unsigned int>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, unsigned int*), unsigned int&) const
487
488
template <typename T>
489
bool SmokeCoAlarmServer::SetAttribute(EndpointId endpointId, AttributeId attributeId,
490
                                      Status (*setFn)(EndpointId endpointId, T value), T value)
491
0
{
492
0
    Status status = setFn(endpointId, value);
493
0
    bool success  = (Status::Success == status);
494
495
0
    if (!success)
496
0
    {
497
0
        ChipLogError(Zcl, "Failed to write SmokeCOAlarm attribute: attribute=" ChipLogFormatMEI ", status=0x%x",
498
0
                     ChipLogValueMEI(attributeId), to_underlying(status));
499
0
    }
500
0
    return success;
501
0
}
Unexecuted instantiation: bool SmokeCoAlarmServer::SetAttribute<chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum), chip::app::Clusters::SmokeCoAlarm::AlarmStateEnum)
Unexecuted instantiation: bool SmokeCoAlarmServer::SetAttribute<chip::app::Clusters::SmokeCoAlarm::MuteStateEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::MuteStateEnum), chip::app::Clusters::SmokeCoAlarm::MuteStateEnum)
Unexecuted instantiation: bool SmokeCoAlarmServer::SetAttribute<bool>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, bool), bool)
Unexecuted instantiation: bool SmokeCoAlarmServer::SetAttribute<chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum), chip::app::Clusters::SmokeCoAlarm::EndOfServiceEnum)
Unexecuted instantiation: bool SmokeCoAlarmServer::SetAttribute<chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum), chip::app::Clusters::SmokeCoAlarm::ContaminationStateEnum)
Unexecuted instantiation: bool SmokeCoAlarmServer::SetAttribute<chip::app::Clusters::SmokeCoAlarm::SensitivityEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::SensitivityEnum), chip::app::Clusters::SmokeCoAlarm::SensitivityEnum)
Unexecuted instantiation: bool SmokeCoAlarmServer::SetAttribute<chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum>(unsigned short, unsigned int, chip::Protocols::InteractionModel::Status (*)(unsigned short, chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum), chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum)
502
503
// =============================================================================
504
// Cluster commands callbacks
505
// =============================================================================
506
507
bool emberAfSmokeCoAlarmClusterSelfTestRequestCallback(CommandHandler * commandObj, const ConcreteCommandPath & commandPath,
508
                                                       const Commands::SelfTestRequest::DecodableType & commandData)
509
0
{
510
0
    SmokeCoAlarmServer::Instance().HandleRemoteSelfTestRequest(commandObj, commandPath);
511
0
    return true;
512
0
}
513
514
1
void MatterSmokeCoAlarmPluginServerInitCallback() {}
515
0
void MatterSmokeCoAlarmPluginServerShutdownCallback() {}