• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 LNN_MODULE_INIT_MONITOR_H
17 #define LNN_MODULE_INIT_MONITOR_H
18 
19 #include <stdint.h>
20 #include <stdbool.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define MONITOR_DELAY 1000
27 #define DELAY_FIVE_MIN_LEN 300000
28 #define DEP_INFO_LEN 1024
29 
30 typedef enum {
31     NOTIFY_MODULE,
32     NOTIFY_LEDGER
33 } InitNotifyType;
34 
35 typedef enum {
36     MONITOR_WIFI_NET,
37     MONITOR_BLE_NET
38 } MonitorNetType;
39 
40 typedef enum {
41     INIT_DEPS_DEVICE_PROFILE = 0,
42     INIT_DEPS_SCREEN_STATUS,
43     INIT_DEPS_NETLINK,
44     INIT_DEPS_PROCESS_BOOT,
45     INIT_DEPS_KVSTORE,
46     INIT_DEPS_DATA_SHARE,
47     INIT_DEPS_HUKS,
48     INIT_DEPS_HICHAIN,
49     INIT_DEPS_BLUETOOTH,
50     INIT_DEPS_USB,
51     INIT_DEPS_MODULE_BUTT
52 } InitModuleDeps;
53 
54 typedef enum {
55     LEDGER_INFO_DEVICE_NAME,
56     LEDGER_INFO_UUID,
57     LEDGER_INFO_UDID,
58     LEDGER_INFO_NETWORKID,
59     LEDGER_INFO_DEVICE_SECURITY_LEVEL,
60     LEDGER_INFO_ACCOUNTID,
61     LEDGER_INFO_BUTT
62 } LedgerInfoDeps;
63 
64 typedef enum {
65     DEPS_STATUS_NOT_INIT,
66     DEPS_STATUS_INIT_PROGRESS,
67     DEPS_STATUS_SUCCESS,
68     DEPS_STATUS_FAILED,
69 } InitDepsStatus;
70 
71 typedef int32_t (*ModuleInitCallBack)(void);
72 
73 bool IsLnnInitCheckSucceed(uint32_t netType);
74 void LnnInitMonitorInit(void);
75 void LnnModuleInitMonitorCheckStart(void);
76 
77 void LnnInitModuleReturnSet(uint32_t module, int32_t ret);
78 void LnnInitModuleStatusSet(uint32_t module, InitDepsStatus status);
79 void LnnInitDeviceInfoStatusSet(uint32_t module, InitDepsStatus status);
80 
81 int32_t LnnInitModuleNotifyWithRetryAsync(uint32_t module, ModuleInitCallBack callback, uint32_t retryMax,
82     uint32_t delay, bool isFirstDelay);
83 int32_t LnnInitModuleNotifyWithRetrySync(uint32_t module, ModuleInitCallBack callback, uint32_t retry,
84     uint32_t delay);
85 void LnnModuleMonitorRestartNetwork(void);
86 
87 void LnnInitSetDeviceInfoReady(void);
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 #endif /* LNN_MODULE_INIT_MONITOR_H */
93