IMqttNetworkChannel.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. using System.Text;
  15. namespace uPLibrary.Networking.M2Mqtt
  16. {
  17. /// <summary>
  18. /// Interface for channel under MQTT library
  19. /// </summary>
  20. public interface IMqttNetworkChannel
  21. {
  22. /// <summary>
  23. /// Data available on channel
  24. /// </summary>
  25. bool DataAvailable { get; }
  26. /// <summary>
  27. /// Receive data from the network channel
  28. /// </summary>
  29. /// <param name="buffer">Data buffer for receiving data</param>
  30. /// <returns>Number of bytes received</returns>
  31. int Receive(byte[] buffer);
  32. /// <summary>
  33. /// Send data on the network channel to the broker
  34. /// </summary>
  35. /// <param name="buffer">Data buffer to send</param>
  36. /// <returns>Number of byte sent</returns>
  37. int Send(byte[] buffer);
  38. /// <summary>
  39. /// Close the network channel
  40. /// </summary>
  41. void Close();
  42. /// <summary>
  43. /// Connect to remote server
  44. /// </summary>
  45. void Connect();
  46. }
  47. }