コード例 #1
0
 internal static MqttConnectMessage InternalDeserialize(byte[] buffer)
 {
     var msg = new MqttConnectMessage();
     msg._msg.MsgBuffer = buffer;
     msg.ReadPayload();
     return msg;
 }
コード例 #2
0
        internal static MqttConnectMessage InternalDeserialize(byte[] buffer)
        {
            var msg = new MqttConnectMessage();

            msg._msg.MsgBuffer = buffer;
            msg.ReadPayload();
            return(msg);
        }
コード例 #3
0
        public static IMqttMessage Deserialize(
#if WIN_PCL
            [ReadOnlyArray]
#endif
            byte[] buffer
            )
        {
            var          msgType      = ReadMessageTypeFromHeader(buffer[0]);
            IMqttMessage resultingMsg = null;

            switch (msgType)
            {
            case MessageType.Connect:
                resultingMsg = MqttConnectMessage.InternalDeserialize(buffer);
                break;

            case MessageType.ConnAck:
                resultingMsg = MqttConnectAckMessage.InternalDeserialize(buffer);
                break;

            case MessageType.Disconnect:
                resultingMsg = MqttDisconnectMessage.InternalDeserialize(buffer);
                break;

            case MessageType.PubAck:
                resultingMsg = MqttPublishAckMessage.InternalDeserialize(buffer);
                break;

            case MessageType.PubRec:
                resultingMsg = MqttPublishReceivedMessage.InternalDeserialize(buffer);
                break;

            case MessageType.PubRel:
                resultingMsg = MqttPublishReleaseMessage.InternalDeserialize(buffer);
                break;

            case MessageType.PubComp:
                resultingMsg = MqttPublishCompleteMessage.InternalDeserialize(buffer);
                break;

            case MessageType.Publish:
                resultingMsg = MqttPublishMessage.InternalDeserialize(buffer);
                break;

            case MessageType.Subscribe:
                resultingMsg = MqttSubscribeMessage.InternalDeserialize(buffer);
                break;

            case MessageType.SubAck:
                resultingMsg = MqttSubscribeAckMessage.InternalDeserialize(buffer);
                break;

            case MessageType.Unsubscribe:
                resultingMsg = MqttUnsubscribeMessage.InternalDeserialize(buffer);
                break;

            case MessageType.UnsubAck:
                resultingMsg = MqttUnsubscribeAckMessage.InternalDeserialize(buffer);
                break;

            case MessageType.PingReq:
                resultingMsg = MqttPingRequestMessage.InternalDeserialize(buffer);
                break;

            case MessageType.PingResp:
                resultingMsg = MqttPingResponseMessage.InternalDeserialize(buffer);
                break;
            }

            return(resultingMsg);
        }
コード例 #4
0
 public IMqttMessage GetMessage()
 {
     byte[] initializedBuffer = _bldr.CreateInitializedMessageBuffer(CalcMessageLength(), PopulateBuffer);
     return(MqttConnectMessage.InternalDeserialize(initializedBuffer));
 }
コード例 #5
0
 protected string GenerateClientUid(MqttConnectMessage msg)
 {
     return GenerateClientUid(msg.ClientId, msg.UserName);
 }