Beispiel #1
0
        public static byte BuildFixedHeader(MqttControlPacketType packetType, byte flags = 0)
        {
            var fixedHeader = (int)packetType << 4;

            fixedHeader |= flags;
            return((byte)fixedHeader);
        }
 public static byte[] AddMqttHeader(this MqttBufferWriter writer, MqttControlPacketType header, byte[] body)
 {
     writer.WriteByte(MqttBufferWriter.BuildFixedHeader(header));
     writer.WriteVariableByteInteger((uint)body.Length);
     writer.WriteBinary(body, 0, body.Length);
     return(writer.GetBuffer());
 }
Beispiel #3
0
        public void InjectFixedHeader(MqttControlPacketType packetType, byte flags = 0)
        {
            var fixedHeader = (byte)((byte)packetType << 4);

            fixedHeader |= flags;
            InjectFixedHeader(fixedHeader);
        }
 private Task SerializeEmptyPacketAsync(MqttControlPacketType type, IMqttCommunicationChannel destination)
 {
     using (var output = new MqttPacketWriter())
     {
         output.InjectFixedHeader(type);
         return(output.WriteToAsync(destination));
     }
 }
Beispiel #5
0
 static byte EncodeEmptyPacket(MqttControlPacketType type)
 {
     return(MqttPacketWriter.BuildFixedHeader(type));
 }
Beispiel #6
0
 private static byte SerializeEmptyPacket(MqttControlPacketType type)
 {
     return(MqttPacketWriter.BuildFixedHeader(type));
 }