add backend codes for upload bms firmware

This commit is contained in:
Yinyin Liu 2024-06-27 12:01:01 +02:00
parent abe69193e2
commit 7f5ea79d16
2 changed files with 5 additions and 3 deletions

View File

@ -625,7 +625,7 @@ public class Controller : ControllerBase
if (installationToUpdate != null) if (installationToUpdate != null)
{ {
_ = session.RunScriptInBackground(installationToUpdate.VpnIp, batteryNode,version); _ = session.RunScriptInBackground(installationToUpdate.VpnIp, batteryNode,version,installationToUpdate.Product);
} }
return Ok(); return Ok();

View File

@ -68,10 +68,12 @@ public static class SessionMethods
.Apply(Db.Update); .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-----------------------------------"); 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(() => await Task.Run(() =>
{ {