From 7f5ea79d16b2f764d7775ec1c08bce4a54625125 Mon Sep 17 00:00:00 2001 From: Yinyin Liu Date: Thu, 27 Jun 2024 12:01:01 +0200 Subject: [PATCH] add backend codes for upload bms firmware --- csharp/App/Backend/Controller.cs | 2 +- csharp/App/Backend/DataTypes/Methods/Session.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/csharp/App/Backend/Controller.cs b/csharp/App/Backend/Controller.cs index 81953bc22..fa8113e7b 100644 --- a/csharp/App/Backend/Controller.cs +++ b/csharp/App/Backend/Controller.cs @@ -625,7 +625,7 @@ public class Controller : ControllerBase if (installationToUpdate != null) { - _ = session.RunScriptInBackground(installationToUpdate.VpnIp, batteryNode,version); + _ = session.RunScriptInBackground(installationToUpdate.VpnIp, batteryNode,version,installationToUpdate.Product); } return Ok(); diff --git a/csharp/App/Backend/DataTypes/Methods/Session.cs b/csharp/App/Backend/DataTypes/Methods/Session.cs index 5824c9602..cba4852cc 100644 --- a/csharp/App/Backend/DataTypes/Methods/Session.cs +++ b/csharp/App/Backend/DataTypes/Methods/Session.cs @@ -68,10 +68,12 @@ public static class SessionMethods .Apply(Db.Update); } - public static async Task RunScriptInBackground(this Session? session, String vpnIp, Int64 batteryNode,String version) + public static async Task RunScriptInBackground(this Session? session, String vpnIp, Int64 batteryNode,String version,Int64 product) { Console.WriteLine("-----------------------------------Start updating firmware-----------------------------------"); - string scriptPath = "/home/ubuntu/backend/uploadBatteryFw/update_firmware.sh"; + string scriptPath = (product == 0) + ? "/home/ubuntu/backend/uploadBatteryFw/update_firmware_Salimax.sh" + : "/home/ubuntu/backend/uploadBatteryFw/update_firmware_Salidomo.sh"; await Task.Run(() => {