Beispiel #1
0
        public void TestSpliter()
        {
            DbDacDataProvider           p    = new DbDacDataProvider();
            Dictionary <string, string> args = new Dictionary <string, string>();

            args.Add("dbcongxml", this.path);
            p.Init(args);
            var d = new SensorOriginalData
            {
                AcqTime = DateTime.Now,
                SID     = 108,
                Type    = ProtocolType.GPS_ZHD,
                Values  = new double[]
                {
                    2.134, 1.945, 1.07
                }
            };

            byte[] buff   = new byte[39];
            int    writed = p.DataToSegment(d, buff, 0);

            TranMsg[] msgs = p.Splite(buff, writed);
            Assert.AreEqual(1, msgs.Length);
            Console.WriteLine("MSG1={0}", ValueHelper.BytesToHexStr(msgs[0].Marshall()));
        }
        public void TestSpliter()
        {
            DbDacDataProvider           p    = new DbDacDataProvider();
            Dictionary <string, string> args = new Dictionary <string, string>();

            args.Add("sqlitedbcongxml", this.path);
            p.Init_Sqlite(args);
            var d = new SensorOriginalData
            {
                AcqTime   = System.DateTime.Now,
                ModuleNo  = 12,
                ChannelNo = 23,
                Type      = ProtocolType.VibratingWire,
                Values    = new double[] { 1924, 12.340000d, 2.340000d }
            };

            byte[] buff   = new byte[39];
            int    writed = p.DataToSegment(d, buff, 0);

            TranMsg[] msgs = p.Splite(buff, writed);
            Assert.AreEqual(1, msgs.Length);
            Console.WriteLine("MSG1={0}", ValueHelper.BytesToHexStr(msgs[0].Marshall()));
        }