xref: /ide/tools/previewer/mock/lite/HalSysParam.cpp (revision 7c804472)
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
26extern "C" {
27#endif
28#endif /* __cplusplus */
29
30static char g_mockString[2] = "";
31
32const 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
42const 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
52const 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
62const char* HalGetMarketName(void)
63{
64    return g_mockString;
65}
66
67const char* HalGetProductSeries(void)
68{
69    return g_mockString;
70}
71
72const 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
82const char* HalGetSoftwareModel(void)
83{
84    return g_mockString;
85}
86
87const char* HalGetHardwareModel(void)
88{
89    return g_mockString;
90}
91
92const char* HalGetHardwareProfile(void)
93{
94    return g_mockString;
95}
96
97const char* HalGetSerial(void)
98{
99    return g_mockString;
100}
101
102const char* HalGetBootloaderVersion(void)
103{
104    return g_mockString;
105}
106
107const char* HalGetAbiList(void)
108{
109    return g_mockString;
110}
111
112const char* HalGetDisplayVersion(void)
113{
114    return g_mockString;
115}
116
117const char* HalGetIncrementalVersion(void)
118{
119    return g_mockString;
120}
121
122const char* HalGetBuildType(void)
123{
124    return g_mockString;
125}
126
127const char* HalGetBuildUser(void)
128{
129    return g_mockString;
130}
131
132const char* HalGetBuildHost(void)
133{
134    return g_mockString;
135}
136
137const char* HalGetBuildTime(void)
138{
139    return g_mockString;
140}
141
142int HalGetFirstApiVersion(void)
143{
144    return 0;
145}
146
147const char* GetDataPath()
148{
149    return FileSystem::GetVirtualFileSystemPath().data();
150}
151
152#ifdef __cplusplus
153#if __cplusplus
154}
155#endif
156#endif /* __cplusplus */
157