1 /* 2 * Copyright (c) 2023 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 BASE_STARTUP_PARAM_INIT_H 17 #define BASE_STARTUP_PARAM_INIT_H 18 #include <stdint.h> 19 #include <stdio.h> 20 21 #ifdef __cplusplus 22 #if __cplusplus 23 extern "C" { 24 #endif 25 #endif 26 27 #ifndef BASE_STARTUP_INIT_PARAM_H 28 typedef uint32_t ParamHandle; 29 #endif 30 31 /** 32 * 外部接口 33 * 查询参数,主要用于其他进程使用,需要给定足够的内存保存参数。 34 * 如果 value == null,获取value的长度 35 * 否则value的大小认为是len 36 * 37 */ 38 int SystemGetParameterName(ParamHandle handle, char *name, unsigned int len); 39 40 /** 41 * 外部接口 42 * 遍历参数。 43 * 44 */ 45 int SystemTraversalParameter(const char *prefix, 46 void (*traversalParameter)(ParamHandle handle, void *cookie), void *cookie); 47 48 long long GetSystemCommitId(void); 49 50 /** 51 * 外部接口 52 * 获取参数值。 53 * 54 */ 55 int SystemGetParameterValue(ParamHandle handle, char *value, unsigned int *len); 56 57 /** 58 * 对外接口 59 * 根据handle获取对应数据的修改标识。 60 * commitId 获取计数变化 61 * 62 */ 63 int SystemGetParameterCommitId(ParamHandle handle, uint32_t *commitId); 64 65 /** 66 * 对外接口 67 * 查询参数,主要用于其他进程使用,找到对应属性的handle。 68 * 69 */ 70 int SystemFindParameter(const char *name, ParamHandle *handle); 71 72 #ifdef __cplusplus 73 #if __cplusplus 74 } 75 #endif 76 #endif 77 #endif