• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 INIT_PARAM_COMM_H
17 #define INIT_PARAM_COMM_H
18 #include <stdint.h>
19 #include <stdatomic.h>
20 #include "beget_ext.h"
21 
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif
26 #endif /* __cplusplus */
27 
28 #define UDID_LEN 65
29 #define MAX_SERIAL_LEN 65
30 #define DISK_SN_LEN 20
31 #define DISK_SN_PATH_LEN 65
32 #define HASH_LENGTH 32
33 #define DEV_BUF_LENGTH 3
34 #define DEV_BUF_MAX_LENGTH 1024
35 
36 typedef char *(*PropertyValueProcessor)(const char *key, char *value);
37 
38 INIT_LOCAL_API const char *GetProperty(const char *key, const char **paramHolder);
39 #ifndef OHOS_LITE
40 INIT_LOCAL_API const char *GetPropertyAtomic(const char *key, const char **paramHolder);
41 #endif
42 INIT_LOCAL_API PropertyValueProcessor SetPropertyGetProcessor(PropertyValueProcessor processor);
43 INIT_LOCAL_API int GetParameter_(const char *key, const char *def, char *value, uint32_t len);
44 
45 INIT_LOCAL_API const char *GetProductModel_(void);
46 INIT_LOCAL_API const char *GetProductModelAlias_(void);
47 INIT_LOCAL_API const char *GetManufacture_(void);
48 INIT_LOCAL_API const char *GetSerial_(void);
49 INIT_LOCAL_API int GetDevUdid_(char *udid, int size);
50 INIT_LOCAL_API int GetDiskSN_(char *diskSN, int size);
51 INIT_LOCAL_API int IsValidParamValue(const char *value, uint32_t len);
52 
53 INIT_LOCAL_API const char *GetFullName_(void);
54 INIT_LOCAL_API int GetSystemError(int err);
55 #ifdef __cplusplus
56 #if __cplusplus
57 }
58 #endif
59 #endif /* __cplusplus */
60 
61 #endif // STARTUP_PARAM_COMM_H
62