Skip to content

feat(HikVision): add instance method#781

Merged
ArgoZhang merged 1 commit intomasterfrom
refactor-hik
Dec 4, 2025
Merged

feat(HikVision): add instance method#781
ArgoZhang merged 1 commit intomasterfrom
refactor-hik

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Dec 4, 2025

Link issues

fixes #780

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Add new instance methods to the HikVision component to control real-time video preview and adjust the login API signature.

New Features:

  • Expose StartRealPlay and StopRealPlay instance methods on the HikVision component to control real-time preview.

Enhancements:

  • Change the HikVision Login method to accept a numeric port parameter instead of a string.

Copilot AI review requested due to automatic review settings December 4, 2025 09:12
@bb-auto bb-auto Bot added the enhancement New feature or request label Dec 4, 2025
@bb-auto bb-auto Bot added this to the v9.2.0 milestone Dec 4, 2025
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Dec 4, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts the HikVision component’s login signature to take a numeric port and adds instance methods to start and stop real-time preview via JS interop.

Sequence diagram for HikVision real-time preview control

sequenceDiagram
    actor User
    participant Page as BlazorPage
    participant Component as HikVision
    participant JS as HikVisionJSInterop

    User->>Page: Click start real-time preview
    Page->>Component: StartRealPlay()
    Component->>JS: InvokeVoidAsync(startRealPlay, Id)
    JS-->>Component: Promise resolved
    Component-->>Page: Task completed

    User->>Page: Click stop real-time preview
    Page->>Component: StopRealPlay()
    Component->>JS: InvokeVoidAsync(stopRealPlay, Id)
    JS-->>Component: Promise resolved
    Component-->>Page: Task completed
Loading

Updated class diagram for HikVision component methods

classDiagram
    class HikVision {
        string Id

        +Task Login(string ip, int port, string userName, string password, LoginType loginType)
        +Task Logout()
        +Task StartRealPlay()
        +Task StopRealPlay()

        +Task InvokeVoidAsync(string identifier, string id)
        +Task InvokeVoidAsync(string identifier, string id, string ip, int port, string userName, string password, int loginType)
    }

    class LoginType {
        <<enumeration>>
        Http
        Other
    }

    HikVision --> LoginType
Loading

File-Level Changes

Change Details Files
Change the Login method signature to accept a numeric port instead of a string and forward it to JS interop.
  • Update the Login method parameter type for port from string to int
  • Ensure the updated port type is passed as-is to InvokeVoidAsync for the "login" JS call
src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.cs
Add instance methods to control real-time preview (start/stop) through JS interop on the HikVision component.
  • Introduce StartRealPlay instance method that calls the "startRealPlay" JS function via InvokeVoidAsync
  • Introduce StopRealPlay instance method that calls the "stopRealPlay" JS function via InvokeVoidAsync
src/components/BootstrapBlazor.HikVision/Components/HikVision.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#780 Add new instance methods to the HikVision component to control real-time preview (e.g., start and stop real play).

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang ArgoZhang merged commit 9b0dc1c into master Dec 4, 2025
5 of 6 checks passed
@ArgoZhang ArgoZhang deleted the refactor-hik branch December 4, 2025 09:13
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new public instance methods (StartRealPlay and StopRealPlay) to the HikVision component for controlling real-time video preview functionality, and corrects the Login method's port parameter type from string to int to match the component's Port property type.

Key Changes

  • Changed the port parameter type from string to int in the Login method to align with the component's Port property definition
  • Added StartRealPlay() method to begin real-time video preview
  • Added StopRealPlay() method to stop real-time video preview

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

/// <summary>
/// 开始实时预览方法
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation comment differs slightly from the interface definition. The interface (IHikVision) uses "开始实时预览画面方法" (Start real-time preview screen method) on line 32, while this implementation uses "开始实时预览方法" (Start real-time preview method). Consider using the same wording as the interface for consistency: "开始实时预览画面方法".

Suggested change
/// 开始实时预览方法
/// 开始实时预览画面方法

Copilot uses AI. Check for mistakes.
}

/// <summary>
/// 停止实时预览方法
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation comment differs slightly from the interface definition. The interface (IHikVision) uses "停止实时预览画面方法" (Stop real-time preview screen method) on line 38, while this implementation uses "停止实时预览方法" (Stop real-time preview method). Consider using the same wording as the interface for consistency: "停止实时预览画面方法".

Suggested change
/// 停止实时预览方法
/// 停止实时预览画面方法

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(HikVision): add instance method

2 participants