Пример #1
0
 private void setValue(int lID, IBeaconInfo layout)
 {
     lineID   = lID;
     beaconID = layout.ID;
     isVB     = layout.IsVariantBeacon();
     version  = layout.getVersion();
 }
Пример #2
0
        //in this func use class member BFGen.isITC
        private bool GenBeaconXMLFile(IBeaconInfo beacon, string filename)
        {
            Balise xmlFile = new Balise();

            //BMGR-0002
            xmlFile.name = new StringData(beacon.Name);

            //BMGR-0003
            xmlFile.Telegram.type = new StringData("LONG");

            //Telegram get
            if (isITC)
            {//BMGR-0004
                TraceMethod.RecordInfo("error:iTC not support now!");
                xmlFile.Telegram.Value = new StringData("iTC not support");
            }
            else
            {
                BeaconMessage bm = new BeaconMessage();
                xmlFile.Telegram.Value = new StringData(bm.GenerateMessage(beacon, sydb.LineID));
            }

            FileSerializer.Serialize(xmlFile, filename, AddLogHead());
            return(true);
        }
Пример #3
0
 public string GenerateMessage(IBeaconInfo layout, int lineID)
 {
     if (null == layout)
     {
         TraceMethod.Record(TraceMethod.TraceKind.ERROR, "GenerateMessage Error:input null beacon");;
         return("");
     }
     setValue(lineID, layout);
     return(GenerateMessage());
 }
Пример #4
0
        public string m_Type;  // add to save IBBM beacon type

        public BEACON(IBeaconInfo BInfo, GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON ibbm)
        {
            m_layoutInfo = BInfo;
            m_ibbmInfo   = ibbm;

            m_UpstreamLst  = new List <PathInfo>();
            m_AppOrgSigLst = new List <OriginSignal>();

            //todo now this must be called here
            //ibbm.GetBeaconType();
            m_Type = ibbm.GetBeaconType();
        }
Пример #5
0
        /// <summary>
        /// check the lineid bid bversionid in default message of FB and VB
        /// </summary>
        /// <param name="b"></param>
        /// <param name="msg"></param>
        /// <param name="lineid"></param>
        public static void checkbeaconmessage(IBeaconInfo b, string msg, int lineid)
        {
            string pattern = "";

            if (false == b.IsVariantBeacon())
            {
                pattern = @"90 00 7F([0-9a-fA-F\s]*)B 10 18 32 ([0-9a-fA-F\s]*)F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FC";
            }
            else
            {
                pattern = @"90 00 7E([0-9a-fA-F\s]*)B 10 18 32 ([0-9a-fA-F\s]*)B 10 3E 32 C0 00 08 00 00 40 00 00 00 00 00 03 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FC";
            }
            //Assert
            Match match = Regex.Match(msg, pattern);

            Debug.Assert(match.Groups.Count == 3);

            Debug.Assert(lineid == (int)getInt64inhex(match.Groups[1].ToString(), 0x007FE0000, 17));
            Debug.Assert(b.ID == (int)getInt64inhex(match.Groups[1].ToString(), 0x00001FFF8, 3));
            Debug.Assert(b.getVersion() == (int)getInt64inhex(match.Groups[2].ToString(), 0x003FFFC, 2));
        }
Пример #6
0
        private bool GenBeaconBinFile(string path, string xmlFile, IBeaconInfo beacon)
        {
            if (!File.Exists(balComPath))
            {
                TraceMethod.RecordInfo($"ERROR:The compile tool [{balComPath}] for bin file is not exist, can't generate *.tgm and *.udf file, please check!");
                return(false);
            }
            //调用beacon compiler生成.udf和.tgm
            Process p = new Process();

            p.StartInfo.FileName = this.balComPath;
            if (isITC)
            {//BMGR-0033
                p.StartInfo.Arguments = string.Format("{0} -o {1} -udf -telformat sacem", xmlFile, path);
            }
            else
            {//BMGR-0034
                p.StartInfo.Arguments = string.Format("{0} -o {1} -udf -telformat udf", xmlFile, path);
            }
            p.StartInfo.CreateNoWindow  = true;
            p.StartInfo.UseShellExecute = false;
            TraceMethod.RecordInfo(string.Format("Converting XML to binary for beacon {0}......", beacon.Name));
            p.Start();
            p.WaitForExit();
            p.Close();
            string fileTGM = xmlFile.Replace(".xml", ".tgm");
            string fileUDF = xmlFile.Replace(".xml", ".udf");

            if (File.Exists(fileTGM) && File.Exists(fileUDF))
            {
                TraceMethod.RecordInfo($"TGM and UDF binary file for beacon {beacon.Info} created success.");
                return(true);
            }
            else
            {
                TraceMethod.RecordInfo($"call {this.balComPath} error.");
                return(false);
            }
        }
Пример #7
0
        /// <summary>
        /// in this function will check and load beacon info from sydb.IBBM
        /// all LEU and Beacon from sydb.IBBM will be generate in this function
        /// </summary>
        /// <returns></returns>
        private bool GenrateDeviceByIBBM()
        {
            bool rt = true;
            //BMGR-0016 LEUID start from 1
            int LEUID = 1;

            //clear leu and beacon before add new data to them
            LEUList.Clear();
            beaconList.Clear();
            int IsAddBeacon;

            List <IBeaconInfo> list1 = sydb.GetBeacons();  // newly added to avoid outputting the same ID and name repeatedly

            //List<string> ibbmBeaconList = (from ibbmBeacon in sydb.ibbmInfoList select ibbmBeacon.Name);

            foreach (GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON ibbm in sydb.ibbmInfoList)//search sydb.ibbm, LEUID should be same with this order
            {
                //IBeaconInfo layout = sydb.GetBeacons().Find(x => x.Name == ibbm.Name);  // This line will repeat the output ID and Name
                IBeaconInfo layout = list1.Find(x => x.Name == ibbm.Name);

                //judge the beacon first, if this beacon is not exist in Beacons, then ignore this beacon and LEU
                if (null == layout)
                {
                    TraceMethod.Record(TraceMethod.TraceKind.WARNING, $"Beacon[{ibbm.Name}] exist in Implementation_Beacon_Block_Mode but not exist in Beacons.");
                    continue;
                }

                if (false == layout.IsVariantBeacon())
                {
                    TraceMethod.Record(TraceMethod.TraceKind.WARNING, $"Beacon[{ibbm.Name}] exist in Implementation_Beacon_Block_Mode but is Fixed Beacon.");
                    continue;
                }

                BEACON newbeacon = new BEACON(layout, ibbm);
                beaconList.Add(newbeacon);
                if (newbeacon.m_Type == "Invalid")
                {
                    continue;
                }

                int LEUidx = LEUList.FindIndex(x => x.Name == ibbm.LEU.LEU_Name);
                if (-1 == LEUidx)//if the LEU not exist, then create a new one
                {
                    //BMGR-0016 set LEUID for each new LEU in IBBM order
                    LEU newLEU = new LEU(ibbm.LEU.LEU_Name, LEUID, ibbm.CI_Name);
                    ++LEUID;//LEU ID start from 1, add 1 for each diff one

                    LEUList.Add(newLEU);
                    LEUidx = LEUList.Count() - 1;
                }

                { //check LEU.BeaconOutNum
                    IsAddBeacon = LEUList[LEUidx].AddBeacon(ibbm.LEU.Beacon_Output_number, ibbm.Name);
                    //if (false == LEUList[LEUidx].AddBeacon(ibbm.LEU.Beacon_Output_number, ibbm.Name))
                    if (-1 == IsAddBeacon)
                    {
                        LEUList.RemoveAt(LEUidx);  // new add to remove error LEU
                        --LEUID;
                        continue;
                    }
                    else if (-2 == IsAddBeacon)
                    {
                        //LEUList.RemoveAt(LEUidx);  // new add to remove error LEU
                        //--LEUID;
                        TraceMethod.Record(TraceMethod.TraceKind.WARNING, $"Beacon {ibbm.Info} will link to LEU {ibbm.LEU.Info} faild.");
                    }
                }

                //BEACON newbeacon = new BEACON(layout, ibbm);
                //beaconList.Add(newbeacon);
                //if (newbeacon.m_Type == "Invalid")
                //{
                //    continue;
                //}
            }

            if (null == beaconList || beaconList.Count() <= 0)
            {
                TraceMethod.Record(TraceMethod.TraceKind.ERROR, "GenrateDeviceByIBBM, after check IBBM and Beacons, no valid beacon can used to generate data");
                return(false);
            }

            //check if exist variant beacon which in beacons but not in Implementation_Beacon_Block_Mode
            //foreach (IBeaconInfo beacon in sydb.GetBeacons())
            foreach (IBeaconInfo beacon in list1)
            {
                if (true == beacon.IsVariantBeacon())
                {
                    int Bidx = beaconList.FindIndex(x => x.Name == beacon.Name);

                    if (-1 == Bidx)
                    {
                        TraceMethod.Record(TraceMethod.TraceKind.WARNING, $"{beacon.Info} can't get vaild info from sydb.IBBM. BMVF file will generate no info for this beacon");
                        continue;
                    }
                }
            }
            LEUList.ForEach(delegate(LEU name)   // print LEU
            {
                Console.WriteLine(name.Name);
            });
            return(rt);
        }