1d9f0492fSopenharmony_ci/*
2d9f0492fSopenharmony_ci * Copyright (c) 2020 Huawei Device Co., Ltd.
3d9f0492fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4d9f0492fSopenharmony_ci * you may not use this file except in compliance with the License.
5d9f0492fSopenharmony_ci * You may obtain a copy of the License at
6d9f0492fSopenharmony_ci *
7d9f0492fSopenharmony_ci *    http://www.apache.org/licenses/LICENSE-2.0
8d9f0492fSopenharmony_ci *
9d9f0492fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10d9f0492fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11d9f0492fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12d9f0492fSopenharmony_ci * See the License for the specific language governing permissions and
13d9f0492fSopenharmony_ci * limitations under the License.
14d9f0492fSopenharmony_ci */
15d9f0492fSopenharmony_ci
16d9f0492fSopenharmony_ci#ifndef TOKEN_H
17d9f0492fSopenharmony_ci#define TOKEN_H
18d9f0492fSopenharmony_ci
19d9f0492fSopenharmony_ci#include <stdio.h>
20d9f0492fSopenharmony_ci
21d9f0492fSopenharmony_ci#ifdef __cplusplus
22d9f0492fSopenharmony_ci#if __cplusplus
23d9f0492fSopenharmony_ciextern "C" {
24d9f0492fSopenharmony_ci#endif
25d9f0492fSopenharmony_ci#endif /* __cplusplus */
26d9f0492fSopenharmony_ci
27d9f0492fSopenharmony_ci/**
28d9f0492fSopenharmony_ci * @brief Read token value form device.
29d9f0492fSopenharmony_ci *
30d9f0492fSopenharmony_ci * @param token The token value, len The token len.
31d9f0492fSopenharmony_ci * @returns 0 if it succeeds and get the update area token,
32d9f0492fSopenharmony_ci *          1 if it succeeds and get the pre-made token,
33d9f0492fSopenharmony_ci *         -1 if it fails, -2 if it no pre-made token.
34d9f0492fSopenharmony_ci */
35d9f0492fSopenharmony_ciint ReadToken(char *token, unsigned int len);
36d9f0492fSopenharmony_ci
37d9f0492fSopenharmony_ci/**
38d9f0492fSopenharmony_ci * @brief Write token value to device.
39d9f0492fSopenharmony_ci *
40d9f0492fSopenharmony_ci * @param token The token value, len The token len.
41d9f0492fSopenharmony_ci * @returns 0 if it succeeds, -1 if it fails.
42d9f0492fSopenharmony_ci */
43d9f0492fSopenharmony_ciint WriteToken(const char *token, unsigned int len);
44d9f0492fSopenharmony_ci
45d9f0492fSopenharmony_ci/**
46d9f0492fSopenharmony_ci * @brief Get AcKey value form device.
47d9f0492fSopenharmony_ci *
48d9f0492fSopenharmony_ci * @param acKey The acKey value, len The acKey len.
49d9f0492fSopenharmony_ci * @returns 0 if it succeeds, -1 if it fails.
50d9f0492fSopenharmony_ci */
51d9f0492fSopenharmony_ciint GetAcKey(char *acKey, unsigned int len);
52d9f0492fSopenharmony_ci
53d9f0492fSopenharmony_ci/**
54d9f0492fSopenharmony_ci * @brief Get ProdId value form device.
55d9f0492fSopenharmony_ci *
56d9f0492fSopenharmony_ci * @param productId The productId value, len The productId len.
57d9f0492fSopenharmony_ci * @returns 0 if it succeeds, -1 if it fails.
58d9f0492fSopenharmony_ci */
59d9f0492fSopenharmony_ciint GetProdId(char *productId, unsigned int len);
60d9f0492fSopenharmony_ci
61d9f0492fSopenharmony_ci/**
62d9f0492fSopenharmony_ci * @brief Get ProdKey value form device.
63d9f0492fSopenharmony_ci *
64d9f0492fSopenharmony_ci * @param productKey The productKey value, len The productKey len.
65d9f0492fSopenharmony_ci * @returns 0 if it succeeds, -1 if it fails.
66d9f0492fSopenharmony_ci */
67d9f0492fSopenharmony_ciint GetProdKey(char *productKey, unsigned int len);
68d9f0492fSopenharmony_ci
69d9f0492fSopenharmony_ci#ifdef __cplusplus
70d9f0492fSopenharmony_ci#if __cplusplus
71d9f0492fSopenharmony_ci}
72d9f0492fSopenharmony_ci#endif
73d9f0492fSopenharmony_ci#endif /* __cplusplus */
74d9f0492fSopenharmony_ci
75d9f0492fSopenharmony_ci#endif // TOKEN_H