private/Functions/Axis/Set-AxisMotion.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 Set-AxisMotion { [cmdletBinding()] Param( [Parameter()] [hashtable]$Object ) <# Object Definition: @{ IP = [String(Mandatory)] Credential = [PSCredential(Mandatory)] Channel = [int] as [String(Mandatory)] MotionHighlight as [String(Optional)] DetectionType as [String(Optional)] } #> #Set basic Paramters for Invoke-AxisCommand $CamCmd = @{ Arguments = @{ IP = $Object.IP Menu = 'eventsources' SubMenu = 'videoanalysis' Action = 'set' Parameters = @() } Credential = $Object.Credential } #Need to add Get-AxisCapability here #Add Action Parameters if($Object.MotionHighlight -and $Object.DetectionType -eq 'Off') { Throw "MotionDetection must be enabled to use Highlighting" } $CamCmd.Arguments.Parameters += "Channel=$($Object.Channel)" if($Object.DetectionType -eq 'All') { $CamCmd.Arguments.Parameters += "DetectionType=MDAndIV" } else { $CamCmd.Arguments.Parameters += "DetectionType=$($Object.DetectionType)" } $CamCmd.Arguments.Parameters += "DetectionResultOverlay=$($Object.MotionHighlight)" Invoke-AxisCommand @CamCmd } |