MqttMsgPublishEventArgs.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #if (!MF_FRAMEWORK_VERSION_V4_2 && !MF_FRAMEWORK_VERSION_V4_3)
  14. using System;
  15. #else
  16. using Microsoft.SPOT;
  17. #endif
  18. namespace uPLibrary.Networking.M2Mqtt.Messages
  19. {
  20. /// <summary>
  21. /// Event Args class for PUBLISH message received from broker
  22. /// </summary>
  23. public class MqttMsgPublishEventArgs : EventArgs
  24. {
  25. #region Properties...
  26. /// <summary>
  27. /// Message topic
  28. /// </summary>
  29. public string Topic
  30. {
  31. get { return this.topic; }
  32. internal set { this.topic = value; }
  33. }
  34. /// <summary>
  35. /// Message data
  36. /// </summary>
  37. public byte[] Message
  38. {
  39. get { return this.message; }
  40. internal set { this.message = value; }
  41. }
  42. /// <summary>
  43. /// Duplicate message flag
  44. /// </summary>
  45. public bool DupFlag
  46. {
  47. get { return this.dupFlag; }
  48. set { this.dupFlag = value; }
  49. }
  50. /// <summary>
  51. /// Quality of Service level
  52. /// </summary>
  53. public byte QosLevel
  54. {
  55. get { return this.qosLevel; }
  56. internal set { this.qosLevel = value; }
  57. }
  58. /// <summary>
  59. /// Retain message flag
  60. /// </summary>
  61. public bool Retain
  62. {
  63. get { return this.retain; }
  64. internal set { this.retain = value; }
  65. }
  66. #endregion
  67. // message topic
  68. private string topic;
  69. // message data
  70. private byte[] message;
  71. // duplicate delivery
  72. private bool dupFlag;
  73. // quality of service level
  74. private byte qosLevel;
  75. // retain flag
  76. private bool retain;
  77. /// <summary>
  78. /// Constructor
  79. /// </summary>
  80. /// <param name="topic">Message topic</param>
  81. /// <param name="message">Message data</param>
  82. /// <param name="dupFlag">Duplicate delivery flag</param>
  83. /// <param name="qosLevel">Quality of Service level</param>
  84. /// <param name="retain">Retain flag</param>
  85. public MqttMsgPublishEventArgs(string topic,
  86. byte[] message,
  87. bool dupFlag,
  88. byte qosLevel,
  89. bool retain)
  90. {
  91. this.topic = topic;
  92. this.message = message;
  93. this.dupFlag = dupFlag;
  94. this.qosLevel = qosLevel;
  95. this.retain = retain;
  96. }
  97. }
  98. }