MqttBrokerSession.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 BROKER
  14. using System.Collections;
  15. using System.Collections.Generic;
  16. using uPLibrary.Networking.M2Mqtt.Managers;
  17. using uPLibrary.Networking.M2Mqtt.Messages;
  18. namespace uPLibrary.Networking.M2Mqtt.Session
  19. {
  20. /// <summary>
  21. /// MQTT Broker Session
  22. /// </summary>
  23. public class MqttBrokerSession : MqttSession
  24. {
  25. /// <summary>
  26. /// Client related to the subscription
  27. /// </summary>
  28. public MqttClient Client { get; set; }
  29. /// <summary>
  30. /// Subscriptions for the client session
  31. /// </summary>
  32. public List<MqttSubscription> Subscriptions;
  33. /// <summary>
  34. /// Outgoing messages to publish
  35. /// </summary>
  36. public Queue<MqttMsgPublish> OutgoingMessages;
  37. /// <summary>
  38. /// Constructor
  39. /// </summary>
  40. public MqttBrokerSession()
  41. : base()
  42. {
  43. this.Client = null;
  44. this.Subscriptions = new List<MqttSubscription>();
  45. this.OutgoingMessages = new Queue<MqttMsgPublish>();
  46. }
  47. public override void Clear()
  48. {
  49. base.Clear();
  50. this.Client = null;
  51. this.Subscriptions.Clear();
  52. this.OutgoingMessages.Clear();
  53. }
  54. }
  55. }
  56. #endif