SSR_SetDeviceData

Definition

Usage

This function applies only to the time and attendance applications that comply with the PULL protocol in the new firmware. Used to set and insert data (such as time segments, user information, and leaves settings) into a device. The data can be one or more records. If the primary key of an inserted record already exists in the device, the original record is overwritten.

Parameter

Device number

Name of a data table. For available tables, see attachment 1 PULL Data Dictionary V1.0.0 of the New Firmware.

Indication of data records. Data is in the text format. Multiple records are separated by \r\n. Various pairs of "field=value" are separated by \t

Used for extension. This parameter is left blank by default.

Return Value

Return True if it is successful, or return False.

Related Function

SSR_GetDeviceData

 

Ejemplo

C#

private int sSR_SetDeviceData(string ipAddr, int port, string options = "")
        {
int iMachineNumber = 1;
int idwErrorCode = 0;
bool ret = false;
string devTableName = "user";
string data = "PIN=19999\tCardNo=13375401\tPassword=1\r\nPIN = 2\tCardNo = 14128058\tPassword = 1";
//Create Standalone SDK class dynamicly.
            zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
if (axCZKEM1.Connect_Net(ipAddr, 4370))
            {
                ret = axCZKEM1.SSR_SetDeviceData(iMachineNumber, devTableName, data, options);
if (ret)
                {
                    MessageBox.Show("SetDeviceData operation is successful!");
return -1;
                }
else
                    MessageBox.Show("SetDeviceData operation is failed!");
            }
else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
            }
            axCZKEM1.Disconnect();
return idwErrorCode;
        }

VB

Private Sub sSR_SetDeviceData(ipAddr As String, port As Int32, options As String)
'Create Standalone SDK class dynamicly.
Dim axCZKEM1 As New zkemkeeper.CZKEM
Dim iMachineNumber As Integer
Dim idwErrorCode As Integer
Dim iUpdateFlag As Integer = 1
Dim tableName As String = "user"
Dim Data As String = "PIN=19999\tCardNo=13375401\tPassword=1\r\nPIN = 2\tCardNo = 14128058\tPassword = 1"
If axCZKEM1.Connect_Net(ipAddr, port) = True Then
            axCZKEM1.EnableDevice(iMachineNumber, False)
If axCZKEM1.SSR_SetDeviceData(iMachineNumber, tableName, Data,  = True Then
                MsgBox("SetDeviceData operation is successful!")
Else
                axCZKEM1.GetLastError(idwErrorCode)
                MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
End If
Else
            axCZKEM1.GetLastError(idwErrorCode)
End If
        axCZKEM1.Disconnect()
End Sub