MqttClientException.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 topic length error
  47. /// </summary>
  48. WillTopicWrong = 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. }
  86. }