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


Java StatusCodes.Bad_TcpMessageTypeInvalid方法代码示例

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


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

示例1: decodeMessage

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
private void decodeMessage(ChannelHandlerContext ctx, ByteBuf buffer) throws UaException {
    int messageLength = getMessageLength(buffer);
    MessageType messageType = MessageType.fromMediumInt(buffer.getMedium(buffer.readerIndex()));

    switch (messageType) {
        case OpenSecureChannel:
            onOpenSecureChannel(ctx, buffer.readSlice(messageLength));
            break;

        case SecureMessage:
            onSecureMessage(ctx, buffer.readSlice(messageLength));
            break;

        case Error:
            onError(ctx, buffer.readSlice(messageLength));
            break;

        default:
            throw new UaException(
                    StatusCodes.Bad_TcpMessageTypeInvalid,
                    "unexpected MessageType: " + messageType);
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:24,代码来源:UaTcpClientMessageHandler.java

示例2: decode

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception {
    buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);

    while (buffer.readableBytes() >= HEADER_LENGTH &&
            buffer.readableBytes() >= getMessageLength(buffer)) {

        int messageLength = getMessageLength(buffer);
        MessageType messageType = MessageType.fromMediumInt(buffer.getMedium(buffer.readerIndex()));

        switch (messageType) {
            case Hello:
                onHello(ctx, buffer.readSlice(messageLength));
                break;

            default:
                throw new UaException(StatusCodes.Bad_TcpMessageTypeInvalid,
                        "unexpected MessageType: " + messageType);
        }
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:22,代码来源:UaTcpServerHelloHandler.java

示例3: decode

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List<Object> out) throws Exception {
    buffer = buffer.order(ByteOrder.LITTLE_ENDIAN);

    while (buffer.readableBytes() >= HEADER_LENGTH &&
            buffer.readableBytes() >= getMessageLength(buffer)) {

        int messageLength = getMessageLength(buffer);
        MessageType messageType = MessageType.fromMediumInt(buffer.getMedium(buffer.readerIndex()));

        switch (messageType) {
            case OpenSecureChannel:
                onOpenSecureChannel(ctx, buffer.readSlice(messageLength));
                break;

            case CloseSecureChannel:
                logger.debug("Received CloseSecureChannelRequest");
                if (secureChannel != null) {
                    server.closeSecureChannel(secureChannel);
                }
                buffer.skipBytes(messageLength);
                break;

            default:
                throw new UaException(StatusCodes.Bad_TcpMessageTypeInvalid,
                        "unexpected MessageType: " + messageType);
        }
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:30,代码来源:UaTcpServerAsymmetricHandler.java


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