GetSMS

Definition

Usage

Obtain details of a short message (including content, start time, short message type, and valid duration) by short message number.

Parameter

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

Content of a short message

Return Value

Return True if it is successful, or return False.

Related Function

SetSMS, SetUserSMS, GetSMS, DeleteSMS, ClearSMS

 

Ejemplo

C#

        /// <summary>
        /// Get short messages through the Short Message ID.
        /// The returned values of the Short Message includes the tag of the message,the valid time, the start time and its content.
        /// </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 GetSMS(int SMSID, int Tag = 0, int ValidMins = 0, 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))
            {
                DateTime dt = new DateTime();
                dt = Convert.ToDateTime(StartTime);
                MessageBox.Show("Successfully Get SMS!, Sms Id: " + SMSID.ToString() + ", Tag: " + Tag.ToString() + ", Valid Mins: " + ValidMins.ToString() + ", Start Time: " + string.Format("{0:g}", dt)
                    + ", Content: " + Content, "Success");
            }
        else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
            }
        }

VB

        ''' <summary>
        ''' Get short messages through the Short Message ID.
        ''' The returned values of the Short Message includes the tag of the message,the valid time, the start time And its content.
        ''' </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 GetSMS(SMSID As Integer, Optional Tag As Integer = 0, Optional ValidMins As Integer = 0, Optional StartTime As String = "",
        Optional 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
        Dim dt As Date
            dt = Convert.ToDateTime(StartTime)
            MsgBox("Successfully Get SMS!, Sms Id: " & SMSID.ToString() & ", Tag: " & Tag.ToString() & ", Valid Mins: " & ValidMins.ToString() & ", Start Time: " & String.Format("{0:g}", dt) & ", Content: " & Content, MsgBoxStyle.Information, "Success")
        Else
            axCZKEM1.GetLastError(idwErrorCode)
            MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
        End If
        End Sub