Livox SDK API  V2.2.0
livox_sdk.h
Go to the documentation of this file.
1 //
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2019 Livox. All rights reserved.
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //
24 
25 #ifndef LIVOX_SDK_H_
26 #define LIVOX_SDK_H_
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <stdbool.h>
33 #include <stdint.h>
34 #include "livox_def.h"
35 
40 void GetLivoxSdkVersion(LivoxSdkVersion *version);
41 
46 
51 bool Init();
52 
57 bool Start();
58 
62 void Uninit();
63 
67 void SaveLoggerFile();
68 
74 
81 
87 typedef void (*DeviceStateUpdateCallback)(const DeviceInfo *device, DeviceEvent type);
88 
102 
111 livox_status AddHubToConnect(const char *broadcast_code, uint8_t *handle);
112 
120 livox_status AddLidarToConnect(const char *broadcast_code, uint8_t *handle);
121 
128 livox_status GetConnectedDevices(DeviceInfo *devices, uint8_t *size);
129 
139  uint8_t handle,
140  DeviceInformationResponse *response,
141  void *client_data);
142 
150 livox_status QueryDeviceInformation(uint8_t handle, DeviceInformationCallback cb, void *client_data);
151 
159 typedef void (*DataCallback)(uint8_t handle, LivoxEthPacket *data, uint32_t data_num, void *client_data);
160 
173 void SetDataCallback(uint8_t handle, DataCallback cb, void *client_data);
174 
183 typedef void (*CommonCommandCallback)(livox_status status, uint8_t handle, uint8_t response, void *client_data);
184 
192 
199 livox_status HubStopSampling(CommonCommandCallback cb, void *client_data);
200 
207 livox_status HubGetLidarHandle(uint8_t slot, uint8_t id);
208 
216 livox_status DisconnectDevice(uint8_t handle, CommonCommandCallback cb, void *client_data);
217 
225 livox_status SetCartesianCoordinate(uint8_t handle, CommonCommandCallback cb, void *client_data);
226 
234 livox_status SetSphericalCoordinate(uint8_t handle, CommonCommandCallback cb, void *client_data);
235 
242 typedef void (*ErrorMessageCallback)(livox_status status, uint8_t handle, ErrorMessage *message);
243 
252 
263 livox_status SetStaticDynamicIP(uint8_t handle,
266  void *client_data);
277 livox_status SetStaticIp(uint8_t handle,
280  void *client_data);
281 
289 livox_status SetDynamicIp(uint8_t handle,
291  void *client_data);
301  uint8_t handle,
302  GetDeviceIpModeResponse *response,
303  void *client_data);
304 
312 livox_status GetDeviceIpInformation(uint8_t handle, GetDeviceIpInformationCallback cb, void *client_data);
313 
323 livox_status RebootDevice(uint8_t handle, uint16_t timeout, CommonCommandCallback cb, void * client_data);
324 
334  uint8_t handle,
335  DeviceParameterResponse *response,
336  void *client_data);
337 
346 livox_status LidarEnableHighSensitivity(uint8_t handle, SetDeviceParametersCallback cb, void *client_data);
347 
356 livox_status LidarDisableHighSensitivity(uint8_t handle, SetDeviceParametersCallback cb, void *client_data);
357 
367  uint8_t handle,
368  GetDeviceParameterResponse *response,
369  void *client_data);
370 
379 livox_status LidarGetHighSensitivityState(uint8_t handle, GetDeviceParametersCallback cb, void *client_data);
380 
390 livox_status LidarSetScanPattern(uint8_t handle, LidarScanPattern pattern, SetDeviceParametersCallback cb, void *client_data);
391 
400 livox_status LidarGetScanPattern(uint8_t handle, GetDeviceParametersCallback cb, void *client_data);
401 
411 livox_status LidarSetSlotNum(uint8_t handle, uint8_t slot, SetDeviceParametersCallback cb, void *client_data);
412 
421 livox_status LidarGetSlotNum(uint8_t handle, GetDeviceParametersCallback cb, void *client_data);
422 
432  uint8_t handle,
433  DeviceParameterResponse *response,
434  void *client_data);
435 
443 livox_status DeviceResetAllParameters(uint8_t handle, DeviceResetParametersCallback cb, void *client_data);
444 
454 livox_status DeviceResetParameters(uint8_t handle, DeviceParamKeyName * keys, uint8_t num, DeviceResetParametersCallback cb, void *client_data);
455 
456 
466  uint8_t handle,
468  void *client_data);
469 
477 
486 typedef void (*HubSetModeCallback)(livox_status status, uint8_t handle, HubSetModeResponse *response, void *client_data);
487 
496 livox_status HubSetMode(HubSetModeRequest *req, uint16_t length, HubSetModeCallback cb, void *client_data);
497 
506 typedef void (*HubQueryLidarStatusCallback)(livox_status status, uint8_t handle, HubQueryLidarStatusResponse *response, void *client_data);
507 
515 
524 
534  uint8_t handle,
536  void *client_data);
537 
547  uint16_t length,
549  void *client_data);
550 
560  uint8_t handle,
562  void *client_data);
563 
571 
579 livox_status HubExtrinsicParameterCalculation(bool enable, CommonCommandCallback cb, void *client_data);
580 
590  uint8_t handle,
591  HubRainFogSuppressResponse *response,
592  void *client_data);
593 
603  uint16_t length,
605  void *client_data);
606 
615 typedef void(*HubQuerySlotPowerStatusCallback)(livox_status status, uint8_t handle, HubQuerySlotPowerStatusResponse *response, void *client_data);
616 
624 
633 typedef void (*HubFanControlCallback)(livox_status status,
634  uint8_t handle,
635  HubFanControlResponse *response,
636  void *client_data);
637 
646 livox_status HubFanControl(HubFanControlRequest *req, uint16_t length, HubFanControlCallback cb, void *client_data);
647 
656 typedef void (*HubGetFanStateCallback)(livox_status status,
657  uint8_t handle,
658  HubGetFanStateResponse *response,
659  void *client_data);
660 
670  uint16_t length,
672  void *client_data);
673 
683  uint8_t handle,
685  void *client_data);
686 
696  uint16_t length,
698  void *client_data);
699 
709  uint8_t handle,
711  void *client_data);
712 
722  uint16_t length,
724  void *client_data);
725 
735  uint8_t handle,
737  void *client_data);
738 
748  uint16_t length,
750  void *client_data);
751 
761  uint8_t handle,
763  void *client_data);
764 
774  uint16_t length,
776  void *client_data);
777 
785 livox_status LidarStartSampling(uint8_t handle, CommonCommandCallback cb, void *client_data);
786 
794 livox_status LidarStopSampling(uint8_t handle, CommonCommandCallback cb, void *client_data);
795 
806 livox_status LidarSetMode(uint8_t handle, LidarMode mode, CommonCommandCallback cb, void *client_data);
807 
819  void *client_data);
820 
830  uint8_t handle,
832  void *client_data);
833 
841 livox_status LidarGetExtrinsicParameter(uint8_t handle, LidarGetExtrinsicParameterCallback cb, void *client_data);
842 
852 livox_status LidarRainFogSuppress(uint8_t handle, bool enable, CommonCommandCallback cb, void *client_data);
853 
862 livox_status LidarTurnOffFan(uint8_t handle, CommonCommandCallback cb, void *client_data);
863 
872 livox_status LidarTurnOnFan(uint8_t handle, CommonCommandCallback cb, void *client_data);
873 
882 typedef void (*LidarGetFanStateCallback)(livox_status status,
883  uint8_t handle,
884  LidarGetFanStateResponse *response,
885  void *client_data);
886 
895 livox_status LidarGetFanState(uint8_t handle, LidarGetFanStateCallback cb, void * client_data) ;
896 
906 livox_status LidarSetPointCloudReturnMode(uint8_t handle, PointCloudReturnMode mode, CommonCommandCallback cb, void * client_data);
907 
917  uint8_t handle,
919  void *client_data);
920 
930 
940 livox_status LidarSetImuPushFrequency(uint8_t handle, ImuFreq freq, CommonCommandCallback cb, void * client_data);
941 
951  uint8_t handle,
953  void *client_data);
954 
963 livox_status LidarGetImuPushFrequency(uint8_t handle, LidarGetImuPushFrequencyCallback cb, void * client_data);
964 
975 livox_status LidarSetRmcSyncTime(uint8_t handle,
976  const char* rmc,
977  uint16_t rmc_length,
979  void *client_data);
980 
990 livox_status LidarSetUtcSyncTime(uint8_t handle,
993  void *client_data);
994 
995 #ifdef __cplusplus
996 }
997 #endif
998 
999 #endif // LIVOX_SDK_H_
livox_status HubStopSampling(CommonCommandCallback cb, void *client_data)
livox_status HubSetImuPushFrequency(HubSetImuPushFrequencyRequest *req, uint16_t length, HubSetImuPushFrequencyCallback cb, void *client_data)
livox_status HubControlSlotPower(HubControlSlotPowerRequest *req, CommonCommandCallback cb, void *client_data)
livox_status SetStaticIp(uint8_t handle, SetStaticDeviceIpModeRequest *req, CommonCommandCallback cb, void *client_data)
livox_status HubQueryLidarStatus(HubQueryLidarStatusCallback cb, void *client_data)
void(* HubGetExtrinsicParameterCallback)(livox_status status, uint8_t handle, HubGetExtrinsicParameterResponse *response, void *client_data)
Definition: livox_sdk.h:559
livox_status LidarRainFogSuppress(uint8_t handle, bool enable, CommonCommandCallback cb, void *client_data)
livox_status HubGetPointCloudReturnMode(HubGetPointCloudReturnModeRequest *req, uint16_t length, HubGetPointCloudReturnModeCallback cb, void *client_data)
livox_status GetConnectedDevices(DeviceInfo *devices, uint8_t *size)
livox_status LidarTurnOffFan(uint8_t handle, CommonCommandCallback cb, void *client_data)
void(* DeviceStateUpdateCallback)(const DeviceInfo *device, DeviceEvent type)
Definition: livox_sdk.h:87
DeviceEvent
Definition: livox_def.h:95
void DisableConsoleLogger()
livox_status SetStaticDynamicIP(uint8_t handle, SetDeviceIPModeRequest *req, CommonCommandCallback cb, void *client_data)
livox_status HubRainFogSuppress(HubRainFogSuppressRequest *req, uint16_t length, HubRainFogSuppressCallback cb, void *client_data)
void(* HubFanControlCallback)(livox_status status, uint8_t handle, HubFanControlResponse *response, void *client_data)
Definition: livox_sdk.h:633
livox_status LidarSetRmcSyncTime(uint8_t handle, const char *rmc, uint16_t rmc_length, CommonCommandCallback cb, void *client_data)
livox_status SetErrorMessageCallback(uint8_t handle, ErrorMessageCallback cb)
void(* HubGetPointCloudReturnModeCallback)(livox_status status, uint8_t handle, HubGetPointCloudReturnModeResponse *response, void *client_data)
Definition: livox_sdk.h:708
void Uninit()
livox_status HubFanControl(HubFanControlRequest *req, uint16_t length, HubFanControlCallback cb, void *client_data)
void(* HubGetImuPushFrequencyCallback)(livox_status status, uint8_t handle, HubGetImuPushFrequencyResponse *response, void *client_data)
Definition: livox_sdk.h:760
livox_status LidarTurnOnFan(uint8_t handle, CommonCommandCallback cb, void *client_data)
void(* GetDeviceIpInformationCallback)(livox_status status, uint8_t handle, GetDeviceIpModeResponse *response, void *client_data)
Definition: livox_sdk.h:300
livox_status GetDeviceIpInformation(uint8_t handle, GetDeviceIpInformationCallback cb, void *client_data)
void(* ErrorMessageCallback)(livox_status status, uint8_t handle, ErrorMessage *message)
Definition: livox_sdk.h:242
livox_status LidarGetExtrinsicParameter(uint8_t handle, LidarGetExtrinsicParameterCallback cb, void *client_data)
livox_status LidarGetHighSensitivityState(uint8_t handle, GetDeviceParametersCallback cb, void *client_data)
void(* HubSetModeCallback)(livox_status status, uint8_t handle, HubSetModeResponse *response, void *client_data)
Definition: livox_sdk.h:486
livox_status HubSetPointCloudReturnMode(HubSetPointCloudReturnModeRequest *req, uint16_t length, HubSetPointCloudReturnModeCallback cb, void *client_data)
void(* HubQuerySlotPowerStatusCallback)(livox_status status, uint8_t handle, HubQuerySlotPowerStatusResponse *response, void *client_data)
Definition: livox_sdk.h:615
void(* HubSetImuPushFrequencyCallback)(livox_status status, uint8_t handle, HubSetImuPushFrequencyResponse *response, void *client_data)
Definition: livox_sdk.h:734
livox_status DisconnectDevice(uint8_t handle, CommonCommandCallback cb, void *client_data)
void(* HubGetFanStateCallback)(livox_status status, uint8_t handle, HubGetFanStateResponse *response, void *client_data)
Definition: livox_sdk.h:656
livox_status LidarStopSampling(uint8_t handle, CommonCommandCallback cb, void *client_data)
DeviceParamKeyName
Definition: livox_def.h:547
void SetBroadcastCallback(DeviceBroadcastCallback cb)
livox_status DeviceResetAllParameters(uint8_t handle, DeviceResetParametersCallback cb, void *client_data)
livox_status AddHubToConnect(const char *broadcast_code, uint8_t *handle)
livox_status LidarGetScanPattern(uint8_t handle, GetDeviceParametersCallback cb, void *client_data)
livox_status HubQuerySlotPowerStatus(HubQuerySlotPowerStatusCallback cb, void *client_data)
void GetLivoxSdkVersion(LivoxSdkVersion *version)
livox_status RebootDevice(uint8_t handle, uint16_t timeout, CommonCommandCallback cb, void *client_data)
livox_status LidarStartSampling(uint8_t handle, CommonCommandCallback cb, void *client_data)
void(* DeviceResetParametersCallback)(livox_status status, uint8_t handle, DeviceParameterResponse *response, void *client_data)
Definition: livox_sdk.h:431
void(* HubSetPointCloudReturnModeCallback)(livox_status status, uint8_t handle, HubSetPointCloudReturnModeResponse *response, void *client_data)
Definition: livox_sdk.h:682
LidarScanPattern
Definition: livox_def.h:72
livox_status AddLidarToConnect(const char *broadcast_code, uint8_t *handle)
void(* DataCallback)(uint8_t handle, LivoxEthPacket *data, uint32_t data_num, void *client_data)
Definition: livox_sdk.h:159
int32_t livox_status
Definition: livox_def.h:92
basic_data data
Definition: format.h:764
void SaveLoggerFile()
void SetDataCallback(uint8_t handle, DataCallback cb, void *client_data)
livox_status HubSetExtrinsicParameter(HubSetExtrinsicParameterRequest *req, uint16_t length, HubSetExtrinsicParameterCallback cb, void *client_data)
PointCloudReturnMode
Definition: livox_def.h:127
livox_status SetCartesianCoordinate(uint8_t handle, CommonCommandCallback cb, void *client_data)
livox_status LidarGetImuPushFrequency(uint8_t handle, LidarGetImuPushFrequencyCallback cb, void *client_data)
livox_status DeviceResetParameters(uint8_t handle, DeviceParamKeyName *keys, uint8_t num, DeviceResetParametersCallback cb, void *client_data)
void(* HubSetExtrinsicParameterCallback)(livox_status status, uint8_t handle, HubSetExtrinsicParameterResponse *response, void *client_data)
Definition: livox_sdk.h:533
void(* LidarGetImuPushFrequencyCallback)(livox_status status, uint8_t handle, LidarGetImuPushFrequencyResponse *response, void *client_data)
Definition: livox_sdk.h:950
livox_status LidarSetMode(uint8_t handle, LidarMode mode, CommonCommandCallback cb, void *client_data)
livox_status SetSphericalCoordinate(uint8_t handle, CommonCommandCallback cb, void *client_data)
livox_status HubGetFanState(HubGetFanStateRequest *req, uint16_t length, HubGetFanStateCallback cb, void *client_data)
livox_status LidarSetSlotNum(uint8_t handle, uint8_t slot, SetDeviceParametersCallback cb, void *client_data)
void(* SetDeviceParametersCallback)(livox_status status, uint8_t handle, DeviceParameterResponse *response, void *client_data)
Definition: livox_sdk.h:333
void(* LidarGetPointCloudReturnModeCallback)(livox_status status, uint8_t handle, LidarGetPointCloudReturnModeResponse *response, void *client_data)
Definition: livox_sdk.h:916
void(* DeviceInformationCallback)(livox_status status, uint8_t handle, DeviceInformationResponse *response, void *client_data)
Definition: livox_sdk.h:138
void(* HubQueryLidarInformationCallback)(livox_status status, uint8_t handle, HubQueryLidarInformationResponse *response, void *client_data)
Definition: livox_sdk.h:465
livox_status HubExtrinsicParameterCalculation(bool enable, CommonCommandCallback cb, void *client_data)
livox_status HubStartSampling(CommonCommandCallback cb, void *client_data)
livox_status LidarSetScanPattern(uint8_t handle, LidarScanPattern pattern, SetDeviceParametersCallback cb, void *client_data)
void(* DeviceBroadcastCallback)(const BroadcastDeviceInfo *info)
Definition: livox_sdk.h:73
ImuFreq
Definition: livox_def.h:135
livox_status HubGetImuPushFrequency(HubGetImuPushFrequencyRequest *req, uint16_t length, HubGetImuPushFrequencyCallback cb, void *client_data)
LidarMode
Definition: livox_def.h:53
bool Init()
livox_status LidarSetPointCloudReturnMode(uint8_t handle, PointCloudReturnMode mode, CommonCommandCallback cb, void *client_data)
void(* CommonCommandCallback)(livox_status status, uint8_t handle, uint8_t response, void *client_data)
Definition: livox_sdk.h:183
livox_status HubSetMode(HubSetModeRequest *req, uint16_t length, HubSetModeCallback cb, void *client_data)
livox_status LidarDisableHighSensitivity(uint8_t handle, SetDeviceParametersCallback cb, void *client_data)
void(* LidarGetFanStateCallback)(livox_status status, uint8_t handle, LidarGetFanStateResponse *response, void *client_data)
Definition: livox_sdk.h:882
livox_status LidarGetPointCloudReturnMode(uint8_t handle, LidarGetPointCloudReturnModeCallback cb, void *client_data)
livox_status HubGetExtrinsicParameter(HubGetExtrinsicParameterCallback cb, void *client_data)
livox_status LidarEnableHighSensitivity(uint8_t handle, SetDeviceParametersCallback cb, void *client_data)
livox_status LidarGetFanState(uint8_t handle, LidarGetFanStateCallback cb, void *client_data)
livox_status HubQueryLidarInformation(HubQueryLidarInformationCallback cb, void *client_data)
void(* HubQueryLidarStatusCallback)(livox_status status, uint8_t handle, HubQueryLidarStatusResponse *response, void *client_data)
Definition: livox_sdk.h:506
void(* GetDeviceParametersCallback)(livox_status status, uint8_t handle, GetDeviceParameterResponse *response, void *client_data)
Definition: livox_sdk.h:366
livox_status SetDynamicIp(uint8_t handle, CommonCommandCallback cb, void *client_data)
void(* LidarGetExtrinsicParameterCallback)(livox_status status, uint8_t handle, LidarGetExtrinsicParameterResponse *response, void *client_data)
Definition: livox_sdk.h:829
void(* HubRainFogSuppressCallback)(livox_status status, uint8_t handle, HubRainFogSuppressResponse *response, void *client_data)
Definition: livox_sdk.h:589
bool Start()
livox_status QueryDeviceInformation(uint8_t handle, DeviceInformationCallback cb, void *client_data)
livox_status LidarSetImuPushFrequency(uint8_t handle, ImuFreq freq, CommonCommandCallback cb, void *client_data)
livox_status HubGetLidarHandle(uint8_t slot, uint8_t id)
void SetDeviceStateUpdateCallback(DeviceStateUpdateCallback cb)
Add a callback for device connection or working state changing event.
livox_status LidarGetSlotNum(uint8_t handle, GetDeviceParametersCallback cb, void *client_data)
livox_status LidarSetUtcSyncTime(uint8_t handle, LidarSetUtcSyncTimeRequest *req, CommonCommandCallback cb, void *client_data)
livox_status LidarSetExtrinsicParameter(uint8_t handle, LidarSetExtrinsicParameterRequest *req, CommonCommandCallback cb, void *client_data)