AllClustersCommandDelegate.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. *
  3. * Copyright (c) 2022 Project CHIP Authors
  4. * All rights reserved.
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #pragma once
  19. #include "NamedPipeCommands.h"
  20. #include <json/json.h>
  21. #include <platform/DiagnosticDataProvider.h>
  22. class AllClustersAppCommandHandler
  23. {
  24. public:
  25. static AllClustersAppCommandHandler * FromJSON(const char * json);
  26. static void HandleCommand(intptr_t context);
  27. AllClustersAppCommandHandler(Json::Value && jasonValue) : mJsonValue(std::move(jasonValue)) {}
  28. private:
  29. Json::Value mJsonValue;
  30. bool IsClusterPresentOnAnyEndpoint(chip::ClusterId clusterId);
  31. /**
  32. * Should be called when a reason that caused the device to start-up has been set.
  33. */
  34. void OnRebootSignalHandler(chip::DeviceLayer::BootReasonType bootReason);
  35. /**
  36. * Should be called when a general fault takes place on the Node.
  37. */
  38. void OnGeneralFaultEventHandler(uint32_t eventId);
  39. /**
  40. * Should be called when a software fault takes place on the Node.
  41. */
  42. void OnSoftwareFaultEventHandler(uint32_t eventId);
  43. /**
  44. * Should be called when the latching switch is moved to a new position.
  45. */
  46. void OnSwitchLatchedHandler(uint8_t newPosition);
  47. /**
  48. * Should be called when the momentary switch starts to be pressed.
  49. */
  50. void OnSwitchInitialPressedHandler(uint8_t newPosition);
  51. /**
  52. * Should be called when the momentary switch has been pressed for a "long" time.
  53. */
  54. void OnSwitchLongPressedHandler(uint8_t newPosition);
  55. /**
  56. * Should be called when the momentary switch has been released.
  57. */
  58. void OnSwitchShortReleasedHandler(uint8_t previousPosition);
  59. /**
  60. * Should be called when the momentary switch has been released after having been pressed for a long time.
  61. */
  62. void OnSwitchLongReleasedHandler(uint8_t previousPosition);
  63. /**
  64. * Should be called to indicate how many times the momentary switch has been pressed in a multi-press
  65. * sequence, during that sequence.
  66. */
  67. void OnSwitchMultiPressOngoingHandler(uint8_t newPosition, uint8_t count);
  68. /**
  69. * Should be called to indicate how many times the momentary switch has been pressed in a multi-press
  70. * sequence, after it has been detected that the sequence has ended.
  71. */
  72. void OnSwitchMultiPressCompleteHandler(uint8_t previousPosition, uint8_t count);
  73. /**
  74. * Should be called when it is necessary to change the mode to manual operation.
  75. */
  76. void OnModeChangeHandler(std::string device, std::string type, chip::app::DataModel::Nullable<uint8_t> mode);
  77. /**
  78. * Should be called when it is necessary to change the air quality attribute.
  79. */
  80. void OnAirQualityChange(uint32_t aEnum);
  81. };
  82. class AllClustersCommandDelegate : public NamedPipeCommandDelegate
  83. {
  84. public:
  85. void OnEventCommandReceived(const char * json) override;
  86. };