MqttMsgPublishedEventArgs.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 published message
  22. /// </summary>
  23. public class MqttMsgPublishedEventArgs : EventArgs
  24. {
  25. #region Properties...
  26. /// <summary>
  27. /// Message identifier
  28. /// </summary>
  29. public ushort MessageId
  30. {
  31. get { return this.messageId; }
  32. internal set { this.messageId = value; }
  33. }
  34. /// <summary>
  35. /// Message published (or failed due to retries)
  36. /// </summary>
  37. public bool IsPublished
  38. {
  39. get { return this.isPublished; }
  40. internal set { this.isPublished = value; }
  41. }
  42. #endregion
  43. // message identifier
  44. ushort messageId;
  45. // published flag
  46. bool isPublished;
  47. /// <summary>
  48. /// Constructor (published message)
  49. /// </summary>
  50. /// <param name="messageId">Message identifier published</param>
  51. public MqttMsgPublishedEventArgs(ushort messageId)
  52. : this(messageId, true)
  53. {
  54. }
  55. /// <summary>
  56. /// Constructor
  57. /// </summary>
  58. /// <param name="messageId">Message identifier</param>
  59. /// <param name="isPublished">Publish flag</param>
  60. public MqttMsgPublishedEventArgs(ushort messageId, bool isPublished)
  61. {
  62. this.messageId = messageId;
  63. this.isPublished = isPublished;
  64. }
  65. }
  66. }