static void _decode_uavcan_protocol_file_Write_res(CanardRxTransfer transfer, ref uint32_t bit_ofs, uavcan_protocol_file_Write_res msg, bool tao) { _decode_uavcan_protocol_file_Error(transfer, ref bit_ofs, msg.error, tao); }
static void _decode_uavcan_equipment_ice_reciprocating_Status(CanardRxTransfer transfer, ref uint32_t bit_ofs, uavcan_equipment_ice_reciprocating_Status msg, bool tao) { canardDecodeScalar(transfer, bit_ofs, 2, false, ref msg.state); bit_ofs += 2; canardDecodeScalar(transfer, bit_ofs, 30, false, ref msg.flags); bit_ofs += 30; bit_ofs += 16; canardDecodeScalar(transfer, bit_ofs, 7, false, ref msg.engine_load_percent); bit_ofs += 7; canardDecodeScalar(transfer, bit_ofs, 17, false, ref msg.engine_speed_rpm); bit_ofs += 17; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.spark_dwell_time_ms = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.atmospheric_pressure_kpa = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.intake_manifold_pressure_kpa = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.intake_manifold_temperature = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.coolant_temperature = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.oil_pressure = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.oil_temperature = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.fuel_pressure = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.fuel_consumption_rate_cm3pm); bit_ofs += 32; canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.estimated_consumed_fuel_volume_cm3); bit_ofs += 32; canardDecodeScalar(transfer, bit_ofs, 7, false, ref msg.throttle_position_percent); bit_ofs += 7; canardDecodeScalar(transfer, bit_ofs, 6, false, ref msg.ecu_index); bit_ofs += 6; canardDecodeScalar(transfer, bit_ofs, 3, false, ref msg.spark_plug_usage); bit_ofs += 3; if (!tao) { canardDecodeScalar(transfer, bit_ofs, 5, false, ref msg.cylinder_status_len); bit_ofs += 5; } if (tao) { msg.cylinder_status_len = 0; while (((transfer.payload_len * 8) - bit_ofs) > 0) { msg.cylinder_status_len++; _decode_uavcan_equipment_ice_reciprocating_CylinderStatus(transfer, ref bit_ofs, msg.cylinder_status[msg.cylinder_status_len], false); } } else { msg.cylinder_status = new uavcan_equipment_ice_reciprocating_CylinderStatus[msg.cylinder_status_len]; for (int i = 0; i < msg.cylinder_status_len; i++) { _decode_uavcan_equipment_ice_reciprocating_CylinderStatus(transfer, ref bit_ofs, msg.cylinder_status[i], false); } } }
static uint32_t decode_uavcan_equipment_camera_gimbal_Mode(CanardRxTransfer transfer, uavcan_equipment_camera_gimbal_Mode msg) { uint32_t bit_ofs = 0; _decode_uavcan_equipment_camera_gimbal_Mode(transfer, ref bit_ofs, msg, true); return (bit_ofs+7)/8; }
static void _decode_uavcan_equipment_gnss_Fix2(CanardRxTransfer transfer, ref uint32_t bit_ofs, uavcan_equipment_gnss_Fix2 msg, bool tao) { _decode_uavcan_Timestamp(transfer, ref bit_ofs, msg.timestamp, false); _decode_uavcan_Timestamp(transfer, ref bit_ofs, msg.gnss_timestamp, false); canardDecodeScalar(transfer, bit_ofs, 3, false, ref msg.gnss_time_standard); bit_ofs += 3; bit_ofs += 13; canardDecodeScalar(transfer, bit_ofs, 8, false, ref msg.num_leap_seconds); bit_ofs += 8; canardDecodeScalar(transfer, bit_ofs, 37, true, ref msg.longitude_deg_1e8); bit_ofs += 37; canardDecodeScalar(transfer, bit_ofs, 37, true, ref msg.latitude_deg_1e8); bit_ofs += 37; canardDecodeScalar(transfer, bit_ofs, 27, true, ref msg.height_ellipsoid_mm); bit_ofs += 27; canardDecodeScalar(transfer, bit_ofs, 27, true, ref msg.height_msl_mm); bit_ofs += 27; for (int i = 0; i < 3; i++) { canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.ned_velocity[i]); bit_ofs += 32; } canardDecodeScalar(transfer, bit_ofs, 6, false, ref msg.sats_used); bit_ofs += 6; canardDecodeScalar(transfer, bit_ofs, 2, false, ref msg.status); bit_ofs += 2; canardDecodeScalar(transfer, bit_ofs, 4, false, ref msg.mode); bit_ofs += 4; canardDecodeScalar(transfer, bit_ofs, 6, false, ref msg.sub_mode); bit_ofs += 6; canardDecodeScalar(transfer, bit_ofs, 6, false, ref msg.covariance_len); bit_ofs += 6; msg.covariance = new Single[msg.covariance_len]; for (int i = 0; i < msg.covariance_len; i++) { { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.covariance[i] = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; } { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.pdop = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; if (!tao) { canardDecodeScalar(transfer, bit_ofs, 1, false, ref msg.ecef_position_velocity_len); bit_ofs += 1; } if (tao) { msg.ecef_position_velocity_len = 0; var temp = new List <uavcan_equipment_gnss_ECEFPositionVelocity>(); while (((transfer.payload_len * 8) - bit_ofs) > 0) { msg.ecef_position_velocity_len++; temp.Add(new uavcan_equipment_gnss_ECEFPositionVelocity()); _decode_uavcan_equipment_gnss_ECEFPositionVelocity(transfer, ref bit_ofs, temp[msg.ecef_position_velocity_len - 1], false); } msg.ecef_position_velocity = temp.ToArray(); } else { msg.ecef_position_velocity = new uavcan_equipment_gnss_ECEFPositionVelocity[msg.ecef_position_velocity_len]; for (int i = 0; i < msg.ecef_position_velocity_len; i++) { _decode_uavcan_equipment_gnss_ECEFPositionVelocity(transfer, ref bit_ofs, msg.ecef_position_velocity[i], false); } } }
static uint32_t decode_uavcan_protocol_dynamic_node_id_server_AppendEntries_req(CanardRxTransfer transfer, uavcan_protocol_dynamic_node_id_server_AppendEntries_req msg) { uint32_t bit_ofs = 0; _decode_uavcan_protocol_dynamic_node_id_server_AppendEntries_req(transfer, ref bit_ofs, msg, true); return((bit_ofs + 7) / 8); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_ahrs_MagneticFieldStrength(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_ahrs_Solution(transfer, this); }
static void _decode_uavcan_navigation_GlobalNavigationSolution(CanardRxTransfer transfer, ref uint32_t bit_ofs, uavcan_navigation_GlobalNavigationSolution msg, bool tao) { _decode_uavcan_Timestamp(transfer, ref bit_ofs, msg.timestamp, false); canardDecodeScalar(transfer, bit_ofs, 64, true, ref msg.longitude); bit_ofs += 64; canardDecodeScalar(transfer, bit_ofs, 64, true, ref msg.latitude); bit_ofs += 64; canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.height_ellipsoid); bit_ofs += 32; canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.height_msl); bit_ofs += 32; canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.height_agl); bit_ofs += 32; canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.height_baro); bit_ofs += 32; { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.qnh_hpa = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; /*['__doc__', '__init__', '__module__', '__repr__', '__str__', 'get_normalized_definition', 'name', 'type']*/ for (int i = 0; i < 4; i++) { canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.orientation_xyzw[i]); bit_ofs += 32; } canardDecodeScalar(transfer, bit_ofs, 6, false, ref msg.pose_covariance_len); bit_ofs += 6; for (int i = 0; i < msg.pose_covariance_len; i++) { { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.pose_covariance[i] = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; } /*['__doc__', '__init__', '__module__', '__repr__', '__str__', 'get_normalized_definition', 'name', 'type']*/ for (int i = 0; i < 3; i++) { canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.linear_velocity_body[i]); bit_ofs += 32; } /*['__doc__', '__init__', '__module__', '__repr__', '__str__', 'get_normalized_definition', 'name', 'type']*/ for (int i = 0; i < 3; i++) { canardDecodeScalar(transfer, bit_ofs, 32, true, ref msg.angular_velocity_body[i]); bit_ofs += 32; } /*['__doc__', '__init__', '__module__', '__repr__', '__str__', 'get_normalized_definition', 'name', 'type']*/ for (int i = 0; i < 3; i++) { { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.linear_acceleration_body[i] = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; } if (!tao) { canardDecodeScalar(transfer, bit_ofs, 6, false, ref msg.velocity_covariance_len); bit_ofs += 6; } else { msg.velocity_covariance_len = (uint8_t)(((transfer.payload_len * 8) - bit_ofs) / 16); } for (int i = 0; i < msg.velocity_covariance_len; i++) { { uint16_t float16_val = 0; canardDecodeScalar(transfer, bit_ofs, 16, true, ref float16_val); msg.velocity_covariance[i] = canardConvertFloat16ToNativeFloat(float16_val); } bit_ofs += 16; } }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_file_Error(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_Panic(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_GetNodeInfo_req(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_safety_ArmingStatus(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_ardupilot_gnss_Status(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_ice_reciprocating_Status(transfer, this); }
public static int canardDecodeScalar <T>(CanardRxTransfer transfer, uint bit_offset, byte bit_length, bool value_is_signed, ref T out_value) { union storage = new union(false); memset(storage.bytes.ToArray(), 0, Marshal.SizeOf(storage)); // This is important int result = descatterTransferPayload(transfer, bit_offset, bit_length, ref storage); if (result <= 0) { return(result); } CANARD_ASSERT((result > 0) && (result <= 64) && (result <= bit_length)); /* * The bit copy algorithm assumes that more significant bits have lower index, so we need to shift some. * Extra most significant bits will be filled with zeroes, which is fine. * Coverity Scan mistakenly believes that the array may be overrun if bit_length == 64; however, this branch will * not be taken if bit_length == 64, because 64 % 8 == 0. */ if ((bit_length % 8) != 0) { // coverity[overrun-local] storage[bit_length / 8] = (byte)(storage.bytes[bit_length / 8] >> ((8 - (bit_length % 8)) & 7)); } /* * Determining the closest standard byte length - this will be needed for byte reordering and sign bit extension. */ Byte std_byte_length = 0; if (bit_length == 1) { std_byte_length = sizeof(bool); } else if (bit_length <= 8) { std_byte_length = 1; } else if (bit_length <= 16) { std_byte_length = 2; } else if (bit_length <= 32) { std_byte_length = 4; } else if (bit_length <= 64) { std_byte_length = 8; } else { CANARD_ASSERT(false); return(-CANARD_ERROR_INTERNAL); } CANARD_ASSERT((std_byte_length > 0) && (std_byte_length <= 8)); /* * Flipping the byte order if needed. */ /*if (isBigEndian()) * { * swapByteOrder(&storage.bytes[0], std_byte_length); * }*/ /* * Extending the sign bit if needed. I miss templates. */ if (value_is_signed && (std_byte_length * 8 != bit_length)) { if (bit_length <= 8) { if ((storage.s8 & (1U << (bit_length - 1))) != 0) // If the sign bit is set... { storage.u8 |= (byte)((Byte)0xFFU & (Byte) ~((1 << bit_length) - 1U)); // ...set all bits above it. } } else if (bit_length <= 16) { if ((storage.s16 & (1U << (bit_length - 1))) != 0) { storage.u16 |= (UInt16)((UInt16)0xFFFFU & (UInt16) ~((1 << bit_length) - 1U)); } } else if (bit_length <= 32) { if ((storage.s32 & (((UInt32)1) << (bit_length - 1))) != 0) { storage.u32 |= (UInt32)0xFFFFFFFFU & (UInt32) ~((((UInt32)1U) << bit_length) - 1U); } } else if (bit_length < 64) // Strictly less, this is not a typo { if ((storage.u64 & (((UInt64)1) << (bit_length - 1))) != 0) { storage.u64 |= (UInt64)0xFFFFFFFFFFFFFFFFU & (UInt64) ~((((UInt64)1) << bit_length) - 1U); } } else { CANARD_ASSERT(false); return(-CANARD_ERROR_INTERNAL); } } /* * Copying the result out. */ if (value_is_signed) { if (bit_length <= 8) { out_value = (T)(IConvertible)storage.s8; } else if (bit_length <= 16) { out_value = (T)(dynamic)storage.s16; } else if (typeof(T) == typeof(float)) { out_value = (T)(IConvertible)storage.f32; } else if (bit_length <= 32) { out_value = (T)(IConvertible)storage.s32; } else if (bit_length <= 64) { out_value = (T)(IConvertible)storage.s64; } else { CANARD_ASSERT(false); return(-CANARD_ERROR_INTERNAL); } } else { if (bit_length == 1) { out_value = (T)(IConvertible)storage.boolean; } else if (bit_length <= 8) { out_value = (T)(IConvertible)storage.u8; } else if (bit_length <= 16) { out_value = (T)(IConvertible)storage.u16; } else if (bit_length <= 32) { out_value = (T)(IConvertible)storage.u32; } else if (bit_length <= 64) { out_value = (T)(IConvertible)storage.u64; } else { CANARD_ASSERT(false); return(-CANARD_ERROR_INTERNAL); } } CANARD_ASSERT(result <= bit_length); CANARD_ASSERT(result > 0); return(result); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_GetTransportStats_req(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_CANIfaceStats(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_actuator_Command(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_hardpoint_Status(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_indication_RGB565(transfer, this); }
static void _decode_uavcan_protocol_GetNodeInfo_req(CanardRxTransfer transfer, ref uint32_t bit_ofs, uavcan_protocol_GetNodeInfo_req msg, bool tao) { }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_param_ExecuteOpcode_res(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_com_hex_equipment_gpio_GetInputStates_req(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_dynamic_node_id_server_Entry(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_file_Write_res(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_protocol_file_BeginFirmwareUpdate_req(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_power_BatteryInfo(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_equipment_air_data_StaticTemperature(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_uavcan_olliw_storm32_Control(transfer, this); }
public void decode(CanardRxTransfer transfer) { decode_ardupilot_equipment_trafficmonitor_TrafficReport(transfer, this); }