123456789101112131415161718192021 |
- using Blue;
- public class MQTTCommand : ICommand
- {
- private IMQTTService mQTTService;
- private string topic;
- private string message;
- public MQTTCommand(string topic,string message)
- {
- this.topic = topic;
- this.message = message;
- }
- public void OnExcute()
- {
- if(mQTTService==null)
- {
- mQTTService = this.GetService<IMQTTService>();
- }
- mQTTService.Publish(topic,message);
- }
- }
|