Exemple #1
0
        public bool GetMarkerCount(CHANNEL channel,
                                   MEASUREMENT measurement,
                                   out int markerCount)
        {
            markerCount = -1;
            try
            {
                IAgNAMeasurement chMeasurement;
                if (measurement != MEASUREMENT.LIKE_CHANNEL)
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                }
                else
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                }

                markerCount = chMeasurement.Markers.Count;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #2
0
        public bool GetMarkerStimulus(CHANNEL channel,
                                      MEASUREMENT measurement,
                                      MARKERS marker,
                                      out double stimulus)
        {
            stimulus = 0;
            try
            {
                IAgNAMeasurement chMeasurement;
                if (measurement != MEASUREMENT.LIKE_CHANNEL)
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                }
                else
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                }

                stimulus = chMeasurement.Markers.Item[getMarker(marker)].Stimulus;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #3
0
        string GetChannelName(CHANNEL channel)
        {
            switch (channel)
            {
            case CHANNEL.CHANNEL1:
                return("Channel1");

            case CHANNEL.CHANNEL2:
                return("Channel2");

            case CHANNEL.CHANNEL3:
                return("Channel3");

            case CHANNEL.CHANNEL4:
                return("Channel4");

            case CHANNEL.CHANNEL5:
                return("Channel5");

            case CHANNEL.CHANNEL6:
                return("Channel6");

            case CHANNEL.CHANNEL7:
                return("Channel7");

            case CHANNEL.CHANNEL8:
                return("Channel8");
            }
            throw (new SystemException("Invalid channel"));
        }
Exemple #4
0
        public void SelectDiffrentialChannel(CHANNEL chPlus, CHANNEL chMinus)
        {
            m_cmdReg.SD = 0;

            if (chPlus == CHANNEL.CH0 && chMinus == CHANNEL.CH1)
            {
                m_cmdReg.C0 = 0;
                m_cmdReg.C1 = 0;
                m_cmdReg.C2 = 0;
                return;
            }
            if (chPlus == CHANNEL.CH2 && chMinus == CHANNEL.CH3)
            {
                m_cmdReg.C0 = 1;
                m_cmdReg.C1 = 0;
                m_cmdReg.C2 = 0;
                return;
            }

            if (chPlus == CHANNEL.CH4 && chMinus == CHANNEL.CH5)
            {
                m_cmdReg.C0 = 0;
                m_cmdReg.C1 = 1;
                m_cmdReg.C2 = 0;
                return;
            }

            // Complete here
            //http://www.ti.com/lit/ds/symlink/ads7828.pdf

            m_i2c.Write(m_slaveAddress, m_cmdReg.ToUInt8());
        }
Exemple #5
0
        public bool GetMarkerTargetValue(CHANNEL channel,
                                         MEASUREMENT measurement,
                                         MARKERS marker,
                                         out double targetValue,
                                         out string outMessage)
        {
            targetValue = 0;
            outMessage  = string.Empty;
            try
            {
                IAgNAMeasurement chMeasurement;
                if (measurement != MEASUREMENT.LIKE_CHANNEL)
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                }
                else
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                }

                targetValue = chMeasurement.Markers.Item[getMarker(marker)].TargetValue;
                return(true);
            }
            catch (Exception err)
            {
                outMessage = err.Message;
                return(false);
            }
        }
Exemple #6
0
        public bool MarkerQueryBandwidth(CHANNEL channel, MEASUREMENT measurement, MARKERS marker,
                                         ref double pBandWidthVal,
                                         ref double pCenterFreqVal,
                                         ref double pQVal,
                                         ref double pLossVal)
        {
            try
            {
                IAgNAMeasurement chMeasurement;
                if (measurement != MEASUREMENT.LIKE_CHANNEL)
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                }
                else
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                }

                chMeasurement.Markers.Item[getMarker(marker)].QueryBandwidth(ref pBandWidthVal, ref pCenterFreqVal, ref pQVal, ref pLossVal);


                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #7
0
        public void CreateChannel(SPARAMS sp,
                                  CHANNEL channel,
                                  WINDOW window,
                                  MEASUREMENT measurement)
        {
            Tuple <CHANNEL, MEASUREMENT> t = new Tuple <CHANNEL, MEASUREMENT>(channel, measurement);

            if (m_measureChannelDic.ContainsKey(t) == true)
            {
                return;
            }

            driver.Channels.AddMeasurement("Standard", SparamName[(int)sp], (int)channel, (int)window);
            // Setup convineient pointers to Channels and Measurements
            agNAChannel[(int)channel - 1] = driver.Channels.get_Item(GetChannelName(channel));
            IAgNAMeasurement chMeasurement;

            if (measurement != MEASUREMENT.LIKE_CHANNEL)
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                m_measureChannelDic.Add(new Tuple <CHANNEL, MEASUREMENT>(channel, measurement), sp);
            }
            else
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                m_measureChannelDic.Add(new Tuple <CHANNEL, MEASUREMENT>(channel, (MEASUREMENT)channel), sp);
            }
        }
Exemple #8
0
        public void MeasureSparam(CHANNEL channel,
                                  out float[] data,
                                  out double[] freq,
                                  out int points,
                                  MEASUREMENT measurement,
                                  bool autoScale = true)
        {
            IAgNAMeasurement chMeasurement;

            if (measurement != MEASUREMENT.LIKE_CHANNEL)
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
            }
            else
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
            }

            agNAChannel[(int)channel - 1].TriggerSweep(2000); // Take sweep and wait up to 2 seconds for sweep to complete
            if (autoScale)
            {
                chMeasurement.Trace.AutoScale();
            }

            // Read and output data
            data   = chMeasurement.FetchFormatted();
            freq   = chMeasurement.FetchX();
            points = data.Length;
        }
Exemple #9
0
        public bool GetMarkerNames(CHANNEL channel,
                                   MEASUREMENT measurement,
                                   out string [] names,
                                   out string outMessage)
        {
            names      = null;
            outMessage = string.Empty;
            try
            {
                IAgNAMeasurement chMeasurement;
                if (measurement != MEASUREMENT.LIKE_CHANNEL)
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                }
                else
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                }

                int markerCount = chMeasurement.Markers.Count;
                names = new string[markerCount];
                for (int i = 0; i < markerCount; i++)
                {
                    names[i] = chMeasurement.Markers.Name[i];
                }
                return(true);
            }
            catch (Exception err)
            {
                outMessage = err.Message;
                return(false);
            }
        }
Exemple #10
0
        /// <summary>
        /// Sets the volume of a channel, if left to nothing, sets all channels.
        /// </summary>
        /// <param name="volume"> The volume to set the channel to.</param>
        /// <param name="channel"> The channel to channel</param>
        /// <param name="fadetime"> Time to fade out</param>
        public void SetVolume(float volume, CHANNEL channel, float fadetime = 0)
        {
            getChannel[channel].SetVolume(volume, fadetime);
            //If you turn down music, you want background stuff off aswell.

            /*if (channel == CHANNEL.MUSIC)
             *  getChannel[CHANNEL.BACKGROUND_SOUNDS].SetVolume(volume, fadetime);*/
        }
Exemple #11
0
        public bool GetOutputState(CHANNEL channel)
        {
            string strCmd = "";

            strCmd = string.Format(":OUTP? {0}", channel.ToString());
            string strRet = Query(strCmd).ToString();

            return(strRet.Contains("ON"));
        }
Exemple #12
0
        public bool SetOutput(CHANNEL channel, bool bEnable)
        {
            string strCmd = "";
            bool   bRet   = false;

            strCmd = string.Format(":OUTP {0},{1}", channel.ToString(), bEnable?"ON":"OFF");
            bRet   = (bool)Excute(strCmd);
            return(bRet);
        }
Exemple #13
0
        public double ReadTemperature(CHANNEL channel)
        {
            double temperature;
            int    status = FLIReadTemperature(dev, channel, out temperature);

            if (0 != status)
            {
                throw new Win32Exception(-status);
            }
            return(temperature);
        }
Exemple #14
0
        public AgNAMeasurementFormatEnum GetMeasureFormat(CHANNEL channel, MEASUREMENT measurement)
        {
            IAgNAMeasurement chMeasurement;

            if (measurement != MEASUREMENT.LIKE_CHANNEL)
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
            }
            else
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
            }
            return(chMeasurement.Format);
        }
Exemple #15
0
        /// <summary>
        /// 取得设置的通道电压值
        /// </summary>
        /// <param name="nChannel"></param>
        /// <returns></returns>
        public double GetVoltLevel(CHANNEL nChannel)
        {
            //[:SOURce[<n>]]:VOLTage[:LEVel][:IMMediate][:AMPLitude]?
            string strCmd = "";

            strCmd = string.Format(":SOUR{0}:VOLT?", nChannel.ToString());
            string strRet = Query(strCmd).ToString();
            double fValue = 0.0f;

            if (double.TryParse(strRet, out fValue))
            {
                return(fValue);
            }
            return(0.0f);
        }
Exemple #16
0
        public void SetMeasureFormat(AgNAMeasurementFormatEnum measureFormat, CHANNEL channel, MEASUREMENT measurement)
        {
            IAgNAMeasurement chMeasurement;

            if (measurement != MEASUREMENT.LIKE_CHANNEL)
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
            }
            else
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
            }

            chMeasurement.Format = measureFormat;
        }
Exemple #17
0
 public string LimitChannelVoltage(CHANNEL channel, ushort lowLimit, ushort highLimit)
 {
     try
     {
         highLimit &= 0x0FFF; // must containe zero at D12 - D15
         lowLimit  &= 0x0FFF; // must containe zero at D12 - D15
         SetRegisterValue((byte)(AD7291_REG_LIMIT_BASE + (byte)channel), highLimit);
         SetRegisterValue((byte)(AD7291_REG_LIMIT_BASE + (byte)channel + 1), highLimit);
         return("ok");
     }
     catch (Exception err)
     {
         return(err.Message);
     }
 }
Exemple #18
0
        public void AutoScale(CHANNEL channel, MEASUREMENT measurement)
        {
            IAgNAMeasurement chMeasurement;

            if (measurement != MEASUREMENT.LIKE_CHANNEL)
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
            }
            else
            {
                chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
            }

            chMeasurement.Trace.AutoScale();
        }
Exemple #19
0
        /// <summary>
        /// 设置通道电压值
        /// </summary>
        /// <param name="nChannel"></param>
        /// <param name="fValue"></param>
        /// <returns></returns>
        public bool SetVoltLevel(CHANNEL nChannel, double fValue)
        {
            //[:SOURce[<n>]]:VOLTage[:LEVel]
            if (fValue < 0.0f)
            {
                fValue = 0.0f;
            }
            if (fValue > 30.0f)
            {
                fValue = 30.0f;
            }
            string strCmd = "";

            strCmd = string.Format(":SOUR{0}:VOLT {1}", ((int)nChannel).ToString(), fValue.ToString("F6"));
            return((bool)Excute(strCmd));
        }
Exemple #20
0
        /// <summary>
        /// 设置通道电流值
        /// </summary>
        /// <param name="nChannel"></param>
        /// <param name="fValue"></param>
        /// <returns></returns>
        public bool SetCurrentLevel(CHANNEL nChannel, double fValue)
        {
            //[:SOURce[<n>]]:CURRent[:LEVel]
            if (fValue < 0.0f)
            {
                fValue = 0.0f;
            }
            if (fValue > 3.0f)
            {
                fValue = 3.0f;
            }
            string strCmd = "";

            strCmd = string.Format(":SOUR{0}:CURR {1}", nChannel.ToString(), fValue.ToString("F6"));
            return((bool)Excute(strCmd));
        }
Exemple #21
0
    public static void trace(string msg, CHANNEL channel = CHANNEL.NORMAL)
    {
        bool active = false;

        for (int i = 0; i < ACTIVE_CHANNEL.Length; ++i)
        {
            if (ACTIVE_CHANNEL[i] == channel)
            {
                active = true;
                break;
            }
        }

        if (active)
        {
            Debug.Log("[" + channel + "]\t" + msg);
        }
    }
        public void ContinuousEnabled(CHANNEL channel, bool e)
        {
            var ChannelA    = (KtRFPowerMeterChannel)driver.Channels.get_Item("A");
            var ChannelB    = (KtRFPowerMeterChannel)driver.Channels.get_Item("B");
            var Measurement = driver.Measurements2.get_Item2("1");

            if (channel == CHANNEL.CHANNELA)
            {
                // Select Channel A and set INIT:CONT OFF
                ChannelA.Trigger.ContinuousEnabled = e;
            }
            if (channel == CHANNEL.CHANNELB)
            {
                // Select Channel A and set INIT:CONT OFF
                ChannelB.Trigger.ContinuousEnabled = e;
            }

            m_continues = e;
        }
Exemple #23
0
            public void ClearMux(CHANNEL channel)
            {
                byte val = 0;

                switch (channel)
                {
                case CHANNEL.CHANNEL0:
                    m_cmdReg.MuxCH7 = val;
                    break;

                case CHANNEL.CHANNEL1:
                    m_cmdReg.MuxCH6 = val;
                    break;

                case CHANNEL.CHANNEL2:
                    m_cmdReg.MuxCH5 = val;
                    break;

                case CHANNEL.CHANNEL3:
                    m_cmdReg.MuxCH4 = val;
                    break;

                case CHANNEL.CHANNEL4:
                    m_cmdReg.MuxCH3 = val;
                    break;

                case CHANNEL.CHANNEL5:
                    m_cmdReg.MuxCH2 = val;
                    break;

                case CHANNEL.CHANNEL6:
                    m_cmdReg.MuxCH1 = val;
                    break;

                case CHANNEL.CHANNEL7:
                    m_cmdReg.MuxCH0 = val;
                    break;
                }
                ushort data = (ushort)(PrimitiveConversion.ToLong(m_cmdReg));

                SetCommandRegister(data);
            }
Exemple #24
0
        /// <summary>
        /// 设置输出模式
        /// OUTP: CVCC? CH1
        /// </summary>
        /// <param name="nChannel"></param>
        /// <param name="Mode"></param>
        /// <returns></returns>
        public OUTPUTMODE GetOutputMode(CHANNEL nChannel)
        {
            string strCmd = "";
            string strRet = "";

            strCmd = string.Format("OUTP:MODE? {0}", nChannel.ToString());
            strRet = Query(strCmd).ToString();
            if (strRet.ToUpper().Contains("CV"))
            {
                return(OUTPUTMODE.CV);
            }
            else if (strRet.ToUpper().Contains("CC"))
            {
                return(OUTPUTMODE.CC);
            }
            else
            {
                return(OUTPUTMODE.UR);
            }
        }
Exemple #25
0
 public void SetPower(StationsInfo Info)
 {
     if (Info == null)
     {
         return;
     }
     this.SceneID = Info.m_SceneID;
     this.Shape   = Info.m_Shape;
     this.m_Camp  = Info.m_Camp;
     if (Info.m_StaionsDeep == 0)
     {
         this.Deep = CHANNEL.ONE;
     }
     else if (Info.m_StaionsDeep == 1)
     {
         this.Deep = CHANNEL.TWO;
     }
     else
     {
         this.Deep = CHANNEL.DEFAULT;
     }
 }
Exemple #26
0
        void SelectSingleEnddedChannel(CHANNEL channel, bool Enable)
        {
            byte Prehumble = 0x80;
            byte SG = 0;
            byte ODD_SIGN = 0;
            byte A2, A1, A0;
            byte dataToWrite = 0;
            byte enable      = (byte)(Enable == true ? 0x20 : 0);


            SG       = m_seMux[channel].Item1;
            ODD_SIGN = m_seMux[channel].Item2;
            A2       = m_seMux[channel].Item3;
            A1       = m_seMux[channel].Item4;
            A0       = m_seMux[channel].Item5;

            dataToWrite = (byte)(Prehumble | enable | SG << 4 | ODD_SIGN << 3 | A2 << 2 | A1 << 1 | A0);

            //see table here:  http://www.analog.com/media/en/technical-documentation/data-sheets/2497fb.pdf

            m_i2c.Write(m_slaveAddress, dataToWrite);
        }
Exemple #27
0
        public bool SetMarkerBandwidthThreshold(CHANNEL channel, MEASUREMENT measurement, MARKERS marker, double t)
        {
            try
            {
                IAgNAMeasurement chMeasurement;
                if (measurement != MEASUREMENT.LIKE_CHANNEL)
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                }
                else
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                }

                chMeasurement.Markers.Item[getMarker(marker)].BandwidthThreshold = t;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #28
0
        public bool SetMarkerTrackEnabled(CHANNEL channel, MEASUREMENT measurement, MARKERS marker, bool te)
        {
            try
            {
                IAgNAMeasurement chMeasurement;
                if (measurement != MEASUREMENT.LIKE_CHANNEL)
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                }
                else
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                }

                chMeasurement.Markers.Item[getMarker(marker)].MarkerTrackEnabled = te;
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #29
0
        public bool MarkerSearch(CHANNEL channel, MEASUREMENT measurement, MARKERS marker, AgNAMarkerSearchTypeEnum s)
        {
            try
            {
                IAgNAMeasurement chMeasurement;
                if (measurement != MEASUREMENT.LIKE_CHANNEL)
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)measurement);
                }
                else
                {
                    chMeasurement = agNAChannel[(int)channel - 1].Measurements.get_Item("Measurement" + (int)channel);
                }

                chMeasurement.Markers.Item[getMarker(marker)].Search(s);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemple #30
0
            public string GetVoltageConversionResults(CHANNEL channel, out double data)
            {
                lock (this)
                {
                    try
                    {
                        data = 0;
                        string res;
                        byte   count = 0;
                        if ((res = GetVoltageConversionResults(out count, m_voltageConData)) != "ok")
                        {
                            return(res);
                        }


                        if (channel == CHANNEL.CHANNEL0)
                        {
                            if (m_voltageConData[(byte)channel] > maxVal)
                            {
                                maxVal = m_voltageConData[(byte)channel];
                            }

                            if (m_voltageConData[(byte)channel] < minVal)
                            {
                                minVal = m_voltageConData[(byte)channel];
                            }

                            Console.WriteLine("{0} ,{1} , {2}", m_voltageConData[(byte)channel], maxVal, minVal);
                        }
                        data = m_voltageConData[(byte)channel] * LSB_Volatage;
                        return("ok");
                    }
                    catch (Exception err)
                    {
                        throw (new SystemException(err.Message));
                    }
                }
            }
Exemple #31
0
        // inputs
        //
        //   jpegs from hardware devices
        //   bitmaps from hardware devices
        //   GPS from stored data or hardware devices
        //   Camera name source info from stored configuration
        //   video files on disk
        //   still images on disk
        // outputs
        //
        //    bitmaps to LPR, with source, time and GPS
        //    jpegs to DVR, with source, time and GPS
        //    
        //
        //
        //
        public FrameGenerator( APPLICATION_DATA appData,bool AsService)
        {
            try
            {

                m_AppData = appData;
                m_AppData.AddOnClosing(OnClose, APPLICATION_DATA.CLOSE_ORDER.MIDDLE);
                m_Log = (ErrorLog)m_AppData.Logger;

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_FrameCnt].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_MotionDetectionPendingQ].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].Peak.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].PerSecond.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].RunningAverage.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_NonMotionFramePushQ].Snapshot.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.FRAME_GENERATOR.FrameGen_GPSLocation].StatString.RegisterForUse(true);

                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_DroppedFrames].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_FrameCnt].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_FramesDetected].Accumulator.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_ProcessQCnt].Snapshot.RegisterForUse(true);
                m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.MOTION_DETECTION.MotionDetector_ProcessQCnt].Peak.RegisterForUse(true);

                m_EabledChannelArray = new bool[m_AppData.MAX_PHYSICAL_CHANNELS];// used tell the 2255 device which of its channels are enabled

                m_LastJPEGReceived = new LAST_JPEG_RECEIVED[m_AppData.MAX_PHYSICAL_CHANNELS];
                m_Channels = new CHANNEL[m_AppData.MAX_PHYSICAL_CHANNELS];
                for (int c = 0; c < m_AppData.MAX_PHYSICAL_CHANNELS; c++)
                {
                    m_LastJPEGReceived[c] = new LAST_JPEG_RECEIVED();
                    m_Channels[c] = new CHANNEL(c);
                }

                LoadChannelNames();

                m_ConsumerIDs = new CONSUMER_ID();

                m_CurrentGPSPosition = m_NoPositionAvailable;

                m_MotionDetectionQ = new ThreadSafeQueue<FRAME>(m_MotionDetectionQueLevel, "QueueOverruns_FG_MotionDetectionQ", m_AppData);
                m_AppData.MotionDetectionGettingBehind = false;

                //////////////////////////////////////
                //
                // start the thread that pushes new frames to the registered consumers

                m_AllFramesConsumerPushQ = new ThreadSafeQueue<CONSUMER_PUSH>(240, "QueueOverruns_FG_AllFramesConsumerPushQ", m_AppData);

                m_MotionDetectedConsumerPushQ = new ThreadSafeQueue<CONSUMER_PUSH>(240, "QueueOverruns_FG_MotionDetectedConsumerPushQ", m_AppData); //120

                PushThread = new Thread(PushLoop);
                PushThread.Priority = ThreadPriority.AboveNormal;
                PushThread.Start();

                m_MotionDetectionThread = new Thread(MotionDetectionLoop);
                m_MotionDetectionThread.Start();

                //////////////////////////////////////
                //
                // start the S2255 controller

                // the 2255 controller has a polling loop that looks for 2255 devices to be added/deleted by the user plugging/unplugging the cables
                //  as new devices are detected, the stored config data is read and the channels are assigned and start running as appropriate
                //   the image data flows into this class via callbacks. this class then pushes the data up a layer after adding GPS and time stamps.

                if (AsService)
                {
                    try
                    {

                        S2255Controller.S2255Controller.PAL_NTSC_MODE videoStandard = S2255Controller.S2255Controller.PAL_NTSC_MODE.NTSC;

                        string NTSC_PAL = UserSettings.Get(UserSettingTags.VideoSetup_PAL_NTSC);
                        if (NTSC_PAL != null)
                        {
                            if (NTSC_PAL.Equals(UserSettingTags.VideoSetup_PAL))
                                videoStandard = S2255Controller.S2255Controller.PAL_NTSC_MODE.PAL;
                        }

                        unsafe
                        {
                            m_S2255Controller = new S2255Controller.S2255Controller(videoStandard, m_AppData, m_EabledChannelArray);
                            m_S2255Controller.OnNewFrame += new S2255Controller.S2255Controller.OnNewFrameFromDeviceEvent(OnReceiveNewImageFromS2255Device);
                            m_S2255Controller.StartThreads();
                        }
                    }
                    catch (Exception ex)
                    {
                        m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL);
                    }

                    //////////////////////////////////////
                    //
                    // start the GPS Controller

                    string GPSPort = FindDevicePort.GetGPSCommPort();
                    m_GPSController = new GPSController(PutNewGPSData, m_AppData);

                    if (m_S2255Controller.GetReadyStatus)
                        m_FrameGenReadyStatus = true;
                    else
                        m_FrameGenReadyStatus = false;
                }

                if (!AsService)
                {
                    MovieFileController = new MovieFiles(m_AppData);
                    MovieFileController.OnNewImage += new MovieFiles.OnNewImageEvent(MovieFiles_OnNewImage);
                    MovieFileController.Start();
                }

            }
            catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL);}
        }
Exemple #32
0
 private static extern int FLIReadTemperature(IntPtr dev, CHANNEL channel, out double temperature);
Exemple #33
0
 public double ReadTemperature(CHANNEL channel)
 {
     double temperature;
     int status = FLIReadTemperature(dev, channel, out temperature);
     if (0 != status)
         throw new Win32Exception(-status);
     return temperature;
 }