Przeglądaj źródła

启动默认上传一次日志文件,半个小时默认上传一次日志文件

样式分支
fyf 2 lat temu
rodzic
commit
bf664879ae
3 zmienionych plików z 7 dodań i 6 usunięć
  1. +2
    -0
      BPASmartClient.IoT/DataVClient.cs
  2. +4
    -4
      BPASmartClient.IoT/Model/FileUpload.cs
  3. +1
    -2
      BPASmartClient.ViewModel/LogViewModel.cs

+ 2
- 0
BPASmartClient.IoT/DataVClient.cs Wyświetl plik

@@ -145,6 +145,7 @@ namespace BPASmartClient.IoT
DeviceSecret = DeviceDataV.deviceTable.devicesecret;
DeviceDataV.DataVMessageAction += DevIOTActionHandler;
MessageLog.GetInstance.Show($"客户端:【{ClientId}】,设备名称{DeviceName}阿里云连接成功");
UpDataFile();
}
else
{
@@ -156,6 +157,7 @@ namespace BPASmartClient.IoT
if (DeviceDataV.InitializeNo(ProductKey, DeviceName, DeviceSecret, ref message))
{
MessageLog.GetInstance.Show($"客户端:【{ClientId}】,设备名称{DeviceName}阿里云连接成功");
UpDataFile();
}
else
MessageLog.GetInstance.ShowEx(message);


+ 4
- 4
BPASmartClient.IoT/Model/FileUpload.cs Wyświetl plik

@@ -26,13 +26,15 @@ namespace BPASmartClient.IoT.Model
{
return UploadData.ContainsKey(key) ? UploadData[key] : string.Empty;
}
public static long length = 0;
public static byte[] FileBlock;
/// <summary>
/// 文件请求上传
/// </summary>
public static void FileRequest(DataVReport dataV)
{
long length = new FileInfo(path).Length;
byte[] FileBlock = FileContent(path);
FileBlock = FileContent(path);
length = FileBlock.Count();
FileUploadModel fileUpload = new FileUploadModel();
fileUpload.@params.fileName = FileName;
fileUpload.@params.fileSize = length;
@@ -58,7 +60,6 @@ namespace BPASmartClient.IoT.Model
/// </summary>
public static void FileSend(DataVReport dataV, string uploadId)
{
long length = new FileInfo(path).Length;
FileSendModel fileSend = new FileSendModel();
fileSend.@params.uploadId = uploadId;
fileSend.@params.offset = 0;
@@ -68,7 +69,6 @@ namespace BPASmartClient.IoT.Model
byte[] Header = Encoding.UTF8.GetBytes(Tools.JsonConvertTools(fileSend));
byte HeaderLen_L = (byte)(Header.Length);
byte HeaderLen_H = (byte)(Header.Length >> 8);
byte[] FileBlock = FileContent(path);
byte[] CRC16 = CRC16Standard.getCRCBytes(FileBlock);//CRC.CRC16(FileBlock);
List<byte> message = new List<byte>() { HeaderLen_H, HeaderLen_L };
message.AddRange(Header);


+ 1
- 2
BPASmartClient.ViewModel/LogViewModel.cs Wyświetl plik

@@ -234,13 +234,12 @@ namespace BPASmartClient.ViewModel
};
dispatcherTimer.Interval = TimeSpan.FromSeconds(10);
dispatcherTimer.Start();

UpDataFileTimer = new DispatcherTimer();
UpDataFileTimer.Tick += delegate
{
DataVClient.GetInstance().UpDataFile();
};
UpDataFileTimer.Interval = TimeSpan.FromHours(2);
UpDataFileTimer.Interval = TimeSpan.FromHours(0.5);
UpDataFileTimer.Start();
}
/// <summary>


Ładowanie…
Anuluj
Zapisz