public static void UpdateDAQ(VehicleScapeAPI.DAQ daq)
 {
     if (daq.handle == 0)
     {
         return;
     }
     VehicleScapeAPI.SetDAQProperties(ref daq);
 }
 public static VehicleScapeAPI.DAQ GetDAQByHandle(uint handle)
 {
     VehicleScapeAPI.DAQ daq = new VehicleScapeAPI.DAQ();
     if (handle == 0)
     {
         return(daq);
     }
     daq.handle = handle;
     VehicleScapeAPI.GetDAQProperties(ref daq);
     return(daq);
 }
 private static VehicleScapeAPI.Result Initialize()
 {
     VehicleScapeAPI.Result result = VehicleScapeAPI.Init();
     if (result == VehicleScapeAPI.Result.ResultOk)
     {
         Initialized = true;
         // VehicleScape automatically creates a DAQ for us and names it "DAQ 1."
         // We want it named "New DAQ" like any DAQ we create, so we'll change it here.
         VehicleScapeAPI.DAQ initialDAQ = GetDAQs()[0];
         initialDAQ.description = "New DAQ";
         VehicleScapeAPI.SetDAQProperties(ref initialDAQ);
     }
     return(result);
 }
        public static VehicleScapeAPI.Result Generate(GenerateParameters parameters, uint daqHandle, uint deviceHandle)
        {
            if (daqHandle == 0 || deviceHandle == 0)
            {
                return(VehicleScapeAPI.Result.ResultInvalidHandle);
            }
            // Set up our DAQ
            VehicleScapeAPI.DAQ daq = GetDAQByHandle(daqHandle);
            VehicleScapeAPI.SetDAQProperties(ref daq);

            // Set up our collection
            List <VehicleScapeAPI.DAQCollection> cols = GetDAQCollections(daqHandle);

            if (cols.Count == 0)
            {
                return(VehicleScapeAPI.Result.ResultUnableToSetupForCompile);
            }
            VehicleScapeAPI.DAQCollection col = cols[0];
            col.fileName = parameters.Name;
            col.stopNumMessages.numMessages = parameters.NumberOfMessagesToCollect;
            col.collectionType = VehicleScapeAPI.CollectionType.StartImmediatelyStopNumMessage;
            VehicleScapeAPI.SetDAQCollectionProperties(ref col);

            List <uint> channelHandles = new List <uint>();

            channelHandles.AddRange(parameters.MessageHandles);
            channelHandles.AddRange(parameters.SignalHandles);
            List <VehicleScapeAPI.DAQChannel> channels = new List <VehicleScapeAPI.DAQChannel>();

            // Set up our channels
            foreach (uint handle in channelHandles)
            {
                VehicleScapeAPI.DAQChannel channel = new VehicleScapeAPI.DAQChannel();
                channel.signalHandle = handle;
                VehicleScapeAPI.AddDAQChannel(daqHandle, handle, ref channel);
                VehicleScapeAPI.SetAlwaysCollectDAQChannel(handle);
                channels.Add(channel);
            }

            VehicleScapeAPI.Result retv = VehicleScapeAPI.GenerateCoreMini(daqHandle, deviceHandle);

            // Clear out the channels
            foreach (VehicleScapeAPI.DAQChannel channel in channels)
            {
                VehicleScapeAPI.RemoveDAQChannel(channel.signalHandle);
            }

            return(retv);
        }
        public static List <VehicleScapeAPI.DAQ> GetDAQs()
        {
            List <VehicleScapeAPI.DAQ> daqList = new List <VehicleScapeAPI.DAQ>();

            if (!Initialized)
            {
                return(daqList);
            }

            int daqCount = 0;

            VehicleScapeAPI.GetDAQs(IntPtr.Zero, ref daqCount);
            if (daqCount == 0)
            {
                return(daqList);
            }
            VehicleScapeAPI.DAQ[] daqs = new VehicleScapeAPI.DAQ[daqCount];
            VehicleScapeAPI.GetDAQs(daqs, ref daqCount);
            daqList.AddRange(daqs);
            return(daqList);
        }
        public static VehicleScapeAPI.DAQ AddDAQ()
        {
            if (!Initialized)
            {
                if (Initialize() == VehicleScapeAPI.Result.ResultOk)
                {
                    VehicleScapeAPI.DAQ initialDAQ = GetDAQs()[0];
                    return(initialDAQ);
                }
                else
                {
                    return(new VehicleScapeAPI.DAQ());
                }
            }

            VehicleScapeAPI.DAQ daq = new VehicleScapeAPI.DAQ();
            VehicleScapeAPI.AddDAQ(ref daq);
            daq.description = "New DAQ";
            VehicleScapeAPI.SetDAQProperties(ref daq);
            return(daq);
        }
示例#7
0
        private void LoadDAQ(VehicleScapeAPI.DAQ daq)
        {
            loading = true;

            if (DAQListView.SelectedIndices.Count > 0)
            {
                DAQListView.Items[DAQListView.SelectedIndices[0]].Text = daq.description;
            }

            StartNewFileOnWakeupCheckBox.Checked = Convert.ToBoolean(daq.newFileOnWakeup);

            if (daq.sleepPeriod == VehicleScapeAPI.NeverGoToSleep)
            {
                NeverGoToSleepRadioButton.Checked = true;
            }
            else
            {
                SleepOnNoBusActivityRadioButton.Checked = true;
                BusActivityThresholdTextBox.Text        = daq.sleepPeriod.ToString();
            }

            if (daq.wakeupMode == VehicleScapeAPI.WakeupModeType.WakeupModeTypeNormal)
            {
                WakeNormalRadioButton.Checked = true;
            }
            else
            {
                WakeInstantRadioButton.Checked = true;
            }

            RemoteWakeupCheckBox.Checked  = Convert.ToBoolean(daq.remoteWakeup);
            OverallTimeoutTextBox.Text    = daq.neoVIOverallTimeout.ToString();
            ConnectionTimeoutTextBox.Text = daq.neoVIConnectionTimeout.ToString();
            VoltageCutoffTextBox.Text     = daq.neoVIVoltageCutoff.ToString();

            loading = false;
        }
示例#8
0
 private void UpdateDAQ()
 {
     if (loading)
     {
         return;
     }
     VehicleScapeAPI.DAQ daq = GetSelectedDAQ();
     if (DAQListView.SelectedIndices.Count > 0)
     {
         daq.description = DAQListView.Items[DAQListView.SelectedIndices[0]].Text;
     }
     daq.newFileOnWakeup = Convert.ToInt32(StartNewFileOnWakeupCheckBox.Checked);
     daq.sleepPeriod     = NeverGoToSleepRadioButton.Checked ?
                           VehicleScapeAPI.NeverGoToSleep :
                           double.Parse(BusActivityThresholdTextBox.Text);
     daq.wakeupMode = WakeNormalRadioButton.Checked ?
                      VehicleScapeAPI.WakeupModeType.WakeupModeTypeNormal :
                      VehicleScapeAPI.WakeupModeType.WakeupModeTypeInstant;
     daq.remoteWakeup           = Convert.ToInt32(RemoteWakeupCheckBox.Checked);
     daq.neoVIOverallTimeout    = double.Parse(OverallTimeoutTextBox.Text);
     daq.neoVIConnectionTimeout = double.Parse(ConnectionTimeoutTextBox.Text);
     daq.neoVIVoltageCutoff     = double.Parse(VoltageCutoffTextBox.Text);
     VehicleScapeInterface.UpdateDAQ(daq);
 }
 public static VehicleScapeAPI.Result WriteDAQ(VehicleScapeAPI.DAQ daq)
 {
     return(VehicleScapeAPI.SetDAQProperties(ref daq));
 }