Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / lock-app / cc13x2x7_26x2x7 / main / include / AppTask.h
1 /*
2  *    Copyright (c) 2020 Project CHIP Authors
3  *    Copyright (c) 2019 Google LLC.
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
19 #ifndef APP_TASK_H
20 #define APP_TASK_H
21
22 #include <stdbool.h>
23 #include <stdint.h>
24
25 #include "FreeRTOS.h"
26 #include "semphr.h"
27 #include "task.h"
28
29 #include "AppEvent.h"
30 #include "BoltLockManager.h"
31
32 #include <ti/drivers/apps/Button.h>
33
34 class AppTask
35 {
36 public:
37     int StartAppTask();
38     static void AppTaskMain(void * pvParameter);
39
40     void PostLockActionRequest(int32_t aActor, BoltLockManager::Action_t aAction);
41     void PostEvent(const AppEvent * event);
42
43 private:
44     friend AppTask & GetAppTask(void);
45
46     int Init();
47
48     // should this be done by BoltLock Manager? I don't want to unravel this spaghetti quite yet
49     static void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor);
50     static void ActionCompleted(BoltLockManager::Action_t aAction);
51
52     void DispatchEvent(AppEvent * event);
53
54     static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events);
55     static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events);
56     static void TimerEventHandler(void * p_context);
57
58     enum Function_t
59     {
60         kFunction_NoneSelected   = 0,
61         kFunction_SoftwareUpdate = 0,
62         kFunction_FactoryReset,
63
64         kFunction_Invalid
65     } Function;
66
67     Function_t mFunction;
68     bool mFunctionTimerActive;
69
70     static AppTask sAppTask;
71 };
72
73 inline AppTask & GetAppTask(void)
74 {
75     return AppTask::sAppTask;
76 }
77
78 #endif // APP_TASK_H