コード例 #1
0
        /// <summary>
        /// 发送所有在线AP的列表给 MainContorller模块
        /// </summary>
        protected void Send2main_OnLineList()
        {
            OnOutputLog(LogInfoType.DEBG, "发送所有在线AP列表给MainController模块!");

            AsyncUserToken token = new AsyncUserToken();

            Msg_Body_Struct TypeKeyValue =
                new Msg_Body_Struct(Main2ApControllerMsgType.OnLineAPList);

            AsyncUserToken[] dList = MyDeviceList.GetConnListToArray();
            int i = 0;

            foreach (AsyncUserToken x in dList)
            {
                Name_DIC_Struct n_dic = new Name_DIC_Struct("Ap" + i++);
                n_dic.dic.Add("Sn", x.Sn);
                n_dic.dic.Add("FullName", x.FullName);
                n_dic.dic.Add("Ip", x.IPAddress.ToString());
                n_dic.dic.Add("Port", x.Port.ToString());
                n_dic.dic.Add("Type", DeviceType);
                TypeKeyValue.n_dic.Add(n_dic);
            }

            //向Main模块发消息
            OnSendMsg2Main(0, MsgStruct.MsgType.NOTICE, token, TypeKeyValue);
        }
コード例 #2
0
ファイル: Ap_WCDMA.cs プロジェクト: jiangboh/CS
        /// <summary>
        /// 向AP删除黑白名单
        /// </summary>
        /// <param name="token">AP信息</param>
        private void Send2ap_imsi_list_delconfig(InterModuleMsgStruct MainMsg)
        {
            AsyncUserToken apToKen = MyDeviceList.FindByApInfo(MainMsg.ApInfo);

            if (apToKen == null)
            {
                OnOutputLog(LogInfoType.WARN, string.Format("在线AP列表中找不到Ap[{0}:{1}]设备({2})!",
                                                            MainMsg.ApInfo.IP, MainMsg.ApInfo.Port.ToString(), MainMsg.ApInfo.Fullname));
                return;
            }

            Msg_Body_Struct TypeKeyValue = new Msg_Body_Struct(ApMsgType.imsi_list_delconfig);
            int             i            = 0;

            foreach (Name_DIC_Struct n_dicList in MainMsg.Body.n_dic)
            {
                Dictionary <string, object> dic = n_dicList.dic;

                String bwFlag = GetMsgStringValueInList("bwFlag", dic);
                if (!bwFlag.Equals("black") && !bwFlag.Equals("white"))
                {
                    OnOutputLog(LogInfoType.WARN, "删除黑白名单参数错误。bwFlag字段错误!");
                    Send2APP_GeneralError(MainMsg.ApInfo, MainMsg.AppInfo, MainMsg.Body.type,
                                          "删除黑白名单参数错误。bwFlag字段错误!");
                    continue;
                }

                if (bwFlag.Equals("white"))
                {
                    String imsi = GetMsgStringValueInList("imsi", dic);
                    if (imsi.Equals(String.Empty))
                    {
                        OnOutputLog(LogInfoType.WARN, "删除白名单参数错误。imsi字段错误!");
                        Send2APP_GeneralError(MainMsg.ApInfo, MainMsg.AppInfo, MainMsg.Body.type,
                                              "删除白名单参数错误。imsi字段错误!");
                        continue;
                    }

                    Name_DIC_Struct n_dic = new Name_DIC_Struct("name" + i++);
                    n_dic.dic.Add("whiteimsi/imsi", imsi);
                    TypeKeyValue.n_dic.Add(n_dic);
                }
                if (bwFlag.Equals("black"))
                {
                    String imsi = GetMsgStringValueInList("imsi", dic);
                    if (imsi.Equals(String.Empty))
                    {
                        OnOutputLog(LogInfoType.WARN, "删除黑名单参数错误。imsi字段错误!");
                        Send2APP_GeneralError(MainMsg.ApInfo, MainMsg.AppInfo, MainMsg.Body.type,
                                              "删除黑名单参数错误。imsi字段错误!");
                        continue;
                    }

                    Name_DIC_Struct n_dic = new Name_DIC_Struct("name" + i++);
                    n_dic.dic.Add("blackimsi/imsi", imsi);
                    TypeKeyValue.n_dic.Add(n_dic);
                }
            }

            if (i == 0)
            {
                OnOutputLog(LogInfoType.EROR, "删除黑名单参数错误。没有要发送的名单!");
                Send2APP_GeneralError(MainMsg.ApInfo, MainMsg.AppInfo, MainMsg.Body.type,
                                      "删除黑名单参数错误。没有要发送的名单!");
                return;
            }

            if (!SendMsg2Ap(apToKen, 0, TypeKeyValue))
            {
                Send2APP_GeneralError(MainMsg.ApInfo, MainMsg.AppInfo, MainMsg.Body.type,
                                      "封装XML消息(imsi_list_delconfig)出错!");
            }
        }