1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DSLM_FSM_PROCESS_H 17 #define DSLM_FSM_PROCESS_H 18 19 #include <stdint.h> 20 21 #include "dslm_core_defines.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 // item state 28 enum { 29 STATE_INIT = 0, 30 STATE_WAITING_CRED_RSP = 1, 31 STATE_SUCCESS = 2, 32 STATE_FAILED = 3, 33 }; 34 35 // item event 36 enum { 37 EVENT_DEVICE_ONLINE = 0, 38 EVENT_CRED_RSP = 1, 39 EVENT_MSG_SEND_FAILED = 2, 40 EVENT_DEVICE_OFFLINE = 3, 41 EVENT_TIME_OUT = 4, 42 EVENT_SDK_GET = 5, 43 EVENT_SDK_TIMEOUT = 6, 44 EVENT_CHECK = 7, 45 EVENT_TO_SYNC = 8, 46 }; 47 48 void InitDslmStateMachine(DslmDeviceInfo *info); 49 void ScheduleDslmStateMachine(DslmDeviceInfo *info, uint32_t event, const void *para); 50 uint32_t GetCurrentMachineState(const DslmDeviceInfo *info); 51 void LockDslmStateMachine(DslmDeviceInfo *info); 52 void UnLockDslmStateMachine(DslmDeviceInfo *info); 53 54 #ifdef __cplusplus 55 } 56 #endif 57 #endif // DSLM_FSM_PROCESS_H 58