Beispiel #1
0
        static public int VehicleModeCommandCallback(Comnet.Header header, Comnet.ABSPacket packet, Comnet.CommNode node)
        {
            //validate who the packet is from 1 is gcs
            if (header.GetSourceID() == 1)
            {
                NGCP.VehicleModeCommand twc = Comnet.ABSPacket.GetValue <NGCP.VehicleModeCommand>(packet);
                //Settings.DriveMode = (DriveMode)twc.vehicle_mode;
            }

            //make sure you return this way to declare succes and destory the pointer(c++)
            return((Int32)(Comnet.CallBackCodes.CALLBACK_SUCCESS | Comnet.CallBackCodes.CALLBACK_DESTROY_PACKET));
        }
        public int VehicleModeCommandCallback(Comnet.Header header, Comnet.ABSPacket packet, Comnet.CommNode node)
        {
            //validate who the packet is from 1 is gcs
            if (header.GetSourceID() == 1)
            {
                NGCP.VehicleModeCommand twc = Comnet.ABSPacket.GetValue <NGCP.VehicleModeCommand>(packet);
                if ((DriveMode)twc.vehicle_mode == DriveMode.LocalControl)
                {
                    Drive_Type_Box.Text = "Local Mode";
                }
                else if ((DriveMode)twc.vehicle_mode == DriveMode.SemiAutonomous)
                {
                    Drive_Type_Box.Text = "Semi-Auto Mode";
                }
                else if ((DriveMode)twc.vehicle_mode == DriveMode.Autonomous)
                {
                    Drive_Type_Box.Text = "Auto Mode";
                }

                //Settings.DriveMode = (DriveMode)twc.vehicle_mode;
            }
            else if (header.GetSourceID() == 7)
            {
                NGCP.VehicleModeCommand vmc = Comnet.ABSPacket.GetValue <NGCP.VehicleModeCommand>(packet);
                if ((DriveMode)vmc.vehicle_mode == DriveMode.LocalControl)
                {
                    Drive_Type_Box.Text = "Local Mode";
                }
                else if ((DriveMode)vmc.vehicle_mode == DriveMode.SemiAutonomous)
                {
                    Drive_Type_Box.Text = "Semi-Auto Mode";
                }
                else if ((DriveMode)vmc.vehicle_mode == DriveMode.Autonomous)
                {
                    Drive_Type_Box.Text = "Auto Mode";
                }
            }

            //make sure you return this way to declare succes and destory the pointer(c++)
            return((Int32)(Comnet.CallBackCodes.CALLBACK_SUCCESS | Comnet.CallBackCodes.CALLBACK_DESTROY_PACKET));
        }