Initial commit

This commit is contained in:
2026-07-03 16:37:12 +07:00
commit 63b8c1ea8b
1931 changed files with 640587 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.SignalR;
using RobotNet10.RobotApp.Client.Shared.Devices;
using RobotNet10.RobotApp.Devices;
using RobotNet10.Shared.Geometry;
namespace RobotNet10.RobotApp.Hubs;
/// <summary>
/// SignalR Hub cho Camera QR device - cung cấp real-time QR detection data
/// </summary>
[Authorize]
public class CameraQrHub(IDeviceProvider deviceProvider) : Hub
{
/// <summary>
/// Lấy thông tin device (DeviceName) theo device ID
/// </summary>
public async Task<DeviceInfoDto?> GetDeviceInfo(string deviceId)
{
var device = deviceProvider.GetDevice(deviceId);
if (device is not ICameraQr)
{
return null;
}
return new DeviceInfoDto
{
DeviceId = device.DeviceId,
DeviceName = device.DeviceName
};
}
/// <summary>
/// Lấy dữ liệu Camera QR theo device ID
/// </summary>
public async Task<CameraQrDataDto?> GetCameraQrData(string deviceId)
{
var device = deviceProvider.GetDevice(deviceId);
if (device is not ICameraQr cameraQr)
{
return null;
}
return MapToDto(cameraQr);
}
/// <summary>
/// Map ICameraQr sang CameraQrDataDto
/// </summary>
private static CameraQrDataDto MapToDto(ICameraQr cameraQr)
{
return new CameraQrDataDto
{
IsConnected = cameraQr.IsConnected,
Codes = cameraQr.Codes,
};
}
}