MqttClientException.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. Copyright (c) 2013, 2014 Paolo Patierno
  3. All rights reserved. This program and the accompanying materials
  4. are made available under the terms of the Eclipse Public License v1.0
  5. and Eclipse Distribution License v1.0 which accompany this distribution.
  6. The Eclipse Public License is available at
  7. http://www.eclipse.org/legal/epl-v10.html
  8. and the Eclipse Distribution License is available at
  9. http://www.eclipse.org/org/documents/edl-v10.php.
  10. Contributors:
  11. Paolo Patierno - initial API and implementation and/or initial documentation
  12. */
  13. using System;
  14. namespace uPLibrary.Networking.M2Mqtt.Exceptions
  15. {
  16. /// <summary>
  17. /// MQTT client exception
  18. /// </summary>
  19. public class MqttClientException : Exception
  20. {
  21. /// <summary>
  22. /// Constructor
  23. /// </summary>
  24. /// <param name="code">Error code</param>
  25. public MqttClientException(MqttClientErrorCode errorCode)
  26. {
  27. this.errorCode = errorCode;
  28. }
  29. // error code
  30. private MqttClientErrorCode errorCode;
  31. /// <summary>
  32. /// Error code
  33. /// </summary>
  34. public MqttClientErrorCode ErrorCode
  35. {
  36. get { return this.errorCode; }
  37. set { this.errorCode = value; }
  38. }
  39. }
  40. /// <summary>
  41. /// MQTT client erroro code
  42. /// </summary>
  43. public enum MqttClientErrorCode
  44. {
  45. /// <summary>
  46. /// Will error (topic, message or QoS level)
  47. /// </summary>
  48. WillWrong = 1,
  49. /// <summary>
  50. /// Keep alive period too large
  51. /// </summary>
  52. KeepAliveWrong,
  53. /// <summary>
  54. /// Topic contains wildcards
  55. /// </summary>
  56. TopicWildcard,
  57. /// <summary>
  58. /// Topic length wrong
  59. /// </summary>
  60. TopicLength,
  61. /// <summary>
  62. /// QoS level not allowed
  63. /// </summary>
  64. QosNotAllowed,
  65. /// <summary>
  66. /// Topics list empty for subscribe
  67. /// </summary>
  68. TopicsEmpty,
  69. /// <summary>
  70. /// Qos levels list empty for subscribe
  71. /// </summary>
  72. QosLevelsEmpty,
  73. /// <summary>
  74. /// Topics / Qos Levels not match in subscribe
  75. /// </summary>
  76. TopicsQosLevelsNotMatch,
  77. /// <summary>
  78. /// Wrong message from broker
  79. /// </summary>
  80. WrongBrokerMessage,
  81. /// <summary>
  82. /// Wrong Message Id
  83. /// </summary>
  84. WrongMessageId,
  85. /// <summary>
  86. /// Inflight queue is full
  87. /// </summary>
  88. InflightQueueFull,
  89. // [v3.1.1]
  90. /// <summary>
  91. /// Invalid flag bits received
  92. /// </summary>
  93. InvalidFlagBits,
  94. // [v3.1.1]
  95. /// <summary>
  96. /// Invalid connect flags received
  97. /// </summary>
  98. InvalidConnectFlags,
  99. // [v3.1.1]
  100. /// <summary>
  101. /// Invalid client id
  102. /// </summary>
  103. InvalidClientId,
  104. // [v3.1.1]
  105. /// <summary>
  106. /// Invalid protocol name
  107. /// </summary>
  108. InvalidProtocolName
  109. }
  110. }