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 * Description: slp api 15 * ROM : NO 16 * STRATEGY : NO 17 */ 18 19 /** 20 * @defgroup middleware_service_slp_api SLP API 21 * @ingroup middleware_service_slp 22 * @{ 23 */ 24 25 #ifndef SLP_H 26 #define SLP_H 27 28 #include <stdint.h> 29 #include <stdbool.h> 30 #include "slp_errcode.h" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /** 37 * @if Eng 38 * @brief slp max device number 39 * @else 40 * @brief slp最大设备数 41 * @endif 42 */ 43 #define SLP_MAX_DEVICE_NUM 16 44 45 /** 46 * @if Eng 47 * @brief slp addr length, unit: byte 48 * @else 49 * @brief slp地址长度,单位:字节 50 * @endif 51 */ 52 #define SLP_ADDR_LEN 6 53 54 /** 55 * @if Eng 56 * @brief Enum of slp device address 57 * @else 58 * @brief slp设备地址 59 * @endif 60 */ 61 typedef struct { 62 uint8_t addr[SLP_ADDR_LEN]; /*!< @if Eng address 63 @else 地址 @endif */ 64 } SlpDeviceAddr; 65 66 /** 67 * @if Eng 68 * @brief Enum of slp security mode 69 * @else 70 * @brief slp安全模式 71 * @endif 72 */ 73 typedef enum { 74 SLP_SEC_MODE_LPLS = 0, /*!< @if Eng slp low power consumption low security mode 75 @else slp低功耗低安全模式 @endif */ 76 SLP_SEC_MODE_HPHS /*!< @if Eng slp high power consumption high security mode 77 @else slp高功耗高安全模式 @endif */ 78 } SlpSecMode; 79 80 /** 81 * @if Eng 82 * @brief Enum of slp encryption mode 83 * @else 84 * @brief slp加密模式 85 * @endif 86 */ 87 typedef enum { 88 SLP_ENCRYPT_MODE_AES128 = 0, /*!< @if Eng slp aes-128 encryption mode 89 @else slp aes-128 加密模式 @endif */ 90 SLP_ENCRYPT_MODE_SM4 /*!< @if Eng slp sm4 encryption mode 91 @else slp sm4加密模式 @endif */ 92 } SlpEncryptMode; 93 94 /** 95 * @if Eng 96 * @brief Enum of slp session key mode 97 * @else 98 * @brief slp会话密钥模式 99 * @endif 100 */ 101 typedef enum { 102 SLP_WB_SHARED_KEY = 0, /*!< @if Eng slp wideband shared key 103 @else slp 宽带共享密钥 @endif */ 104 SLP_NB_SESSION_KEY /*!< @if Eng slp wideband shared key 105 @else slp 窄带会话密钥 @endif */ 106 } SlpSessionKeyMode; 107 108 /** 109 * @if Eng 110 * @brief Struct of slp security parameters 111 * @else 112 * @brief slp安全参数 113 * @endif 114 */ 115 typedef struct { 116 uint8_t secMode; /*!< @if Eng security mode, @ref SlpSecMode 117 @else 安全模式,参考 { @ref SlpSecMode }. @endif */ 118 uint8_t encryptMode; /*!< @if Eng encrypt mode, @ref SlpEncryptMode 119 @else 加密模式,参考 { @ref SlpEncryptMode }. @endif */ 120 uint8_t sessionKeyMode; /*!< @if Eng session key mode, @ref SlpSessionKeyMode 121 @else 会话密钥模式,参考 { @ref SlpSessionKeyMode }. @endif */ 122 uint8_t sessionKeyIdx; /*!< @if Eng session key index when sessionKeyMode is WB_SHARED_KEY, 0~15 123 @else 会话密钥索引值,会话密钥模式是宽带共享密钥时有效,取值范围0~15 @endif */ 124 } SlpSecurityParam; 125 126 /** 127 * @if Eng 128 * @brief Struct of slp frame parameters 129 * @else 130 * @brief slp帧参数 131 * @endif 132 */ 133 typedef struct { 134 uint8_t codeLen; /*!< @if Eng preamble code length, 0-31(16), 1-63(8), 2-91(4), 3-127(4) 135 @else 前导码长度 @endif */ 136 uint8_t syncCodeIdx; /*!< @if Eng sync code index, codeLen31/91: 0~7, codeLen63: 0~5, codeLen127: 0~15 137 @else sync段的码字索引值 @endif */ 138 uint8_t syncSymNum; /*!< @if Eng sync symbol number, 0-16, 1-32, 2-64, 3-96, 4-128, 5-256 139 @else sync段的符号数量 @endif */ 140 uint8_t ctsSegNum; /*!< @if Eng segment number of cts, 0-1, 1-2, 2-4, 3-8, 4-16, 5-32 141 @else cts域中segment段的数量 @endif */ 142 uint8_t ctsSegSymNum; /*!< @if Eng segment symbol number, 0-16, 1-32 143 @else 一个segment段中的符号数量 @endif */ 144 uint8_t gapBaseSymNum; /*!< @if Eng gap base symbol number, 0-12, 1-25, 2-50, 3-125, 4-250, 5-500, 6-1000 145 @else gap段基准的符号数量 @endif */ 146 uint8_t ctsCpLen; /*!< @if Eng cts cp length, 0-0, 1-64, 2-96, 3-128 147 @else cts段中cp长度 @endif */ 148 } SlpFrameParam; 149 150 /** 151 * @if Eng 152 * @brief Enum of slp channel 153 * @else 154 * @brief slp信道 155 * @endif 156 */ 157 typedef enum { 158 SLP_CH_5 = 0, /*!< @if Eng slp channel 5, center frequency 6489.6MHz 159 @else slp信道5,中心频率6489.6MHz @endif */ 160 SLP_CH_6, /*!< @if Eng slp channel 6, center frequency 6988.8MHz 161 @else slp信道6,中心频率6988.8MHz @endif */ 162 SLP_CH_8, /*!< @if Eng slp channel 8, center frequency 7488MHz 163 @else slp信道8,中心频率7488MHz @endif */ 164 SLP_CH_9 /*!< @if Eng slp channel 9, center frequency 7987.2MHz 165 @else slp信道9,中心频率7987.2MHz @endif */ 166 } SlpChannel; 167 168 /** 169 * @if Eng 170 * @brief Enum of slp usage mode 171 * @else 172 * @brief slp使用模式 173 * @endif 174 */ 175 typedef enum { 176 SLP_USAGE_RANGING_AOX = 0, /*!< @if Eng slp ranging and aox usage mode 177 @else slp测距测角使用模式 @endif */ 178 SLP_USAGE_AIR_MOUSE, /*!< @if Eng slp air mouse usage mode 179 @else slp空中鼠标使用模式 @endif */ 180 } SlpUsageMode; 181 182 /** 183 * @if Eng 184 * @brief Enum of slp mode 185 * @else 186 * @brief slp模式 187 * @endif 188 */ 189 typedef enum { 190 SLP_RANGING_ONLY = 0, /*!< @if Eng slp ranging 191 @else slp测距 @endif */ 192 SLP_RANGING_AOA, /*!< @if Eng slp ranging and angle of arrival 193 @else slp测距和aoa测角 @endif */ 194 } SlpRangingMode; 195 196 /** 197 * @if Eng 198 * @brief Enum of slp multiple node mode 199 * @else 200 * @brief slp多节点模式 201 * @endif 202 */ 203 typedef enum { 204 SLP_ONE_TO_ONE = 0, /*!< @if Eng slp one-to-one 205 @else slp 1对1 @endif */ 206 SLP_ONE_TO_MANY, /*!< @if Eng slp one-to-many 207 @else slp 1对多 @endif */ 208 SLP_MANY_TO_MANY /*!< @if Eng slp many-to-many 209 @else slp 多对多 @endif */ 210 } SlpMultiNodeMode; 211 212 /** 213 * @if Eng 214 * @brief Enum of slp ranging round usage 215 * @else 216 * @brief slp测距轮用法 217 * @endif 218 */ 219 typedef enum { 220 SLP_OWR = 0, /*!< @if Eng slp one way ranging 221 @else slp 单向测距 @endif */ 222 SLP_SS_TWR, /*!< @if Eng slp single-sided two way ranging 223 @else slp 单边双向测距 @endif */ 224 SLP_DS_TWR /*!< @if Eng slp double-sided two way ranging 225 @else slp 双边双向测距 @endif */ 226 } SlpRangingRoundUsage; 227 228 /** 229 * @if Eng 230 * @brief Enum of slp measurement request source 231 * @else 232 * @brief slp测量值请求源,测量值接收方表示计算距离的一方 233 * @endif 234 */ 235 typedef enum { 236 SLP_MR_RECV = 0, /*!< @if Eng slp measurement receiver 237 @else slp测量值接收方,表示计算距离的一方 @endif */ 238 SLP_MR_SEND /*!< @if Eng slp measurement sender, 239 @else slp测量值发送方 @endif */ 240 } SlpMrSource; 241 242 /** 243 * @if Eng 244 * @brief Enum of slp aox direction 245 * @else 246 * @brief slp测角方向 247 * @endif 248 */ 249 typedef enum { 250 SLP_POLL_AOX = 0, /*!< @if Eng slp initiator send aox frame 251 @else slp测距发起方发测角帧 @endif */ 252 SLP_RESPONSE_AOX, /*!< @if Eng slp responder send aox frame 253 @else slp测距响应方发测角帧 @endif */ 254 SLP_DOUBLE_SIDE_AOX /*!< @if Eng slp double-sided angle measurement 255 @else slp双边测角 @endif */ 256 } SlpAoxDirection; 257 258 /** 259 * @if Eng 260 * @brief Enum of narrowband time synchronization mode 261 * @else 262 * @brief 窄带时间同步模式 263 * @endif 264 */ 265 typedef enum { 266 SLP_NB_SINGLE_SIDE_SYNC = 1, /*!< @if Eng narrowband single side sync 267 @else 窄带单向同步 @endif */ 268 SLP_NB_DOUBLE_SIDE_SYNC, /*!< @if Eng narrowband double side sync 269 @else 窄带双向同步 @endif */ 270 } SlpNbSyncMode; 271 272 /** 273 * @if Eng 274 * @brief Struct of slp ranging parameters 275 * @else 276 * @brief slp测距参数 277 * @endif 278 */ 279 typedef struct { 280 uint8_t chIdx; /*!< @if Eng channel index, @ref SlpChannel 281 @else 通道号,参考 { @ref SlpChannel }. @endif */ 282 uint8_t usageMode; /*!< @if Eng slp usage mode, @ref SlpUsageMode 283 @else slp使用模式,参考 { @ref SlpUsageMode }. @endif */ 284 uint8_t slpRangingMode; /*!< @if Eng slp ranging mode, @ref SlpRangingMode 285 @else slp测距模式,参考 { @ref SlpRangingMode }. @endif */ 286 uint8_t multiNodeMode; /*!< @if Eng slp multiple node mode, @ref SlpMultiNodeMode 287 @else slp多节点模式,参考 { @ref SlpMultiNodeMode }. @endif */ 288 uint8_t rangingRoundUsage; /*!< @if Eng slp ranging round usage, @ref SlpRangingRoundUsage 289 @else slp测距轮用法,参考 { @ref SlpRangingRoundUsage }. @endif */ 290 uint8_t mrSource; /*!< @if Eng slp measurement request source, @ref SlpMrSource 291 @else slp测量值请求源,参考 { @ref SlpMrSource }. @endif */ 292 uint8_t rangingFreq; /*!< @if Eng ranging frequency, value:1~20, unit: Hz 293 @else 测距频率,取值:1~20,单位:Hz @endif */ 294 uint8_t validRoundNum; /*!< @if Eng valid ranging round number, value: 0~255, 0: infinity round 295 @else 有效测距轮数,取值范围:0~255,其中0表示无限轮 @endif */ 296 uint8_t aoxDirection; /*!< @if Eng aox direaction, @ref SlpAoxDirection 297 @else 测角方向,参考 { @ref SlpAoxDirection }. @endif */ 298 uint8_t nbSyncMode; /*!< @if Eng narrowband sync mode, @ref SlpNbSyncMode 299 @else 窄带同步模式,参考 { @ref SlpNbSyncMode }. @endif */ 300 uint8_t deviceNum; /*!< @if Eng device number, value:2 301 @else 参与测距的设备个数,取值:2 @endif */ 302 uint32_t sessionId; /*!< @if Eng session identifier 303 @else 会话标识符,随机值,每次启动测距,值不同 @endif */ 304 SlpDeviceAddr deviceAddr[SLP_MAX_DEVICE_NUM]; /*!< @if Eng device address list, the fist address is initiator 305 @else 设备地址列表,第1个是测距发起者的地址 @endif */ 306 } SlpRangingParam; 307 308 /** 309 * @if Eng 310 * @brief Struct of slp ranging parameters 311 * @else 312 * @brief slp测距控制参数 313 * @endif 314 */ 315 typedef struct { 316 SlpFrameParam frameParam; /*!< @if Eng slp frame parameters 317 @else slp帧参数 @endif */ 318 SlpSecurityParam secParam; /*!< @if Eng slp security parameters 319 @else slp安全参数 @endif */ 320 SlpRangingParam rangingParam; /*!< @if Eng slp ranging parameters 321 @else slp测距参数 @endif */ 322 } SlpStartRangingParam; 323 324 /** 325 * @if Eng 326 * @brief Enum of slp screen resolution 327 * @else 328 * @brief slp屏幕分辨率 329 * @endif 330 */ 331 typedef enum { 332 SLP_SCREEN_720P = 0, /*!< @if Eng slp screen resolution 720p 333 @else slp屏幕分辨率720p @endif */ 334 SLP_SCREEN_1080P, /*!< @if Eng slp screen resolution 1080p 335 @else slp屏幕分辨率1080p @endif */ 336 SLP_SCREEN_4K, /*!< @if Eng slp screen resolution 4K 337 @else slp屏幕分辨率4K @endif */ 338 SLP_SCREEN_8K /*!< @if Eng slp screen resolution 8K 339 @else slp屏幕分辨率8k @endif */ 340 } SlpScreenResolution; 341 342 /** 343 * @if Eng 344 * @brief Enum of slp cursor speed 345 * @else 346 * @brief slp光标移动速度 347 * @endif 348 */ 349 typedef enum { 350 SLP_CURSOR_SPEED_LOW = 0, /*!< @if Eng slp cursor low speed 351 @else slp光标低速移动 @endif */ 352 SLP_CURSOR_SPEED_MEDIUM, /*!< @if Eng slp cursor medium speed 353 @else slp光标中速移动 @endif */ 354 SLP_CURSOR_SPEED_HIGH, /*!< @if Eng slp cursor high speed 355 @else slp光标高速移动 @endif */ 356 } SlpCursorSpeed; 357 358 /** 359 * @if Eng 360 * @brief Enum of slp screen parameters 361 * @else 362 * @brief slp屏幕参数 363 * @endif 364 */ 365 typedef struct { 366 uint8_t cursorSpeed; /*!< @if Eng slp cursor speed, @ref SlpCursorSpeed 367 @else slp光标移动速度,参考 { @ref SlpCursorSpeed }. @endif */ 368 uint8_t resolution; /*!< @if Eng slp screen resolution 720p, @ref SlpScreenResolution 369 @else slp屏幕分辨率720p,参考 { @ref SlpScreenResolution }. @endif */ 370 } SlpScreenParam; 371 372 /** 373 * @if Eng 374 * @brief Struct of slp local attribute 375 * @else 376 * @brief slp本机属性 377 * @endif 378 */ 379 typedef struct { 380 SlpDeviceAddr localAddr; /*!< @if Eng local address 381 @else 本机地址 @endif */ 382 SlpScreenParam screenParam; /*!< @if Eng screen parameters 383 @else 屏幕参数 @endif */ 384 } SlpLocalAtt; 385 386 /** 387 * @if Eng 388 * @brief Struct of slp ranging report interface 389 * @else 390 * @brief slp测距结果上报 391 * @endif 392 */ 393 typedef struct { 394 uint32_t distance; /*!< @if Eng distance, unit: mm 395 @else 距离,单位:毫米 @endif */ 396 uint8_t aoxAziFom; /*!< @if Eng azimuth figure-of-merit 397 @else 方位角置信度 @endif */ 398 uint8_t aoxElevFom; /*!< @if Eng elevation figure-of-merit 399 @else 俯仰角置信度 @endif */ 400 int16_t aoxAzi; /*!< @if Eng azimuth, uint: degree 401 @else 方位角,单位:度 @endif */ 402 int16_t aoxElev; /*!< @if Eng elevation, uint: degree 403 @else 俯仰角,单位:度 @endif */ 404 SlpDeviceAddr providerAddr; /*!< @if Eng provider address 405 @else 测量值提供方的地址 @endif */ 406 SlpDeviceAddr requestorAddr; /*!< @if Eng requestor address 407 @else 测量值请求方的地址 @endif */ 408 } SlpRangingRpt; 409 410 /** 411 * @if Eng 412 * @brief Struct of slp payload Information 413 * @else 414 * @brief slp负载信息 415 * @endif 416 */ 417 typedef struct { 418 uint8_t *payload; /*!< @if Eng slp payload 419 @else slp负载 @endif */ 420 uint16_t payloadLen; /*!< @if Eng slp payload length 421 @else slp负载长度,取值范围[0, 255] @endif */ 422 } SlpPayloadInfo; 423 424 /** 425 * @if Eng 426 * @brief Callback invoked when report ranging result 427 * @par Callback invoked when report ranging result 428 * @attention 1.This function is called in SLP context,should not be blocked or do long time waiting. 429 * @attention 2.The memories of pointer are requested and freed by the slp automatically. 430 * @param [in] rangingRpt ranging result. 431 * @else 432 * @brief 测距结果上报的回调函数。 433 * @par 测距结果上报的回调函数。 434 * @attention 1. 该回调函数运行于SLP线程,不能阻塞或长时间等待。 435 * @attention 2. 指针由SLP申请内存,也由SLP释放,回调中不应释放。 436 * @param [in] rangingRpt 测距结果。 437 * @endif 438 */ 439 typedef void (*SlpReportRangingCallback)(SlpRangingRpt *rangingRpt); 440 441 /** 442 * @if Eng 443 * @brief Callback invoked when report cursor data 444 * @par Callback invoked when report cursor data 445 * @attention 1.This function is called in SLP context,should not be blocked or do long time waiting. 446 * @attention 2.The memories of pointer are requested and freed by the slp automatically. 447 * @param [in] x x-axis coordinate value. The upper left corner of the screen is used as the coordinate origin, 448 and the horizontal rightward direction is the positive direction of the X axis. unit: pixel 449 * @param [in] y y-axis coordinate value. The upper left corner of the screen is used as the coordinate origin, 450 and the vertical downward direction is the positive direction of the y axis. unit: pixel 451 * @else 452 * @brief 光标数据上报的回调函数。 453 * @par 光标数据上报的回调函数。 454 * @attention 1. 该回调函数运行于SLP线程,不能阻塞或长时间等待。 455 * @attention 2. 指针由SLP申请内存,也由SLP释放,回调中不应释放。 456 * @param [in] x x轴坐标值,以屏幕左上角为圆点,水平向右为x轴正方向,单位:像素 457 * @param [in] y y轴坐标值,以屏幕左上角为圆点,垂直向下为y轴正方向,单位:像素 458 * @endif 459 */ 460 typedef void (*SlpReportCursorCallback)(uint16_t x, uint16_t y); 461 462 /** 463 * @if Eng 464 * @brief Callback invoked when send payload 465 * @par Callback invoked when send payload 466 * @attention 1.This function is called in SLP context,should not be blocked or do long time waiting. 467 * @attention 2.The memories of pointer are requested and freed by the slp automatically. 468 * @param [in] info payload information, see @ref SlpPayloadInfo. 469 * @else 470 * @brief 发送负载的回调函数。 471 * @par 发送负载的回调函数。 472 * @attention 1. 该回调函数运行于SLP线程,不能阻塞或长时间等待。 473 * @attention 2. 指针由SLP申请内存,也由SLP释放,回调中不应释放。 474 * @param [in] info 负载信息,参考 SlpPayloadInfo。 475 * @endif 476 */ 477 typedef void (*SlpSendPayloadCallback)(const SlpPayloadInfo *info); 478 479 /** 480 * @if Eng 481 * @brief SLP main. 482 * @par Description: SLP main. 483 * @param [in] param parameters that may be passed in 484 * @else 485 * @brief SLP线程主函数。 486 * @par Description: SLP线程主函数。 487 * @param [in] param 可能传入的参数 488 * @endif 489 */ 490 void SlpTask(void* param); 491 492 /** 493 * @if Eng 494 * @brief SLP power on, complete SLP loading. 495 * @par Description: SLP power on, complete SLP loading. 496 * @retval ERRCODE_SUCC Success. 497 * @retval Other Failure. For details, see @ref ErrcodeSlpClient 498 * @else 499 * @brief SLP上电,完成SLP加载。 500 * @par Description: SLP上电,完成SLP加载。 501 * @retval ERRCODE_SUCC 成功。 502 * @retval Other 失败。参考 @ref ErrcodeSlpClient 503 * @endif 504 */ 505 ErrcodeSlpClient SlpPowerOnCommand(void); 506 507 /** 508 * @if Eng 509 * @brief SLP Start Ranging. 510 * @par Description: SLP Start Ranging. 511 * @retval ERRCODE_SUCC Success. 512 * @retval Other Failure. For details, see @ref ErrcodeSlpClient 513 * @param [in] param start ranging parameters, see @ref SlpStartRangingParam 514 * @else 515 * @brief SLP启动测距。 516 * @par Description: SLP启动测距。 517 * @param [in] param 启动测距参数,参考 @ref SlpStartRangingParam 518 * @retval ERRCODE_SUCC 成功。 519 * @retval Other 失败。参考 @ref ErrcodeSlpClient 520 * @endif 521 */ 522 ErrcodeSlpClient SlpStartRangingCommand(const SlpStartRangingParam *param); 523 524 /** 525 * @if Eng 526 * @brief SLP power off. 527 * @par Description: SLP power off. 528 * @retval ERRCODE_SUCC Success. 529 * @retval Other Failure. For details, see @ref ErrcodeSlpClient 530 * @else 531 * @brief SLP下电。 532 * @par Description: SLP下电。 533 * @retval ERRCODE_SUCC 成功。 534 * @retval Other 失败。参考 @ref ErrcodeSlpClient 535 * @endif 536 */ 537 ErrcodeSlpClient SlpPowerOffCommand(void); 538 539 /** 540 * @if Eng 541 * @brief SLP sleep. 542 * @par Description: SLP sleep. 543 * @retval ERRCODE_SUCC Success. 544 * @retval Other Failure. For details, see @ref ErrcodeSlpClient 545 * @else 546 * @brief SLP睡眠。 547 * @par Description: SLP睡眠。 548 * @retval ERRCODE_SUCC 成功。 549 * @retval Other 失败。参考 @ref ErrcodeSlpClient 550 * @endif 551 */ 552 ErrcodeSlpClient SlpSleepCommand(void); 553 554 /** 555 * @if Eng 556 * @brief Set local device attributes. 557 * @par Description: Set local device attributes. 558 * @retval ERRCODE_SUCC Success. 559 * @retval Other Failure. For details, see @ref ErrcodeSlpClient 560 * @param [in] param local device attribute parameters, see @ref SlpLocalAtt 561 * @else 562 * @brief 设置本机特性。 563 * @par Description: 设置本机特性。 564 * @param [in] param 本机特性参数,参考 @ref SlpLocalAtt 565 * @retval ERRCODE_SUCC 成功。 566 * @retval Other 失败。参考 @ref ErrcodeSlpClient 567 * @endif 568 */ 569 ErrcodeSlpClient SlpSetLocalAttCommand(const SlpLocalAtt *param); 570 571 /** 572 * @if Eng 573 * @brief SLP receive payload. 574 * @par Description: SLP receive payload. 575 * @retval ERRCODE_SUCC Success. 576 * @retval Other Failure. For details, see @ref ErrcodeSlpClient 577 * @param [in] info payload information, see @ref SlpPayloadInfo 578 * @else 579 * @brief SLP接收负载。 580 * @par Description: SLP接收负载。 581 * @param [in] info 负载信息,参考 @ref SlpPayloadInfo 582 * @retval ERRCODE_SUCC 成功。 583 * @retval Other 失败。参考 @ref ErrcodeSlpClient 584 * @endif 585 */ 586 ErrcodeSlpClient SlpRecvPayload(const SlpPayloadInfo *info); 587 588 /** 589 * @if Eng 590 * @brief Register SLP send payload callback 591 * @par Description: Register SLP send payload callback 592 * @param [in] cbk callback function. 593 * @retval ERRCODE_SUCC Success. 594 * @retval Other Failure. For details, see @ref ErrcodeSlpClient 595 * @else 596 * @brief 注册SLP发送负载回调。 597 * @par Description: 注册SLP发送负载回调。 598 * @param [in] cbk 回调函数。 599 * @retval ERRCODE_SUCC 成功。 600 * @retval Other 失败。参考 @ref ErrcodeSlpClient 601 * @endif 602 */ 603 ErrcodeSlpClient SlpRegisterSendPayloadCallback(SlpSendPayloadCallback cbk); 604 605 /** 606 * @if Eng 607 * @brief Enum of SLP result report callbacks 608 * @else 609 * @brief SLP结果上报回调 610 * @endif 611 */ 612 typedef struct { 613 SlpReportCursorCallback rptCursorCbk; /*!< @if Eng slp report cursor callback. 614 @else sle上报光标回调函数。 @endif */ 615 SlpReportRangingCallback rptRangingCbk; /*!< @if Eng slp report ranging result callback. 616 @else sle上报测距结果回调函数。 @endif */ 617 } SlpReportCallbacks; 618 619 /** 620 * @if Eng 621 * @brief Register SLP report callbacks. 622 * @par Description: Register SLP report callbacks. 623 * @param [in] func Callback function. 624 * @retval ERRCODE_SUCC Success. 625 * @retval Other Failure. For details, see @ref ErrcodeSlpClient 626 * @else 627 * @brief 注册SLP上报结果回调函数。 628 * @par Description: 注册SLP上报结果回调函数。 629 * @param [in] func 回调函数。 630 * @retval ERRCODE_SUCC 成功。 631 * @retval Other 失败。参考 @ref ErrcodeSlpClient 632 * @endif 633 */ 634 ErrcodeSlpClient SlpRegisterReportCallbacks(SlpReportCallbacks *func); 635 636 /** 637 * @} 638 */ 639 640 #ifdef __cplusplus 641 } 642 #endif 643 644 #endif