Skip to content

Commit

Permalink
[Resyle] fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
pankore committed Oct 4, 2022
1 parent 7c718bb commit ef62308
Show file tree
Hide file tree
Showing 8 changed files with 605 additions and 509 deletions.
33 changes: 20 additions & 13 deletions examples/all-clusters-app/ameba/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,18 @@ to be On or Off.

- Open the USB-TTL serial port and type `help` to view the available commands

- To know what are the available subcommands and what it does, simply enter the command that you are interested in
- To know what are the available subcommands and what it does, simply enter
the command that you are interested in

> switch
> switch
help Usage: switch <subcommand>
onoff Usage: switch onoff <subcommand>
levelcontrol Usage: switch levlecontrol <subcommand>
colorcontrol Usage: switch colorcontrol <subcommand>
thermostat Usage: switch thermostat <subcommand>
groups Usage: switch groups <subcommand>
binding Usage: switch binding <subcommand>

> switch onoff
help Usage: switch ononff <subcommand>
on on Usage: switch onoff on
Expand All @@ -170,33 +171,39 @@ to be On or Off.
$ ./chip-tool pairing ble-wifi 1 <SSID> <PASSWORD> 20202021 3840
$ ./chip-tool pairing ble-wifi 2 <SSID> <PASSWORD> 20202021 3840

- After successful commissioning, configure the ACL in the controllee device to
allow access from switch device and chip-tool.
- After successful commissioning, configure the ACL in the controllee device
to allow access from switch device and chip-tool.

$ ./chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null },{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [1], "targets": null }]' 2 0

- Bind the endpoint 1 OnOff cluster of the controllee device to the switch device.
- Bind the endpoint 1 OnOff cluster of the controllee device to the switch
device.

$ ./chip-tool binding write binding '[{"fabricIndex": 1, "node":2, "endpoint":1, "cluster":6}]' 1 1

- Send OnOff command to the device through the switch device's Matter Shell

> switch onoff on
> switch onoff off
- You may also bind more than one cluster to the switch device. Below command binds the Identify, OnOff, LevelControl, ColorControl and Thermostat clusters to the switch device.


- You may also bind more than one cluster to the switch device. Below command
binds the Identify, OnOff, LevelControl, ColorControl and Thermostat
clusters to the switch device.

$ ./chip-tool binding write binding '[{"fabricIndex": 1, "node":2, "endpoint":1, "cluster":3}, {"fabricIndex": 1, "node":2, "endpoint":1, "cluster":6}, {"fabricIndex": 1, "node":2, "endpoint":1, "cluster":8}, {"fabricIndex": 1, "node":2, "endpoint":1, "cluster":768}, {"fabricIndex": 1, "node":2, "endpoint":1, "cluster":513}]' 1 1
- After binding the clusters, you may send these cluster commands to the controllee device through the switch device's Matter Shell. Follow the format shown in the description of the commands.


- After binding the clusters, you may send these cluster commands to the
controllee device through the switch device's Matter Shell. Follow the
format shown in the description of the commands.

> switch onoff on
> switch levelcontrol movetolevel 100 0 0 0
> switch colorcontrol movetohue 100 0 0 0 0
> switch thermostat SPRL 0 0


- You may also request to read cluster attributes from Matter Shell

> switch <cluster> read <attribute>
219 changes: 153 additions & 66 deletions examples/all-clusters-app/ameba/main/BindingHandler.cpp

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/all-clusters-app/ameba/main/include/BindingHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

#pragma once

#include "app-common/zap-generated/ids/Attributes.h"
#include "app-common/zap-generated/ids/Clusters.h"
#include "app-common/zap-generated/ids/Commands.h"
#include "app-common/zap-generated/ids/Attributes.h"
#include "lib/core/CHIPError.h"

CHIP_ERROR InitBindingHandler();
Expand All @@ -33,7 +33,7 @@ struct BindingCommandData
chip::EndpointId localEndpointId = 1;
chip::CommandId commandId;
chip::ClusterId clusterId;
bool isGroup = false;
bool isGroup = false;
bool isReadAttribute = false;
uint32_t args[7];
};
540 changes: 271 additions & 269 deletions examples/all-clusters-app/ameba/main/include/ColorControlCommands.h

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions examples/all-clusters-app/ameba/main/include/IdentifyCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ void ProcessIdentifyUnicastBindingRead(BindingCommandData * data, const EmberBin
switch (data->attributeId)
{
case Clusters::Identify::Attributes::AttributeList::Id:
Controller::ReadAttribute<Clusters::Identify::Attributes::AttributeList::TypeInfo>(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
onSuccess, onFailure);
Controller::ReadAttribute<Clusters::Identify::Attributes::AttributeList::TypeInfo>(
peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, onSuccess, onFailure);
break;

case Clusters::Identify::Attributes::IdentifyTime::Id:
Controller::ReadAttribute<Clusters::Identify::Attributes::IdentifyTime::TypeInfo>(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
onSuccess, onFailure);
Controller::ReadAttribute<Clusters::Identify::Attributes::IdentifyTime::TypeInfo>(
peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, onSuccess, onFailure);
break;

case Clusters::Identify::Attributes::IdentifyType::Id:
Controller::ReadAttribute<Clusters::Identify::Attributes::IdentifyType::TypeInfo>(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
onSuccess, onFailure);
Controller::ReadAttribute<Clusters::Identify::Attributes::IdentifyType::TypeInfo>(
peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, onSuccess, onFailure);
break;
}
}

void ProcessIdentifyUnicastBindingCommand(BindingCommandData * data, const EmberBindingTableEntry & binding,
OperationalDeviceProxy * peer_device)
OperationalDeviceProxy * peer_device)
{
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
ChipLogProgress(NotSpecified, "Identify command succeeds");
Expand All @@ -97,7 +97,7 @@ void ProcessIdentifyUnicastBindingCommand(BindingCommandData * data, const Ember

case Clusters::Identify::Commands::TriggerEffect::Id:
triggerEffectCommand.effectIdentifier = static_cast<EmberAfIdentifyEffectIdentifier>(data->args[0]);
triggerEffectCommand.effectVariant = static_cast<EmberAfIdentifyEffectVariant>(data->args[1]);
triggerEffectCommand.effectVariant = static_cast<EmberAfIdentifyEffectVariant>(data->args[1]);
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
triggerEffectCommand, onSuccess, onFailure);
break;
Expand All @@ -120,7 +120,7 @@ void ProcessIdentifyGroupBindingCommand(BindingCommandData * data, const EmberBi

case Clusters::Identify::Commands::TriggerEffect::Id:
triggerEffectCommand.effectIdentifier = static_cast<EmberAfIdentifyEffectIdentifier>(data->args[0]);
triggerEffectCommand.effectVariant = static_cast<EmberAfIdentifyEffectVariant>(data->args[1]);
triggerEffectCommand.effectVariant = static_cast<EmberAfIdentifyEffectVariant>(data->args[1]);
Controller::InvokeGroupCommandRequest(&exchangeMgr, binding.fabricIndex, binding.groupId, triggerEffectCommand);
break;
}
Expand Down Expand Up @@ -267,4 +267,4 @@ CHIP_ERROR GroupTriggerEffectSwitchCommandHandler(int argc, char ** argv)
DeviceLayer::PlatformMgr().ScheduleWork(SwitchWorkerFunction, reinterpret_cast<intptr_t>(data));
return CHIP_NO_ERROR;
}
#endif //CONFIG_ENABLE_CHIP_SHELL
#endif // CONFIG_ENABLE_CHIP_SHELL
Loading

0 comments on commit ef62308

Please sign in to comment.