Beispiel #1
0
    public void MqttPublishMsg(MQTTMsgType type, MQTTMsgEnvironment area, string RPI, string device, string msg)
    {
        string topic = "FtRD/";

        if (type == MQTTMsgType.ALL)
        {
            topic += "#";
        }
        else
        {
            topic += type.ToString() + "/";

            if (area == MQTTMsgEnvironment.ALL)
            {
                topic += "#";
            }
            else
            {
                topic += area.ToString() + "/";

                if (RPI == AllTopicLabel)
                {
                    topic += AllTopicLabel;
                }
                else
                {
                    topic += RPI + "/";

                    if (device == AllTopicLabel)
                    {
                        topic += AllTopicLabel;
                    }
                    else
                    {
                        topic += device;
                    }
                }
            }
        }
        Debug.Log("Topic to publish to: " + topic + " : [" + msg + "]");
        Byte[] bytes = System.Text.Encoding.UTF8.GetBytes(msg);
        client.Publish(topic, bytes);
    }
Beispiel #2
0
 internal void MqttPublishMsg(MQTTMsgType action, MQTTMsgEnvironment house, object rPI, object iD, string v)
 {
     throw new NotImplementedException();
 }