1 /* 2 * Collie - An asynchronous event-driven network framework using Dlang development 3 * 4 * Copyright (C) 2015-2017 Shanghai Putao Technology Co., Ltd 5 * 6 * Developer: putao's Dlang team 7 * 8 * Licensed under the Apache-2.0 License. 9 * 10 */ 11 module collie.codec.mqtt.mqttconnectvariableheader; 12 import collie.codec.mqtt.mqttversion; 13 14 class MqttConnectVariableHeader 15 { 16 17 public: 18 this( 19 string name, 20 int mqtt_version, 21 bool hasUserName, 22 bool hasPassword, 23 bool isWillRetain, 24 int willQos, 25 bool isWillFlag, 26 bool isCleanSession, 27 int keepAliveTimeSeconds) { 28 this._name = name; 29 this._version = mqtt_version; 30 this._hasUserName = hasUserName; 31 this._hasPassword = hasPassword; 32 this._isWillRetain = isWillRetain; 33 this._willQos = willQos; 34 this._isWillFlag = isWillFlag; 35 this._isCleanSession = isCleanSession; 36 this._keepAliveTimeSeconds = keepAliveTimeSeconds; 37 } 38 39 string name() { 40 return _name; 41 } 42 43 int mqtt_version() { 44 return _version; 45 } 46 47 bool hasUserName() { 48 return _hasUserName; 49 } 50 51 bool hasPassword() { 52 return _hasPassword; 53 } 54 55 bool isWillRetain() { 56 return _isWillRetain; 57 } 58 59 int willQos() { 60 return _willQos; 61 } 62 63 bool isWillFlag() { 64 return _isWillFlag; 65 } 66 67 bool isCleanSession() { 68 return _isCleanSession; 69 } 70 71 int keepAliveTimeSeconds() { 72 return _keepAliveTimeSeconds; 73 } 74 75 override 76 string toString() { 77 return ""; 78 } 79 80 private: 81 string _name; 82 int _version; 83 bool _hasUserName; 84 bool _hasPassword; 85 bool _isWillRetain; 86 int _willQos; 87 bool _isWillFlag; 88 bool _isCleanSession; 89 int _keepAliveTimeSeconds; 90 } 91