3 * Copyright (c) 2020 Project CHIP Authors
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.
22 #include "LightingManager.h"
25 #include <platform/CHIPDeviceLayer.h>
36 void PostLightingActionRequest(LightingManager::Action_t aAction);
37 void PostEvent(AppEvent * event);
38 void UpdateClusterState();
41 friend class chip::rpc::LightingService;
42 friend AppTask & GetAppTask(void);
46 static void ActionInitiated(LightingManager::Action_t aAction, int32_t aActor);
47 static void ActionCompleted(LightingManager::Action_t aAction, int32_t aActor);
49 void CancelTimer(void);
51 void DispatchEvent(AppEvent * event);
53 static void FunctionTimerEventHandler(AppEvent * aEvent);
54 static void FunctionHandler(AppEvent * aEvent);
55 static void StartThreadHandler(AppEvent * aEvent);
56 static void LightingActionEventHandler(AppEvent * aEvent);
57 static void StartBLEAdvertisementHandler(AppEvent * aEvent);
59 static void ThreadProvisioningHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg);
61 static void ButtonEventHandler(uint32_t button_state, uint32_t has_changed);
62 static void TimerEventHandler(k_timer * timer);
64 void StartTimer(uint32_t aTimeoutInMs);
66 #ifdef CONFIG_CHIP_NFC_COMMISSIONING
72 kFunction_NoneSelected = 0,
73 kFunction_SoftwareUpdate = 0,
74 kFunction_FactoryReset,
80 bool mFunctionTimerActive;
81 static AppTask sAppTask;
84 inline AppTask & GetAppTask(void)
86 return AppTask::sAppTask;