diff --git a/RH-Engine/Command.cs b/RH-Engine/Command.cs index 4bfe2bc..a962372 100644 --- a/RH-Engine/Command.cs +++ b/RH-Engine/Command.cs @@ -215,6 +215,11 @@ namespace RH_Engine return showOnPanel(uuidPanel, serialCode, "Resistance: " + resistance + " %", 3); } + public string showMessage(string uuidPanel, string serialCode, string message) + { + return showOnPanel(uuidPanel, serialCode, "Last message: " + message, 5); + } + public string SwapPanelCommand(string uuid) { dynamic payload = new diff --git a/RH-Engine/Program.cs b/RH-Engine/Program.cs index fcd212a..4df6e5e 100644 --- a/RH-Engine/Program.cs +++ b/RH-Engine/Program.cs @@ -36,6 +36,12 @@ namespace RH_Engine private static string bikeId = string.Empty; private static string headId = string.Empty; + private static double bikeSpeed = 6.66; + private static int bpm = 6; + private static int power = 6; + private static int resistance = 6; + private static string lastMessage = "No message received yet"; + private static Dictionary serialResponses = new Dictionary(); private static void Main(string[] args) @@ -189,11 +195,8 @@ namespace RH_Engine bool speedReplied = false; bool moveReplied = true; panelId = JSONParser.getPanelID(message); - WriteTextMessage(stream, mainCommand.ColorPanel(panelId)); - WriteTextMessage(stream, mainCommand.ClearPanel(panelId)); - - - showPanel(stream, mainCommand, 5.3, 83, 52, 53); + + showPanel(stream, mainCommand); //while (!(speedReplied && moveReplied)) { } @@ -338,8 +341,10 @@ namespace RH_Engine } - private static void showPanel(NetworkStream stream, Command mainCommand, double bikeSpeed, int bpm, int power, int resistance) + private static void showPanel(NetworkStream stream, Command mainCommand) { + WriteTextMessage(stream, mainCommand.ColorPanel(panelId)); + WriteTextMessage(stream, mainCommand.ClearPanel(panelId)); SendMessageAndOnResponse(stream, mainCommand.showBikespeed(panelId, "bikeSpeed", bikeSpeed), "bikeSpeed", (message) => { @@ -360,6 +365,11 @@ namespace RH_Engine { // TODO check if is drawn }); + SendMessageAndOnResponse(stream, mainCommand.showMessage(panelId, "message", lastMessage), "message", + (message) => + { + // TODO check if is drawn + }); // Check if every text is drawn!