Ejemplo n.º 1
0
        public Dictionary <string, Object> commonHandle(CRouter router, string channnel)
        {
            Dictionary <string, Object> resMap = new Dictionary <string, object>();

            //判定报文格式是16进制还是ASCII

            // 如果是gprs信道,则根据gprs号码获取数据协议
            if (isUpdated)
            {
                initStations();
            }
            if (channnel == "transparent")
            {
                //如果站点信息进行了更新,则重新获取站点map

                ////获取站点对应的数据协议,如果不存在则不做处理直接返回
                //if (stationGprsMap.ContainsKey(router.dutid))
                //{
                //    dataProtocol = stationGprsMap[router.dutid];
                //    HexOrASCII = hexGprsMap[router.dutid];
                //}
                //else
                //{
                //    return null;
                //}
                dataProtocol = "GY";
                HexOrASCII   = "ASCII";
            }
            if (channnel == "hdgprs" || channnel == "sxgprs")
            {
                //如果站点信息进行了更新,则重新获取站点map

                //获取站点对应的数据协议,如果不存在则不做处理直接返回
                if (stationGprsMap.ContainsKey(router.dutid))
                {
                    dataProtocol = stationGprsMap[router.dutid];
                    HexOrASCII   = hexGprsMap[router.dutid];
                }
                else
                {
                    return(null);
                }
            }
            if (channnel == "gsm")
            {
                //如果站点信息进行了更新,则重新获取站点map

                //获取站点对应的数据协议,如果不存在则不做处理直接返回
                if (stationGsmMap.ContainsKey(router.dutid))
                {
                    dataProtocol = stationGsmMap[router.dutid];
                    HexOrASCII   = hexGsmMap[router.dutid];
                }
                else
                {
                    return(null);
                }
            }
            if (channnel == "beidou" || channnel == "beidou500")
            {
                //如果站点信息进行了更新,则重新获取站点map

                //获取站点对应的数据协议,如果不存在则不做处理直接返回
                if (stationBeidouMap.ContainsKey(router.dutid))
                {
                    dataProtocol = stationBeidouMap[router.dutid];
                    HexOrASCII   = hexBeidouMap[router.dutid];
                }
                else
                {
                    return(null);
                }
            }
            //单数据协议
            if (!dataProtocol.Contains(","))
            {
                switch (dataProtocol)
                {
                case "LN":
                    break;

                case "YN":
                    break;

                case "GY":
                    resMap = gyDataHandle.getHandledData(router, HexOrASCII);
                    break;

                case "ZYJBX":
                    break;

                default:
                    break;
                }
            }
            else
            {
                // 多数据协议
                //TODO
            }

            return(resMap);
        }