1 /* 2 * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. 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 "hal_sys_param.h" 17 18 #define OHOS_DEVICE_TYPE "liteWearable" 19 #define OHOS_DISPLAY_VERSION "OpenHarmony-2.2-Beta2" 20 #define OHOS_MANUFACTURE "Bestechnic" 21 #define OHOS_BRAND "Bestechnic" 22 #define OHOS_MARKET_NAME "****" 23 #define OHOS_PRODUCT_SERIES "****" 24 #define OHOS_PRODUCT_MODEL "****" 25 #define OHOS_SOFTWARE_MODEL "****" 26 #define OHOS_HARDWARE_MODEL "bes2600w" 27 #define OHOS_HARDWARE_PROFILE "aout:true,display:true" 28 #define OHOS_BOOTLOADER_VERSION "bootloader" 29 #define OHOS_ABI_LIST "****" 30 #define OHOS_SERIAL "1234567890" 31 #define OHOS_FIRST_API_VERSION 1 32 #define ETH_ALEN 6 33 #define MAC_BITS 4 34 #define HEX_A 0xa 35 #define MAC_HIGH_MASK 0xf0 36 #define MAC_LOW_MASK 0x0f 37 #define CHAR_NUM_OFFSET 0x30 38 #define CHAR_CAPITAL_OFFSET 0x37 39 #define STR_END_FLAG '\0' 40 41 typedef unsigned char u8; 42 43 static char serialNumber[2*ETH_ALEN + 1]; 44 HalGetDeviceType(void)45const char* HalGetDeviceType(void) 46 { 47 return OHOS_DEVICE_TYPE; 48 } 49 HalGetManufacture(void)50const char* HalGetManufacture(void) 51 { 52 return OHOS_MANUFACTURE; 53 } 54 HalGetBrand(void)55const char* HalGetBrand(void) 56 { 57 return OHOS_BRAND; 58 } 59 HalGetMarketName(void)60const char* HalGetMarketName(void) 61 { 62 return OHOS_MARKET_NAME; 63 } 64 HalGetProductSeries(void)65const char* HalGetProductSeries(void) 66 { 67 return OHOS_PRODUCT_SERIES; 68 } 69 HalGetProductModel(void)70const char* HalGetProductModel(void) 71 { 72 return OHOS_PRODUCT_MODEL; 73 } 74 HalGetSoftwareModel(void)75const char* HalGetSoftwareModel(void) 76 { 77 return OHOS_SOFTWARE_MODEL; 78 } 79 HalGetHardwareModel(void)80const char* HalGetHardwareModel(void) 81 { 82 return OHOS_HARDWARE_MODEL; 83 } 84 HalGetHardwareProfile(void)85const char* HalGetHardwareProfile(void) 86 { 87 return OHOS_HARDWARE_PROFILE; 88 } 89 Hex2Char(u8 hex)90static char Hex2Char(u8 hex) 91 { 92 if (hex < HEX_A) { 93 return hex + CHAR_NUM_OFFSET; 94 } else { 95 return hex + CHAR_CAPITAL_OFFSET; 96 } 97 } 98 HalGetSerial(void)99const char* HalGetSerial(void) 100 { 101 char macAddr[ETH_ALEN]; 102 // as devboard has no production serial number, we just 103 // use wifi mac address as device serial number. 104 if (serialNumber[0] == STR_END_FLAG) { 105 extern int bwifi_get_own_mac(u8 *addr); 106 bwifi_get_own_mac(macAddr); 107 int j = 0; 108 for (int i = 0; i < ETH_ALEN; i++) { 109 u8 lowFour, highFour; 110 highFour = (macAddr[i] & MAC_HIGH_MASK) >> MAC_BITS; 111 serialNumber[j] = Hex2Char(highFour); 112 j++; 113 lowFour = macAddr[i] & MAC_LOW_MASK; 114 serialNumber[j] = Hex2Char(lowFour); 115 j++; 116 } 117 } 118 return serialNumber; 119 } 120 HalGetBootloaderVersion(void)121const char* HalGetBootloaderVersion(void) 122 { 123 return OHOS_BOOTLOADER_VERSION; 124 } 125 HalGetAbiList(void)126const char* HalGetAbiList(void) 127 { 128 return OHOS_ABI_LIST; 129 } 130 HalGetDisplayVersion(void)131const char* HalGetDisplayVersion(void) 132 { 133 return OHOS_DISPLAY_VERSION; 134 } 135 HalGetIncrementalVersion(void)136const char* HalGetIncrementalVersion(void) 137 { 138 return INCREMENTAL_VERSION; 139 } 140 HalGetBuildType(void)141const char* HalGetBuildType(void) 142 { 143 return BUILD_TYPE; 144 } 145 HalGetBuildUser(void)146const char* HalGetBuildUser(void) 147 { 148 return BUILD_USER; 149 } 150 HalGetBuildHost(void)151const char* HalGetBuildHost(void) 152 { 153 return BUILD_HOST; 154 } 155 HalGetBuildTime(void)156const char* HalGetBuildTime(void) 157 { 158 return BUILD_TIME; 159 } 160 HalGetFirstApiVersion(void)161int HalGetFirstApiVersion(void) 162 { 163 return OHOS_FIRST_API_VERSION; 164 } 165 166 /** 167 * @brief implement for js kvstorekit/filekit 168 */ GetDataPath()169const char *GetDataPath() 170 { 171 return "/data"; 172 } 173