method added to make it easier to reply that we have received the ack message

master
Alex 2022-03-15 14:42:27 +01:00
parent 06fa3c2841
commit f0ab8812a3
1 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package earth.krakatao.protocol;
import earth.krakatao.Formatter;
import earth.krakatao.KraSocketClient;
import earth.krakatao.SocketClient;
import java.nio.charset.StandardCharsets;
import java.text.Format;
import java.text.Normalizer.Form;
@ -159,4 +160,18 @@ public class KraSocketClientProtocol {
public void removeMessageFromReceivedQueue(int cmdID) {
this.receivedQueueMessages.remove(cmdID);
}
// This method is used to send a reply message to the backend that we have received the ack message.
public void replyToBackendThatWeReceivedMessage(SocketClient socketClient,
KraSocketClientProtocol kraSocketClientProtocol, int cmdID, byte dest, UUID uuid,
int cmdNumber) {
KraSocketClientProtocolMessage kraSocketClientProtocolMessage = new KraSocketClientProtocolMessage(
KraSocketClientProtocolStatus.REPLY.getStatus(), cmdID,
KraSocketClientProtocolDest.BACKEND.getStatus(), uuid,
cmdNumber, "", null);
socketClient.SendMessage(kraSocketClientProtocolMessage);
kraSocketClientProtocol.removeMessageFromReceivedQueue(cmdID);
}
}