Esempio n. 1
0
        /// <summary>
        /// Terminates this instance.
        /// </summary>
        public void terminate()
        {
            actualTaskState = BasicTaskStates.TASK_STATE_ILDE;

            if (getContext().Connection.close() != ERR_CODES.OK)
            {
                debug(DEBUG_LEVEL.ERROR, "TracerDataCatcherTask.terminate() - Closing Comport has FAILED !!! ---");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TracerDataCatcherTask"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        /// <param name="timeout">The timeout.</param>
        public TracerDataCatcherTask(TaskEngine engine, long timeout)
            : base(engine, timeout)
        {
            actualTaskState = BasicTaskStates.TASK_STATE_ILDE;
            debugMode       = Debug.DEBUG_MODE.CONSOLE;

            frameStart = new byte[TracerFrame.HEADER_PREFIX_DATA_LENGTH];

            debug("TracerDataCatcherTask() - Created");
        }
Esempio n. 3
0
        /// <summary>
        /// Executes this instance.
        /// </summary>
        public void execute()
        {
            markExecutionTime();

            switch (actualTaskState)
            {
            default:
            case BasicTaskStates.TASK_STATE_ILDE:

                if (!getContext().TraceActive)
                {
                    break;
                }

                debug("TracerDataCatcherTask.execute() - Starting Trace catching");
                actualTaskState = BasicTaskStates.TASK_STATE_INIT;

                break;

            case BasicTaskStates.TASK_STATE_INIT:

                getContext().Connection.configure(getContext().Comport, getContext().Baudrate, DATABITS.DATABITS_8, PARITY.NONE, STOPBIT.ONE);
                if (getContext().Connection.open() != ERR_CODES.OK)
                {
                    debug(DEBUG_LEVEL.ERROR, "TracerDataCatcherTask.execute() - Opening Comport has FAILED !!! ---");
                    actualTaskState = BasicTaskStates.TASK_STATE_ILDE;
                }
                else
                {
                    debug("TracerDataCatcherTask.execute() - Opening Comport succeeded");
                    actualTaskState = BasicTaskStates.TASK_STATE_RUNNING;
                }

                break;

            case BasicTaskStates.TASK_STATE_RUNNING:

                if (!getContext().TraceActive)
                {
                    debug("TracerDataCatcherTask.execute() - Trace catching has been stopped");
                    actualTaskState = BasicTaskStates.TASK_STATE_FINISH;
                    break;
                }

                loadBytesFromInterface();

                break;

            case BasicTaskStates.TASK_STATE_FINISH:
                if (getContext().Connection.close() != ERR_CODES.OK)
                {
                    debug(DEBUG_LEVEL.ERROR, "TracerDataCatcherTask.execute() - Closing Comport has FAILED !!! ---");
                    actualTaskState = BasicTaskStates.TASK_STATE_ILDE;
                }
                else
                {
                    debug("TracerDataCatcherTask.execute() - Closing Comport succeeded");
                    actualTaskState = BasicTaskStates.TASK_STATE_RUNNING;
                }
                break;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Executes this instance.
        /// </summary>
        public void execute()
        {
            markExecutionTime();

            switch (actualTaskState)
            {
            default:
            case BasicTaskStates.TASK_STATE_ILDE:

                if (!getContext().TraceActive)
                {
                    break;
                }

                if (getTraceTableRaw().getSize() == 0)
                {
                    break;
                }

                debug("TracerFileLoadTask.execute() - Starting File loading");
                actualTaskState = BasicTaskStates.TASK_STATE_INIT;

                break;

            case BasicTaskStates.TASK_STATE_INIT:

                actualTaskState = BasicTaskStates.TASK_STATE_RUNNING;
                break;

            case BasicTaskStates.TASK_STATE_RUNNING:

                if (!getContext().TraceActive)
                {
                    debug("TracerFileLoadTask.execute() - Tracing not active anymore - go into idle");

                    actualTaskState = BasicTaskStates.TASK_STATE_ILDE;
                    break;
                }

                while (getTraceTableRaw().getSize() != 0)
                {
                    TraceElement traceElement = getTraceTableRaw().getNext();

                    if (traceElement.Type == TraceType.UNKNOWN)
                    {
                        continue;
                    }

                    string filePath = (getContext().BasicFilePath + traceElement.FileName).Replace("/", "\\");
                    debug("TracerFileLoadTask.execute() - Loading File: " + filePath);

                    string[] fileContent = getFileFactory().getFileContentAsLineArray(filePath);

                    if (fileContent.Length == 0)
                    {
                        debug(DEBUG_LEVEL.ERROR, "TracerFileLoadTask.execute() - File not found !!! --- (" + filePath + ")");
                        continue;
                    }

                    if (traceElement.LineNumber > fileContent.Length - 1)
                    {
                        debug(DEBUG_LEVEL.ERROR, "TracerFileLoadTask.execute() - Error reading file !!! --- (" + filePath + ")");
                        continue;
                    }

                    traceElement.CodeLine = fileContent[traceElement.LineNumber];
                    getTraceTable().addElement(traceElement);
                }

                this.invokeEvent(TracerEventType.NEW_TRACE_RECORD);

                break;
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TracerDataCatcherTask"/> class.
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="timeout">The timeout.</param>
 public TracerFileLoadTask(TaskEngine engine, long timeout) : base(engine, timeout)
 {
     debugMode       = Debug.DEBUG_MODE.CONSOLE;
     actualTaskState = BasicTaskStates.TASK_STATE_ILDE;
     debug("TracerFileLoadTask() - Created");
 }