Beispiel #1
0
            public static uavcan_equipment_indication_LightsCommand ByteArrayToDroneCANMsg(byte[] transfer, int startoffset)
            {
                var ans = new uavcan_equipment_indication_LightsCommand();

                ans.decode(new DroneCAN.CanardRxTransfer(transfer.Skip(startoffset).ToArray()));
                return(ans);
            }
Beispiel #2
0
        static void _decode_uavcan_equipment_indication_LightsCommand(CanardRxTransfer transfer, ref uint32_t bit_ofs, uavcan_equipment_indication_LightsCommand msg, bool tao)
        {
            if (!tao)
            {
                canardDecodeScalar(transfer, bit_ofs, 5, false, ref msg.commands_len);
                bit_ofs += 5;
            }


            if (tao)
            {
                msg.commands_len = 0;
                var temp = new List <uavcan_equipment_indication_SingleLightCommand>();
                while (((transfer.payload_len * 8) - bit_ofs) > 0)
                {
                    msg.commands_len++;
                    temp.Add(new uavcan_equipment_indication_SingleLightCommand());
                    _decode_uavcan_equipment_indication_SingleLightCommand(transfer, ref bit_ofs, temp[msg.commands_len - 1], false);
                }
                msg.commands = temp.ToArray();
            }
            else
            {
                msg.commands = new uavcan_equipment_indication_SingleLightCommand[msg.commands_len];
                for (int i = 0; i < msg.commands_len; i++)
                {
                    _decode_uavcan_equipment_indication_SingleLightCommand(transfer, ref bit_ofs, msg.commands[i], false);
                }
            }
        }
Beispiel #3
0
 static void _encode_uavcan_equipment_indication_LightsCommand(uint8_t[] buffer, uavcan_equipment_indication_LightsCommand msg, uavcan_serializer_chunk_cb_ptr_t chunk_cb, object ctx, bool tao)
 {
     if (!tao)
     {
         memset(buffer, 0, 8);
         canardEncodeScalar(buffer, 0, 5, msg.commands_len);
         chunk_cb(buffer, 5, ctx);
     }
     for (int i = 0; i < msg.commands_len; i++)
     {
         _encode_uavcan_equipment_indication_SingleLightCommand(buffer, msg.commands[i], chunk_cb, ctx, false);
     }
 }
Beispiel #4
0
        static uint32_t decode_uavcan_equipment_indication_LightsCommand(CanardRxTransfer transfer, uavcan_equipment_indication_LightsCommand msg)
        {
            uint32_t bit_ofs = 0;

            _decode_uavcan_equipment_indication_LightsCommand(transfer, ref bit_ofs, msg, true);
            return((bit_ofs + 7) / 8);
        }
Beispiel #5
0
 static void encode_uavcan_equipment_indication_LightsCommand(uavcan_equipment_indication_LightsCommand msg, uavcan_serializer_chunk_cb_ptr_t chunk_cb, object ctx)
 {
     uint8_t[] buffer = new uint8_t[8];
     _encode_uavcan_equipment_indication_LightsCommand(buffer, msg, chunk_cb, ctx, true);
 }
Beispiel #6
0
        static void _decode_uavcan_equipment_indication_LightsCommand(CanardRxTransfer transfer, ref uint32_t bit_ofs, uavcan_equipment_indication_LightsCommand msg, bool tao)
        {
            if (!tao)
            {
                canardDecodeScalar(transfer, bit_ofs, 5, false, ref msg.commands_len);
                bit_ofs += 5;
            }


            if (tao)
            {
                msg.commands_len = 0;
                while (((transfer.payload_len * 8) - bit_ofs) > 0)
                {
                    _decode_uavcan_equipment_indication_SingleLightCommand(transfer, ref bit_ofs, msg.commands[msg.commands_len], false);
                    msg.commands_len++;
                }
            }
            else
            {
                for (int i = 0; i < msg.commands_len; i++)
                {
                    _decode_uavcan_equipment_indication_SingleLightCommand(transfer, ref bit_ofs, msg.commands[i], false);
                }
            }
        }