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 #include <cstring>
17
18 #include "hal_sys_param.h"
19
20 #include "FileSystem.h"
21 #include "ModelManager.h"
22 #include "PreviewerEngineLog.h"
23
24 #ifdef __cplusplus
25 #if __cplusplus
26 extern "C" {
27 #endif
28 #endif /* __cplusplus */
29
30 static char g_mockString[2] = "";
31
HalGetDeviceType(void)32 const char* HalGetDeviceType(void)
33 {
34 ILOG("Get productType, result: %s", ModelManager::GetConfig().deviceType.c_str());
35 if (ModelManager::GetConfig().deviceType.empty()) {
36 ILOG("GetDeviceType is null.");
37 return nullptr;
38 }
39 return ModelManager::GetConfig().deviceType.c_str();
40 }
41
HalGetManufacture(void)42 const char* HalGetManufacture(void)
43 {
44 ILOG("Get manufacture, result: %s", ModelManager::GetConfig().manufactureName.c_str());
45 if (ModelManager::GetConfig().manufactureName.empty()) {
46 ILOG("GetManufacture is null.");
47 return nullptr;
48 }
49 return ModelManager::GetConfig().manufactureName.c_str();
50 }
51
HalGetBrand(void)52 const char* HalGetBrand(void)
53 {
54 ILOG("Get brand, result: %s", ModelManager::GetConfig().brandName.c_str());
55 if (ModelManager::GetConfig().brandName.empty()) {
56 ILOG("GetBrand is null.");
57 return nullptr;
58 }
59 return ModelManager::GetConfig().brandName.c_str();
60 }
61
HalGetMarketName(void)62 const char* HalGetMarketName(void)
63 {
64 return g_mockString;
65 }
66
HalGetProductSeries(void)67 const char* HalGetProductSeries(void)
68 {
69 return g_mockString;
70 }
71
HalGetProductModel(void)72 const char* HalGetProductModel(void)
73 {
74 ILOG("Get model, result: %s", ModelManager::GetConfig().modelName.c_str());
75 if (ModelManager::GetConfig().modelName.empty()) {
76 ILOG("GetProductModel is null.");
77 return nullptr;
78 }
79 return ModelManager::GetConfig().modelName.c_str();
80 }
81
HalGetSoftwareModel(void)82 const char* HalGetSoftwareModel(void)
83 {
84 return g_mockString;
85 }
86
HalGetHardwareModel(void)87 const char* HalGetHardwareModel(void)
88 {
89 return g_mockString;
90 }
91
HalGetHardwareProfile(void)92 const char* HalGetHardwareProfile(void)
93 {
94 return g_mockString;
95 }
96
HalGetSerial(void)97 const char* HalGetSerial(void)
98 {
99 return g_mockString;
100 }
101
HalGetBootloaderVersion(void)102 const char* HalGetBootloaderVersion(void)
103 {
104 return g_mockString;
105 }
106
HalGetAbiList(void)107 const char* HalGetAbiList(void)
108 {
109 return g_mockString;
110 }
111
HalGetDisplayVersion(void)112 const char* HalGetDisplayVersion(void)
113 {
114 return g_mockString;
115 }
116
HalGetIncrementalVersion(void)117 const char* HalGetIncrementalVersion(void)
118 {
119 return g_mockString;
120 }
121
HalGetBuildType(void)122 const char* HalGetBuildType(void)
123 {
124 return g_mockString;
125 }
126
HalGetBuildUser(void)127 const char* HalGetBuildUser(void)
128 {
129 return g_mockString;
130 }
131
HalGetBuildHost(void)132 const char* HalGetBuildHost(void)
133 {
134 return g_mockString;
135 }
136
HalGetBuildTime(void)137 const char* HalGetBuildTime(void)
138 {
139 return g_mockString;
140 }
141
HalGetFirstApiVersion(void)142 int HalGetFirstApiVersion(void)
143 {
144 return 0;
145 }
146
GetDataPath()147 const char* GetDataPath()
148 {
149 return FileSystem::GetVirtualFileSystemPath().data();
150 }
151
152 #ifdef __cplusplus
153 #if __cplusplus
154 }
155 #endif
156 #endif /* __cplusplus */
157