-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add autofocus commands, more agent events
- Loading branch information
Showing
26 changed files
with
629 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
OpenAlprWebhookProcessor/Cameras/ZoomAndFocus/TriggerAutofocusHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Threading.Tasks; | ||
using System.Threading; | ||
using System; | ||
|
||
namespace OpenAlprWebhookProcessor.Cameras.ZoomAndFocus | ||
{ | ||
public class TriggerAutofocusHandler | ||
{ | ||
private readonly CameraUpdateService.CameraUpdateService _cameraUpdateService; | ||
|
||
public TriggerAutofocusHandler(CameraUpdateService.CameraUpdateService cameraUpdateService) | ||
{ | ||
_cameraUpdateService = cameraUpdateService; | ||
} | ||
|
||
public async Task<bool> HandleAsync( | ||
Guid cameraId, | ||
CancellationToken cancellationToken) | ||
{ | ||
return await _cameraUpdateService.TriggerAutofocusAsync( | ||
cameraId, | ||
cancellationToken); | ||
} | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
OpenAlprWebhookProcessor/ImageRelay/SnapshotWebSocketRelay/GetSnapshotHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using OpenAlprWebhookProcessor.Cameras; | ||
using OpenAlprWebhookProcessor.Data; | ||
using OpenAlprWebhookProcessor.WebhookProcessor.OpenAlprWebsocket; | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace OpenAlprWebhookProcessor.ImageRelay | ||
{ | ||
public class GetWebSocketSnapshotHandler | ||
{ | ||
private readonly ProcessorContext _processorContext; | ||
|
||
private readonly WebsocketClientOrganizer _websocketClientOrganizer; | ||
|
||
public GetWebSocketSnapshotHandler( | ||
ProcessorContext processorContext, | ||
WebsocketClientOrganizer websocketClientOrganizer) | ||
{ | ||
_processorContext = processorContext; | ||
_websocketClientOrganizer = websocketClientOrganizer; | ||
} | ||
|
||
public async Task<Stream> GetSnapshotAsync( | ||
string agentId, | ||
Guid cameraId, | ||
CancellationToken cancellationToken) | ||
{ | ||
var openAlprCameraId = await _processorContext.Cameras | ||
.AsNoTracking() | ||
.Where(x => x.Id == cameraId) | ||
.Select(x => x.OpenAlprCameraId) | ||
.FirstOrDefaultAsync(cancellationToken); | ||
|
||
var image = await _websocketClientOrganizer.GetCameraImageAsync( | ||
agentId, | ||
openAlprCameraId, | ||
cancellationToken); | ||
|
||
return image; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
OpenAlprWebhookProcessor/WebhookProcessor/OpenAlprWebsocket/ConfigSaveMaskRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace OpenAlprWebhookProcessor.WebhookProcessor.OpenAlprWebsocket | ||
{ | ||
public class ConfigSaveMaskRequest | ||
{ | ||
[JsonPropertyName("type")] | ||
public string RequestType { get; set; } | ||
|
||
[JsonPropertyName("transaction_id")] | ||
public Guid TransactionId { get; set; } | ||
|
||
[JsonPropertyName("stream_file")] | ||
public string StreamFile { get; set; } | ||
|
||
[JsonPropertyName("mask_image")] | ||
public string MaskImage { get; set; } | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
OpenAlprWebhookProcessor/WebhookProcessor/OpenAlprWebsocket/ImageDownloadRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace OpenAlprWebhookProcessor.WebhookProcessor.OpenAlprWebsocket | ||
{ | ||
public class ImageDownloadRequest | ||
{ | ||
public ImageDownloadRequest() { } | ||
|
||
|
||
[JsonPropertyName("type")] | ||
public string RequestType { get; set; } | ||
|
||
[JsonPropertyName("direction")] | ||
public string Direction { get; set; } | ||
|
||
[JsonPropertyName("camera_id")] | ||
public long CameraId { get; set; } | ||
|
||
[JsonPropertyName("transaction_id")] | ||
public Guid TransactionId { get; set; } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
OpenAlprWebhookProcessor/WebhookProcessor/OpenAlprWebsocket/ImageDownloadResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace OpenAlprWebhookProcessor.WebhookProcessor.OpenAlprWebsocket | ||
{ | ||
public class ImageDownloadResponse | ||
{ | ||
[JsonPropertyName("image")] | ||
public string Image { get; set; } | ||
|
||
[JsonPropertyName("response_code")] | ||
public string ResponseCode { get; set; } | ||
|
||
[JsonPropertyName("transaction_id")] | ||
public Guid TransactionId { get; set; } | ||
} | ||
} |
Oops, something went wrong.