• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "token.h"
17 #include "hal_token.h"
18 #include "log.h"
19 #include "ohos_errno.h"
20 
ReadToken(char * token,unsigned int len)21 int ReadToken(char *token, unsigned int len)
22 {
23     if (token == NULL) {
24         HILOG_ERROR(HILOG_MODULE_HIVIEW, "token is nullptr\n");
25         return EC_FAILURE;
26     }
27 
28     return HalReadToken(token, len);
29 }
30 
WriteToken(const char * token,unsigned int len)31 int WriteToken(const char *token, unsigned int len)
32 {
33     if (token == NULL) {
34         HILOG_ERROR(HILOG_MODULE_HIVIEW, "token is nullptr\n");
35         return EC_FAILURE;
36     }
37 
38     return HalWriteToken(token, len);
39 }
40 
GetAcKey(char * acKey,unsigned int len)41 int GetAcKey(char *acKey, unsigned int len)
42 {
43     if (acKey == NULL) {
44         HILOG_ERROR(HILOG_MODULE_HIVIEW, "acKey is nullptr");
45         return EC_FAILURE;
46     }
47 
48     return HalGetAcKey(acKey, len);
49 }
50 
GetProdId(char * productId,unsigned int len)51 int GetProdId(char *productId, unsigned int len)
52 {
53     if (productId == NULL) {
54         HILOG_ERROR(HILOG_MODULE_HIVIEW, "productId is nullptr");
55         return EC_FAILURE;
56     }
57 
58     return HalGetProdId(productId, len);
59 }
60 
GetProdKey(char * productKey,unsigned int len)61 int GetProdKey(char *productKey, unsigned int len)
62 {
63     if (productKey == NULL) {
64         HILOG_ERROR(HILOG_MODULE_HIVIEW, "productKey is nullptr");
65         return EC_FAILURE;
66     }
67 
68     return HalGetProdKey(productKey, len);
69 }