@@ -327,59 +327,12 @@ void ChefBindingHandler::SwitchWorkerHandler(intptr_t context)
327
327
BindingManager::GetInstance ().NotifyBoundClusterChanged (data->EndpointId , data->ClusterId , static_cast <void *>(data));
328
328
}
329
329
330
- /*
331
- static void ChefBoundDeviceChangedHandler(const EmberBindingTableEntry & binding, chip::OperationalDeviceProxy * peer_device,
332
- void * context)
333
- {
334
- using namespace chip;
335
- using namespace chip::app;
336
-
337
- if (binding.type == EMBER_MULTICAST_BINDING)
338
- {
339
- ChipLogError(NotSpecified, "Group binding is not supported now");
340
- return;
341
- }
342
-
343
- printf("\033[41m %s, %d \033[0m \n", __func__, __LINE__);
344
-
345
- if (binding.type == EMBER_UNICAST_BINDING && binding.local == 1 &&
346
- (!binding.clusterId.HasValue() || binding.clusterId.Value() == Clusters::OnOff::Id))
347
- {
348
- auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
349
- ChipLogProgress(NotSpecified, "OnOff command succeeds");
350
- };
351
- auto onFailure = [](CHIP_ERROR ret) {
352
- ChipLogError(NotSpecified, "OnOff command failed: %" CHIP_ERROR_FORMAT, ret.Format());
353
- };
354
-
355
- VerifyOrDie(peer_device != nullptr && peer_device->ConnectionReady());
356
- if (sSwitchOnOffState)
357
- {
358
- Clusters::OnOff::Commands::On::Type onCommand;
359
- Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(),
360
- binding.remote, onCommand, onSuccess, onFailure);
361
- }
362
- else
363
- {
364
- Clusters::OnOff::Commands::Off::Type offCommand;
365
- Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(),
366
- binding.remote, offCommand, onSuccess, onFailure);
367
- }
368
- }
369
- }
370
- */
371
-
372
- /*
373
- static void ChefBoundDeviceContextReleaseHandler(void * context)
374
- {
375
- (void) context;
376
- }
377
- */
378
330
void ChefBindingHandler::Init (chip::EndpointId endpoint)
379
331
{
380
332
DeviceLayer::PlatformMgr ().ScheduleWork (InitInternal, endpoint);
381
333
}
382
334
335
+ #if CONFIG_ENABLE_PW_RPC == 1
383
336
#include " Rpc.h"
384
337
385
338
void ChefBindingCommandHandler (intptr_t ctx, chip::rpc::BindingCommandRequest * command)
@@ -395,26 +348,19 @@ printf("\033[41 %s, %d, endpoint=%d, clusterId=%d, commandId=%d \033[0m \n", __f
395
348
data->IsGroup = ChefBindingHandler::GetInstance ().IsGroupBound ();
396
349
397
350
ChefBindingHandler::SwitchWorkerHandler (reinterpret_cast <intptr_t >(data));
398
- // DeviceLayer::PlatformMgr().ScheduleWork(ChefBindingHandler::SwitchWorkerHandler, reinterpret_cast<intptr_t>(data));
399
351
// TODO: Platform::Delete(data);
400
352
}
401
353
}
402
-
403
- #include " Rpc.h"
354
+ #endif // CONFIG_ENABLE_PW_RPC
404
355
405
356
void emberAfBindingClusterInitCallback (EndpointId endpoint)
406
357
{
407
- intptr_t ctx = 1 ;
408
358
printf (" \033 [41m %s, %d \033 [0m \n " , __func__, __LINE__);
409
359
410
360
ChefBindingHandler::GetInstance ().Init (endpoint);
361
+ #if CONFIG_ENABLE_PW_RPC == 1
362
+ intptr_t ctx = 1 ;
411
363
chip::rpc::RpcRegisterAppBindingCommandHander (ChefBindingCommandHandler, ctx);
412
- /*
413
- auto & server = chip::Server::GetInstance();
414
- chip::BindingManager::GetInstance().Init(
415
- { &server.GetFabricTable(), server.GetCASESessionManager(), &server.GetPersistentStorage() });
416
- chip::BindingManager::GetInstance().RegisterBoundDeviceChangedHandler(ChefBoundDeviceChangedHandler);
417
- chip::BindingManager::GetInstance().RegisterBoundDeviceContextReleaseHandler(ChefBoundDeviceContextReleaseHandler);
418
- */
364
+ #endif // CONFIG_ENABLE_PW_RPC
419
365
}
420
366
0 commit comments