5 #include "ReportingCommand.h"
8 typedef void (*UnsupportedAttributeCallback)(void * context);
10 class Listen : public ReportingCommand
13 Listen() : ReportingCommand("listen")
20 {{#chip_server_cluster_attributes}}
21 {{#if (isReportableAttribute)}}
22 delete onReport{{asCamelCased parent.name false}}{{asCamelCased name false}}Callback;
24 {{/chip_server_cluster_attributes}}
28 void AddReportCallbacks(uint8_t endpointId) override
30 chip::app::CHIPDeviceCallbacksMgr & callbacksMgr = chip::app::CHIPDeviceCallbacksMgr::GetInstance();
32 {{#chip_server_cluster_attributes}}
33 {{#if (isReportableAttribute)}}
34 callbacksMgr.AddReportCallback(chip::kTestDeviceNodeId, endpointId, {{asHex parent.code 4}}, {{asHex attributeCode 4}}, onReport{{asCamelCased parent.name false}}{{asCamelCased name false}}Callback->Cancel());
36 {{/chip_server_cluster_attributes}}
40 static void OnDefaultSuccessResponse(void * context)
42 ChipLogProgress(chipTool, "Default Success Response");
45 static void OnDefaultFailureResponse(void * context, uint8_t status)
47 ChipLogProgress(chipTool, "Default Failure Response: 0x%02x", status);
50 static void OnUnsupportedAttributeResponse(void * context)
52 ChipLogError(chipTool, "Unsupported attribute Response. This should never happen !");
55 static void OnBooleanAttributeResponse(void * context, bool value)
57 ChipLogProgress(chipTool, "Boolean attribute Response: %d", value);
60 static void OnInt8uAttributeResponse(void * context, uint8_t value)
62 ChipLogProgress(chipTool, "Int8u attribute Response: %" PRIu8, value);
65 static void OnInt16uAttributeResponse(void * context, uint16_t value)
67 ChipLogProgress(chipTool, "Int16u attribute Response: %" PRIu16, value);
70 static void OnInt16sAttributeResponse(void * context, int16_t value)
72 ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value);
77 {{#chip_server_cluster_attributes}}
78 {{#if (isReportableAttribute)}}
79 chip::Callback::Callback<{{asCallbackAttributeType atomicTypeId}}AttributeCallback> * onReport{{asCamelCased parent.name false}}{{asCamelCased name false}}Callback = new chip::Callback::Callback<{{asCallbackAttributeType atomicTypeId}}AttributeCallback>(On{{asCallbackAttributeType atomicTypeId}}AttributeResponse, this);
81 {{/chip_server_cluster_attributes}}
85 void registerCommandsReporting(Commands & commands)
87 const char * clusterName = "Reporting";
89 commands_list clusterCommands = {
90 make_unique<Listen>(),
93 commands.Register(clusterName, clusterCommands);