示例#1
0
        private void TryStartSimpleLog()
        {
            RTConst.LOGINTERVAL startDelay     = RTConst.LOGINTERVAL.INT_1MIN;
            RTConst.LOGINTERVAL sampleInterval = RTConst.LOGINTERVAL.INT_1MIN;

            try
            {
                mTag.StartSimpleLog(startDelay, sampleInterval);
                MessageBox.Show("Logging will start in one minute and will sample every minute until stopped. No alarms are enabled.");
            }
            catch (Exception e)
            {
                MessageBox.Show("Error during log start.\n\nMessage:\n\n", e.Message);
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="intVal"></param>
        /// <returns></returns>
        public static ushort IntervalToUIn16(RTConst.LOGINTERVAL intVal)
        {
            switch (intVal)
            {
            case RTConst.LOGINTERVAL.INT_1MIN: return(60);

            case RTConst.LOGINTERVAL.INT_2MIN: return(2 * 60);

            case RTConst.LOGINTERVAL.INT_5MIN: return(5 * 60);

            case RTConst.LOGINTERVAL.INT_10MIN: return(10 * 60);

            case RTConst.LOGINTERVAL.INT_15MIN: return(15 * 60);

            case RTConst.LOGINTERVAL.INT_30MIN: return(30 * 60);

            case RTConst.LOGINTERVAL.INT_1HR: return(60 * 60);
            }

            return(0);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="startDelay"></param>
        /// <param name="samplingInterval"></param>
        public void StartSimpleLog(RTConst.LOGINTERVAL startDelay, RTConst.LOGINTERVAL samplingInterval)
        {
            ushort wIntVal = 0;
            ushort wDelay  = 0;

            List <int> enList = new List <int>();

            if (samplingInterval == RTConst.LOGINTERVAL.INT_NONE)
            {
                throw new RTException("StartSimpleLog: interval cannot be 0.");
            }

            wIntVal = RTConverters.IntervalToUIn16(samplingInterval);
            wDelay  = RTConverters.IntervalToUIn16(startDelay);

            ResetAll();

            try
            {
                BINLimit[0]      = RTConst.FIXED_70LIM;
                BINThreshold[0]  = RTConst.FIXED_MINUS20LIM;
                BINSampleTime[0] = wIntVal;
            }
            catch
            {
                throw new RTException("StartSimpleLog: BIN setup failed.");
            }

            enList.Add(0);

            try
            {
                BINEnable       = enList;
                BINEnableSample = enList;
            }
            catch
            {
                throw new RTException("StartSimpleLog: BIN enable failed.");
            }

            /* Disable time stamp store */
            try
            {
                WriteShortReg(RTRegs.BIN_ENA_TIME_STORE, 0);
            }
            catch
            {
                throw new RTException("StartSimpleLog: timestamp store disable failed.");
            }

            try
            {
                /* Setup delay time */
                if (wDelay == 0)                        // Disable ?
                {
                    int dummy = RTConst.CTL_DLYEN_MASK;
                    dummy            = ~dummy;
                    ControlRegister &= (ushort)(dummy);
                }
                else
                {
                    ControlRegister |= RTConst.CTL_DLYEN_MASK;
                }
            }
            catch
            {
                throw new RTException("StartSimpleLog: start delay control failed.");
            }

            try
            {
                WriteShortReg(RTRegs.SAMPLING_DELAY, wDelay);
            }
            catch
            {
                throw new RTException("StartSimpleLog: writing sampling delay failed.");
            }

            /* Start logging. */
            try
            {
                ResetStart();
            }
            catch
            {
                throw new RTException("StartSimpleLog: reset + start failed.");
            }
        }