3 * Copyright (c) 2020 Google LLC.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
25 #include "BoltLockManager.h"
27 #include <platform/CHIPDeviceLayer.h>
36 static void AppTaskMain(void * pvParameter);
38 void PostLockActionRequest(int32_t aActor, BoltLockManager::Action_t aAction);
39 void PostEvent(const AppEvent * event);
41 void UpdateClusterState(void);
44 friend AppTask & GetAppTask(void);
48 static void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor);
49 static void ActionCompleted(BoltLockManager::Action_t aAction);
51 void CancelTimer(void);
53 void DispatchEvent(AppEvent * event);
55 static void FunctionTimerEventHandler(AppEvent * aEvent);
56 static void KBD_Callback(uint8_t events);
57 static void HandleKeyboard(void);
58 static void JoinHandler(AppEvent * aEvent);
59 static void BleHandler(AppEvent * aEvent);
60 static void LockActionEventHandler(AppEvent * aEvent);
61 static void ResetActionEventHandler(AppEvent * aEvent);
62 static void InstallEventHandler(AppEvent * aEvent);
64 static void ButtonEventHandler(uint8_t pin_no, uint8_t button_action);
65 static void TimerEventHandler(TimerHandle_t xTimer);
67 static void ThreadStart();
68 void StartTimer(uint32_t aTimeoutInMs);
72 kFunction_NoneSelected = 0,
73 kFunction_SoftwareUpdate = 0,
74 kFunction_FactoryReset,
81 bool mResetTimerActive;
83 static AppTask sAppTask;
86 inline AppTask & GetAppTask(void)
88 return AppTask::sAppTask;