diff --git a/ExtLibs/MockDroneID/MockDroneID.csproj b/ExtLibs/MockDroneID/MockDroneID.csproj new file mode 100644 index 0000000000..586090d423 --- /dev/null +++ b/ExtLibs/MockDroneID/MockDroneID.csproj @@ -0,0 +1,13 @@ + + + + Exe + net7.0 + 1701;1702;NU1605 + + + + + + + diff --git a/ExtLibs/MockDroneID/Program.cs b/ExtLibs/MockDroneID/Program.cs new file mode 100644 index 0000000000..6c89f54a34 --- /dev/null +++ b/ExtLibs/MockDroneID/Program.cs @@ -0,0 +1,108 @@ +using System; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading; + +namespace Mock +{ + class Program + { + static void Main(string[] args) + { + var mavlinkudp = new UdpClient(14550); + var mavparse = new MAVLink.MavlinkParse(); + var seqno = 0; + IPEndPoint ipEP = new IPEndPoint(IPAddress.Any, 0); + + + while (true) + { + while (mavlinkudp.Available > 0) + { + ipEP = new IPEndPoint(IPAddress.Any, 0); + try + { + var rawpacket = mavlinkudp.Receive(ref ipEP); + + var packet = mavparse.ReadPacket(new MemoryStream(rawpacket)); + Console.WriteLine(packet); + } + catch + { + continue; + } + } + + if (ipEP.Address == IPAddress.Any) + { + Thread.Sleep(100); + continue; + } + + var sendpacket = mavparse.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, + new MAVLink.mavlink_heartbeat_t() + { + autopilot = (byte)MAVLink.MAV_AUTOPILOT.ARDUPILOTMEGA, + base_mode = (byte)MAVLink.MAV_MODE_FLAG.CUSTOM_MODE_ENABLED, + system_status = (byte)MAVLink.MAV_STATE.ACTIVE, + type = (byte)MAVLink.MAV_TYPE.QUADROTOR + }, false, 1, 1, seqno++); + mavlinkudp.Send(sendpacket, sendpacket.Length, ipEP); + + + sendpacket = mavparse.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.OPEN_DRONE_ID_BASIC_ID, + new MAVLink.mavlink_open_drone_id_basic_id_t() + { + + }, false, 1, 1, seqno++); + mavlinkudp.Send(sendpacket, sendpacket.Length, ipEP); + + + sendpacket = mavparse.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.OPEN_DRONE_ID_LOCATION, + new MAVLink.mavlink_open_drone_id_location_t() + { + + }, false, 1, 1, seqno++); + mavlinkudp.Send(sendpacket, sendpacket.Length, ipEP); + + + + sendpacket = mavparse.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.OPEN_DRONE_ID_SELF_ID, + new MAVLink.mavlink_open_drone_id_self_id_t() + { + + }, false, 1, 1, seqno++); + mavlinkudp.Send(sendpacket, sendpacket.Length, ipEP); + + sendpacket = mavparse.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.OPEN_DRONE_ID_SYSTEM, + new MAVLink.mavlink_open_drone_id_system_t() + { + + }, false, 1, 1, seqno++); + mavlinkudp.Send(sendpacket, sendpacket.Length, ipEP); + + sendpacket = mavparse.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.OPEN_DRONE_ID_SYSTEM_UPDATE, + new MAVLink.mavlink_open_drone_id_system_update_t() + { + + }, false, 1, 1, seqno++); + mavlinkudp.Send(sendpacket, sendpacket.Length, ipEP); + + sendpacket = mavparse.GenerateMAVLinkPacket20(MAVLink.MAVLINK_MSG_ID.OPEN_DRONE_ID_OPERATOR_ID, + new MAVLink.mavlink_open_drone_id_operator_id_t() + { + + }, false, 1, 1, seqno++); + mavlinkudp.Send(sendpacket, sendpacket.Length, ipEP); + + Thread.Sleep(1000); + } + } + } + + internal struct mavlink_vfr_hud_EDIT_t + { + } +} diff --git a/MissionPlanner.sln b/MissionPlanner.sln index a487b7a926..a05fab486d 100644 --- a/MissionPlanner.sln +++ b/MissionPlanner.sln @@ -223,6 +223,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bulb", "ExtLibs\LEDBulb\Bul EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MissionPlannerTests", "MissionPlannerTests\MissionPlannerTests.csproj", "{0B99EBF2-B964-4AAC-9EC5-76353610AAAE}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MockDroneID", "ExtLibs\MockDroneID\MockDroneID.csproj", "{6D39C141-733B-4C4A-87AB-974637952D1B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -550,6 +552,10 @@ Global {AF81C41B-06E6-4CA5-9FD4-A4E7042F1107}.Release|Any CPU.Build.0 = Release|Any CPU {0B99EBF2-B964-4AAC-9EC5-76353610AAAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0B99EBF2-B964-4AAC-9EC5-76353610AAAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D39C141-733B-4C4A-87AB-974637952D1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D39C141-733B-4C4A-87AB-974637952D1B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D39C141-733B-4C4A-87AB-974637952D1B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D39C141-733B-4C4A-87AB-974637952D1B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -634,6 +640,7 @@ Global {DED183CA-5591-4CE5-A89D-987035BAC553} = {9B3AC501-5FCB-4A2A-A628-BE0985DB2BD4} {FBE658B3-684D-46E6-8668-50DEF0778538} = {9B3AC501-5FCB-4A2A-A628-BE0985DB2BD4} {AF81C41B-06E6-4CA5-9FD4-A4E7042F1107} = {7E264F12-9EC3-4CDC-A187-6879C2B2BFCF} + {6D39C141-733B-4C4A-87AB-974637952D1B} = {0371886E-5A61-4626-B9E0-50A837ECE2DD} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {FD2C9507-1A09-4F5B-98AB-B6B194A4B260}