AppTask.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. *
  3. * Copyright (c) 2020 Project CHIP Authors
  4. * Copyright (c) 2019 Google LLC.
  5. * All rights reserved.
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. #pragma once
  20. /**********************************************************
  21. * Includes
  22. *********************************************************/
  23. #include <stdbool.h>
  24. #include <stdint.h>
  25. #include "BaseApplication.h"
  26. #include "FreeRTOS.h"
  27. #include "timers.h" // provides FreeRTOS timer support
  28. #include <ble/BLEEndPoint.h>
  29. #include <lib/core/CHIPError.h>
  30. #include <platform/CHIPDeviceLayer.h>
  31. /**********************************************************
  32. * AppTask Declaration
  33. *********************************************************/
  34. class AppTask : public BaseApplication
  35. {
  36. public:
  37. AppTask() = default;
  38. static AppTask & GetAppTask() { return sAppTask; }
  39. /**
  40. * @brief AppTask task main loop function
  41. *
  42. * @param pvParameter FreeRTOS task parameter
  43. */
  44. static void AppTaskMain(void * pvParameter);
  45. CHIP_ERROR StartAppTask();
  46. static void ButtonEventHandler(uint8_t button, uint8_t btnAction);
  47. private:
  48. static AppTask sAppTask;
  49. /**
  50. * @brief AppTask initialisation function
  51. *
  52. * @return CHIP_ERROR
  53. */
  54. CHIP_ERROR Init();
  55. };