1 /* 2 * Copyright (c) 2020-2022 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 HAL_TOKEN_H 17 #define HAL_TOKEN_H 18 19 #include <stdio.h> 20 21 #ifdef __cplusplus 22 #if __cplusplus 23 extern "C" { 24 #endif 25 #endif /* __cplusplus */ 26 27 #define KIT_FRAMEWORK_UID_MAX 1000 28 29 /** 30 * @brief Read token value from device. 31 * 32 * @param token the result token value, if read successfully. 33 * @param len length of the token. 34 * @returns 0 if success and get the update area token, 35 * 1 if success and get the pre-made token, 36 * -1 if failed, 37 * -2 if no pre-made token. 38 */ 39 int HalReadToken(char *token, unsigned int len); 40 41 /** 42 * @brief Write token value to device. 43 * 44 * @param token the token to write. 45 * @param len length of the token. 46 * @returns 0 if success, otherwise -1. 47 */ 48 int HalWriteToken(const char *token, unsigned int len); 49 50 /** 51 * @brief Get AcKey value from device. 52 * 53 * @param acKey the result acKey, if get successfully. 54 * @param len length of the acKey. 55 * @returns 0 if success, otherwise -1. 56 */ 57 int HalGetAcKey(char *acKey, unsigned int len); 58 59 /** 60 * @brief Get ProdId value from device. 61 * 62 * @param productId product IDs to be populated with. 63 * @param len length of the productId. 64 * @returns 0 if success, otherwise -1. 65 */ 66 int HalGetProdId(char *productId, unsigned int len); 67 68 /** 69 * @brief Get ProdKey value from device. 70 * 71 * @param productKey The productKey value 72 * @param len The productKey len. 73 * @returns 0 if success, otherwise -1. 74 */ 75 int HalGetProdKey(char *productKey, unsigned int len); 76 77 #ifdef __cplusplus 78 #if __cplusplus 79 } 80 #endif 81 #endif /* __cplusplus */ 82 83 #endif // HAL_TOKEN_H 84