static void _encode_uavcan_protocol_GetNodeInfo_res(uint8_t[] buffer, uavcan_protocol_GetNodeInfo_res msg, uavcan_serializer_chunk_cb_ptr_t chunk_cb, object ctx, bool tao) { _encode_uavcan_protocol_NodeStatus(buffer, msg.status, chunk_cb, ctx, false); _encode_uavcan_protocol_SoftwareVersion(buffer, msg.software_version, chunk_cb, ctx, false); _encode_uavcan_protocol_HardwareVersion(buffer, msg.hardware_version, chunk_cb, ctx, false); if (!tao) { memset(buffer, 0, 8); canardEncodeScalar(buffer, 0, 7, msg.name_len); chunk_cb(buffer, 7, ctx); } for (int i = 0; i < msg.name_len; i++) { memset(buffer, 0, 8); canardEncodeScalar(buffer, 0, 8, msg.name[i]); chunk_cb(buffer, 8, ctx); } }
public static uavcan_protocol_GetNodeInfo_res ByteArrayToDroneCANMsg(byte[] transfer, int startoffset) { var ans = new uavcan_protocol_GetNodeInfo_res(); ans.decode(new DroneCAN.CanardRxTransfer(transfer.Skip(startoffset).ToArray())); return(ans); }
static void _decode_uavcan_protocol_GetNodeInfo_res(CanardRxTransfer transfer, ref uint32_t bit_ofs, uavcan_protocol_GetNodeInfo_res msg, bool tao) { _decode_uavcan_protocol_NodeStatus(transfer, ref bit_ofs, msg.status, false); _decode_uavcan_protocol_SoftwareVersion(transfer, ref bit_ofs, msg.software_version, false); _decode_uavcan_protocol_HardwareVersion(transfer, ref bit_ofs, msg.hardware_version, false); if (!tao) { canardDecodeScalar(transfer, bit_ofs, 7, false, ref msg.name_len); bit_ofs += 7; } else { msg.name_len = (uint8_t)(((transfer.payload_len * 8) - bit_ofs) / 8); } for (int i = 0; i < msg.name_len; i++) { canardDecodeScalar(transfer, bit_ofs, 8, false, ref msg.name[i]); bit_ofs += 8; } }
static uint32_t decode_uavcan_protocol_GetNodeInfo_res(CanardRxTransfer transfer, uavcan_protocol_GetNodeInfo_res msg) { uint32_t bit_ofs = 0; _decode_uavcan_protocol_GetNodeInfo_res(transfer, ref bit_ofs, msg, true); return((bit_ofs + 7) / 8); }
/* * * static uavcan_message_descriptor_s uavcan_protocol_GetNodeInfo_res_descriptor = { * UAVCAN_PROTOCOL_GETNODEINFO_RES_DT_SIG, * UAVCAN_PROTOCOL_GETNODEINFO_RES_DT_ID, * * CanardTransferTypeResponse, * * sizeof(uavcan_protocol_GetNodeInfo_res), * UAVCAN_PROTOCOL_GETNODEINFO_RES_MAX_PACK_SIZE, * encode_func, * decode_func, * * null * * }; */ static void encode_uavcan_protocol_GetNodeInfo_res(uavcan_protocol_GetNodeInfo_res msg, uavcan_serializer_chunk_cb_ptr_t chunk_cb, object ctx) { uint8_t[] buffer = new uint8_t[8]; _encode_uavcan_protocol_GetNodeInfo_res(buffer, msg, chunk_cb, ctx, true); }