Hi Hanz,
I am trying to create an interface between mIP and M2Mqtt, as I understand I need to replace the MqttNetworkChannel with my own implementation that inherits IMqttNetworkChannel and reference my implementation in the MqttClient class. Also I need to replace the dnsLookup in the client class.
The IMqttNetworkChannel looks like this:
/// <summary> /// Interface for channel under MQTT library /// </summary> public interface IMqttNetworkChannel { /// <summary> /// Data available on channel /// </summary> bool DataAvailable { get; } /// <summary> /// Receive data from the network channel /// </summary> /// <param name="buffer">Data buffer for receiving data</param> /// <returns>Number of bytes received</returns> int Receive(byte[] buffer); /// <summary> /// Send data on the network channel to the broker /// </summary> /// <param name="buffer">Data buffer to send</param> /// <returns>Number of byte sent</returns> int Send(byte[] buffer); /// <summary> /// Close the network channel /// </summary> void Close(); /// <summary> /// Connect to remote server /// </summary> void Connect(); }
Would I be correct in saying that the connect and close methods would come from mIP's Networking class?
And Send and Receive from the HttpRequest and HttpResponse classes?
I remember reading in the mIP class that it tries to stay away from sockets to make things simpler, would I be right in saying that the mqtt library is using sockets?
If so would there be some particular methods I should use instead of the Http ones?
Also would you say that Start() in mIP is Connect in M2Mqtt? Stop() relates to Close() ?
I have no idea in terms of DataAvailable?
Any help would be much appreciated
Andy