SetDeviceMAC

Definition

Usage

Set the MAC address of the device.

Parameter

Device number

MAC address

Return Value

Return True if it is successful, or return False.

Related Function

GetDeviceMAC

 

Ejemplo

C#

                            //Create Standalone SDK class dynamicly.
                                zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
                            int iMachineNumber = 1;
                                        axCZKEM1.Connect_Net("10.0.0.43", 4370);
                            string sMAC = "10:10:10:10:10:FF";
                            int idwErrorCode = 0;
                            if (axCZKEM1.SetDeviceMAC(iMachineNumber, sMAC))
                                    {<                    
                                        axCZKEM1.RefreshData(iMachineNumber);//the data in the device should be refreshed
                                        MessageBox.Show("Successfully set MAC address! MAC=" + sMAC, "Success");
                                    }
                            else
                                    {
                                        axCZKEM1.GetLastError(ref idwErrorCode);
                                        MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
                            }
                        

VB

    'Create Standalone SDK class dynamicly.
    Dim axCZKEM1 As New zkemkeeper.CZKEM
    Dim bIsConnected = False 'the boolean value identifies whether the device is connected
    Dim sIP As String = "10.0.0.43"
    Dim sPort As Integer = 4370
    Dim sMAC As String = "10:10:10:10:10:FF"
    Dim idwErrorCode As Integer = 0
        bIsConnected = axCZKEM1.Connect_Net(sIP, Convert.ToInt32(sPort))
    If axCZKEM1.SetDeviceMAC(sMAC, sMAC) = True Then
            axCZKEM1.RefreshData(sMAC) 'the data in the device should be refreshed
            MsgBox("Successfully set MAC address! MAC=" & sMAC, MsgBoxStyle.Information, "Success")
    Else
            axCZKEM1.GetLastError(idwErrorCode)
            MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
    End If