-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat(HikVision): add OnGetChannelsAsync parameter #789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright (c) BootstrapBlazor & Argo Zhang ([email protected]). All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||
|
|
||
| namespace BootstrapBlazor.Components; | ||
|
|
||
| /// <summary> | ||
| /// 模拟通道信息 | ||
| /// </summary> | ||
| public class HikVisionAnalogChannelInfo() | ||
| { | ||
| /// <summary> | ||
| /// 获得 通道 Id | ||
| /// </summary> | ||
| public int Id { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 获得 通道号 | ||
| /// </summary> | ||
| public int InputPort { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 获得 通道名称 | ||
| /// </summary> | ||
| public string? Name { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// 获得 通道制式 | ||
| /// </summary> | ||
| public string? VideoFormat { get; set; } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Copyright (c) BootstrapBlazor & Argo Zhang ([email protected]). All rights reserved. | ||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||
|
|
||
| namespace BootstrapBlazor.Components; | ||
|
|
||
| /// <summary> | ||
| /// 海康威视网络摄像机通道信息 | ||
| /// </summary> | ||
| public class HikVisionChannel | ||
| { | ||
| /// <summary> | ||
| /// 获得/设置 模拟通道信息集合 | ||
| /// </summary> | ||
| public List<HikVisionAnalogChannelInfo> AnalogChannels { get; set; } = []; | ||
|
|
||
| /// <summary> | ||
| /// 获得/设置 数字通道信息集合 | ||
| /// </summary> | ||
| public List<HikVisionDigitalChannelInfo> DigitalChannels { get; set; } = []; | ||
|
|
||
| /// <summary> | ||
| /// 获得/设置 数字通道信息集合 | ||
| /// </summary> | ||
| public List<HikVisionZeroChannelInfo> ZeroChannels { get; set; } = []; | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||||||||||||||||||||||||||||
| // Copyright (c) BootstrapBlazor & Argo Zhang ([email protected]). All rights reserved. | ||||||||||||||||||||||||||||||||||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||||||||||||||||||||||||||||||||||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| namespace BootstrapBlazor.Components; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||
| /// 模拟通道信息 | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (typo): The XML summary for The summary text currently says
|
||||||||||||||||||||||||||||||||||
| /// 模拟通道信息 | |
| /// 数字通道信息 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): The HikVisionDigitalChannelInfo model doesn’t align with the JS channel data shape.
On the JS side digitalChannels are shaped as { id, online }, but this class exposes Id, InputPort, Name, and VideoFormat. When JS data is marshalled, only Id will bind and online will be dropped. Please either add an Online property (and remove any unused ones) or update the JS mapping to populate the properties defined here so the interop model matches the actual payload.
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JavaScript code in hikvision.js (lines 134-138) sets an online property for digital channels, not InputPort, Name, or VideoFormat. This mismatch will cause deserialization issues when JavaScript passes data to C#. The HikVisionDigitalChannelInfo class should have an Online property (string or bool) instead of InputPort, Name, and VideoFormat, or the JavaScript code needs to be updated to extract these fields from the XML.
| /// 获得 通道号 | |
| /// </summary> | |
| public int InputPort { get; set; } | |
| /// <summary> | |
| /// 获得 通道名称 | |
| /// </summary> | |
| public string? Name { get; set; } | |
| /// <summary> | |
| /// 获得 通道制式 | |
| /// </summary> | |
| public string? VideoFormat { get; set; } | |
| /// 获得 通道在线状态 | |
| /// </summary> | |
| public string? Online { get; set; } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |||||
| namespace BootstrapBlazor.Components; | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 海康威视网络摄像机组件 (Websdk Plugin 插件版本) | ||||||
| /// 海康威视网络摄像机组件 (WebSdk Plugin 插件版本) | ||||||
| /// </summary> | ||||||
| [JSModuleAutoLoader("./_content/BootstrapBlazor.HikVision/Components/HikVisionWebPlugin.razor.js", JSObjectReference = true)] | ||||||
| public partial class HikVisionWebPlugin | ||||||
|
|
@@ -37,10 +37,10 @@ public partial class HikVisionWebPlugin | |||||
| public string? Password { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 获得/设置 网络摄像机 登录类型 默认值 <see cref="LoginType.Http"/> | ||||||
| /// 获得/设置 网络摄像机 登录类型 默认值 <see cref="HikVisionLoginType.Http"/> | ||||||
| /// </summary> | ||||||
| [Parameter] | ||||||
| public LoginType LoginType { get; set; } | ||||||
| public HikVisionLoginType LoginType { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 获得/设置 视频图像窗口宽度 默认值 500px | ||||||
|
|
@@ -64,13 +64,19 @@ public partial class HikVisionWebPlugin | |||||
| /// 获得/设置 登录成功后回调方法 | ||||||
| /// </summary> | ||||||
| [Parameter] | ||||||
| public Func<Task>? OnLoginedAsync { get; set; } | ||||||
| public Func<Task>? OnLoginAsync { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 获得/设置 停止预览后回调方法 | ||||||
|
||||||
| /// 获得/设置 停止预览后回调方法 | |
| /// 获得/设置 获取通道列表后回调方法 |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment uses "Web sdk" (with a space and lowercase "sdk") while line 10 uses "WebSdk" (no space, camelCase). For consistency, this should also be "WebSdk" to match the naming convention used elsewhere in the file.
| /// 获得 Web sdk 插件是否初始化成功 | |
| /// 获得 WebSdk 插件是否初始化成功 |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The property name IsLogin is grammatically awkward. Consider using IsLoggedIn instead, which is the standard past participle form used in similar contexts (e.g., User.IsLoggedIn() is a common pattern). Alternatively, IsAuthenticated would also be appropriate.
| public bool IsLogin { get; private set; } | |
| public bool IsLoggedIn { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): The C# GetChannelList method invokes a JS function that is not exported, which will cause a JS interop error at runtime.
This calls InvokeVoidAsync("getChannelList", Id), but HikVisionWebPlugin.razor.js doesn’t export getChannelList, and in hikvision.js it is only defined as an internal const (not exported). This will cause the interop call to fail at runtime. Please either export getChannelList on the JS side and re-export it via the .razor.js module, or remove/repurpose this C# method and rely on the existing login callback that fetches channel information.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||
| import { init as initVision, login, logout, startRealPlay, stopRealPlay, dispose as disposeVision } from '../hikvision.js'; | ||||
| import { init as initVision, login as loginVision, logout, startRealPlay, stopRealPlay, dispose as disposeVision } from '../hikvision.js'; | ||||
| import Data from '../../BootstrapBlazor/modules/data.js'; | ||||
| import EventHandler from '../../BootstrapBlazor/modules/event-handler.js'; | ||||
|
|
||||
|
Comment on lines
3
to
4
|
||||
| import EventHandler from '../../BootstrapBlazor/modules/event-handler.js'; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,26 @@ | ||||||
| // Copyright (c) BootstrapBlazor & Argo Zhang ([email protected]). All rights reserved. | ||||||
| // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||||||
| // Website: https://www.blazor.zone or https://argozhang.github.io/ | ||||||
|
|
||||||
| namespace BootstrapBlazor.Components; | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 模拟通道信息 | ||||||
|
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (typo): The XML summary for Please update the summary text to explicitly describe this as zero-channel information so it’s clearly distinguished from the analog and digital channel types.
|
||||||
| /// 模拟通道信息 | |
| /// 零通道信息 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 23 says "数字通道信息集合" (digital channel info collection) which is identical to the comment on line 18 for DigitalChannels. The comment for ZeroChannels should be "零通道信息集合" (zero channel info collection) instead.