nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
onoff_light_switch.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#pragma once
8
9#include "matter_bridged_device.h"
10
11class OnOffLightSwitchDevice : public Nrf::MatterBridgedDevice {
12public:
13 OnOffLightSwitchDevice(const char *nodeLabel);
14
15 uint16_t GetDeviceType() const override { return Nrf::MatterBridgedDevice::DeviceType::OnOffLightSwitch; }
16 CHIP_ERROR HandleRead(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t *buffer,
17 uint16_t maxReadLength) override;
18 CHIP_ERROR HandleReadOnOff(chip::AttributeId attributeId, uint8_t *buffer, uint16_t maxReadLength);
19 CHIP_ERROR HandleReadBinding(chip::AttributeId attributeId, uint8_t *buffer, uint16_t maxReadLength);
20 CHIP_ERROR HandleWrite(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t *buffer,
21 size_t size) override
22 {
23 if (clusterId != chip::app::Clusters::BridgedDeviceBasicInformation::Id) {
24 return CHIP_ERROR_INVALID_ARGUMENT;
25 }
26
27 switch (attributeId) {
28 case chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::NodeLabel::Id:
29 return HandleWriteDeviceBasicInformation(clusterId, attributeId, buffer, size);
30 default:
31 return CHIP_ERROR_INVALID_ARGUMENT;
32 }
33 return CHIP_NO_ERROR;
34 }
35 CHIP_ERROR HandleAttributeChange(chip::ClusterId clusterId, chip::AttributeId attributeId, void *data,
36 size_t dataSize) override
37 {
38 return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
39 }
40
41 static constexpr uint16_t GetOnOffClusterRevision() { return 4; }
42 static constexpr uint32_t GetOnOffFeatureMap() { return 1; }
43 static constexpr uint16_t GetBindingClusterRevision() { return 1; }
44 static constexpr uint32_t GetBindingFeatureMap() { return 0; }
45};
OnOffLightSwitchDevice(const char *nodeLabel)
static constexpr uint32_t GetBindingFeatureMap()
Definition onoff_light_switch.h:44
CHIP_ERROR HandleReadBinding(chip::AttributeId attributeId, uint8_t *buffer, uint16_t maxReadLength)
static constexpr uint16_t GetOnOffClusterRevision()
Definition onoff_light_switch.h:41
CHIP_ERROR HandleAttributeChange(chip::ClusterId clusterId, chip::AttributeId attributeId, void *data, size_t dataSize) override
Definition onoff_light_switch.h:35
uint16_t GetDeviceType() const override
Definition onoff_light_switch.h:15
static constexpr uint16_t GetBindingClusterRevision()
Definition onoff_light_switch.h:43
CHIP_ERROR HandleRead(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t *buffer, uint16_t maxReadLength) override
static constexpr uint32_t GetOnOffFeatureMap()
Definition onoff_light_switch.h:42
CHIP_ERROR HandleWrite(chip::ClusterId clusterId, chip::AttributeId attributeId, uint8_t *buffer, size_t size) override
Definition onoff_light_switch.h:20
CHIP_ERROR HandleReadOnOff(chip::AttributeId attributeId, uint8_t *buffer, uint16_t maxReadLength)
Definition onoff_light_switch.h:11