LCOV - code coverage report
Current view: top level - src/messages/connectack - mqtt_client_mqtt_connect_ack_variable_header.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 7 7 100.0 %
Date: 2017-10-09 Functions: 0 0 -

          Line data    Source code
       1             : /*
       2             :  * Package : mqtt_client
       3             :  * Author : S. Hamblett <steve.hamblett@linux.com>
       4             :  * Date   : 15/06/2017
       5             :  * Copyright :  S.Hamblett
       6             :  */
       7             : 
       8             : part of mqtt_client;
       9             : 
      10             : /// Implementation of the variable header for an MQTT ConnectAck message.
      11             : class MqttConnectAckVariableHeader extends MqttVariableHeader {
      12             :   /// Initializes a new instance of the MqttConnectVariableHeader class.
      13           4 :   MqttConnectAckVariableHeader();
      14             : 
      15             :   /// Initializes a new instance of the MqttConnectVariableHeader class.
      16             :   MqttConnectAckVariableHeader.fromByteBuffer(MqttByteBuffer headerStream)
      17           4 :       : super.fromByteBuffer(headerStream);
      18             : 
      19             :   /// Writes the variable header for an MQTT Connect message to the supplied stream.
      20             :   void writeTo(MqttByteBuffer variableHeaderStream) {
      21             :     // Unused additional "compression" byte used within the variable header acknowledgement.
      22           4 :     variableHeaderStream.writeByte(0);
      23           4 :     writeReturnCode(variableHeaderStream);
      24             :   }
      25             : 
      26             :   /// Creates a variable header from the specified header stream.
      27             :   void readFrom(MqttByteBuffer variableHeaderStream) {
      28             :     // Unused additional "compression" byte used within the variable header acknowledgement.
      29           4 :     variableHeaderStream.readByte();
      30           4 :     readReturnCode(variableHeaderStream);
      31             :   }
      32             : 
      33             :   /// Gets the length of the write data when WriteTo will be called.
      34             :   /// This method is overriden by the ConnectAckVariableHeader because the variable header of this
      35             :   /// message type, for some reason, contains an extra byte that is not present in the variable
      36             :   /// header spec, meaning we have to do some custom serialization and deserialization.
      37             :   int getWriteLength() {
      38             :     return 2;
      39             :   }
      40             : 
      41             :   String toString() {
      42           8 :     return "Connect Variable Header: TopicNameCompressionResponse={0}, ReturnCode={$returnCode}";
      43             :   }
      44             : }

Generated by: LCOV version 1.10