Exemple #1
0
        private static MqttPacket Acquire(MqttPacketType type, IClient client)
        {
            switch (type)
            {
            case MqttPacketType.Connect: return(MqttConnectPacket.Acquire());

            case MqttPacketType.Subscribe: return(MqttSubscribePacket.Acquire());

            case MqttPacketType.Unsubscribe: return(MqttUnsubscribePacket.Acquire());

            case MqttPacketType.PingReq: return(MqttPingReqPacket.Acquire());

            case MqttPacketType.Disconnect: return(MqttDisconnectPacket.Acquire());

            case MqttPacketType.Publish: return(MqttPublishPacket.Acquire());

            case MqttPacketType.PubAck: return(MqttPubackPacket.Acquire());

            default:
                Service.Logger.Log("Unknown MQTT Type: " + type);
                return(null);
            }
        }