Package org.jboss.netty.buffer

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


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

        ChannelBuffer buf = (ChannelBuffer) msg;
        int type = buf.readUnsignedShort();
        buf.readUnsignedShort(); // length

        // Authentication
        if (type == MSG_IDENT || type == MSG_IDENT_FULL) {
            long id = buf.readUnsignedInt();
View Full Code Here


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

        ChannelBuffer buf = (ChannelBuffer) msg;
        int type = buf.readUnsignedShort();
        buf.readUnsignedShort(); // length

        // Authentication
        if (type == MSG_IDENT || type == MSG_IDENT_FULL) {
            long id = buf.readUnsignedInt();
            int length = buf.readUnsignedShort();
View Full Code Here

        buf.readUnsignedShort(); // length

        // Authentication
        if (type == MSG_IDENT || type == MSG_IDENT_FULL) {
            long id = buf.readUnsignedInt();
            int length = buf.readUnsignedShort();
            buf.skipBytes(length);
            length = buf.readUnsignedShort();
            buf.skipBytes(length);
            length = buf.readUnsignedShort();
            String imei = buf.readBytes(length).toString(Charset.defaultCharset());
View Full Code Here

        // Authentication
        if (type == MSG_IDENT || type == MSG_IDENT_FULL) {
            long id = buf.readUnsignedInt();
            int length = buf.readUnsignedShort();
            buf.skipBytes(length);
            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

            long id = buf.readUnsignedInt();
            int length = buf.readUnsignedShort();
            buf.skipBytes(length);
            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_POINT || type == MSG_ALARM || type == MSG_LOGMSG)) {
            List<Position> positions = new LinkedList<Position>();

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

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

                position.setDeviceId(deviceId);

                // Message index
                if (type == MSG_LOGMSG) {
                    extendedInfo.set("archive", true);
                    int subtype = buf.readUnsignedShort();
                    if (subtype == MSG_ALARM) {
                        extendedInfo.set("alarm", true);
                    }
                    if (buf.readUnsignedShort() > buf.readableBytes()) {
                        lastIndex += 1;
View Full Code Here

                    extendedInfo.set("archive", true);
                    int subtype = buf.readUnsignedShort();
                    if (subtype == MSG_ALARM) {
                        extendedInfo.set("alarm", true);
                    }
                    if (buf.readUnsignedShort() > buf.readableBytes()) {
                        lastIndex += 1;
                        break; // workaround for device bug
                    }
                    lastIndex = buf.readUnsignedInt();
                    extendedInfo.set("index", lastIndex);
View Full Code Here

                // Speed
                position.setSpeed(((double) buf.readUnsignedInt()) / 100);

                // Course
                position.setCourse(((double) buf.readUnsignedShort()) / 100);

                // Altitude
                position.setAltitude(((double) buf.readUnsignedShort()) / 100);

                // Satellites
View Full Code Here

                // Course
                position.setCourse(((double) buf.readUnsignedShort()) / 100);

                // Altitude
                position.setAltitude(((double) buf.readUnsignedShort()) / 100);

                // Satellites
                int satellitesNumber = buf.readUnsignedByte();
                extendedInfo.set("satellites", satellitesNumber);
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.