Procházet zdrojové kódy

update CLient provider

Zixuan před 8 hodinami
rodič
revize
995f52142c

+ 7 - 0
Server/EEMSClientCore/ClientProvider.cs

@@ -12,10 +12,16 @@ public class ClientProvider(IClientCaller clientCaller, IClientBaseProvider base
     //Receive Files from Server
     public Task<bool> PushFile(Guid guid, FileType fileType, byte[] buffer, int current, int total)
     {
+        if (baseProvider is null)
+            return Task.FromResult(false);
+
         if (!_streamBuffer.TryGetValue(fileType, out MemoryStream? stream) || stream is null)
         {
             if (current != 1)
                 return Task.FromResult(false);
+            if (!baseProvider.AllowReceiveFile())
+                return Task.FromResult(false);
+
             baseProvider?.StartFileReceiveNotify(fileType);
             stream = new();
             _streamBuffer[fileType] = stream;
@@ -104,6 +110,7 @@ public interface IClientBaseProvider
     string? RecipePath { get; set; }
     string? ConfigPath { get; set; }
 
+    bool AllowReceiveFile();
     void FileReceivedNotify(FileType fileType);
     void StartFileReceiveNotify(FileType fileType);
 }

+ 2 - 1
Server/EEMSService/Hubs/ClientsMainHub.cs

@@ -41,6 +41,7 @@ internal partial class ClientsMainHub(DeviceManager deviceManager, IEEMSBaseServ
 
     public Task<bool> UpdateRealTimeData(Dictionary<string, object> realtimeData)
     {
-        throw new NotImplementedException();
+
+        return Task.FromResult(true);
     }
 }