feat:support Tele
This commit is contained in:
@@ -226,6 +226,27 @@ bool ParseRmcTime(const char* rmc, uint16_t rmc_len, LidarSetUtcSyncTimeRequest*
|
||||
return true;
|
||||
}
|
||||
|
||||
livox_status SetDeviceParameters(uint8_t handle, uint8_t *req, uint16_t length, SetDeviceParametersCallback cb, void *client_data) {
|
||||
|
||||
livox_status result = command_handler().SendCommand(handle,
|
||||
kCommandSetGeneral,
|
||||
kCommandIDGeneralSetDeviceParam,
|
||||
req,
|
||||
length,
|
||||
MakeCommandCallback<DeviceParameterResponse>(cb, client_data));
|
||||
return result;
|
||||
}
|
||||
|
||||
livox_status GetDeiveParameter(uint8_t handle, GetDeviceParameterRequest *req, GetDeviceParametersCallback cb, void *client_data) {
|
||||
livox_status result = command_handler().SendCommand(handle,
|
||||
kCommandSetGeneral,
|
||||
kCommandIDGeneralGetDeviceParam,
|
||||
(uint8_t *)req,
|
||||
sizeof(GetDeviceParameterRequest),
|
||||
MakeCommandCallback<GetDeviceParameterResponse>(cb, client_data));
|
||||
return result;
|
||||
}
|
||||
|
||||
livox_status LidarStartSampling(uint8_t handle, CommonCommandCallback cb, void *client_data) {
|
||||
if (device_manager().device_mode() != kDeviceModeLidar) {
|
||||
return kStatusNotSupported;
|
||||
@@ -369,6 +390,48 @@ livox_status RebootDevice(uint8_t handle, uint16_t timeout, CommonCommandCallbac
|
||||
return result;
|
||||
}
|
||||
|
||||
livox_status LidarEnableHighSensitivity(uint8_t handle, SetDeviceParametersCallback cb, void *client_data) {
|
||||
if (!device_manager().IsLidarTele(handle)) {
|
||||
return kStatusNotSupported;
|
||||
}
|
||||
|
||||
uint8_t req_buff[kMaxCommandBufferSize] = {0};
|
||||
uint16_t req_len = 0;
|
||||
KeyValueParam * kv = (KeyValueParam *)&req_buff[0];
|
||||
kv->key = static_cast<uint16_t>(kKeyHighSensetivity);
|
||||
kv->length = 1;
|
||||
kv->value[0] = static_cast<uint8_t>(true);
|
||||
req_len = sizeof(KeyValueParam);
|
||||
|
||||
return SetDeviceParameters(handle, req_buff, req_len, cb, client_data);
|
||||
}
|
||||
|
||||
livox_status LidarDisableHighSensitivity(uint8_t handle, SetDeviceParametersCallback cb, void *client_data) {
|
||||
if (!device_manager().IsLidarTele(handle)) {
|
||||
return kStatusNotSupported;
|
||||
}
|
||||
uint8_t req_buff[kMaxCommandBufferSize] = {0};
|
||||
uint16_t req_len = 0;
|
||||
KeyValueParam * kv = (KeyValueParam *)&req_buff[0];
|
||||
kv->key = static_cast<uint16_t>(kKeyHighSensetivity);
|
||||
kv->length = 1;
|
||||
kv->value[0] = static_cast<uint8_t>(false);
|
||||
req_len = sizeof(KeyValueParam);
|
||||
|
||||
return SetDeviceParameters(handle, req_buff, req_len, cb, client_data);
|
||||
}
|
||||
|
||||
livox_status LidarGetHighSensitivityState(uint8_t handle, GetDeviceParametersCallback cb, void *client_data) {
|
||||
if (!device_manager().IsLidarTele(handle)) {
|
||||
return kStatusNotSupported;
|
||||
}
|
||||
|
||||
GetDeviceParameterRequest req;
|
||||
req.param_num = 1;
|
||||
req.key[0] = static_cast<uint16_t>(kKeyHighSensetivity);
|
||||
return GetDeiveParameter(handle, &req, cb, client_data);
|
||||
}
|
||||
|
||||
livox_status LidarSetMode(uint8_t handle, LidarMode mode, CommonCommandCallback cb, void *client_data) {
|
||||
if (device_manager().device_mode() != kDeviceModeLidar) {
|
||||
return kStatusNotSupported;
|
||||
|
||||
@@ -84,7 +84,18 @@ typedef enum {
|
||||
* General command set, reboot a device.
|
||||
*/
|
||||
kCommandIDGeneralRebootDevice = 0x0a,
|
||||
|
||||
/**
|
||||
* Set device's parameters.
|
||||
*/
|
||||
kCommandIDGeneralSetDeviceParam = 0x0b,
|
||||
/**
|
||||
* Get device's parameters.
|
||||
*/
|
||||
kCommandIDGeneralGetDeviceParam = 0x0c,
|
||||
/**
|
||||
* Reset device's all parameters.
|
||||
*/
|
||||
kCommandIDGeneralResetDeviceParam = 0x0d,
|
||||
/**
|
||||
* ******************************************************
|
||||
* Don't add command id after kCommandIDGeneralCommandCount.
|
||||
@@ -102,7 +113,9 @@ static const uint16_t GeneralCommandTimeout[kCommandIDGeneralCommandCount] = {KD
|
||||
KDefaultTimeOut,
|
||||
KDefaultTimeOut,
|
||||
KDefaultTimeOut,
|
||||
KDefaultTimeOut};
|
||||
KDefaultTimeOut,
|
||||
KDefaultTimeOut,
|
||||
KDefaultTimeOut,};
|
||||
|
||||
/** Enum that represents the command id. */
|
||||
typedef enum {
|
||||
@@ -167,7 +180,7 @@ static const uint16_t LidarCommandTimeout[kCommandIDLidarCommandCount] = {KDefau
|
||||
KDefaultTimeOut,
|
||||
KDefaultTimeOut,
|
||||
KDefaultTimeOut,
|
||||
KDefaultTimeOut};
|
||||
KDefaultTimeOut,};
|
||||
|
||||
/** Enum that represents the command id. */
|
||||
typedef enum {
|
||||
|
||||
@@ -301,6 +301,15 @@ bool DeviceManager::IsLidarMid40(uint8_t handle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceManager::IsLidarTele(uint8_t handle) {
|
||||
DeviceInfo lidar_info;
|
||||
bool found = device_manager().FindDevice(handle, lidar_info);
|
||||
if ( found && lidar_info.type == kDeviceTypeLidarTele) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeviceManager::GetLidarFirmwareVersion(uint8_t handle, uint32_t &firmware_version) {
|
||||
if (handle > devices_.size()) {
|
||||
return false;
|
||||
|
||||
@@ -103,6 +103,7 @@ class DeviceManager : public noncopyable {
|
||||
void GetConnectedDevices(std::vector<DeviceInfo> &devices);
|
||||
bool AddListeningDevice(const std::string &broadcast_code, DeviceMode mode, uint8_t &handle);
|
||||
bool IsLidarMid40(uint8_t handle);
|
||||
bool IsLidarTele(uint8_t handle);
|
||||
bool GetLidarFirmwareVersion(uint8_t handle, uint32_t &firmware_version);
|
||||
|
||||
private:
|
||||
@@ -159,4 +160,4 @@ void DeviceRemove(uint8_t handle,DeviceEvent device_event);
|
||||
|
||||
} // namespace livox
|
||||
|
||||
#endif // LIVOX_DEVICE_MANAGER_H_
|
||||
#endif // LIVOX_DEVICE_MANAGER_H_
|
||||
Reference in New Issue
Block a user