Ejemplo n.º 1
0
        public static ExceptionRFID Create(ErrorCodeRFID errorCode, string message)
        {
            string   errorMessage = "";
            Severity severity     = Severity.None;

            switch (errorCode)
            {
            case ErrorCodeRFID.Unknown:
                errorMessage = "Unknown error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.RFID_SUCCESS:
                errorMessage = "RFID operation succeeded.";
                severity     = Severity.None;
                break;

            case ErrorCodeRFID.MEMORY_ERR:
                errorMessage = "Memory error. The internal data structures couldn't be allocated.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.RANGE_ERR:
                errorMessage = "Parameter out of range error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.NOT_FOUND:
                errorMessage = "Station code not found error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.NOT_NEXT:
                errorMessage = "Station is out of sequence error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CHECKSUM_ERR:
                errorMessage = "Check sum error for data in RFID tag. The data is corrupted.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.WRITECOUNT_ERR:
                errorMessage = "The maximum number of write cycles has been reached on the RFID tag.";
                severity     = Severity.Error;
                break;

            //case ErrorCodeRFID.INVALID_CARRIER:
            //    errorMessage = "The tray at the RF head " + message + " does not contain a valid tray ID.";
            //    severity = Severity.Error;
            //    break;
            case ErrorCodeRFID.INVALID_ID:
                errorMessage = "Invalid Carrier/Tray ID.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.WRITE_VERIFY_ERR:
                errorMessage = "Read after write failure.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.TAGTYPE_ERR:
                errorMessage = "Operation not valid for tag error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.TIMEOUT_ERR:
                errorMessage = "No data was received error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.NO_WORKORDER:
                errorMessage = "No workorder description file was found error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.ASYNC_BUSY:
                errorMessage = "An asynchronous operation is already running.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.ASYNC_FAIL:
                errorMessage = "The asynchronous operation failed.";
                severity     = Severity.Error;
                break;
            // Error from Controller

            case ErrorCodeRFID.CTRL_BATTERY_LOW:
                errorMessage = "Battery low warning indicating the battery replacement is required.";
                severity     = Severity.Warning;
                break;

            case ErrorCodeRFID.CTRL_VERICAL_PARITY_ERROR:
                errorMessage = "Vertical parity error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_FRAMING_ERROR:
                errorMessage = "Framing Error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_OVERRUN_ERROR:
                errorMessage = "Overrun Error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_FORMAT_ERROR:
                errorMessage = "Format Error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_EXECUTION_STATUS_ERROR:
                errorMessage = "Execution status error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_FRAME_LENGTH_ERROR:
                errorMessage = "Frame length error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_COMM_ERROR:
                errorMessage = "Data carrier communications error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_MISMATCH_ERROR:
                errorMessage = "Mismatch error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_DATA_CARRIER_ERROR:
                errorMessage = "Data carrier non-existent error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_DATA_ERROR:
                errorMessage = "Data error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_ADDRESS_ERROR:
                errorMessage = "Address error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_ANTENNA_ERROR:
                errorMessage = "Antenna error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_WRITE_PROTECT_ERROR:
                errorMessage = "Write protect error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.CTRL_MEMORY_ERROR:
                errorMessage = "Memory error.";
                severity     = Severity.Error;
                break;

            // External Error
            case ErrorCodeRFID.DLL_INTERNAL_ERR:
                errorMessage = "DLL internal error.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.SerialPortError:
                errorMessage = "Port " + message + ", Serial port error. Check that all cables are connected and the port is not being used by another application.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.SerialPortOpenError:
                errorMessage = "Opening port " + message + " Error.  Check that it is not being used by another application.";
                severity     = Severity.Error;
                break;

            case ErrorCodeRFID.INVALID_DATA:
                errorMessage = "Invalid Data.";
                severity     = Severity.Error;
                break;

            default:
                errorMessage = "Omron internal error reading/writing the RFID tag on the tray at the " + message + ".";
                severity     = Severity.Error;
                break;
            }

            ExceptionRFID ex = new ExceptionRFID(errorMessage);

            ex.severity   = severity;
            ex._errorCode = errorCode;
            return(ex);
        }
Ejemplo n.º 2
0
        // Methods -------------------------------------------------------------

        public static ExceptionRFID Create(ErrorCodeRFID errorCode)
        {
            return(Create(errorCode, ""));
        }