12ee81decSopenharmony_ci/*
22ee81decSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
32ee81decSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42ee81decSopenharmony_ci * you may not use this file except in compliance with the License.
52ee81decSopenharmony_ci * You may obtain a copy of the License at
62ee81decSopenharmony_ci *
72ee81decSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
82ee81decSopenharmony_ci *
92ee81decSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102ee81decSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112ee81decSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122ee81decSopenharmony_ci * See the License for the specific language governing permissions and
132ee81decSopenharmony_ci * limitations under the License.
142ee81decSopenharmony_ci */
152ee81decSopenharmony_ci
162ee81decSopenharmony_ci#ifndef DSLM_FSM_PROCESS_H
172ee81decSopenharmony_ci#define DSLM_FSM_PROCESS_H
182ee81decSopenharmony_ci
192ee81decSopenharmony_ci#include <stdint.h>
202ee81decSopenharmony_ci
212ee81decSopenharmony_ci#include "dslm_core_defines.h"
222ee81decSopenharmony_ci
232ee81decSopenharmony_ci#ifdef __cplusplus
242ee81decSopenharmony_ciextern "C" {
252ee81decSopenharmony_ci#endif
262ee81decSopenharmony_ci
272ee81decSopenharmony_ci// item state
282ee81decSopenharmony_cienum {
292ee81decSopenharmony_ci    STATE_INIT = 0,
302ee81decSopenharmony_ci    STATE_WAITING_CRED_RSP = 1,
312ee81decSopenharmony_ci    STATE_SUCCESS = 2,
322ee81decSopenharmony_ci    STATE_FAILED = 3,
332ee81decSopenharmony_ci};
342ee81decSopenharmony_ci
352ee81decSopenharmony_ci// item event
362ee81decSopenharmony_cienum {
372ee81decSopenharmony_ci    EVENT_DEVICE_ONLINE = 0,
382ee81decSopenharmony_ci    EVENT_CRED_RSP = 1,
392ee81decSopenharmony_ci    EVENT_MSG_SEND_FAILED = 2,
402ee81decSopenharmony_ci    EVENT_DEVICE_OFFLINE = 3,
412ee81decSopenharmony_ci    EVENT_TIME_OUT = 4,
422ee81decSopenharmony_ci    EVENT_SDK_GET = 5,
432ee81decSopenharmony_ci    EVENT_SDK_TIMEOUT = 6,
442ee81decSopenharmony_ci    EVENT_CHECK = 7,
452ee81decSopenharmony_ci    EVENT_TO_SYNC = 8,
462ee81decSopenharmony_ci};
472ee81decSopenharmony_ci
482ee81decSopenharmony_civoid InitDslmStateMachine(DslmDeviceInfo *info);
492ee81decSopenharmony_civoid ScheduleDslmStateMachine(DslmDeviceInfo *info, uint32_t event, const void *para);
502ee81decSopenharmony_ciuint32_t GetCurrentMachineState(const DslmDeviceInfo *info);
512ee81decSopenharmony_civoid LockDslmStateMachine(DslmDeviceInfo *info);
522ee81decSopenharmony_civoid UnLockDslmStateMachine(DslmDeviceInfo *info);
532ee81decSopenharmony_ci
542ee81decSopenharmony_ci#ifdef __cplusplus
552ee81decSopenharmony_ci}
562ee81decSopenharmony_ci#endif
572ee81decSopenharmony_ci#endif // DSLM_FSM_PROCESS_H
58