private/Functions/Hanwha/Get-HanwhaMotion.ps1

#https://$($ip)/stw-cgi/eventsources.cgi?msubmenu=videoanalysis2&action=set&Channel=$($channelnum)&DetectionType=MotionDetection
#https://$($ip)/stw-cgi/eventsources.cgi?msubmenu=videoanalysis2&action=set&Channel=$($channelnum)
#ROI.1.Coordinate=0,0,1919,0,1919,1079,0,1079&ROI.1.SensitivityLevel=80
#ROI.1.Duration=0&
#ROI.1.ThresholdLevel=5
#DetectionType.MotionDetection.DetectionResultOverlay=False

Function Get-HanwhaMotion {
    [cmdletBinding()]
    Param(
        [Parameter()]
        [hashtable]$Object
    )
    
    <#
    Object Definition:
    @{
        IP = [String(Mandatory)]
        Credential = [PSCredential(Mandatory)]
        Channel = [int] as [String(Optional)]
    }
    #>


    #Set basic Paramters for Invoke-HanwhaCommand
    $CamCmd = @{
        Arguments = @{
            IP = $Object.IP
            Menu = 'eventsources'
            SubMenu = 'videoanalysis'
            Action = 'view'
            Parameters = @()
        }
        Credential = $Object.Credential
    }

    if($Object.ContainsKey('Channel')) {
        $CamCmd.Arguments.Parameters += "Channel=$($Object.Channel)"
    }

    return (Invoke-HanwhaCommand @CamCmd).VideoAnalysis
}