1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 * Description: SLE error code. 16 */ 17 18 /** 19 * @defgroup sle_error_code Error Code API 20 * @ingroup SLE 21 * @{ 22 */ 23 24 #ifndef SLE_ERRCODE_H 25 #define SLE_ERRCODE_H 26 27 #ifdef __cplusplus 28 #if __cplusplus 29 extern "C" { 30 #endif 31 #endif 32 33 /** 34 * @if Eng 35 * @brief SLE error code base. 36 * @else 37 * @brief SLE 错误码起始。 38 * @endif 39 */ 40 #define ERRCODE_SLE_COMMON_BASE 0x80006000 41 42 /** 43 * @if Eng 44 * @brief SLE SSAP error code base. 45 * @else 46 * @brief SLE SSAP 错误码起始。 47 * @endif 48 */ 49 #define ERRCODE_SLE_SSAP_BASE 0x80006100 50 51 /** 52 * @if Eng 53 * @brief SLE SSAP error code end. 54 * @else 55 * @brief SLE SSAP 错误码结束。 56 * @endif 57 */ 58 #define ERRCODE_SLE_SSAP_END 0x800061FF 59 60 /** 61 * @if Eng 62 * @brief SLE error code base. 63 * @else 64 * @brief SLE 错误码结束。 65 * @endif 66 */ 67 #define ERRCODE_SLE_COMMON_END 0x800067FF 68 69 /** 70 * @if Eng 71 * @brief SLE error code. 72 * @else 73 * @brief SLE 错误码(非协议相关)。 74 * @endif 75 */ 76 typedef enum { 77 ERRCODE_SLE_SUCCESS = 0, /*!< @if Eng error code of success 78 @else 执行成功错误码 @endif */ 79 ERRCODE_SLE_CONTINUE = ERRCODE_SLE_COMMON_BASE, /*!< @if Eng error code of continue 80 @else 继续执行错误码 @endif */ 81 ERRCODE_SLE_DIRECT_RETURN, /*!< @if Eng error code of direct return 82 @else 直接返回错误码 @endif */ 83 ERRCODE_SLE_NO_ATTATION, /*!< @if Eng error code of no attention 84 @else 错误码 @endif */ 85 ERRCODE_SLE_PARAM_ERR, /*!< @if Eng error code of parameter error 86 @else 参数错误错误码 @endif */ 87 ERRCODE_SLE_FAIL, /*!< @if Eng error code of configure fail 88 @else 配置失败错误码 @endif */ 89 ERRCODE_SLE_TIMEOUT, /*!< @if Eng error code of configure timeout 90 @else 配置超时错误码 @endif */ 91 ERRCODE_SLE_UNSUPPORTED, /*!< @if Eng error code of unsupported parameter 92 @else 参数不支持错误码 @endif */ 93 ERRCODE_SLE_GETRECORD_FAIL, /*!< @if Eng error code of get current record fail 94 @else 获取当前记录失败错误码 @endif */ 95 ERRCODE_SLE_POINTER_NULL, /*!< @if Eng error code of pointer is NULL 96 @else 指针为空错误码 @endif */ 97 ERRCODE_SLE_NO_RECORD, /*!< @if Eng error code of no record return 98 @else 无记录返回错误码 @endif */ 99 ERRCODE_SLE_STATUS_ERR, /*!< @if Eng error code of state error 100 @else 状态错误错误码 @endif */ 101 ERRCODE_SLE_NOMEM, /*!< @if Eng error code of no memory 102 @else 内存不足错误码 @endif */ 103 ERRCODE_SLE_AUTH_FAIL, /*!< @if Eng error code of authentication failure 104 @else 认证失败错误码 @endif */ 105 ERRCODE_SLE_AUTH_PKEY_MISS, /*!< @if Eng error code of authentication fail due to pin 106 code or key lost 107 @else PIN码或密钥丢失致认证失败错误码 @endif */ 108 ERRCODE_SLE_RMT_DEV_DOWN, /*!< @if Eng error code of remote device down 109 @else 对端设备关闭错误码 @endif */ 110 ERRCODE_SLE_PAIRING_REJECT, /*!< @if Eng error code of pair reject 111 @else 配对拒绝错误码 @endif */ 112 ERRCODE_SLE_BUSY, /*!< @if Eng error code of system busy 113 @else 系统繁忙错误码 @endif */ 114 ERRCODE_SLE_NOT_READY, /*!< @if Eng error code of system not ready 115 @else 系统未准备好错误码 @endif */ 116 ERRCODE_SLE_CONN_FAIL, /*!< @if Eng error code of connect fail 117 @else 连接失败错误码 @endif */ 118 ERRCODE_SLE_OUT_OF_RANGE, /*!< @if Eng error code of out of range 119 @else 越界错误码 @endif */ 120 ERRCODE_SLE_MEMCPY_FAIL, /*!< @if Eng error code of memcpy fail 121 @else 拷贝失败错误码 @endif */ 122 ERRCODE_SLE_MALLOC_FAIL, /*!< @if Eng error code of malloc fail 123 @else 内存申请失败错误码 @endif */ 124 ERRCODE_SLE_MAX = ERRCODE_SLE_COMMON_END /*!< @if Eng maximum of SLE error code 125 @else SLE 错误码最大值 @endif */ 126 } errcode_sle_t; 127 128 /** 129 * @if Eng 130 * @brief SLE SSAP protocol error code. 131 * @else 132 * @brief SLE SSAP 协议错误码。 133 * @endif 134 */ 135 typedef enum { 136 ERRCODE_SSAP_INVALID_PDU = ERRCODE_SLE_SSAP_BASE + 0x01, /*!< @if Eng invalid PDU 137 @else 服务端接收的 PDU 无效 138 @endif */ 139 ERRCODE_SSAP_PDU_NOT_SUPPORT = ERRCODE_SLE_SSAP_BASE + 0x02, /*!< @if Eng PDU not support 140 @else 服务端不支持处理接收的 141 PDU 142 @endif */ 143 ERRCODE_SSAP_UNKNOW = ERRCODE_SLE_SSAP_BASE + 0x03, /*!< @if Eng PDU unknow 144 @else 服务端执行请求时发生 145 未知错误 146 @endif */ 147 ERRCODE_SSAP_INVALID_HANDLE = ERRCODE_SLE_SSAP_BASE + 0x04, /*!< @if Eng invalid handle 148 @else 请求中的句柄无效 149 @endif */ 150 ERRCODE_SSAP_INSUFFICIENT_RESOURCES = ERRCODE_SLE_SSAP_BASE + 0x05, /*!< @if Eng insufficient resources 151 @else 服务端没有足够资源完成 152 请求 153 @endif */ 154 ERRCODE_SSAP_PROHIBIT_READING = ERRCODE_SLE_SSAP_BASE + 0x06, /*!< @if Eng prohibit reading 155 @else 服务端禁止客户端读取值 156 @endif */ 157 ERRCODE_SSAP_PROHIBIT_WRITE = ERRCODE_SLE_SSAP_BASE + 0x07, /*!< @if Eng prohibit writing 158 @else 服务端禁止客户端写入值 159 @endif */ 160 ERRCODE_SSAP_CLIENT_NOT_AUTHENTICATED = ERRCODE_SLE_SSAP_BASE + 0x08, /*!< @if Eng client no authentication 161 @else 客户端未经过认证 162 @endif */ 163 ERRCODE_SSAP_CLIENT_NOT_AUTHORIZATION = ERRCODE_SLE_SSAP_BASE + 0x09, /*!< @if Eng client no authorizaion 164 @else 客户端未被授权 165 @endif */ 166 ERRCODE_SSAP_BEARER_NOT_ENCRYPTED = ERRCODE_SLE_SSAP_BASE + 0x0A, /*!< @if Eng bearer not encrypted 167 @else 传输 PDU 的承载未加密 168 @endif */ 169 ERRCODE_SSAP_ENTRIES_NOT_FOUND = ERRCODE_SLE_SSAP_BASE + 0x0B, /*!< @if Eng entries not found 170 @else 服务端未找到对应条目 171 @endif */ 172 ERRCODE_SSAP_DATA_NOT_FOUND = ERRCODE_SLE_SSAP_BASE + 0x0C, /*!< @if Eng data not found 173 @else 服务端未找到对应类型数据 174 @endif */ 175 ERRCODE_SSAP_INCORRECT_DATA_TYPE = ERRCODE_SLE_SSAP_BASE + 0x0D, /*!< @if Eng data type incorrected 176 @else 客户端发送写入数据类型 177 不符的错误 178 @endif */ 179 ERRCODE_SSAP_INCORRECT_DATA_VALUE = ERRCODE_SLE_SSAP_BASE + 0x0E, /*!< @if Eng data value incorrected 180 @else 客户端发送写入值不符 181 的错误 182 @endif */ 183 ERRCODE_SSAP_VALUE_OUT_OF_RANGE = ERRCODE_SLE_SSAP_BASE + 0x0F, /*!< @if Eng data value incorrected 184 @else 客户端写入的值超出范围 185 @endif */ 186 ERRCODE_SSAP_UPPERLAYER_APPLICATION_ERROR_MIN = ERRCODE_SLE_SSAP_BASE + 0xAF, /*!< @if Eng reserve 187 @else 预留给上层协议定义应用 188 错误 189 @endif */ 190 ERRCODE_SSAP_UPPERLAYER_APPLICATION_ERROR_MAX = ERRCODE_SLE_SSAP_BASE + 0xFF, /*!< @if Eng reserve 191 @else 预留给上层协议定义应用 192 错误 193 @endif */ 194 } errcode_sle_ssap_t; 195 196 #ifdef __cplusplus 197 #if __cplusplus 198 } 199 #endif 200 #endif 201 #endif /* SLE_ERRCODE_H */ 202 /** 203 * @} 204 */ 205