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