示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="packetData"></param>
        public bool ProcessAPIPacket(byte [] data)
        {
            switch (data[3])
            {
            case 0xc2:
                // check packet running number
                if (data[5] == 0x9e && data[8] == 0x81 && data[9] == 0x00)
                {
                    _blePacketRunningNumber++;
                    if (!_handleSiliconLabIC._firmwareOlderT108 && data[4] != _blePacketRunningNumber)
                    {
                        if (data[4] > _blePacketRunningNumber)
                        {
                            InventoryDebug.InventorySkipPackerAdd((uint)(data[4] - _blePacketRunningNumber));
                        }
                        else
                        {
                            InventoryDebug.InventorySkipPackerAdd((uint)((256U + data[4]) - _blePacketRunningNumber));
                        }

                        _blePacketRunningNumber = data[4];
                        _handlerRFIDReader.ClearBuffer();
                    }
                }

                _currentCommandResponse |= RecvRFIDPacket(data);
                break;

            case 0x6a:
                switch (RecvBarcodePacket(data))
                {
                case BARCODECOMMANDRESPONSETYPE.CONTROLCOMMAND:
                    _currentCommandResponse |= BTWAITCOMMANDRESPONSETYPE.BTAPIRESPONSE;
                    break;

                case BARCODECOMMANDRESPONSETYPE.DATA:
                    _currentCommandResponse |= BTWAITCOMMANDRESPONSETYPE.DATA1;
                    break;

                case BARCODECOMMANDRESPONSETYPE.NOTIFICATION:
                case BARCODECOMMANDRESPONSETYPE.ERROR:
                default:
                    return(true);
                }
                break;

            case 0xd9:
                if (RecvNofigicationPacket(data))
                {
                    _currentCommandResponse |= BTWAITCOMMANDRESPONSETYPE.BTAPIRESPONSE;
                }
                break;
            //return false;

            case 0xe8:
                _currentCommandResponse |= _handleSiliconLabIC.ProcessDataPacket(data);
                break;

            case 0x5f:
                if (_handleBluetoothIC.BluetoothICPacket(data))
                {
                    _currentCommandResponse |= BTWAITCOMMANDRESPONSETYPE.BTAPIRESPONSE;
                }
                break;
            }

            BLERWEngineTimer(); // send next packet immediately
            return(true);
        }
        public Result StartOperation(Operation opertion)
        {
            CurrentOperation = opertion;

            // Clear inventory compatmode
            if (opertion != Operation.TAG_EXERANGING)
            {
                UInt32 Value = 0;

                // Clear inventory compatmode
                MacReadRegister(MACREGISTER.HST_INV_CFG, ref Value);
                Value &= ~(1U << 26); // bit 26
                Value &= ~(3U << 16); // bit 16,17
                MacWriteRegister(MACREGISTER.INV_CYCLE_DELAY, 0);
                MacWriteRegister(MACREGISTER.HST_INV_CFG, Value);
            }

            InventoryDebug.Clear();
            switch (opertion)
            {
            case Operation.TAG_RANGING:
                TagRangingThreadProc();
                break;

            case Operation.TAG_PRERANGING:
                PreTagRangingThreadProc();
                break;

            case Operation.TAG_EXERANGING:
                CurrentOperation = Operation.TAG_RANGING;
                ExeTagRangingThreadProc();
                break;

            case Operation.TAG_SEARCHING:
                TagSearchOneTagThreadProc();
                break;

            case Operation.TAG_PRESEARCHING:
                PreTagSearchOneTagThreadProc();
                break;

            case Operation.TAG_EXESEARCHING:
                CurrentOperation = Operation.TAG_SEARCHING;
                ExeTagSearchOneTagThreadProc();
                break;

            case Operation.TAG_SELECTED:
                TagSelected();
                break;

            case Operation.TAG_SELECTEDDYNQ:
                TagSelectedDYNQ();
                break;

            case Operation.TAG_FASTSELECTED:
                FastTagSelected();
                break;

            case Operation.TAG_GENERALSELECTED:
                SetMaskThreadProc();
                break;

            case Operation.TAG_PREFILTER:
                PreFilter();
                break;

            case Operation.TAG_READ:
                ReadThreadProc();
                break;

            case Operation.TAG_READ_PC:
                TagReadPCThreadProc();
                break;

            case Operation.TAG_READ_EPC:
                TagReadEPCThreadProc();
                break;

            case Operation.TAG_READ_ACC_PWD:
                TagReadAccPwdThreadProc();
                break;

            case Operation.TAG_READ_KILL_PWD:
                TagReadKillPwdThreadProc();
                break;

            case Operation.TAG_READ_TID:
                TagReadTidThreadProc();
                break;

            case Operation.TAG_READ_USER:
                TagReadUsrMemThreadProc();
                break;

            case Operation.TAG_WRITE:
                WriteThreadProc();
                break;

            case Operation.TAG_WRITE_PC:
                TagWritePCThreadProc();
                break;

            case Operation.TAG_WRITE_EPC:
                TagWriteEPCThreadProc();
                break;

            case Operation.TAG_WRITE_ACC_PWD:
                TagWriteAccPwdThreadProc();
                break;

            case Operation.TAG_WRITE_KILL_PWD:
                TagWriteKillPwdThreadProc();
                break;

            case Operation.TAG_WRITE_USER:
                TagWriteUsrMemThreadProc();
                break;

            case Operation.TAG_BLOCK_WRITE:
                BlockWriteThreadProc();
                break;

            case Operation.TAG_LOCK:
                TagLockThreadProc();
                break;

            case Operation.TAG_BLOCK_PERMALOCK:
                TagBlockLockThreadProc();
                break;

            case Operation.TAG_KILL:
                TagKillThreadProc();
                break;

            case Operation.TAG_AUTHENTICATE:
                TagAuthenticateThreadProc();
                break;

            case Operation.TAG_READBUFFER:
                TagReadBufferThreadProc();
                break;

            case Operation.TAG_UNTRACEABLE:
                TagUntraceableThreadProc();
                break;

            default:
                return(Result.NOT_SUPPORTED);
            }

            return(Result.OK);
        }
示例#3
0
        public Result StartOperation(Operation opertion)
        {
            CurrentOperation = opertion;

            // Clear inventory compatmode
            if (opertion != Operation.TAG_EXERANGING)
            {
                UInt32 Value = 0;

                // Clear inventory compatmode
                MacReadRegister(MACREGISTER.HST_INV_CFG, ref Value);
                Value &= ~(1U << 26); // bit 26
                Value &= ~(3U << 16); // bit 16,17
                MacWriteRegister(MACREGISTER.INV_CYCLE_DELAY, 0);
                MacWriteRegister(MACREGISTER.HST_INV_CFG, Value);
            }

            InventoryDebug.Clear();
            switch (opertion)
            {
            case Operation.TAG_RANGING:     // Enable get battery level by interrupt
                _deviceHandler.battery.EnableAutoBatteryLevel();
                TagRangingThreadProc();
                break;

            case Operation.TAG_PRERANGING:     // Enable get battery level by interrupt
                PreTagRangingThreadProc();
                break;

            case Operation.TAG_EXERANGING:     // Enable get battery level by interrupt
                CurrentOperation = Operation.TAG_RANGING;
                _deviceHandler.battery.EnableAutoBatteryLevel();
                ExeTagRangingThreadProc();
                break;

            case Operation.TAG_SEARCHING:     // Enable get battery level by interrupt
                _deviceHandler.battery.EnableAutoBatteryLevel();
                TagSearchOneTagThreadProc();
                break;

            case Operation.TAG_PRESEARCHING:
                PreTagSearchOneTagThreadProc();
                break;

            case Operation.TAG_EXESEARCHING:     // Enable get battery level by interrupt
                CurrentOperation = Operation.TAG_SEARCHING;
                _deviceHandler.battery.EnableAutoBatteryLevel();
                ExeTagSearchOneTagThreadProc();
                break;

            case Operation.TAG_SELECTED:
                TagSelected();
                break;

            case Operation.TAG_SELECTEDDYNQ:
                TagSelectedDYNQ();
                break;

            case Operation.TAG_FASTSELECTED:
                FastTagSelected();
                break;

            case Operation.TAG_GENERALSELECTED:
                SetMaskThreadProc();
                break;

            case Operation.TAG_PREFILTER:
                PreFilter();
                break;

            case Operation.TAG_READ:
                ReadThreadProc();
                break;

            case Operation.TAG_READ_PC:
                TagReadPCThreadProc();
                break;

            case Operation.TAG_READ_EPC:
                TagReadEPCThreadProc();
                break;

            case Operation.TAG_READ_ACC_PWD:
                TagReadAccPwdThreadProc();
                break;

            case Operation.TAG_READ_KILL_PWD:
                TagReadKillPwdThreadProc();
                break;

            case Operation.TAG_READ_TID:
                TagReadTidThreadProc();
                break;

            case Operation.TAG_READ_USER:
                TagReadUsrMemThreadProc();
                break;

            case Operation.TAG_WRITE:
                WriteThreadProc();
                break;

            case Operation.TAG_WRITE_PC:
                TagWritePCThreadProc();
                break;

            case Operation.TAG_WRITE_EPC:
                TagWriteEPCThreadProc();
                break;

            case Operation.TAG_WRITE_ACC_PWD:
                TagWriteAccPwdThreadProc();
                break;

            case Operation.TAG_WRITE_KILL_PWD:
                TagWriteKillPwdThreadProc();
                break;

            case Operation.TAG_WRITE_USER:
                TagWriteUsrMemThreadProc();
                break;

            case Operation.TAG_BLOCK_WRITE:
                BlockWriteThreadProc();
                break;

            case Operation.TAG_LOCK:
                TagLockThreadProc();
                break;

            case Operation.TAG_BLOCK_PERMALOCK:
                TagBlockLockThreadProc();
                break;

            case Operation.TAG_KILL:
                TagKillThreadProc();
                break;

            case Operation.TAG_AUTHENTICATE:
                TagAuthenticateThreadProc();
                break;

            case Operation.TAG_READBUFFER:
                TagReadBufferThreadProc();
                break;

            case Operation.TAG_UNTRACEABLE:
                TagUntraceableThreadProc();
                break;

            case Operation.FM13DT_READMEMORY:
                FM13DTReadMemoryThreadProc();
                break;

            case Operation.FM13DT_WRITEMEMORY:
                FM13DTWriteMemoryThreadProc();
                break;

            case Operation.FM13DT_READREGISTER:
                FM13DTReadRegThreadProc();
                break;

            case Operation.FM13DT_WRITEREGISTER:
                FM13DTWriteRegThreadProc();
                break;

            case Operation.FM13DT_AUTH:
                FM13DTAuthThreadProc();
                break;

            case Operation.FM13DT_GETTEMP:
                FM13DTGetTempThreadProc();
                break;

            case Operation.FM13DT_STARTLOG:
                FM13DTStartLogThreadProc();
                break;

            case Operation.FM13DT_STOPLOG:
                FM13DTStopLogChkThreadProc();
                break;

            case Operation.FM13DT_DEEPSLEEP:
                FM13DTDeepSleepThreadProc();
                break;

            case Operation.FM13DT_OPMODECHK:
                FM13DTOpModeChkThreadProc();
                break;

            case Operation.FM13DT_INITIALREGFILE:
                FM13DTInitialRegFileThreadProc();
                break;

            case Operation.FM13DT_LEDCTRL:
                FM13DTLedCtrlThreadProc();
                break;

            case Operation.QT_COMMAND:
                QT_CommandProc();
                break;

            default:
                return(Result.NOT_SUPPORTED);
            }

            return(Result.OK);
        }