1 /* 2 * Copyright (c) 2020 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 TOKEN_H 17 #define TOKEN_H 18 19 #include <stdio.h> 20 21 #ifdef __cplusplus 22 #if __cplusplus 23 extern "C" { 24 #endif 25 #endif /* __cplusplus */ 26 27 /** 28 * @brief Read token value form device. 29 * 30 * @param token The token value, len The token len. 31 * @returns 0 if it succeeds and get the update area token, 32 * 1 if it succeeds and get the pre-made token, 33 * -1 if it fails, -2 if it no pre-made token. 34 */ 35 int ReadToken(char *token, unsigned int len); 36 37 /** 38 * @brief Write token value to device. 39 * 40 * @param token The token value, len The token len. 41 * @returns 0 if it succeeds, -1 if it fails. 42 */ 43 int WriteToken(const char *token, unsigned int len); 44 45 /** 46 * @brief Get AcKey value form device. 47 * 48 * @param acKey The acKey value, len The acKey len. 49 * @returns 0 if it succeeds, -1 if it fails. 50 */ 51 int GetAcKey(char *acKey, unsigned int len); 52 53 /** 54 * @brief Get ProdId value form device. 55 * 56 * @param productId The productId value, len The productId len. 57 * @returns 0 if it succeeds, -1 if it fails. 58 */ 59 int GetProdId(char *productId, unsigned int len); 60 61 /** 62 * @brief Get ProdKey value form device. 63 * 64 * @param productKey The productKey value, len The productKey len. 65 * @returns 0 if it succeeds, -1 if it fails. 66 */ 67 int GetProdKey(char *productKey, unsigned int len); 68 69 #ifdef __cplusplus 70 #if __cplusplus 71 } 72 #endif 73 #endif /* __cplusplus */ 74 75 #endif // TOKEN_H