From a5aeb501311729d13f7efcd7b22a13afc59464cb Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Wed, 29 Apr 2020 21:48:52 +0800 Subject: [PATCH 1/2] 1.0.0.4293 Former-commit-id: 2746e6b06f4ddca37034c7087848b73279f4eacc --- projects/Infrastructure/Infrastructure.csproj | 4 +++- projects/IoT.Shared/IoT.Shared.csproj | 1 + projects/IoTCenter/IoTCenter.csproj | 1 + projects/IoTNode/IoTNode.csproj | 1 + projects/JobServer/JobServer.csproj | 1 + projects/StudyCenter/StudyCenter.csproj | 1 + projects/UserCenter/UserCenter.csproj | 1 + projects/Version.cs | 2 +- projects/WebMVC/WebMVC.csproj | 1 + projects/WebSPA/WebSPA.csproj | 1 + 10 files changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/Infrastructure/Infrastructure.csproj b/projects/Infrastructure/Infrastructure.csproj index 5006493f..20cb20a9 100644 --- a/projects/Infrastructure/Infrastructure.csproj +++ b/projects/Infrastructure/Infrastructure.csproj @@ -5,6 +5,7 @@ true true true + $(DefaultItemExcludes);wwwroot\**\* false false @@ -50,7 +51,8 @@   - + + \ No newline at end of file diff --git a/projects/IoT.Shared/IoT.Shared.csproj b/projects/IoT.Shared/IoT.Shared.csproj index 950717b6..a21e48f8 100644 --- a/projects/IoT.Shared/IoT.Shared.csproj +++ b/projects/IoT.Shared/IoT.Shared.csproj @@ -4,6 +4,7 @@ netcoreapp3.1 true true + $(DefaultItemExcludes);wwwroot\**\* true false false diff --git a/projects/IoTCenter/IoTCenter.csproj b/projects/IoTCenter/IoTCenter.csproj index 6503ca65..21aa933a 100644 --- a/projects/IoTCenter/IoTCenter.csproj +++ b/projects/IoTCenter/IoTCenter.csproj @@ -1,6 +1,7 @@  netcoreapp3.1 + en true false false diff --git a/projects/IoTNode/IoTNode.csproj b/projects/IoTNode/IoTNode.csproj index eaa83037..ec3d817c 100644 --- a/projects/IoTNode/IoTNode.csproj +++ b/projects/IoTNode/IoTNode.csproj @@ -1,6 +1,7 @@  netcoreapp3.1 + en true false false diff --git a/projects/JobServer/JobServer.csproj b/projects/JobServer/JobServer.csproj index 5ee5e9b9..8f81faef 100644 --- a/projects/JobServer/JobServer.csproj +++ b/projects/JobServer/JobServer.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + en true false false diff --git a/projects/StudyCenter/StudyCenter.csproj b/projects/StudyCenter/StudyCenter.csproj index 9017a046..e451a079 100644 --- a/projects/StudyCenter/StudyCenter.csproj +++ b/projects/StudyCenter/StudyCenter.csproj @@ -1,6 +1,7 @@  netcoreapp3.1 + en true false false diff --git a/projects/UserCenter/UserCenter.csproj b/projects/UserCenter/UserCenter.csproj index fcd980f1..6944ace8 100644 --- a/projects/UserCenter/UserCenter.csproj +++ b/projects/UserCenter/UserCenter.csproj @@ -1,6 +1,7 @@  netcoreapp3.1 + en true false false diff --git a/projects/Version.cs b/projects/Version.cs index bd4ffb31..f468ee3e 100644 --- a/projects/Version.cs +++ b/projects/Version.cs @@ -1,4 +1,4 @@ using System.Reflection; [assembly: AssemblyVersion("1.0.0.*")] -[assembly: AssemblyInformationalVersion("1.0.0.4292")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("1.0.0.4293")] \ No newline at end of file diff --git a/projects/WebMVC/WebMVC.csproj b/projects/WebMVC/WebMVC.csproj index e51b1acf..e84ff198 100644 --- a/projects/WebMVC/WebMVC.csproj +++ b/projects/WebMVC/WebMVC.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + en diff --git a/projects/WebSPA/WebSPA.csproj b/projects/WebSPA/WebSPA.csproj index e51b1acf..e84ff198 100644 --- a/projects/WebSPA/WebSPA.csproj +++ b/projects/WebSPA/WebSPA.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 + en From 087a70cf968307bc407b1d891295b857c6ad58b3 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Thu, 30 Apr 2020 09:29:28 +0800 Subject: [PATCH 2/2] 1.0.0.430 Former-commit-id: 36119b14b94d4362be12b912f9b7626e57db6b1e --- .../DeviceServices/Onvif/OnvifService.cs | 41 ++++++++++++++++++- .../IoTNode/Services/IoTNodeEventHandler.cs | 19 ++++++++- projects/Version.cs | 2 +- 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/projects/IoTNode/DeviceServices/Onvif/OnvifService.cs b/projects/IoTNode/DeviceServices/Onvif/OnvifService.cs index 51d42f37..020edac8 100644 --- a/projects/IoTNode/DeviceServices/Onvif/OnvifService.cs +++ b/projects/IoTNode/DeviceServices/Onvif/OnvifService.cs @@ -272,7 +272,31 @@ namespace IoTNode.DeviceServices.Onvif } } - private void StartPushToServer(Device camera) + public void StartPushToServer() + { + using var scope = _applicationServices.CreateScope(); + var repo = scope.ServiceProvider.GetService>(); + var cameras = repo.ReadOnlyTable().Include(o => o.Data).Where(o => o.Name == "摄像头").ToList(); + foreach (var camera in cameras) + { + try + { + if (camera.Data.Any(o => o.Key == "Push" && o.Value == "是")) + { + if (camera.Data.Any(o => o.Key == "NeedAuth" && o.Value == "否") || camera.Data.Any(o => o.Key == "HasAuth" && o.Value == "是")) + { + this.StartPushToServer(camera); + } + } + } + catch (Exception ex) + { + ex.PrintStack(); + } + } + } + + public void StartPushToServer(Device camera) { try { @@ -337,6 +361,21 @@ namespace IoTNode.DeviceServices.Onvif } } + public void StopPushToServer() + { + foreach (var item in this._list.Keys) + { + try + { + this.StopPushToServer(item); + } + catch (Exception ex) + { + ex.PrintStack(); + } + } + } + public void StopPushToServer(string key) { if (this._list.TryRemove(key, out Process process)) diff --git a/projects/IoTNode/Services/IoTNodeEventHandler.cs b/projects/IoTNode/Services/IoTNodeEventHandler.cs index 0f78aca0..e4b2ba82 100644 --- a/projects/IoTNode/Services/IoTNodeEventHandler.cs +++ b/projects/IoTNode/Services/IoTNodeEventHandler.cs @@ -1,14 +1,17 @@ using Application.Domain.Entities; using CSScriptLib; using Hangfire; +using Infrastructure.Application.Entites.Settings; using Infrastructure.Events; using Infrastructure.Extensions; +using IoTNode.DeviceServices.Onvif; using System; -using System.Collections.Concurrent; +using System.Threading.Tasks; namespace IoTNode.Services { public class IoTNodeEventHandler : + IEventHander>, IEventHander>, IEventHander>, IEventHander>, @@ -16,11 +19,13 @@ namespace IoTNode.Services { private readonly ISceneTiggerService _sceneTiggerService; private readonly IoTNodeJob _job; + private readonly OnvifService _onvifService; - public IoTNodeEventHandler(ISceneTiggerService sceneTiggerService, IoTNodeJob job) + public IoTNodeEventHandler(ISceneTiggerService sceneTiggerService, IoTNodeJob job, OnvifService onvifService) { this._sceneTiggerService = sceneTiggerService; this._job = job; + this._onvifService = onvifService; } public void Handle(EntityInsertedEvent message) @@ -63,5 +68,15 @@ namespace IoTNode.Services } } } + + public void Handle(EntityUpdatedEvent message) + { + if (message.Data.Name == "stream.rtmp" || message.Data.Name == "ffmpeg.args") + { + Task.Delay(1000); + this._onvifService.StopPushToServer(); + this._onvifService.StartPushToServer(); + } + } } } \ No newline at end of file diff --git a/projects/Version.cs b/projects/Version.cs index f468ee3e..c30e1a8a 100644 --- a/projects/Version.cs +++ b/projects/Version.cs @@ -1,4 +1,4 @@ using System.Reflection; [assembly: AssemblyVersion("1.0.0.*")] -[assembly: AssemblyInformationalVersion("1.0.0.4293")] \ No newline at end of file +[assembly: AssemblyInformationalVersion("1.0.0.430")] \ No newline at end of file