Add a short message to the device. To set a short message of a user, use SetUserSMS to allocate the short message to the user.
Device number
Short message number
Short message type. 253: public short message, 254: personal short message, 255: reserved short message
Valid duration of a short message. The value ranges from 0 to 65535. That is, the short message becomes valid at StartTime and keeps valid for ValidMinutes.
Start time when a short message becomes valid, in a string format of yyyy-mm-dd hh:mm:ss
Content of a short message
Return True if it is successful, or return False.
GetSMS, DeleteSMS, ClearSMS, SetUserSMS
/// <summary> /// Set short messages. /// You should input the five parameters:Short Message ID,the tag of the message,the Valid Minutes,the Start Time and the Short Messages Content. /// If you want to set personal message, you should use function SetUserSMS to establish the correlation between users and short messages. /// </summary> /// <param name="SMSID">Short message number</param> /// <param name="Tag">Short message type. 253: public short message, 254: personal short message, 255: reserved short message </param> /// <param name="ValidMins">Valid duration of a short message. The value ranges from 0 to 65535. That is, the short message becomes valid at StartTime and keeps valid for ValidMinutes. </param> /// <param name="StartTime">Start time when a short message becomes valid, in a string format of yyyy-mm-dd hh:mm:ss </param> /// <param name="Content">Content of a short message </param> /// <param name="IP"> Ip of device </param> /// <param name="Port"> Port of Device </param> /// <param name="MachineNumber"> Device Number </param> private void SetSMS(int SMSID, int Tag, int ValidMins, string StartTime, string Content, 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.GetSMS(MachineNumber, SMSID, ref Tag, ref ValidMins, ref StartTime, ref Content) == true) { MessageBox.Show("The ID has existed!Pls change it!", "Error"); return; } if (axCZKEM1.SetSMS(MachineNumber, SMSID, Tag, ValidMins, StartTime, Content)) { axCZKEM1.RefreshData(MachineNumber); //After you have set the short message,you should refresh the data of the device MessageBox.Show("Successfully set SMS! SMSType=" + Tag.ToString(), "Success"); } else { axCZKEM1.GetLastError(ref idwErrorCode); MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error"); } }
''' <summary> ''' Set short messages. ''' You should input the five parameters:Short Message ID,the tag of the message,the Valid Minutes,the Start Time and the Short Messages Content. ''' If you want to set personal message, you should use function SetUserSMS to establish the correlation between users and short messages. ''' </summary> ''' <param name="SMSID">Short message number</param> ''' <param name="Tag">Short message type. 253: Public Short message, 254: personal short message, 255: reserved short message </param> ''' <param name="ValidMins">Valid duration of a short message. The value ranges from 0 to 65535. That Is, the short message becomes valid at StartTime And keeps valid for ValidMinutes. </param> ''' <param name="StartTime">Start time when a short message becomes valid, in a string format of yyyy-mm-dd hh:mm:ss </param> ''' <param name="Content">Content of a short message </param> ''' <param name="IP"> Ip of device </param> ''' <param name="Port"> Port of Device </param> ''' <param name="MachineNumber"> Device Number </param> Private Sub SetSMS(SMSID As Integer, Tag As Integer, ValidMins As Integer, StartTime As String, Content 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.GetSMS(MachineNumber, SMSID, Tag, ValidMins, StartTime, Content) = True Then MsgBox("The ID has existed!Pls change it! ", MsgBoxStyle.Exclamation, "Error") Return End If If axCZKEM1.SetSMS(MachineNumber, SMSID, Tag, ValidMins, StartTime, Content) = True Then axCZKEM1.RefreshData(MachineNumber) 'the data in the device should be refreshed MsgBox("Successfully set SMS! SMSType=" + Tag.ToString(), MsgBoxStyle.Information, "Success") Else axCZKEM1.GetLastError(idwErrorCode) MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error") End If End Sub