SMS questions about cats and cats
[FAQs about sms cats]
Reference of getDeviceNameByRFID. Note:
StringBuilder. Append (DbHelperSQL. getDeviceNameByRFID (dt. Rows [I] ["RFID"]. ToString (); // () next to ToString ()!!!
A series of configurations
[SMS SmsHelper]
Using System; using System. collections. generic; using System. linq; using System. text; using System. runtime. interopServices; namespace EquipMonitorConsole. duanXinMao {class SmsHelper {[STAThread] [DllImport ("sms. dll ", EntryPoint =" Sms_Connection ")] public static extern uint Sms_Connection (string CopyRight, uint Com_Port, uint Com_BaudRate, out string Mobile_Type, out string CopyRightToCOM ); // output variable out. [DllImport ("sms. dll ", EntryPoint =" Sms_Disconnection ")] public static extern uint Sms_Disconnection (); [DllImport (" sms. dll ", EntryPoint =" Sms_Send ")] public static extern uint Sms_Send (string Sms_TelNum, string Sms_Text); [DllImport (" sms. dll ", EntryPoint =" Sms_Receive ")] public static extern uint Sms_Receive (string Sms_Type, out string Sms_Text); [DllImport (" sms. dll ", EntryPoint =" Sms_Delete ")] Public static extern uint Sms_Delete (string Sms_Index); [DllImport ("sms. dll ", EntryPoint =" Sms_AutoFlag ")] public static extern uint Sms_AutoFlag (); [DllImport (" sms. dll ", EntryPoint =" Sms_NewFlag ")] public static extern uint Sms_NewFlag (); public bool connectSmsAndSend (String tele_num, String content) {bool result = false; // 1. connect to the SMS cat String TypeStr = ""; String CopyRightToCOM = ""; String Cop YRightStr = "// Shanghai xunsai Information Technology Co., Ltd., website www.xunsai.com/"; String com_port = "3"; if (Sms_Connection (CopyRightStr, uint. parse (com_port), 9600, out TypeStr, out CopyRightToCOM) = 1) // 5 indicates the serial port number, 0 indicates the infrared interface, 1, 2, 3 ,... is the serial port {Console. writeLine ("connection successful! "); Log. WriteLog (LogType. LogInfo," connection successful! ", True); if (Sms_Send (tele_num, content) = 1) {Console. WriteLine (" sent successfully! "); Log. WriteLog (LogType. LogInfo," sent successfully! ", True); result = true;} else {Console. WriteLine (" failed to send! "); Log. WriteLog (LogType. LogInfo," failed to send! ", True) ;}sms_disconnection () ;}else {Console. WriteLine (" connection failed! "); Log. WriteLog (LogType. LogInfo," connection failed! ", True) ;}return result ;}}}
[SMS cat DuanXinMao]
Using System; using System. collections. generic; using System. linq; using System. text; namespace EquipMonitorConsole. duanXinMao {public class DuanXinMaotest {public static string EnableFlag; public static string Receivemobiles; public static bool hasSendOneSMS = false; string [] arrays = Receivemobiles. split (';'); public void DuanXinMaofun (String smsContent) // public static void DuanXinMaofun () {SmsHelpe R smshelper = new SmsHelper (); for (int I = 0; I <arrays. length; I ++) {if (arrays [I]. equals ("15601596871") {if (! HasSendOneSMS) {smshelper. connectSmsAndSend (arrays [I], smsContent); hasSendOneSMS = true; Log. writeLog (LogType. logInfo, "a text message has been sent: Recipient:" + arrays [I] + "content:" + smsContent, true) ;}} else {smshelper. connectSmsAndSend (arrays [I], smsContent); Log. writeLog (LogType. logInfo, "a text message has been sent: Recipient:" + arrays [I] + "content:" + smsContent, true );}}}}}