Beispiel #1
0
 internal static int Serialize_HEARTBEAT(this Msg_heartbeat msg, byte[] bytes, ref int offset)
 {
     bitconverter.GetBytes(msg.time_usec, bytes, offset + 0);
     bytes[offset + 8] = msg.fightstatus;
     offset           += 9;
     return(0);
 }
 internal static int Serialize_HEARTBEAT(this Msg_heartbeat msg, byte[] bytes, ref int offset)
 {
     bitconverter.GetBytes(msg.custom_mode, bytes, offset + 0);
     bytes[offset + 4] = msg.type;
     bytes[offset + 5] = msg.autopilot;
     bytes[offset + 6] = msg.base_mode;
     bytes[offset + 7] = msg.system_status;
     bytes[offset + 8] = msg.mavlink_version;
     offset           += 9;
     return(0);
 }
Beispiel #3
0
        public void HeartBeatSerialisation()
        {
            _mav.txPacketSequence = 0x98; // hack to sync up with the real packet sequence no

            var packet = new Msg_heartbeat { autopilot = 3, type = 0, mavlink_version  = 2 };

             _mav.Send(new MavlinkPacket { SystemId = 7, ComponentId = 1, Message = packet });

            var dlbytes = _testStream.SentBytes.SelectMany(b => b).ToArray();

            var hbBytes = GoodMavlinkHeartbeatPacketData();

            CollectionAssert.AreEqual(hbBytes, dlbytes);
        }