GetDoorState

Definition

Usage

Obtain the current door state. 1: opened, 0: closed

Parameter

Device number

Door state

Return Value

Return True if it is successful, or return False.

Related Function

None

 

Ejemplo

C#

int idwErrorCode = 0;
int iState = 0;
//Create Standalone SDK class dynamicly.
zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
int iMachineNumber = 1;

string sMessage;

if (axCZKEM1.GetDoorState(iMachineNumber, ref iState))
{
    if (iState == 1)
    {
        sMessage = "The door is open now!";
    }
    else
    {
        sMessage = "The door is close now!";
    }
}
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 iMachineNumber As Integer

Dim idwErrorCode As Integer

Dim iState As Integer

Dim sMessage As String

If AxCZKEM1.GetDoorState(iMachineNumber, iState) = True Then
    If iState = 1 Then
        sMessage = "The door is open now!"
    Else
        sMessage = "The door is close now!"
    End If
Else
    AxCZKEM1.GetLastError(idwErrorCode)
    MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
End If