Skip to content

Commit

Permalink
Generating the code using ZAP script
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarkov committed Jul 5, 2021
1 parent 6d787c0 commit ddd91e3
Show file tree
Hide file tree
Showing 12 changed files with 847 additions and 64 deletions.
156 changes: 149 additions & 7 deletions examples/chip-tool/commands/clusters/Commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,8 @@ class ReadApplicationBasicClusterRevision : public ModelCommand
|------------------------------------------------------------------------------|
| Attributes: | |
| * ApplicationLauncherList | 0x0000 |
| * CatalogVendorId | 0x0001 |
| * ApplicationId | 0x0002 |
| * ClusterRevision | 0xFFFD |
\*----------------------------------------------------------------------------*/

Expand Down Expand Up @@ -1805,6 +1807,74 @@ class ReadApplicationLauncherApplicationLauncherList : public ModelCommand
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Attribute CatalogVendorId
*/
class ReadApplicationLauncherCatalogVendorId : public ModelCommand
{
public:
ReadApplicationLauncherCatalogVendorId() : ModelCommand("read")
{
AddArgument("attr-name", "catalog-vendor-id");
ModelCommand::AddArguments();
}

~ReadApplicationLauncherCatalogVendorId()
{
delete onSuccessCallback;
delete onFailureCallback;
}

CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster (0x050C) command (0x00) on endpoint %" PRIu8, endpointId);

chip::Controller::ApplicationLauncherCluster cluster;
cluster.Associate(device, endpointId);
return cluster.ReadAttributeCatalogVendorId(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
}

private:
chip::Callback::Callback<Int8uAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<Int8uAttributeCallback>(OnInt8uAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Attribute ApplicationId
*/
class ReadApplicationLauncherApplicationId : public ModelCommand
{
public:
ReadApplicationLauncherApplicationId() : ModelCommand("read")
{
AddArgument("attr-name", "application-id");
ModelCommand::AddArguments();
}

~ReadApplicationLauncherApplicationId()
{
delete onSuccessCallback;
delete onFailureCallback;
}

CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster (0x050C) command (0x00) on endpoint %" PRIu8, endpointId);

chip::Controller::ApplicationLauncherCluster cluster;
cluster.Associate(device, endpointId);
return cluster.ReadAttributeApplicationId(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
}

private:
chip::Callback::Callback<Int8uAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<Int8uAttributeCallback>(OnInt8uAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Attribute ClusterRevision
*/
Expand Down Expand Up @@ -1848,6 +1918,7 @@ class ReadApplicationLauncherClusterRevision : public ModelCommand
|------------------------------------------------------------------------------|
| Attributes: | |
| * AudioOutputList | 0x0000 |
| * CurrentAudioOutput | 0x0001 |
| * ClusterRevision | 0xFFFD |
\*----------------------------------------------------------------------------*/

Expand Down Expand Up @@ -1987,6 +2058,40 @@ class ReadAudioOutputAudioOutputList : public ModelCommand
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Attribute CurrentAudioOutput
*/
class ReadAudioOutputCurrentAudioOutput : public ModelCommand
{
public:
ReadAudioOutputCurrentAudioOutput() : ModelCommand("read")
{
AddArgument("attr-name", "current-audio-output");
ModelCommand::AddArguments();
}

~ReadAudioOutputCurrentAudioOutput()
{
delete onSuccessCallback;
delete onFailureCallback;
}

CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster (0x050B) command (0x00) on endpoint %" PRIu8, endpointId);

chip::Controller::AudioOutputCluster cluster;
cluster.Associate(device, endpointId);
return cluster.ReadAttributeCurrentAudioOutput(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
}

private:
chip::Callback::Callback<Int8uAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<Int8uAttributeCallback>(OnInt8uAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Attribute ClusterRevision
*/
Expand Down Expand Up @@ -11738,6 +11843,7 @@ class ReadLowPowerClusterRevision : public ModelCommand
|------------------------------------------------------------------------------|
| Attributes: | |
| * MediaInputList | 0x0000 |
| * CurrentMediaInput | 0x0001 |
| * ClusterRevision | 0xFFFD |
\*----------------------------------------------------------------------------*/

Expand Down Expand Up @@ -11935,6 +12041,40 @@ class ReadMediaInputMediaInputList : public ModelCommand
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Attribute CurrentMediaInput
*/
class ReadMediaInputCurrentMediaInput : public ModelCommand
{
public:
ReadMediaInputCurrentMediaInput() : ModelCommand("read")
{
AddArgument("attr-name", "current-media-input");
ModelCommand::AddArguments();
}

~ReadMediaInputCurrentMediaInput()
{
delete onSuccessCallback;
delete onFailureCallback;
}

CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override
{
ChipLogProgress(chipTool, "Sending cluster (0x0507) command (0x00) on endpoint %" PRIu8, endpointId);

chip::Controller::MediaInputCluster cluster;
cluster.Associate(device, endpointId);
return cluster.ReadAttributeCurrentMediaInput(onSuccessCallback->Cancel(), onFailureCallback->Cancel());
}

private:
chip::Callback::Callback<Int8uAttributeCallback> * onSuccessCallback =
new chip::Callback::Callback<Int8uAttributeCallback>(OnInt8uAttributeResponse, this);
chip::Callback::Callback<DefaultFailureCallback> * onFailureCallback =
new chip::Callback::Callback<DefaultFailureCallback>(OnDefaultFailureResponse, this);
};

/*
* Attribute ClusterRevision
*/
Expand Down Expand Up @@ -22396,6 +22536,8 @@ void registerClusterApplicationLauncher(Commands & commands)
make_unique<ApplicationLauncherLaunchApp>(),
make_unique<DiscoverApplicationLauncherAttributes>(),
make_unique<ReadApplicationLauncherApplicationLauncherList>(),
make_unique<ReadApplicationLauncherCatalogVendorId>(),
make_unique<ReadApplicationLauncherApplicationId>(),
make_unique<ReadApplicationLauncherClusterRevision>(),
};

Expand All @@ -22406,9 +22548,9 @@ void registerClusterAudioOutput(Commands & commands)
const char * clusterName = "AudioOutput";

commands_list clusterCommands = {
make_unique<AudioOutputRenameOutput>(), make_unique<AudioOutputSelectOutput>(),
make_unique<DiscoverAudioOutputAttributes>(), make_unique<ReadAudioOutputAudioOutputList>(),
make_unique<ReadAudioOutputClusterRevision>(),
make_unique<AudioOutputRenameOutput>(), make_unique<AudioOutputSelectOutput>(),
make_unique<DiscoverAudioOutputAttributes>(), make_unique<ReadAudioOutputAudioOutputList>(),
make_unique<ReadAudioOutputCurrentAudioOutput>(), make_unique<ReadAudioOutputClusterRevision>(),
};

commands.Register(clusterName, clusterCommands);
Expand Down Expand Up @@ -22845,10 +22987,10 @@ void registerClusterMediaInput(Commands & commands)
const char * clusterName = "MediaInput";

commands_list clusterCommands = {
make_unique<MediaInputHideInputStatus>(), make_unique<MediaInputRenameInput>(),
make_unique<MediaInputSelectInput>(), make_unique<MediaInputShowInputStatus>(),
make_unique<DiscoverMediaInputAttributes>(), make_unique<ReadMediaInputMediaInputList>(),
make_unique<ReadMediaInputClusterRevision>(),
make_unique<MediaInputHideInputStatus>(), make_unique<MediaInputRenameInput>(),
make_unique<MediaInputSelectInput>(), make_unique<MediaInputShowInputStatus>(),
make_unique<DiscoverMediaInputAttributes>(), make_unique<ReadMediaInputMediaInputList>(),
make_unique<ReadMediaInputCurrentMediaInput>(), make_unique<ReadMediaInputClusterRevision>(),
};

commands.Register(clusterName, clusterCommands);
Expand Down
Loading

0 comments on commit ddd91e3

Please sign in to comment.