DreamineVMS
1.0.0.0
Windows PC의 RTSP·USB 카메라 영상을 HLS로 변환해 원격 CCTV Viewer에 전달하는 데스크톱 에이전트입니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
CameraRuntimeStateService.cs
이 파일의 문서화 페이지로 가기
1
using
DreamineVMS.Models
;
2
using
System.Collections.Concurrent;
3
4
namespace
DreamineVMS.Services.Runtime
;
5
14
public
sealed
class
CameraRuntimeStateService
:
ICameraRuntimeStateService
15
{
24
private
readonly ConcurrentDictionary<string, CameraRuntimeState>
_states
=
new
();
25
34
public
event
EventHandler<CameraRuntimeState>?
StateChanged
;
35
60
public
CameraRuntimeState
GetState
(
string
cameraId)
61
{
62
return
_states
.GetOrAdd(cameraId,
id
=>
new
CameraRuntimeState
{ CameraId =
id
});
63
}
64
81
public
IReadOnlyList<CameraRuntimeState>
GetAll
()
82
{
83
return
_states
.Values.OrderBy(state => state.CameraId).ToArray();
84
}
85
126
public
void
SetState
(
string
cameraId,
CameraConnectionState
state,
string
message,
string
? error =
null
)
127
{
128
CameraRuntimeState
runtimeState =
GetState
(cameraId);
129
130
// Connecting은 새 HLS 출력 세션의 시작으로 봅니다.
131
// StopAll → StartAll 후 playlist URL이 같아도 Blazor/hls.js가 새 세션을 구분할 수 있게
132
// RestartCount를 세션 버전으로 함께 사용합니다.
133
if
(state ==
CameraConnectionState
.Connecting && runtimeState.
State
!=
CameraConnectionState
.Connecting)
134
{
135
runtimeState.
RestartCount
++;
136
}
137
138
runtimeState.State = state;
139
runtimeState.LastMessage = message;
140
runtimeState.LastError = error;
141
runtimeState.LastUpdated = DateTimeOffset.Now;
142
StateChanged
?.Invoke(
this
, runtimeState);
143
}
144
169
public
void
IncrementRestart
(
string
cameraId,
string
message)
170
{
171
CameraRuntimeState
runtimeState =
GetState
(cameraId);
172
runtimeState.
RestartCount
++;
173
runtimeState.LastMessage = message;
174
runtimeState.LastUpdated = DateTimeOffset.Now;
175
StateChanged
?.Invoke(
this
, runtimeState);
176
}
177
}
DreamineVMS.Models
Definition
CameraConnectionState.cs:1
DreamineVMS.Models.CameraConnectionState
CameraConnectionState
Definition
CameraConnectionState.cs:12
DreamineVMS.Services.Runtime
Definition
CameraRuntimeStateService.cs:4
DreamineVMS.Models.CameraRuntimeState
Definition
CameraRuntimeState.cs:15
DreamineVMS.Models.CameraRuntimeState.RestartCount
int RestartCount
Definition
CameraRuntimeState.cs:147
DreamineVMS.Models.CameraRuntimeState.State
CameraConnectionState State
Definition
CameraRuntimeState.cs:91
DreamineVMS.Services.Runtime.CameraRuntimeStateService
Definition
CameraRuntimeStateService.cs:15
DreamineVMS.Services.Runtime.CameraRuntimeStateService._states
readonly ConcurrentDictionary< string, CameraRuntimeState > _states
Definition
CameraRuntimeStateService.cs:24
DreamineVMS.Services.Runtime.CameraRuntimeStateService.GetState
CameraRuntimeState GetState(string cameraId)
Definition
CameraRuntimeStateService.cs:60
DreamineVMS.Services.Runtime.CameraRuntimeStateService.IncrementRestart
void IncrementRestart(string cameraId, string message)
Definition
CameraRuntimeStateService.cs:169
DreamineVMS.Services.Runtime.CameraRuntimeStateService.GetAll
IReadOnlyList< CameraRuntimeState > GetAll()
Definition
CameraRuntimeStateService.cs:81
DreamineVMS.Services.Runtime.CameraRuntimeStateService.StateChanged
EventHandler< CameraRuntimeState >? StateChanged
Definition
CameraRuntimeStateService.cs:34
DreamineVMS.Services.Runtime.CameraRuntimeStateService.SetState
void SetState(string cameraId, CameraConnectionState state, string message, string? error=null)
Definition
CameraRuntimeStateService.cs:126
DreamineVMS.Services.Runtime.ICameraRuntimeStateService
Definition
ICameraRuntimeStateService.cs:14
Services
Runtime
CameraRuntimeStateService.cs
다음에 의해 생성됨 :
1.17.0