本文整理汇总了C++中device_send_request函数的典型用法代码示例。如果您正苦于以下问题:C++ device_send_request函数的具体用法?C++ device_send_request怎么用?C++ device_send_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了device_send_request函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: io4_get_monoflop
int io4_get_monoflop(IO4 *io4, uint8_t pin, uint8_t *ret_value, uint32_t *ret_time, uint32_t *ret_time_remaining) {
DevicePrivate *device_p = io4->p;
GetMonoflop_ request;
GetMonoflopResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), IO4_FUNCTION_GET_MONOFLOP, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
request.pin = pin;
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_value = response.value;
*ret_time = leconvert_uint32_from(response.time);
*ret_time_remaining = leconvert_uint32_from(response.time_remaining);
return ret;
}
示例2: servo_get_current_velocity
int servo_get_current_velocity(Servo *servo, uint8_t servo_num, uint16_t *ret_velocity) {
DevicePrivate *device_p = servo->p;
GetCurrentVelocity_ request;
GetCurrentVelocityResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), SERVO_FUNCTION_GET_CURRENT_VELOCITY, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
request.servo_num = servo_num;
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_velocity = leconvert_uint16_from(response.velocity);
return ret;
}
示例3: servo_get_pulse_width
int servo_get_pulse_width(Servo *servo, uint8_t servo_num, uint16_t *ret_min, uint16_t *ret_max) {
DevicePrivate *device_p = servo->p;
GetPulseWidth_ request;
GetPulseWidthResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), SERVO_FUNCTION_GET_PULSE_WIDTH, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
request.servo_num = servo_num;
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_min = leconvert_uint16_from(response.min);
*ret_max = leconvert_uint16_from(response.max);
return ret;
}
示例4: servo_get_protocol1_bricklet_name
int servo_get_protocol1_bricklet_name(Servo *servo, char port, uint8_t *ret_protocol_version, uint8_t ret_firmware_version[3], char ret_name[40]) {
DevicePrivate *device_p = servo->p;
GetProtocol1BrickletName_ request;
GetProtocol1BrickletNameResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), SERVO_FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
request.port = port;
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_protocol_version = response.protocol_version;
memcpy(ret_firmware_version, response.firmware_version, 3 * sizeof(uint8_t));
strncpy(ret_name, response.name, 40);
return ret;
}
示例5: servo_is_enabled
int servo_is_enabled(Servo *servo, uint8_t servo_num, bool *ret_enabled) {
DevicePrivate *device_p = servo->p;
IsEnabled_ request;
IsEnabledResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), SERVO_FUNCTION_IS_ENABLED, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
request.servo_num = servo_num;
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_enabled = response.enabled;
return ret;
}
示例6: industrial_digital_in_4_get_identity
int industrial_digital_in_4_get_identity(IndustrialDigitalIn4 *industrial_digital_in_4, char ret_uid[8], char ret_connected_uid[8], char *ret_position, uint8_t ret_hardware_version[3], uint8_t ret_firmware_version[3], uint16_t *ret_device_identifier) {
DevicePrivate *device_p = industrial_digital_in_4->p;
GetIdentity_ request;
GetIdentityResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), INDUSTRIAL_DIGITAL_IN_4_FUNCTION_GET_IDENTITY, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
strncpy(ret_uid, response.uid, 8);
strncpy(ret_connected_uid, response.connected_uid, 8);
*ret_position = response.position;
memcpy(ret_hardware_version, response.hardware_version, 3 * sizeof(uint8_t));
memcpy(ret_firmware_version, response.firmware_version, 3 * sizeof(uint8_t));
*ret_device_identifier = leconvert_uint16_from(response.device_identifier);
return ret;
}
示例7: humidity_v2_get_spitfp_error_count
int humidity_v2_get_spitfp_error_count(HumidityV2 *humidity_v2, uint32_t *ret_error_count_ack_checksum, uint32_t *ret_error_count_message_checksum, uint32_t *ret_error_count_frame, uint32_t *ret_error_count_overflow) {
DevicePrivate *device_p = humidity_v2->p;
GetSPITFPErrorCount_Request request;
GetSPITFPErrorCount_Response response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), HUMIDITY_V2_FUNCTION_GET_SPITFP_ERROR_COUNT, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_error_count_ack_checksum = leconvert_uint32_from(response.error_count_ack_checksum);
*ret_error_count_message_checksum = leconvert_uint32_from(response.error_count_message_checksum);
*ret_error_count_frame = leconvert_uint32_from(response.error_count_frame);
*ret_error_count_overflow = leconvert_uint32_from(response.error_count_overflow);
return ret;
}
示例8: imu_get_angular_velocity
int imu_get_angular_velocity(IMU *imu, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z) {
GetAngularVelocity_ request;
GetAngularVelocityResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_GET_ANGULAR_VELOCITY, imu->ipcon, imu);
if (ret < 0) {
return ret;
}
ret = device_send_request(imu, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_x = leconvert_int16_from(response.x);
*ret_y = leconvert_int16_from(response.y);
*ret_z = leconvert_int16_from(response.z);
return ret;
}
示例9: imu_get_all_data
int imu_get_all_data(IMU *imu, int16_t *ret_acc_x, int16_t *ret_acc_y, int16_t *ret_acc_z, int16_t *ret_mag_x, int16_t *ret_mag_y, int16_t *ret_mag_z, int16_t *ret_ang_x, int16_t *ret_ang_y, int16_t *ret_ang_z, int16_t *ret_temperature) {
GetAllData_ request;
GetAllDataResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_GET_ALL_DATA, imu->ipcon, imu);
if (ret < 0) {
return ret;
}
ret = device_send_request(imu, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_acc_x = leconvert_int16_from(response.acc_x);
*ret_acc_y = leconvert_int16_from(response.acc_y);
*ret_acc_z = leconvert_int16_from(response.acc_z);
*ret_mag_x = leconvert_int16_from(response.mag_x);
*ret_mag_y = leconvert_int16_from(response.mag_y);
*ret_mag_z = leconvert_int16_from(response.mag_z);
*ret_ang_x = leconvert_int16_from(response.ang_x);
*ret_ang_y = leconvert_int16_from(response.ang_y);
*ret_ang_z = leconvert_int16_from(response.ang_z);
*ret_temperature = leconvert_int16_from(response.temperature);
return ret;
}
示例10: imu_get_acceleration
int imu_get_acceleration(IMU *imu, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z) {
GetAcceleration_ request;
GetAccelerationResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_GET_ACCELERATION, imu->ipcon, imu);
if (ret < 0) {
return ret;
}
ret = device_send_request(imu, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_x = leconvert_int16_from(response.x);
*ret_y = leconvert_int16_from(response.y);
*ret_z = leconvert_int16_from(response.z);
return ret;
}
示例11: imu_get_magnetic_field
int imu_get_magnetic_field(IMU *imu, int16_t *ret_x, int16_t *ret_y, int16_t *ret_z) {
GetMagneticField_ request;
GetMagneticFieldResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_GET_MAGNETIC_FIELD, imu->ipcon, imu);
if (ret < 0) {
return ret;
}
ret = device_send_request(imu, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_x = leconvert_int16_from(response.x);
*ret_y = leconvert_int16_from(response.y);
*ret_z = leconvert_int16_from(response.z);
return ret;
}
示例12: imu_get_protocol1_bricklet_name
int imu_get_protocol1_bricklet_name(IMU *imu, char port, uint8_t *ret_protocol_version, uint8_t ret_firmware_version[3], char ret_name[40]) {
GetProtocol1BrickletName_ request;
GetProtocol1BrickletNameResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), IMU_FUNCTION_GET_PROTOCOL1_BRICKLET_NAME, imu->ipcon, imu);
if (ret < 0) {
return ret;
}
request.port = port;
ret = device_send_request(imu, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_protocol_version = response.protocol_version;
memcpy(ret_firmware_version, response.firmware_version, 3 * sizeof(uint8_t));
strncpy(ret_name, response.name, 40);
return ret;
}
示例13: io4_get_edge_count_config
int io4_get_edge_count_config(IO4 *io4, uint8_t pin, uint8_t *ret_edge_type, uint8_t *ret_debounce) {
DevicePrivate *device_p = io4->p;
GetEdgeCountConfig_ request;
GetEdgeCountConfigResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), IO4_FUNCTION_GET_EDGE_COUNT_CONFIG, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
request.pin = pin;
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_edge_type = response.edge_type;
*ret_debounce = response.debounce;
return ret;
}
示例14: io4_get_edge_count
int io4_get_edge_count(IO4 *io4, uint8_t pin, bool reset_counter, uint32_t *ret_count) {
DevicePrivate *device_p = io4->p;
GetEdgeCount_ request;
GetEdgeCountResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), IO4_FUNCTION_GET_EDGE_COUNT, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
request.pin = pin;
request.reset_counter = reset_counter;
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_count = leconvert_uint32_from(response.count);
return ret;
}
示例15: industrial_digital_in_4_get_edge_count
int industrial_digital_in_4_get_edge_count(IndustrialDigitalIn4 *industrial_digital_in_4, uint8_t pin, bool reset_counter, uint32_t *ret_count) {
DevicePrivate *device_p = industrial_digital_in_4->p;
GetEdgeCount_ request;
GetEdgeCountResponse_ response;
int ret;
ret = packet_header_create(&request.header, sizeof(request), INDUSTRIAL_DIGITAL_IN_4_FUNCTION_GET_EDGE_COUNT, device_p->ipcon_p, device_p);
if (ret < 0) {
return ret;
}
request.pin = pin;
request.reset_counter = reset_counter;
ret = device_send_request(device_p, (Packet *)&request, (Packet *)&response);
if (ret < 0) {
return ret;
}
*ret_count = leconvert_uint32_from(response.count);
return ret;
}