23
23
#include " DeviceManager.h"
24
24
25
25
#include < app/AttributeAccessInterfaceRegistry.h>
26
- #include < lib/support/ZclString.h>
27
26
28
27
#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE
29
28
#include " RpcClient.h"
@@ -40,10 +39,6 @@ using namespace chip::app;
40
39
using namespace chip ::app::Clusters;
41
40
using namespace chip ::app::Clusters::AdministratorCommissioning;
42
41
43
- #define ZCL_DESCRIPTOR_CLUSTER_REVISION (1u )
44
- #define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION (2u )
45
- #define ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP (0u )
46
-
47
42
namespace {
48
43
49
44
constexpr uint16_t kPollIntervalMs = 100 ;
@@ -158,6 +153,8 @@ AdministratorCommissioningCommandHandler gAdministratorCommissioningCommandHandl
158
153
159
154
void ApplicationInit ()
160
155
{
156
+ ChipLogDetail (NotSpecified, " Fabric-Bridge: ApplicationInit()" );
157
+
161
158
InteractionModelEngine::GetInstance ()->RegisterCommandHandler (&gAdministratorCommissioningCommandHandler );
162
159
163
160
#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE
@@ -172,7 +169,10 @@ void ApplicationInit()
172
169
DeviceMgr ().Init ();
173
170
}
174
171
175
- void ApplicationShutdown () {}
172
+ void ApplicationShutdown ()
173
+ {
174
+ ChipLogDetail (NotSpecified, " Fabric-Bridge: ApplicationShutdown()" );
175
+ }
176
176
177
177
int main (int argc, char * argv[])
178
178
{
@@ -185,65 +185,3 @@ int main(int argc, char * argv[])
185
185
186
186
return 0 ;
187
187
}
188
-
189
- // External attribute read callback function
190
- Protocols::InteractionModel::Status emberAfExternalAttributeReadCallback (EndpointId endpoint, ClusterId clusterId,
191
- const EmberAfAttributeMetadata * attributeMetadata,
192
- uint8_t * buffer, uint16_t maxReadLength)
193
- {
194
- uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint (endpoint);
195
- AttributeId attributeId = attributeMetadata->attributeId ;
196
-
197
- Device * dev = DeviceMgr ().GetDevice (endpointIndex);
198
- if (dev != nullptr && clusterId == app::Clusters::BridgedDeviceBasicInformation::Id)
199
- {
200
- using namespace app ::Clusters::BridgedDeviceBasicInformation::Attributes;
201
- ChipLogProgress (NotSpecified, " HandleReadBridgedDeviceBasicAttribute: attrId=%d, maxReadLength=%d" , attributeId,
202
- maxReadLength);
203
-
204
- if ((attributeId == Reachable::Id) && (maxReadLength == 1 ))
205
- {
206
- *buffer = dev->IsReachable () ? 1 : 0 ;
207
- }
208
- else if ((attributeId == NodeLabel::Id) && (maxReadLength == 32 ))
209
- {
210
- MutableByteSpan zclNameSpan (buffer, maxReadLength);
211
- MakeZclCharString (zclNameSpan, dev->GetName ());
212
- }
213
- else if ((attributeId == ClusterRevision::Id) && (maxReadLength == 2 ))
214
- {
215
- uint16_t rev = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER_REVISION;
216
- memcpy (buffer, &rev, sizeof (rev));
217
- }
218
- else if ((attributeId == FeatureMap::Id) && (maxReadLength == 4 ))
219
- {
220
- uint32_t featureMap = ZCL_BRIDGED_DEVICE_BASIC_INFORMATION_FEATURE_MAP;
221
- memcpy (buffer, &featureMap, sizeof (featureMap));
222
- }
223
- else
224
- {
225
- return Protocols::InteractionModel::Status::Failure;
226
- }
227
- return Protocols::InteractionModel::Status::Success;
228
- }
229
-
230
- return Protocols::InteractionModel::Status::Failure;
231
- }
232
-
233
- // External attribute write callback function
234
- Protocols::InteractionModel::Status emberAfExternalAttributeWriteCallback (EndpointId endpoint, ClusterId clusterId,
235
- const EmberAfAttributeMetadata * attributeMetadata,
236
- uint8_t * buffer)
237
- {
238
- uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint (endpoint);
239
- Protocols::InteractionModel::Status ret = Protocols::InteractionModel::Status::Failure;
240
-
241
- Device * dev = DeviceMgr ().GetDevice (endpointIndex);
242
- if (dev != nullptr && dev->IsReachable ())
243
- {
244
- ChipLogProgress (NotSpecified, " emberAfExternalAttributeWriteCallback: ep=%d, clusterId=%d" , endpoint, clusterId);
245
- ret = Protocols::InteractionModel::Status::Success;
246
- }
247
-
248
- return ret;
249
- }
0 commit comments