/// <summary> /// 发送消息 /// 不跟踪服务端的消息处理结果 /// </summary> /// <param name="topic">主题</param> /// <param name="message">消息</param> /// <exception cref="ArgumentNullException"></exception> /// <returns></returns> public MqttError SendMessageAsync(string topic, MqttMessage message) { if (string.IsNullOrEmpty(topic)) { throw new ArgumentNullException("topic"); } if (message == null) { throw new ArgumentNullException("message"); } var msg = message.ToStruct(); var opt = new MQTTAsync_responseOptions(); opt.Init(); var er = MQTTAsync.MQTTAsync_sendMessage(this.handle, topic, ref msg, ref opt); msg.Dispose(); return(er); }
public static extern MqttError MQTTAsync_sendMessage( IntPtr handle, [MarshalAs(UnmanagedType.LPStr)] string destinationName, ref MQTTAsync_message msg, ref MQTTAsync_responseOptions response);
unsafe public static extern MqttError MQTTAsync_unsubscribeMany( IntPtr handle, int count, IntPtr *topic, ref MQTTAsync_responseOptions response);
public static extern MqttError MQTTAsync_unsubscribe( IntPtr handle, [MarshalAs(UnmanagedType.LPStr)] string topic, ref MQTTAsync_responseOptions response);