protected override bool SendData(byte[] buffer, object state) { var message = new MqttApplicationMessageBuilder() .WithTopic(topic) .WithPayload(buffer) .WithExactlyOnceQoS() .Build(); if (!mqttClient.PublishAsync(message).Wait(TIMEOUT, cancellationToken.Token)) { var e = new TimeoutException(); Tracker.LogE(TAG, e); using (new MethodUtils.Unlocker(this)) { OnExceptionCallback?.Invoke(e); } return(false); } using (new MethodUtils.Unlocker(this)) { OnSendCompletedCallback?.Invoke(state); } return(true); }
private void OnSendCompleted(object state) { using (new MethodUtils.Unlocker(this)) { OnSendCompletedCallback?.Invoke(state); } }