ICommunicationService implementation with MQTT as transport layer. Uses M2MQTT library.
Add MQTT and configuration in DeviceBuilder
DeviceBuilder.Create()
.AddWiFi()
.AddMqtt()
.AddConfiguration(cfg =>
{
cfg.WriteDefault(WiFiConfig.SectionName, new WiFiConfig
{
Ssid = "",
Password = ""
});
cfg.WriteDefault(MqttConfig.SectionName, new MqttConfig
{
BrokerAddress = "test.mosquitto.org",
Port = 8883,
UseTLS = true,
CACert = "...", //broker's TLS certificate
ClientId = "device1",
TopicPrefix = "mako-iot-test", //prefix for pub-sub topics
PublishQoS = 1, //QoS for published messages (0-2)
PublishRetain = false //retain flag for published messages
});
})
.Build()
.Start();
See example in MessageBus class.