当前位置: 首页>>代码示例>>Java>>正文


Java ChannelBuffer.readInt方法代码示例

本文整理汇总了Java中org.jboss.netty.buffer.ChannelBuffer.readInt方法的典型用法代码示例。如果您正苦于以下问题:Java ChannelBuffer.readInt方法的具体用法?Java ChannelBuffer.readInt怎么用?Java ChannelBuffer.readInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.netty.buffer.ChannelBuffer的用法示例。


在下文中一共展示了ChannelBuffer.readInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads the channel buffer and returns object of Med.
 *
 * @param cb ChannelBuffer
 * @return object of Med
 * @throws BgpParseException while parsing Med path attribute
 */
public static Med read(ChannelBuffer cb) throws BgpParseException {
    int med;
    ChannelBuffer tempCb = cb.copy();
    Validation parseFlags = Validation.parseAttributeHeader(cb);

    if ((parseFlags.getLength() > MED_MAX_LEN) || cb.readableBytes() < parseFlags.getLength()) {
        Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
                parseFlags.getLength());
    }
    int len = parseFlags.isShort() ? parseFlags.getLength() + Constants.TYPE_AND_LEN_AS_SHORT : parseFlags
            .getLength() + Constants.TYPE_AND_LEN_AS_BYTE;
    ChannelBuffer data = tempCb.readBytes(len);
    if (!parseFlags.getFirstBit() && parseFlags.getSecondBit() && parseFlags.getThirdBit()) {
        throw new BgpParseException(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_FLAGS_ERROR, data);
    }

    med = cb.readInt();
    return new Med(med);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:27,代码来源:Med.java

示例2: readValue

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
private long readValue(ChannelBuffer buf, int length, boolean signed) {
    switch (length) {
        case 1:
            return signed ? buf.readByte() : buf.readUnsignedByte();
        case 2:
            return signed ? buf.readShort() : buf.readUnsignedShort();
        case 4:
            return signed ? buf.readInt() : buf.readUnsignedInt();
        default:
            return buf.readLong();
    }
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:13,代码来源:RuptelaProtocolDecoder.java

示例3: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads the Prefix Metric.
 *
 * @param cb ChannelBuffer
 * @return object of BgpPrefixAttrMetric
 * @throws BgpParseException while parsing BgpPrefixAttrMetric
 */
public static BgpPrefixAttrMetric read(ChannelBuffer cb)
        throws BgpParseException {
    int linkPfxMetric;

    short lsAttrLength = cb.readShort(); // 4 Bytes

    if ((lsAttrLength != ATTR_PREFIX_LEN)
            || (cb.readableBytes() < lsAttrLength)) {
        Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR,
                               BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
                               lsAttrLength);
    }

    linkPfxMetric = cb.readInt();

    return BgpPrefixAttrMetric.of(linkPfxMetric);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:25,代码来源:BgpPrefixAttrMetric.java

示例4: parseErrSpecSubObj

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
private static LinkedList<PcepValueType> parseErrSpecSubObj(ChannelBuffer cb) throws PcepParseException {
    LinkedList<PcepValueType> llRsvpUserSpecSubObj = new LinkedList<>();
    while (0 < cb.readableBytes()) {
        PcepValueType tlv = null;
        short hType = cb.readShort();
        int iValue = 0;
        //short hLength = cb.readShort();
        switch (hType) {
        case AutonomousSystemSubTlv.TYPE:
            iValue = cb.readInt();
            tlv = new AutonomousSystemSubTlv(iValue);
            break;
        default:
            throw new PcepParseException("Unsupported Sub TLV type :" + hType);
        }
        llRsvpUserSpecSubObj.add(tlv);
    }
    return llRsvpUserSpecSubObj;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:20,代码来源:PcepRsvpUserErrorSpec.java

示例5: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads from channel buffer and returns object of PcepFecObjectIPv4UnnumberedAdjacency.
 *
 * @param cb of channel buffer
 * @return object of PcepFecObjectIPv4UnnumberedAdjacency
 * @throws PcepParseException when fails to read from channel buffer
 */
public static PcepFecObjectIPv4UnnumberedAdjacency read(ChannelBuffer cb) throws PcepParseException {

    PcepObjectHeader fecObjHeader;
    int localNodeID;
    int localInterfaceID;
    int remoteNodeID;
    int remoteInterfaceID;

    fecObjHeader = PcepObjectHeader.read(cb);

    //take only FEC IPv4 Unnumbered Adjacency Object buffer.
    ChannelBuffer tempCb = cb.readBytes(fecObjHeader.getObjLen() - MINIMUM_COMMON_HEADER_LENGTH);
    localNodeID = tempCb.readInt();
    localInterfaceID = tempCb.readInt();
    remoteNodeID = tempCb.readInt();
    remoteInterfaceID = tempCb.readInt();

    return new PcepFecObjectIPv4UnnumberedAdjacencyVer1(fecObjHeader, localNodeID, localInterfaceID, remoteNodeID,
            remoteInterfaceID);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:28,代码来源:PcepFecObjectIPv4UnnumberedAdjacencyVer1.java

示例6: processBgpOpen

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Processes BGP open message.
 *
 * @param ctx Channel handler context
 * @param message open message
 */
private void processBgpOpen(ChannelHandlerContext ctx,
                            ChannelBuffer message) {
    int minLength =
        MINIMUM_OPEN_MSG_LENGTH - MINIMUM_COMMON_HEADER_LENGTH;
    if (message.readableBytes() < minLength) {
        log.debug("Error: Bad message length");
        ctx.getChannel().close();
        return;
    }

    message.readByte(); // read version
    message.readShort(); // read AS number
    message.readShort(); // read Hold timer
    message.readInt(); // read BGP Identifier
    // Optional Parameters
    int optParamLen = message.readUnsignedByte();
    if (message.readableBytes() < optParamLen) {
        log.debug("Error: Bad message length");
        ctx.getChannel().close();
        return;
    }
    message.readBytes(optParamLen);

    // Open message received
    receivedOpenMessageLatch.countDown();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:33,代码来源:BgpPeerFrameDecoderTest.java

示例7: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads the channel buffer and returns the object of PcepRPObject.
 *
 * @param cb of type channel buffer
 * @return the object of PcepRPObject
 * @throws PcepParseException if mandatory fields are missing
 */
public static PcepRPObject read(ChannelBuffer cb) throws PcepParseException {
    log.debug("read");
    PcepObjectHeader rpObjHeader;
    int iRequestIdNum;
    boolean bOFlag;
    boolean bBFlag;
    boolean bRFlag;
    byte yPriFlag; // 3bytes
    LinkedList<PcepValueType> llOptionalTlv = new LinkedList<>();

    rpObjHeader = PcepObjectHeader.read(cb);

    //take only LspObject buffer.
    ChannelBuffer tempCb = cb.readBytes(rpObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);

    int iTemp = tempCb.readInt();
    yPriFlag = (byte) (iTemp & PRIFLAG_TEMP_SHIFT_VALUE);
    bOFlag = (iTemp & OFLAG_TEMP_SHIFT_VALUE) == OFLAG_TEMP_SHIFT_VALUE;
    bBFlag = (iTemp & BFLAG_TEMP_SHIFT_VALUE) == BFLAG_TEMP_SHIFT_VALUE;
    bRFlag = (iTemp & RFLAG_TEMP_SHIFT_VALUE) == RFLAG_TEMP_SHIFT_VALUE;

    iRequestIdNum = tempCb.readInt();

    // parse optional TLV
    llOptionalTlv = parseOptionalTlv(tempCb);

    return new PcepRPObjectVer1(rpObjHeader, iRequestIdNum, bOFlag, bBFlag, bRFlag, yPriFlag, llOptionalTlv);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:36,代码来源:PcepRPObjectVer1.java

示例8: readFrom

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads bytes from channel buffer .
 *
 * @param channelBuffer channel buffer instance
 */
public void readFrom(ChannelBuffer channelBuffer) {
    while (channelBuffer.readableBytes() >= IsisUtil.FOUR_BYTES) {
        int maxReversibleBandwidth = channelBuffer.readInt();
        this.addUnReservedBandwidth(Float.intBitsToFloat(maxReversibleBandwidth));
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:12,代码来源:UnreservedBandwidth.java

示例9: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads the channel buffer and returns object of StatefulIPv4LspIdentidiersTlv.
 *
 * @param c of type channel buffer
 * @return object of StatefulIPv4LspIdentidiersTlv
 */
public static PcepValueType read(ChannelBuffer c) {
    int ipv4IngressAddress = c.readInt();
    short lspId = c.readShort();
    short tunnelId = c.readShort();
    int extendedTunnelId = c.readInt();
    int ipv4EgressAddress = c.readInt();
    return new StatefulIPv4LspIdentifiersTlv(ipv4IngressAddress, lspId, tunnelId, extendedTunnelId,
            ipv4EgressAddress);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:16,代码来源:StatefulIPv4LspIdentifiersTlv.java

示例10: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads channel buffer and returns object of PcepLspaObject.
 *
 * @param cb of type channel buffer.
 * @return object of PcepLspaObject
 * @throws PcepParseException while parsing lspa object from channel buffer
 */
public static PcepLspaObject read(ChannelBuffer cb) throws PcepParseException {

    log.debug("LspaObject::read");
    PcepObjectHeader lspaObjHeader;
    int iExcludeAny;
    int iIncludeAny;
    int iIncludeAll;
    byte cSetupPriority;
    byte cHoldPriority;
    boolean bLFlag;
    byte flags;

    // Optional TLV
    LinkedList<PcepValueType> llOptionalTlv;

    lspaObjHeader = PcepObjectHeader.read(cb);

    //take only Lspa Object buffer.
    ChannelBuffer tempCb = cb.readBytes(lspaObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);
    iExcludeAny = tempCb.readInt();
    iIncludeAny = tempCb.readInt();
    iIncludeAll = tempCb.readInt();
    cSetupPriority = tempCb.readByte();
    cHoldPriority = tempCb.readByte();
    flags = tempCb.readByte();
    tempCb.readByte();

    bLFlag = (flags & (byte) LFLAG_SET) == LFLAG_SET;

    llOptionalTlv = parseOptionalTlv(tempCb);

    return new PcepLspaObjectVer1(lspaObjHeader, bLFlag, iExcludeAny, iIncludeAny, iIncludeAll, cSetupPriority,
            cHoldPriority, llOptionalTlv);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:42,代码来源:PcepLspaObjectVer1.java

示例11: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads from channel buffer and returns object of PcepMetricObject.
 *
 * @param cb of channel buffer.
 * @return object of PcepMetricObject
 * @throws PcepParseException when metric object is not present in channel buffer
 */
public static PcepMetricObject read(ChannelBuffer cb) throws PcepParseException {

    log.debug("MetricObject::read");
    PcepObjectHeader metricObjHeader;
    int iMetricVal;
    byte yFlag; // 6-flags
    boolean bCFlag;
    boolean bBFlag;
    byte bType;

    metricObjHeader = PcepObjectHeader.read(cb);

    if (metricObjHeader.getObjClass() != METRIC_OBJ_CLASS) {
        throw new PcepParseException("This object is not a Metric Object. Object Class: "
                + metricObjHeader.getObjClass());
    }

    //take only metric buffer.
    ChannelBuffer tempCb = cb.readBytes(metricObjHeader.getObjLen() - OBJECT_HEADER_LENGTH);

    tempCb.readShort();
    yFlag = tempCb.readByte();
    bType = tempCb.readByte();
    bCFlag = (yFlag & CFLAG_CHECK) == CFLAG_CHECK;
    bBFlag = (yFlag & BFLAG_SET) == BFLAG_SET;
    iMetricVal = tempCb.readInt();

    return new PcepMetricObjectVer1(metricObjHeader, iMetricVal, yFlag, bCFlag, bBFlag, bType);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:37,代码来源:PcepMetricObjectVer1.java

示例12: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads the wide community attribute.
 *
 * @param c ChannelBuffer
 * @return object of WideCommunityAttr
 * @throws BgpParseException while parsing BgpPrefixAttrRouteTag
 */
public static WideCommunity read(ChannelBuffer c) throws BgpParseException {

    WideCommunityAttrHeader wideCommunityHeader;
    int community;
    int localAsn;
    int contextAsn;
    WideCommunityTarget target = null;
    WideCommunityExcludeTarget excludeTarget = null;
    WideCommunityParameter parameter = null;

    short length = c.readShort();

    if (c.readableBytes() < length) {
        Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR, length);
    }

    wideCommunityHeader = WideCommunityAttrHeader.read(c);
    if ((c.readableBytes() < 12) || (c.readableBytes() < wideCommunityHeader.length())) {
        Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR, length);
    }

    community = c.readInt();
    localAsn = c.readInt();
    contextAsn = c.readInt();

    while (c.readableBytes() > 0) {

        if (c.readableBytes() < TYPE_LENGTH_SIZE) {
            Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
                                   c.readableBytes());
        }

        byte type = c.readByte();
        length = c.readShort();

        if (c.readableBytes() < length) {
            Validation.validateLen(BgpErrorType.UPDATE_MESSAGE_ERROR, BgpErrorType.ATTRIBUTE_LENGTH_ERROR,
                                   c.readableBytes());
        }

        if (type == WideCommunityTarget.TYPE) {
            target = WideCommunityTarget.read(c);
        } else if (type == WideCommunityExcludeTarget.TYPE) {
            excludeTarget = WideCommunityExcludeTarget.read(c);
        } else if (type == WideCommunityParameter.TYPE) {
            parameter = WideCommunityParameter.read(c);
        }
    }
    return new WideCommunity(wideCommunityHeader, community, localAsn, contextAsn,
                                 target, excludeTarget, parameter);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:59,代码来源:WideCommunity.java

示例13: decode

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
@Override
protected Object decode(
        Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {

    ChannelBuffer buf = (ChannelBuffer) msg;

    buf.readUnsignedByte(); // start marker
    int type = buf.readUnsignedShort();
    buf.readUnsignedShort(); // body length
    ChannelBuffer id = buf.readBytes(6); // phone number
    int index = buf.readUnsignedShort();

    DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, ChannelBuffers.hexDump(id));
    if (deviceSession == null) {
        return null;
    }

    if (type == MSG_TERMINAL_REGISTER) {

        if (channel != null) {
            ChannelBuffer response = ChannelBuffers.dynamicBuffer();
            response.writeShort(index);
            response.writeByte(RESULT_SUCCESS);
            response.writeBytes("authentication".getBytes(StandardCharsets.US_ASCII));
            channel.write(formatMessage(MSG_TERMINAL_REGISTER_RESPONSE, id, response), remoteAddress);
        }

    } else if (type == MSG_TERMINAL_AUTH) {

        sendGeneralResponse(channel, remoteAddress, id, type, index);

    } else if (type == MSG_LOCATION_REPORT) {

        Position position = new Position();
        position.setProtocol(getProtocolName());
        position.setDeviceId(deviceSession.getDeviceId());

        position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedInt()));

        int flags = buf.readInt();

        position.set(Position.KEY_IGNITION, BitUtil.check(flags, 0));

        position.setValid(BitUtil.check(flags, 1));

        double lat = buf.readUnsignedInt() * 0.000001;
        double lon = buf.readUnsignedInt() * 0.000001;

        if (BitUtil.check(flags, 2)) {
            position.setLatitude(-lat);
        } else {
            position.setLatitude(lat);
        }

        if (BitUtil.check(flags, 3)) {
            position.setLongitude(-lon);
        } else {
            position.setLongitude(lon);
        }

        position.setAltitude(buf.readShort());
        position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort() * 0.1));
        position.setCourse(buf.readUnsignedShort());

        DateBuilder dateBuilder = new DateBuilder(TimeZone.getTimeZone("GMT+8"))
                .setYear(BcdUtil.readInteger(buf, 2))
                .setMonth(BcdUtil.readInteger(buf, 2))
                .setDay(BcdUtil.readInteger(buf, 2))
                .setHour(BcdUtil.readInteger(buf, 2))
                .setMinute(BcdUtil.readInteger(buf, 2))
                .setSecond(BcdUtil.readInteger(buf, 2));
        position.setTime(dateBuilder.getDate());

        // additional information

        return position;

    }

    return null;
}
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:82,代码来源:HuabaoProtocolDecoder.java

示例14: read

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
/**
 * Reads channel buffer and returns object of LinkDescriptorsTlv.
 *
 * @param c input channel buffer
 * @param length length
 * @return object of LinkDescriptorsTlv
 * @throws PcepParseException if mandatory fields are missing
 */
public static PcepValueType read(ChannelBuffer c, short length) throws PcepParseException {

    // Node Descriptor Sub-TLVs (variable)
    List<PcepValueType> llLinkDescriptorsSubTLVs = new LinkedList<>();

    ChannelBuffer tempCb = c.readBytes(length);

    while (TLV_HEADER_LENGTH <= tempCb.readableBytes()) {

        PcepValueType tlv;
        short hType = tempCb.readShort();
        int iValue = 0;
        short hLength = tempCb.readShort();
        log.debug("sub Tlv Length" + hLength);
        switch (hType) {

        case LinkLocalRemoteIdentifiersSubTlv.TYPE:
            tlv = LinkLocalRemoteIdentifiersSubTlv.read(tempCb);
            break;
        case IPv4InterfaceAddressSubTlv.TYPE:
            iValue = tempCb.readInt();
            tlv = new IPv4InterfaceAddressSubTlv(iValue);
            break;
        case IPv4NeighborAddressSubTlv.TYPE:
            iValue = tempCb.readInt();
            tlv = new IPv4NeighborAddressSubTlv(iValue);
            break;
        case IPv6InterfaceAddressSubTlv.TYPE:
            byte[] ipv6Value = new byte[IPv6InterfaceAddressSubTlv.VALUE_LENGTH];
            tempCb.readBytes(ipv6Value, 0, IPv6InterfaceAddressSubTlv.VALUE_LENGTH);
            tlv = new IPv6InterfaceAddressSubTlv(ipv6Value);
            break;
        case IPv6NeighborAddressSubTlv.TYPE:
            byte[] ipv6NeighborAdd = new byte[IPv6NeighborAddressSubTlv.VALUE_LENGTH];
            tempCb.readBytes(ipv6NeighborAdd, 0, IPv6NeighborAddressSubTlv.VALUE_LENGTH);
            tlv = new IPv6NeighborAddressSubTlv(ipv6NeighborAdd);
            break;
        default:
            throw new PcepParseException("Unsupported Sub TLV type:" + hType);
        }

        // Check for the padding
        int pad = hLength % 4;
        if (0 < pad) {
            pad = 4 - pad;
            if (pad <= tempCb.readableBytes()) {
                tempCb.skipBytes(pad);
            }
        }
        llLinkDescriptorsSubTLVs.add(tlv);

    }

    if (0 < tempCb.readableBytes()) {

        throw new PcepParseException("Sub Tlv parsing error. Extra bytes received.");
    }
    return new LinkDescriptorsTlv(llLinkDescriptorsSubTLVs);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:68,代码来源:LinkDescriptorsTlv.java

示例15: decodeCanData

import org.jboss.netty.buffer.ChannelBuffer; //导入方法依赖的package包/类
private void decodeCanData(ChannelBuffer buf, Position position) {

        buf.readUnsignedMedium(); // packet identifier
        position.set(Position.KEY_VERSION_FW, buf.readUnsignedByte());
        int count = buf.readUnsignedByte();
        buf.readUnsignedByte(); // batch count
        buf.readUnsignedShort(); // selector bit
        buf.readUnsignedInt(); // timestamp

        buf.skipBytes(8);

        ArrayList<ChannelBuffer> values = new ArrayList<>(count);

        for (int i = 0; i < count; i++) {
            values.add(buf.readBytes(8));
        }

        for (int i = 0; i < count; i++) {
            ChannelBuffer value = values.get(i);
            switch (buf.readInt()) {
                case 0x20D:
                    position.set(Position.KEY_RPM, ChannelBuffers.swapShort(value.readShort()));
                    position.set("dieselTemperature", ChannelBuffers.swapShort(value.readShort()) * 0.1);
                    position.set("batteryVoltage", ChannelBuffers.swapShort(value.readShort()) * 0.01);
                    position.set("supplyAirTempDep1", ChannelBuffers.swapShort(value.readShort()) * 0.1);
                    break;
                case 0x30D:
                    position.set("activeAlarm", ChannelBuffers.hexDump(value));
                    break;
                case 0x40C:
                    position.set("airTempDep1", ChannelBuffers.swapShort(value.readShort()) * 0.1);
                    position.set("airTempDep2", ChannelBuffers.swapShort(value.readShort()) * 0.1);
                    break;
                case 0x40D:
                    position.set("coldUnitState", ChannelBuffers.hexDump(value));
                    break;
                case 0x50C:
                    position.set("defrostTempDep1", ChannelBuffers.swapShort(value.readShort()) * 0.1);
                    position.set("defrostTempDep2", ChannelBuffers.swapShort(value.readShort()) * 0.1);
                    break;
                case 0x50D:
                    position.set("condenserPressure", ChannelBuffers.swapShort(value.readShort()) * 0.1);
                    position.set("suctionPressure", ChannelBuffers.swapShort(value.readShort()) * 0.1);
                    break;
                case 0x58C:
                    value.readByte();
                    value.readShort(); // index
                    switch (value.readByte()) {
                        case 0x01:
                            position.set("setpointZone1", ChannelBuffers.swapInt(value.readInt()) * 0.1);
                            break;
                        case 0x02:
                            position.set("setpointZone2", ChannelBuffers.swapInt(value.readInt()) * 0.1);
                            break;
                        case 0x05:
                            position.set("unitType", ChannelBuffers.swapInt(value.readInt()));
                            break;
                        case 0x13:
                            position.set("dieselHours", ChannelBuffers.swapInt(value.readInt()) / 60 / 60);
                            break;
                        case 0x14:
                            position.set("electricHours", ChannelBuffers.swapInt(value.readInt()) / 60 / 60);
                            break;
                        case 0x17:
                            position.set("serviceIndicator", ChannelBuffers.swapInt(value.readInt()));
                            break;
                        case 0x18:
                            position.set("softwareVersion", ChannelBuffers.swapInt(value.readInt()) * 0.01);
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    Log.warning(new UnsupportedOperationException());
                    break;
            }
        }
    }
 
开发者ID:bamartinezd,项目名称:traccar-service,代码行数:80,代码来源:AplicomProtocolDecoder.java


注:本文中的org.jboss.netty.buffer.ChannelBuffer.readInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。