Package org.jboss.netty.buffer

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


                buf.skipBytes(6);
            }

            // Battery level
            if (checkBit(mask, 24)) {
                extendedInfo.set("power", buf.readUnsignedShort() / 1000.0);
            }

            // GPS overspeed
            if (checkBit(mask, 25)) {
                buf.skipBytes(18);
View Full Code Here


                buf.skipBytes(54);
            }

            // Sequence number
            if (checkBit(mask, 28)) {
                extendedInfo.set("index", buf.readUnsignedShort());
            }

            // Extended info
            position.setExtendedInfo(extendedInfo.toString());
View Full Code Here

            ChannelHandlerContext ctx, Channel channel, SocketAddress remoteAddress, Object msg)
            throws Exception {
       
        ChannelBuffer buf = (ChannelBuffer) msg;
       
        buf.readUnsignedShort(); // length
        int type = buf.readUnsignedShort();
       
        if (type == MSG_SHAKE_HAND && channel != null) {
           
            ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 13);
View Full Code Here

            throws Exception {
       
        ChannelBuffer buf = (ChannelBuffer) msg;
       
        buf.readUnsignedShort(); // length
        int type = buf.readUnsignedShort();
       
        if (type == MSG_SHAKE_HAND && channel != null) {
           
            ChannelBuffer response = ChannelBuffers.dynamicBuffer(ByteOrder.LITTLE_ENDIAN, 13);
            response.writeBytes(ChannelBuffers.copiedBuffer(ByteOrder.LITTLE_ENDIAN, "\r\n*KW", Charset.defaultCharset()));
View Full Code Here

    protected Object decode(
            ChannelHandlerContext ctx, Channel channel, Object msg)
            throws Exception {

        ChannelBuffer buf = (ChannelBuffer) msg;
        int type = buf.readUnsignedShort();
        boolean alarm = (type & 0x8000) != 0;
        type = type & 0x7FFF;
        buf.readUnsignedShort(); // length
       
        if (alarm) {
View Full Code Here

        ChannelBuffer buf = (ChannelBuffer) msg;
        int type = buf.readUnsignedShort();
        boolean alarm = (type & 0x8000) != 0;
        type = type & 0x7FFF;
        buf.readUnsignedShort(); // length
       
        if (alarm) {
            sendSimpleMessage(channel, MSG_TYPE_ACK_ALARM);
        }
       
View Full Code Here

            return null;
        }

        if (type == MSG_TYPE_TRACKER_ID_EXT) {
            long id = buf.readUnsignedInt();
            int length = buf.readUnsignedShort();
            buf.skipBytes(length);
            length = buf.readUnsignedShort();
            String imei = buf.readBytes(length).toString(Charset.defaultCharset());
            try {
                deviceId = getDataManager().getDeviceByImei(imei).getId();
View Full Code Here

        if (type == MSG_TYPE_TRACKER_ID_EXT) {
            long id = buf.readUnsignedInt();
            int length = buf.readUnsignedShort();
            buf.skipBytes(length);
            length = buf.readUnsignedShort();
            String imei = buf.readBytes(length).toString(Charset.defaultCharset());
            try {
                deviceId = getDataManager().getDeviceByImei(imei).getId();
                loadLastIndex();
            } catch(Exception error) {
View Full Code Here

        else if (deviceId != 0 && (type == MSG_TYPE_CURRENT_GPS_DATA || type == MSG_TYPE_STATE_FULL_INFO_T104 || type == MSG_TYPE_LOG_RECORDS)) {
            List<Position> positions = new LinkedList<Position>();

            int recordCount = 1;
            if (type == MSG_TYPE_LOG_RECORDS) {
                recordCount = buf.readUnsignedShort();
            }

            for (int j = 0; j < recordCount; j++) {
                Position position = new Position();
                ExtendedInfoFormatter extendedInfo = new ExtendedInfoFormatter(getProtocol());
View Full Code Here

                if (type == MSG_TYPE_LOG_RECORDS) {
                    extendedInfo.set("archive", true);
                    lastIndex = buf.readUnsignedInt() + 1;
                    extendedInfo.set("index", lastIndex);

                    subtype = buf.readUnsignedShort();
                    if (subtype != MSG_TYPE_CURRENT_GPS_DATA && subtype != MSG_TYPE_STATE_FULL_INFO_T104) {
                        buf.skipBytes(buf.readUnsignedShort());
                        continue;
                    }
                    buf.readUnsignedShort(); // length
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.