AppEvent.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. *
  3. * Copyright (c) 2020 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. struct AppEvent;
  20. typedef void (*EventHandler)(AppEvent *);
  21. #include <app/clusters/window-covering-server/window-covering-server.h>
  22. #include <lib/core/CHIPError.h>
  23. using namespace chip::app::Clusters::WindowCovering;
  24. struct AppEvent
  25. {
  26. enum AppEventTypes
  27. {
  28. kEventType_Button = 0,
  29. kEventType_Timer,
  30. kEventType_Light,
  31. kEventType_Install,
  32. kEventType_ButtonDown,
  33. kEventType_ButtonUp,
  34. kEventType_None,
  35. kEventType_Reset,
  36. kEventType_ResetPressed,
  37. kEventType_ResetWarning,
  38. kEventType_ResetCanceled,
  39. // Button events
  40. kEventType_UpPressed,
  41. kEventType_UpReleased,
  42. kEventType_DownPressed,
  43. kEventType_DownReleased,
  44. // Cover events
  45. kEventType_CoverChange,
  46. kEventType_CoverTypeChange,
  47. kEventType_TiltModeChange,
  48. // Cover Attribute update events
  49. kEventType_AttributeChange,
  50. // Provisioning events
  51. kEventType_ProvisionedStateChanged,
  52. kEventType_ConnectivityStateChanged,
  53. kEventType_BLEConnectionsChanged,
  54. kEventType_WinkOff,
  55. kEventType_WinkOn,
  56. };
  57. uint16_t Type;
  58. chip::EndpointId mEndpoint = 0;
  59. chip::AttributeId mAttributeId;
  60. union
  61. {
  62. struct
  63. {
  64. uint8_t Action;
  65. } ButtonEvent;
  66. struct
  67. {
  68. void * Context;
  69. } TimerEvent;
  70. struct
  71. {
  72. void * Context;
  73. } WindowEvent;
  74. };
  75. EventHandler Handler;
  76. };