예제 #1
0
 /// <summary>
 /// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点
 /// </summary>
 /// <returns></returns>
 public static MeshTcpConfigManager GetInstance()
 {
     // 如果类的实例不存在则创建,否则直接返回
     if (uniqueInstance == null)
     {
         uniqueInstance = new MeshTcpConfigManager();
     }
     return(uniqueInstance);
 }
예제 #2
0
        private void Server_OnWelcomeMessage(TcpConnention conn)
        {
            MeshDeviceInfo meshInfo = null;
            string         toCOMip  = conn.ipAddr;
            MeshPlanManage plan     = SQLiteHelper.GetInstance().MeshPlanQuerByTCPToCOMIP(toCOMip);

            if (plan != null)
            {
                meshInfo = SQLiteHelper.GetInstance().MeshDeviceInfoQueryByIP(plan.MeshIP);
            }

            if ((meshInfo != null))
            {
                //TODO:是否考虑启动时即设置频率
                SendBytesTo(toCOMip, MeshTcpConfigManager.GetChangePowerBytesCommand((int)meshInfo.Power));
                SendBytesTo(toCOMip, MeshTcpConfigManager.GetChangeRateBytesCommand((int)meshInfo.Frequency, (int)meshInfo.BandWidth));
                // BindwidthCommandHelper.ChangeBindwidth(plan.MeshIP, (int)meshInfo.BandWidth);
            }
            //SendBytesTo(toCOMip, MeshTcpConfigManager.GetChangeRateBytesCommand(656));
            // SendBytesTo(toCOMip, MeshTcpConfigManager.GetChangeRateBytesCommand(616));
        }