private/Functions/Hanwha/Update-HanwhaMediaProfile.ps1

Function Update-HanwhaMediaProfile {
    [cmdletBinding()]
    Param(
        [Parameter()]
        [hashtable]$Object
    )
    
    <#
    Object Definition:
    @{
        IP = [String(Mandatory)]
        Credential = [PSCredential(Mandatory)]
        ProfileID = [int(Mandatory)]
        NewName = [String()]
        FrameRate = [int]
        BitRate = [int]
        Channel = [int]
        Encoding = [String(Mandatory)]
        Resolution = [String]
        PriorityType = [String]
        BitrateControlType = [String]
        H26xProfile = [String]
    }
    #>


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

    #Add Action Parameters
    $CamCmd.Arguments.Parameters += "Channel=$($Object.Channel)"
    $CamCmd.Arguments.Parameters += "Profile=$($Object.ProfileID)"
    $CamCmd.Arguments.Parameters += "EncodingType=$($Object.Encoding)"

    if($Resolution) {
        $CamCmd.Arguments.Parameters += "Resolution=$($Object.Resolution)"
    }
    if($FrameRate) {
        $CamCmd.Arguments.Parameters += "FrameRate=$($Object.FrameRate)"
    }
    if($BitRate) {
        $CamCmd.Arguments.Parameters += "Bitrate=$($Object.Bitrate)"
    }
    if($NewName) {
        $CamCmd.Arguments.Parameters += "Name=$($Object.NewName)"
    }
    if($H26xProfile) {
        $CamCmd.Arguments.Parameters += "$($Object.Encoding).Profile=$($Object.H26xProfile)"
    }
    if($BitrateControlType) {
        $CamCmd.Arguments.Parameters += "$($Object.Encoding).BitrateControlType=$($Object.BitrateControlType)"
    }
    if($PriorityType) {
        $CamCmd.Arguments.Parameters += "$($Object.Encoding).PriorityType=$($Object.PriorityType)"
    }

    Invoke-HanwhaCommand @CamCmd
}