Skip to content

Commit

Permalink
Remove some usage of cluster-id.h to use ids/Clusters.h instead (#10658)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple authored and pull[bot] committed Nov 9, 2021
1 parent b68656d commit 1dd58c0
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 40 deletions.
6 changes: 0 additions & 6 deletions examples/bridge-app/linux/include/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@

#pragma once

//#include <zap-generated/attribute-id.h>
//#include <zap-generated/cluster-id.h>
//#include <app/chip-zcl-zpro-codec.h>
//#include <app/util/af-types.h>
//#include <app/util/af.h>
#include <app/util/attribute-storage.h>
//#include <app/util/util.h>

#include <stdbool.h>
#include <stdint.h>
Expand Down
9 changes: 3 additions & 6 deletions examples/common/pigweed/rpc_services/Locking.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
#include "app/util/attribute-storage.h"
#include "locking_service/locking_service.rpc.pb.h"
#include "pigweed/rpc_services/internal/StatusUtils.h"
#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/attributes/Accessors.h>

namespace chip {
namespace rpc {
Expand All @@ -36,16 +35,14 @@ class Locking final : public generated::Locking<Locking>
virtual pw::Status Set(ServerContext &, const chip_rpc_LockingState & request, pw_protobuf_Empty & response)
{
uint8_t locked = request.locked;
RETURN_STATUS_IF_NOT_OK(emberAfWriteServerAttribute(kEndpoint, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, &locked,
ZCL_BOOLEAN_ATTRIBUTE_TYPE));
RETURN_STATUS_IF_NOT_OK(app::Clusters::OnOff::Attributes::OnOff::Set(kEndpoint, locked));
return pw::OkStatus();
}

virtual pw::Status Get(ServerContext &, const pw_protobuf_Empty & request, chip_rpc_LockingState & response)
{
uint8_t locked;
RETURN_STATUS_IF_NOT_OK(
emberAfReadServerAttribute(kEndpoint, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, &locked, sizeof(locked)));
RETURN_STATUS_IF_NOT_OK(app::Clusters::OnOff::Attributes::OnOff::Get(kEndpoint, &locked));
response.locked = locked;
return pw::OkStatus();
}
Expand Down
11 changes: 5 additions & 6 deletions examples/tv-app/linux/include/wake-on-lan/WakeOnLanManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

#include "WakeOnLanManager.h"

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/util/af.h>
#include <app/util/attribute-storage.h>
#include <app/util/basic-types.h>
Expand All @@ -34,6 +33,7 @@
#include <sstream>

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

CHIP_ERROR WakeOnLanManager::Init()
{
Expand All @@ -51,9 +51,8 @@ void WakeOnLanManager::store(chip::EndpointId endpoint, char macAddress[32])
uint8_t bufferMemory[32];
MutableByteSpan zclString(bufferMemory);
MakeZclCharString(zclString, macAddress);
EmberAfStatus macAddressStatus =
emberAfWriteServerAttribute(endpoint, ZCL_WAKE_ON_LAN_CLUSTER_ID, ZCL_WAKE_ON_LAN_MAC_ADDRESS_ATTRIBUTE_ID,
zclString.data(), ZCL_CHAR_STRING_ATTRIBUTE_TYPE);
EmberAfStatus macAddressStatus = emberAfWriteServerAttribute(
endpoint, WakeOnLan::Id, WakeOnLan::Attributes::WakeOnLanMacAddress::Id, zclString.data(), ZCL_CHAR_STRING_ATTRIBUTE_TYPE);
if (macAddressStatus != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogError(Zcl, "Failed to store mac address attribute.");
Expand Down
13 changes: 7 additions & 6 deletions src/app/clusters/binary-input-server/binary-input-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,40 @@

#include <app/util/af.h>

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/util/af-event.h>
#include <app/util/attribute-storage.h>
#include <lib/support/logging/CHIPLogging.h>

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

#ifndef emberAfBinaryInputBasicClusterPrintln
#define emberAfBinaryInputBasicClusterPrintln(...) ChipLogProgress(Zcl, __VA_ARGS__);
#endif

EmberAfStatus emberAfBinaryInputBasicClusterGetPresentValue(EndpointId endpoint, bool * presentValue)
{
return emberAfReadServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_PRESENT_VALUE_ATTRIBUTE_ID,
return emberAfReadServerAttribute(endpoint, BinaryInputBasic::Id, BinaryInputBasic::Attributes::PresentValue::Id,
(uint8_t *) presentValue, sizeof(uint8_t));
}

EmberAfStatus emberAfBinaryInputBasicClusterGetOutOfService(EndpointId endpoint, bool * isOutOfService)
{
return emberAfReadServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_OUT_OF_SERVICE_ATTRIBUTE_ID,
return emberAfReadServerAttribute(endpoint, BinaryInputBasic::Id, BinaryInputBasic::Attributes::OutOfService::Id,
(uint8_t *) isOutOfService, sizeof(uint8_t));
}

EmberAfStatus emberAfBinaryInputBasicClusterSetPresentValueCallback(EndpointId endpoint, bool presentValue)
{
return emberAfWriteServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_PRESENT_VALUE_ATTRIBUTE_ID,
return emberAfWriteServerAttribute(endpoint, BinaryInputBasic::Id, BinaryInputBasic::Attributes::PresentValue::Id,
(uint8_t *) &presentValue, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
}

EmberAfStatus emberAfBinaryInputBasicClusterSetOutOfServiceCallback(EndpointId endpoint, bool isOutOfService)
{
return emberAfWriteServerAttribute(endpoint, ZCL_BINARY_INPUT_BASIC_CLUSTER_ID, ZCL_OUT_OF_SERVICE_ATTRIBUTE_ID,
return emberAfWriteServerAttribute(endpoint, BinaryInputBasic::Id, BinaryInputBasic::Attributes::OutOfService::Id,
(uint8_t *) &isOutOfService, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
}
8 changes: 5 additions & 3 deletions src/app/clusters/keypad-input-server/keypad-input-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,26 @@
*******************************************************************************
******************************************************************************/

#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app-common/zap-generated/command-id.h>
#include <app-common/zap-generated/enums.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app-common/zap-generated/ids/Commands.h>
#include <app/CommandHandler.h>
#include <app/ConcreteCommandPath.h>
#include <app/util/af.h>

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

EmberAfKeypadInputStatus keypadInputClusterSendKey(EmberAfKeypadInputCecKeyCode keyCode);

static void sendResponse(app::CommandHandler * command, EmberAfKeypadInputStatus keypadInputStatus)
{
CHIP_ERROR err = CHIP_NO_ERROR;
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_KEYPAD_INPUT_CLUSTER_ID,
ZCL_SEND_KEY_RESPONSE_COMMAND_ID, (app::CommandPathFlags::kEndpointIdValid) };
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, KeypadInput::Id,
KeypadInput::Commands::SendKeyResponse::Id, (app::CommandPathFlags::kEndpointIdValid) };
TLV::TLVWriter * writer = nullptr;

VerifyOrExit(command != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down
4 changes: 0 additions & 4 deletions src/app/clusters/power-source-server/power-source-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@

#include "power-source-server.h"

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/command-id.h>
#include <app/CommandHandler.h>
#include <app/reporting/reporting.h>
#include <app/util/af-event.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
#include <app/util/af-event.h>
#include <app/util/attribute-storage.h>

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>

using namespace chip;

void emberAfPumpConfigurationAndControlClusterInitCallback(EndpointId endpoint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@
#include <app/util/af.h>

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

TargetNavigatorResponse targetNavigatorClusterNavigateTarget(uint8_t target, std::string data);

void sendResponse(app::CommandHandler * command, TargetNavigatorResponse response)
{
CHIP_ERROR err = CHIP_NO_ERROR;
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, ZCL_TARGET_NAVIGATOR_CLUSTER_ID,
ZCL_NAVIGATE_TARGET_RESPONSE_COMMAND_ID, (app::CommandPathFlags::kEndpointIdValid) };
app::CommandPathParams cmdParams = { emberAfCurrentEndpoint(), /* group id */ 0, TargetNavigator::Id,
TargetNavigator::Commands::NavigateTargetResponse::Id,
(app::CommandPathFlags::kEndpointIdValid) };
TLV::TLVWriter * writer = nullptr;
SuccessOrExit(err = command->PrepareCommand(cmdParams));
VerifyOrExit((writer = command->GetCommandDataElementTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE);
Expand Down
3 changes: 0 additions & 3 deletions src/app/clusters/thermostat-client/thermostat-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

#include <app/util/af.h>

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app/CommandHandler.h>
#include <app/util/af-event.h>
#include <app/util/attribute-storage.h>
Expand Down

0 comments on commit 1dd58c0

Please sign in to comment.