mpr2010_awid_io.java

来自「一个开源的rfid middleware 资料」· Java 代码 · 共 568 行 · 第 1/2 页

JAVA
568
字号
            (int) 0xabbb, (int) 0xbb9a, (int) 0x4a75, (int) 0x5a54,
            (int) 0x6a37, (int) 0x7a16, (int) 0x0af1, (int) 0x1ad0,
            (int) 0x2ab3, (int) 0x3a92, (int) 0xfd2e, (int) 0xed0f,
            (int) 0xdd6c, (int) 0xcd4d, (int) 0xbdaa, (int) 0xad8b,
            (int) 0x9de8, (int) 0x8dc9, (int) 0x7c26, (int) 0x6c07,
            (int) 0x5c64, (int) 0x4c45, (int) 0x3ca2, (int) 0x2c83,
            (int) 0x1ce0, (int) 0x0cc1, (int) 0xef1f, (int) 0xff3e,
            (int) 0xcf5d, (int) 0xdf7c, (int) 0xaf9b, (int) 0xbfba,
            (int) 0x8fd9, (int) 0x9ff8, (int) 0x6e17, (int) 0x7e36,
            (int) 0x4e55, (int) 0x5e74, (int) 0x2e93, (int) 0x3eb2,
            (int) 0x0ed1, (int) 0x1ef0 };

    private byte[] compute(int[] buffer) {
        int count = buffer.length;
        int register = 0xffff;
        byte[] bArray = new byte[buffer.length + 2];
        for (int t = 0; t < buffer.length; t++) {
            bArray[t] = (byte) buffer[t];
        }

        while (count > 0) {
            int element = buffer[buffer.length - count];
            int t = ((int) ((register >>> 8) ^ element) & 0xff);
            register <<= 8;
            register ^= table[t];
            count--;
        }

        register ^= 0xFFFF;
        int upperByte = register >> 8;
        int lowerByte = register & 0x000000FF;
        bArray[buffer.length] = (byte) upperByte;
        bArray[buffer.length + 1] = (byte) lowerByte;

        /*
         * for(int t = 0; t < bArray.length; t++) { log.debug("byte =
         * "+bArray[t]); }
         */

        return bArray;
    }

    private void connect() {
        aSocket = null;
        try {

            log.debug("Constructor()  deviceProfileName = " + deviceProfile.getDeviceProfileID());
            int portInt = Integer.valueOf(deviceProfile.getPort()).intValue();
            aSocket = new Socket(deviceProfile.getIpAddress(), portInt);

            // aSocket.setSoTimewriteToInterrogatorStream.4000);
            readFromInterrogatorStream = aSocket.getInputStream();
            writeToInterrogatorStream = aSocket.getOutputStream();
            flushInitialGreeting();

        } catch (java.net.NoRouteToHostException x) {
            log.error("No route to host exception.  "
                    + deviceProfile.getIpAddress());
        } catch (Exception x) {
            log.error("unable to conectio to reader", x);
        }
    }

    public synchronized void on() {
        if (continueReading == false) {
            continueReading = true;
            this.run();
        }
    }

    /**
     * Must complete shutdown before starting again.
     * @throws IOException 
     */
    public synchronized void off() {
        if (continueReading == true) {
            continueReading = false;
            // currentThread.join();

            try {
                close();
            } catch (IOException e) {
                // TODO: Clean up for restart
                log.error("unable to turn off device", e);
                throw new InfrastructureException("unable to turn off device");
            }

        }// end if
    }

    /**
     * @return Returns the deviceProfile.
     */
    public DeviceProfile getDeviceProfile() {
        return deviceProfile;
    }

    /**
     * @param deviceProfile
     *            The deviceProfile to set.
     */
    public void setDeviceProfile(DeviceProfile deviceProfile) {
        this.deviceProfile = deviceProfile;
    }

    /**
     * @return Returns the interrogatorIO.
     */
    public InterrogatorIO getInterrogatorIO() {
        return interrogatorIO;
    }

    /**
     * 
     */
    public void setInterrogatorIO(InterrogatorIO interrogatorIO) {
        this.interrogatorIO = interrogatorIO;

    }

    public boolean shutdown() {

        return true;
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#queryRep()
     */
    public void queryRep() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#ack()
     */
    public void ack() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#query()
     */
    public void query() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#queryAdjust()
     */
    public void queryAdjust() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#select()
     */
    public void select() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#nak()
     */
    public void nak() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#reqRN()
     */
    public void reqRN() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#read()
     */
    public void read() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#write()
     */
    public void write() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#kill()
     */
    public void kill() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#lock()
     */
    public void lock() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#access()
     */
    public void access() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#blockWrite()
     */
    public void blockWrite() {
        // TODO Auto-generated method stub

    }

    /*
     * (non-Javadoc)
     * 
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#blockErase()
     */
    public void blockErase() {
        // TODO Auto-generated method stub

    }

    /* (non-Javadoc)
     * @see org.firstopen.singularity.devicemgr.interrogator.Interrogator#getDescription()
     */
    public String getDescription() {
        // TODO Auto-generated method stub
        return null;
    }

    /**
     * 
     */
    public MPR2010_AWID_IO() {
        super();
        // TODO Auto-generated constructor stub
    }

  
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?