| | |
| | | /// <summary> |
| | | /// 远程发送数据格式 |
| | | /// </summary> |
| | | async System.Threading.Tasks.Task SendRemoteMsg(string topicName, byte[] message, MQTTnet.Core.Protocol.MqttQualityOfServiceLevel qosLevel = MQTTnet.Core.Protocol.MqttQualityOfServiceLevel.ExactlyOnce, bool retain = false) |
| | | async System.Threading.Tasks.Task SendRemoteMsg(string topicName, byte[] message, bool retain = false) |
| | | { |
| | | if (this.getGatewayBaseInfo?.gwID == null || !GateWayBaseInfomations.ContainsKey(this.getGatewayBaseInfo?.gwID)) |
| | | { |
| | |
| | | /// <param name="message"></param> |
| | | /// <param name="qosLevel"></param> |
| | | /// <param name="retain"></param> |
| | | public async System.Threading.Tasks.Task Send(string topic, byte[] message, MQTTnet.Core.Protocol.MqttQualityOfServiceLevel qosLevel = MQTTnet.Core.Protocol.MqttQualityOfServiceLevel.ExactlyOnce, bool retain = false) |
| | | public async System.Threading.Tasks.Task Send(string topic, byte[] message, bool retain = false) |
| | | { |
| | | try |
| | | { |
| | |
| | | |
| | | if (IsRemote) |
| | | { |
| | | await SendRemoteMsg(topic, message, qosLevel, retain); |
| | | await SendRemoteMsg(topic, message, retain); |
| | | DebugPrintLog($"远程——发送到网关的主题:{topic}_发送到网关的数据:{System.Text.Encoding.UTF8.GetString(message)}_当前网关{CurrentGateWayId}");//{System.DateTime.Now.ToString()}");// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff") |
| | | } |
| | | else |
| | |
| | | /// <param name="message"></param> |
| | | /// <param name="qosLevel"></param> |
| | | /// <param name="retain"></param> |
| | | public async System.Threading.Tasks.Task Send(string topic, string message, MQTTnet.Core.Protocol.MqttQualityOfServiceLevel qosLevel = MQTTnet.Core.Protocol.MqttQualityOfServiceLevel.ExactlyOnce, bool retain = false) |
| | | public async System.Threading.Tasks.Task Send(string topic, string message, bool retain = false) |
| | | { |
| | | if (string.IsNullOrEmpty(message)) |
| | | {
|
| | | return; |
| | | } |
| | | await Send(topic, System.Text.Encoding.UTF8.GetBytes(message), qosLevel, retain); |
| | | await Send(topic, System.Text.Encoding.UTF8.GetBytes(message), retain); |
| | | } |
| | | |
| | | |