Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
achaulk-goog committed Aug 16, 2022
1 parent 6c3f9e1 commit 9a5d3b7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 21 deletions.
13 changes: 13 additions & 0 deletions examples/bridge-app/linux/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,21 @@ Device::Device(chip::Span<chip::DataVersion> dataVersions, chip::Span<EmberAfClu
chip::EndpointId parentId) :
mParentEndpointId(parentId),
mDataVersions(dataVersions), mClusters(clusters), mClusterImpl(clusterImpl), mDeviceTypeList(deviceTypeList)
{}

void Device::SetEndpointId(chip::EndpointId id)
{
mEndpointId = id;
for (auto * c : mClusterImpl)
c->SetEndpointId(id);
}

const char * Device::GetName()
{
return mDeviceName;
}

void Device::SetName(const char * name)
{
mDeviceName = name;
}
8 changes: 1 addition & 7 deletions examples/bridge-app/linux/bridged-actions-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,11 @@ CHIP_ERROR ActionsAttrAccess::ReadEndpointListAttribute(EndpointId endpoint, Att
CHIP_ERROR err = aEncoder.EncodeList([](const auto & encoder) -> CHIP_ERROR {
for (auto & room : gRooms)
{
<<<<<<< HEAD
Actions::Structs::EndpointListStruct::Type endpointListStruct = {
info.GetEndpointListId(), CharSpan::fromCharString(info.GetName().c_str()), info.GetType(),
DataModel::List<chip::EndpointId>(info.GetEndpointListData(), info.GetEndpointListSize())
=======
if (room.GetEndpointListSize() == 0)
continue;
BridgedActions::Structs::EndpointListStruct::Type endpointListStruct = {
Actions::Structs::EndpointListStruct::Type endpointListStruct = {
room.GetEndpointListId(), CharSpan::fromCharString(room.GetName().c_str()), room.GetType(),
DataModel::List<chip::EndpointId>(room.GetEndpointListData(), room.GetEndpointListSize())
>>>>>>> ebb974a33 (Update bridge app)
};
ReturnErrorOnFailure(encoder.Encode(endpointListStruct));
}
Expand Down
13 changes: 7 additions & 6 deletions examples/bridge-app/linux/include/Clusters.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@

#include <functional>

static constexpr uint16_t ZCL_DESCRIPTOR_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_FIXED_LABEL_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_ON_OFF_CLUSTER_REVISION = 4;
static constexpr uint16_t ZCL_SWITCH_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_LEVEL_CONTROL_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_DESCRIPTOR_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_FIXED_LABEL_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_ON_OFF_CLUSTER_REVISION = 4;
static constexpr uint16_t ZCL_SWITCH_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_LEVEL_CONTROL_CLUSTER_REVISION = 1;
static constexpr uint16_t ZCL_TEMPERATURE_MEASUREMENT_CLUSTER_REVISION = 1;

// This is the interface to cluster implementations, providing access to manipulate attributes.
class ClusterImpl
Expand Down
1 change: 1 addition & 0 deletions examples/bridge-app/linux/include/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include <lib/support/Span.h>
#include <app-common/app-common/zap-generated/cluster-enums.h>

#include <stdbool.h>
#include <stdint.h>
Expand Down
4 changes: 2 additions & 2 deletions examples/bridge-app/linux/include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Room
Room() = default;
void SetName(std::string name) { mName = name; }
const std::string & GetName() { return mName; }
chip::app::Clusters::BridgedActions::EndpointListTypeEnum GetType() { return mType; };
chip::app::Clusters::Actions::EndpointListTypeEnum GetType() { return mType; };
uint16_t GetEndpointListId() { return mEndpointListId; };
chip::EndpointId * GetEndpointListData() { return mEndpoints.data(); };
size_t GetEndpointListSize() { return mEndpoints.size(); };
Expand All @@ -42,7 +42,7 @@ class Room
private:
std::string mName;
uint16_t mEndpointListId = 0;
chip::app::Clusters::BridgedActions::EndpointListTypeEnum mType;
chip::app::Clusters::Actions::EndpointListTypeEnum mType;
std::vector<chip::EndpointId> mEndpoints;
};

Expand Down
5 changes: 2 additions & 3 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ static EndpointId gFirstDynamicEndpointId;
static Device * gDevices[CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT];
Room gRooms[kMaxRooms];

bool emberAfBridgedActionsClusterInstantActionCallback(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath,
const BridgedActions::Commands::InstantAction::DecodableType & commandData)
bool emberAfActionsClusterInstantActionCallback(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
const Actions::Commands::InstantAction::DecodableType & commandData)
{
// No actions are implemented, just return status NotFound.
commandObj->AddStatus(commandPath, Protocols::InteractionModel::Status::NotFound);
Expand Down
6 changes: 3 additions & 3 deletions scripts/idl/generators/cpp/BridgeClustersCpp.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct {{cluster.name}}Cluster : public CommonCluster
{%- endfor %}


static constexpr chip::ClusterId kClusterId = ZCL_{{cluster.name | cameltoconst}}_CLUSTER_ID;
static constexpr chip::ClusterId kClusterId = {{cluster.code}};

chip::ClusterId GetClusterId() override { return kClusterId; }

Expand Down Expand Up @@ -198,7 +198,7 @@ struct ClusterInfo
{% for cluster in clusters %}
{%- if cluster | dynamicCluster(idl) %}
{
ZCL_{{cluster.name | cameltoconst}}_CLUSTER_ID,
{{cluster.code}},
"{{cluster.name}}",
sizeof({{cluster.name}}Cluster),
[](void *mem) -> CommonCluster* {
Expand Down Expand Up @@ -229,7 +229,7 @@ struct AttrInfo
{%- if cluster | dynamicCluster(idl) %}

{%- for attr in cluster.attributes %}
{ZCL_{{cluster.name | cameltoconst}}_CLUSTER_ID, {{attr.definition.code}}, "{{attr.definition.name | capitalcase}}" },
{ {{cluster.code}}, {{attr.definition.code}}, "{{attr.definition.name | capitalcase}}" },
{%- endfor %}

{%- endif %}
Expand Down

0 comments on commit 9a5d3b7

Please sign in to comment.