Package org.jboss.netty.buffer

Examples of org.jboss.netty.buffer.ChannelBuffer.readUnsignedShort()


        // Read header
        prefix = buf.toString(buf.readerIndex(), 4, charset);
        buf.skipBytes(prefix.length()); // prefix @NTC by default
        serverId = buf.readUnsignedInt();
        deviceId = buf.readUnsignedInt();
        int length = buf.readUnsignedShort();
        buf.skipBytes(2); // header and data XOR checksum

        if (length == 0) {
            return null; // keep alive message
        }
View Full Code Here


        ChannelBuffer buf = (ChannelBuffer) msg;

        buf.skipBytes(2); // header
        int type = buf.readUnsignedByte();
        buf.readShort(); // length
        int index = buf.readUnsignedShort();
       
        if (type != MSG_GPS && type != MSG_DATA) {
            sendResponse(channel, type, index);
        }
       
View Full Code Here

            // Location
            position.setTime(new Date(buf.readUnsignedInt() * 1000));
            position.setLatitude(buf.readInt() / 1800000.0);
            position.setLongitude(buf.readInt() / 1800000.0);
            position.setSpeed(buf.readUnsignedByte() * 0.539957);
            position.setCourse((double) buf.readUnsignedShort());
            position.setAltitude(0.0);
           
            // Cell
            extendedInfo.set("cell", ChannelBufferTools.readHexString(buf, 18));
           
View Full Code Here

        buf.skipBytes(4); // system code
        int type = buf.readUnsignedByte();
        long deviceId = buf.readUnsignedInt();
       
        if (type != MSG_CLIENT_SERIAL) {
            buf.readUnsignedShort(); // communication control
        }
        byte packetNumber = buf.readByte();

        // Send reply
        sendReply(channel, deviceId, packetNumber);
View Full Code Here

           
            buf.readUnsignedInt(); // ADC
            buf.readUnsignedMedium(); // milage
            buf.skipBytes(6); // multi-purpose data
           
            buf.readUnsignedShort(); // gps fix
            buf.readUnsignedByte(); // location status
            buf.readUnsignedByte(); // mode 1
            buf.readUnsignedByte(); // mode 2

            position.setValid(buf.readUnsignedByte() >= 3); // satellites
View Full Code Here

            // Location data
            position.setLongitude(buf.readInt() / Math.PI * 180 / 100000000);
            position.setLatitude(buf.readInt() / Math.PI * 180 / 100000000.0);
            position.setAltitude(buf.readInt() * 0.01);
            position.setSpeed(buf.readInt() * 0.01 * 1.943844);
            position.setCourse(buf.readUnsignedShort() / Math.PI * 180.0 / 1000.0);
           
            // Time
            Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
            time.clear();
            time.set(Calendar.SECOND, buf.readUnsignedByte());
View Full Code Here

            time.set(Calendar.SECOND, buf.readUnsignedByte());
            time.set(Calendar.MINUTE, buf.readUnsignedByte());
            time.set(Calendar.HOUR_OF_DAY, buf.readUnsignedByte());
            time.set(Calendar.DAY_OF_MONTH, buf.readUnsignedByte());
            time.set(Calendar.MONTH, buf.readUnsignedByte() - 1);
            time.set(Calendar.YEAR, buf.readUnsignedShort());
            position.setTime(time.getTime());

            position.setExtendedInfo(extendedInfo.toString());
            return position;
        }
View Full Code Here

            throws Exception {

        ChannelBuffer buf = (ChannelBuffer) msg;
       
        buf.readUnsignedByte(); // header
        int length = (buf.readUnsignedShort() & 0x7fff) + 3;
       
        List<Position> positions = new LinkedList<Position>();
        Set<Integer> tags = new HashSet<Integer>();
        Position position = new Position();
        ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
View Full Code Here

                    position.setLatitude(buf.readInt() / 1000000.0);
                    position.setLongitude(buf.readInt() / 1000000.0);
                    break;
                   
                case TAG_SPEED_COURSE:
                    position.setSpeed(buf.readUnsignedShort() * 0.0539957);
                    position.setCourse(buf.readUnsignedShort() * 0.1);
                    break;
                   
                case TAG_ALTITUDE:
                    position.setAltitude((double) buf.readShort());
View Full Code Here

                    position.setLongitude(buf.readInt() / 1000000.0);
                    break;
                   
                case TAG_SPEED_COURSE:
                    position.setSpeed(buf.readUnsignedShort() * 0.0539957);
                    position.setCourse(buf.readUnsignedShort() * 0.1);
                    break;
                   
                case TAG_ALTITUDE:
                    position.setAltitude((double) buf.readShort());
                    break;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.