zoukankan      html  css  js  c++  java
  • 短信猫相关问题

     【短信猫相关问题】

    【getDeviceNameByRFID】的引用。注意

    stringBuilder.Append(DbHelperSQL.getDeviceNameByRFID(dt.Rows[i]["RFID"].ToString())); //ToString()后面的()!!!

    一系列配置

    【短信猫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);//输出变量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. 连接短信猫
                String TypeStr = "";
                String CopyRightToCOM = "";
                String CopyRightStr = "//上海迅赛信息技术有限公司,网址www.xunsai.com//";
                String com_port = "3";
    
                if (Sms_Connection(CopyRightStr, uint.Parse(com_port), 9600, out TypeStr, out CopyRightToCOM) == 1) ///5为串口号,0为红外接口,1,2,3,...为串口
                {
                    Console.WriteLine("连接成功!");
                    Log.WriteLog(LogType.LogInfo, "连接成功!", true);
                    if (Sms_Send(tele_num, content) == 1)
                    {
                        Console.WriteLine("发送成功!");
                        Log.WriteLog(LogType.LogInfo, "发送成功!", true);
                        result = true;
                    }
                    else
                    {
                        Console.WriteLine("发送失败!");
                        Log.WriteLog(LogType.LogInfo, "发送失败!", true);
    
                    }
                    Sms_Disconnection();
    
    
                }
                else
                {
                    Console.WriteLine("连接失败!");
                    Log.WriteLog(LogType.LogInfo, "连接失败!", true);
                }
                return result;
            }
        }
    }

    【短信猫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()
            {
                SmsHelper 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, "已发送一条短信:收件人:"+arrays[i]+" 内容:"+smsContent, true);
                        }
                    }
                    else {
                        smshelper.connectSmsAndSend(arrays[i], smsContent);
                        Log.WriteLog(LogType.LogInfo, "已发送一条短信:收件人:" + arrays[i] + " 内容:" + smsContent, true);
                    }
    
                    
                    
                }
    
            }
        }
    }
  • 相关阅读:
    格式化数字,将字符串格式的数字,如:1000000 改为 1 000 000 这种展示方式
    jquery图片裁剪插件
    前端开发采坑之安卓和ios的兼容问题
    页面消息提示,上下滚动
    可以使用css的方式让input不能输入文字吗?
    智慧农村“三网合一”云平台测绘 大数据 农业 信息平台 应急
    三维虚拟城市平台测绘 大数据 规划 三维 信息平台 智慧城市
    农业大数据“一张图”平台测绘 大数据 房产 国土 农业 信息平台
    应急管理管理局安全生产预警平台应急管理系统不动产登记 测绘 大数据 规划 科教 三维 信息平台
    地下综合管廊管理平台测绘 大数据 地下管线 三维 信息平台
  • 原文地址:https://www.cnblogs.com/liuyaozhi/p/5790655.html
Copyright © 2011-2022 走看看