SetSysOption

Definition

Usage

Configure the parameters in the device.

Parameter

Device number

Name of the parameter to be set

Value of the parameter described by Option

Return Value

Return True if it is successful, or return False.

Related Function

GetSysOption

 

Ejemplo

C#

    /// <summary>
    /// Set the options' parameters in the device 
    /// </summary>
    /// <param name="Option"></param>
    /// <param name="Value"></param>
    /// <param name="IP"> Ip of device </param>
    /// <param name="Port"> Port of Device </param>
    /// <param name="MachineNumber"> Device Number </param>
    private void SetSysOption(string Option = "~PIN2Width", string Value = "value", string IP = "10.0.0.44", int Port = 4370, int MachineNumber = 1)
        {
    //Create Standalone SDK class dynamicly.
            zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
            axCZKEM1.Connect_Net(IP, Port);
    int idwErrorCode = 0;
    if (axCZKEM1.SetSysOption(MachineNumber, Option, Value))
            {
                axCZKEM1.RefreshData(MachineNumber);//the data in the device should be refreshed
                MessageBox.Show("Successfully set " + Option + " ! value=" + Value, "Success");
            }
    else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
            }
        }

VB

    ''' <summary>
    ''' Set the options' parameters in the device
    ''' </summary>
    ''' <param name="sOption"></param>
    ''' <param name="Value"></param>
    ''' <param name="IP"> Ip of device </param>
    ''' <param name="Port"> Port of Device </param>
    ''' <param name="MachineNumber"> Device Number </param>
    Private Sub SetSysOption(Optional sOption As String = "~PIN2Width", Optional Value As String = "", Optional IP As String = "10.0.0.44", Optional Port As Integer = 4370, Optional MachineNumber As Integer = 1)
    Dim idwErrorCode As Integer = 0
    'Create Standalone SDK class dynamicly.
    Dim axCZKEM1 As New zkemkeeper.CZKEM
        axCZKEM1.Connect_Net(IP, Convert.ToInt32(Port))
    If axCZKEM1.SetSysOption(MachineNumber, sOption, Value) = True Then
            axCZKEM1.RefreshData(MachineNumber) 'the data in the device should be refreshed
            MsgBox("Successfully set " & sOption & " ! value=" & Value, MsgBoxStyle.Information, "Success")
    Else
            axCZKEM1.GetLastError(idwErrorCode)
            MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
    End If
    End Sub