fix: 修改camera寄存器地址,同时修改前端逻辑
This commit is contained in:
parent
d83bc250bd
commit
bdffba7576
|
@ -162,13 +162,7 @@ public class VideoStreamController : ControllerBase
|
|||
logger.Info("获取摄像头配置");
|
||||
var cameraStatus = _videoStreamService.GetCameraStatus();
|
||||
|
||||
return TypedResults.Ok(new
|
||||
{
|
||||
address = _videoStreamService.CameraAddress,
|
||||
port = _videoStreamService.CameraPort,
|
||||
isConfigured = cameraStatus.GetType().GetProperty("IsConfigured")?.GetValue(cameraStatus),
|
||||
connectionString = $"{_videoStreamService.CameraAddress}:{_videoStreamService.CameraPort}"
|
||||
});
|
||||
return TypedResults.Ok(cameraStatus);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -7,9 +7,9 @@ static class CameraAddr
|
|||
{
|
||||
public const UInt32 BASE = 0x7000_0000;
|
||||
|
||||
public const UInt32 STORE_ADDR = BASE + 12;
|
||||
public const UInt32 STORE_NUM = BASE + 13;
|
||||
public const UInt32 CAPTURE_ON = BASE + 14;
|
||||
public const UInt32 STORE_ADDR = BASE + 0x12;
|
||||
public const UInt32 STORE_NUM = BASE + 0x13;
|
||||
public const UInt32 CAPTURE_ON = BASE + 0x14;
|
||||
}
|
||||
|
||||
class Camera
|
||||
|
|
|
@ -90,6 +90,15 @@
|
|||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="card-actions justify-end mt-4">
|
||||
<button
|
||||
class="btn btn-outline btn-primary"
|
||||
@click="configCamera"
|
||||
:dsiabled="configing"
|
||||
>
|
||||
<RefreshCw v-if="configing" class="animate-spin h-4 w-4 mr-2" />
|
||||
<RefreshCw v-else class="h-4 w-4 mr-2" />
|
||||
{{ configing ? "配置中..." : "配置摄像头" }}
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-outline btn-primary"
|
||||
@click="refreshStatus"
|
||||
|
@ -307,6 +316,7 @@ const eqps = useEquipments();
|
|||
|
||||
// 状态管理
|
||||
const loading = ref(false);
|
||||
const configing = ref(false);
|
||||
const testing = ref(false);
|
||||
const isPlaying = ref(false);
|
||||
const hasVideoError = ref(false);
|
||||
|
@ -425,9 +435,8 @@ const takeSnapshot = async () => {
|
|||
}
|
||||
};
|
||||
|
||||
// 刷新状态
|
||||
const refreshStatus = async () => {
|
||||
loading.value = true;
|
||||
async function configCamera() {
|
||||
configing.value = true;
|
||||
try {
|
||||
// addLog("info", "正在配置并初始化摄像头...");
|
||||
// const boardconfig = new CameraConfigRequest({
|
||||
|
@ -436,6 +445,24 @@ const refreshStatus = async () => {
|
|||
// });
|
||||
// await videoClient.configureCamera(boardconfig);
|
||||
|
||||
const status = await videoClient.getCameraConfig();
|
||||
if (status.isConfigured) {
|
||||
addLog("success", "摄像头已配置并初始化");
|
||||
} else {
|
||||
addLog("error", "摄像头配置失败,请检查地址和端口");
|
||||
}
|
||||
} catch (error) {
|
||||
addLog("error", `摄像头配置失败: ${error}`);
|
||||
console.error("摄像头配置失败:", error);
|
||||
} finally {
|
||||
configing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新状态
|
||||
const refreshStatus = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
addLog("info", "正在获取服务状态...");
|
||||
|
||||
// 使用新的API方法名称
|
||||
|
@ -559,7 +586,8 @@ onUnmounted(() => {
|
|||
/* 自定义样式 */
|
||||
.stats {
|
||||
background-color: var(--b1);
|
||||
color: var(--bc); /* 添加适配文本颜色 */
|
||||
color: var(--bc);
|
||||
/* 添加适配文本颜色 */
|
||||
}
|
||||
|
||||
code {
|
||||
|
|
Loading…
Reference in New Issue