public void SetUp() { provider = new VibFileDataProvider(); var args = new Dictionary <string, string>(); args["DataPath"] = "VibData"; provider.Init(args); }
public void TestSend() { // DAC.Test.Tran.TranDataSenderTester.TestSend Dictionary <string, string> args = new Dictionary <string, string>(); args["PortName"] = "COM1"; //COM6-COM13 args["BaudRate"] = "9600"; args["Parity"] = Convert.ToString((int)Parity.None); args["DataBits"] = "8"; args["StopBits"] = Convert.ToString((int)StopBits.One); args["ReadTimeOut"] = "1"; // 1ms args["sqlitedbcongxml"] = this.path; //SQLite用 args["DataPath"] = "VibData"; //振动用 var provider1 = new DbDacDataProvider(); ITranDataSendDelegator comSender = new ComDataSender { DtuCode = 20120049 }; comSender.Init(args); provider1.Init_Sqlite(args); ITranDataProvider provider2 = new VibFileDataProvider(); provider2.Init(args); TranDataSender sender = new TranDataSender(comSender, provider1, provider2); sender.OnMessageSent += (TranMsg req, TranMsg resp) => { int len = resp.LoadSize; Console.WriteLine("Data received. {0}: {1}", len, ValueHelper.BytesToHexStr(resp.Data)); }; sender.DoWork(); Console.ReadLine(); // SQLiteDataSpliter }