예제 #1
0
        protected LogRecorder(CanPort Port, FileInfo LogFile)
        {
            this.Port    = Port;
            this.LogFile = LogFile;
            FileStream   = LogFile.Open(FileMode.Append, FileAccess.Write);

            Port.Received += PortReceived;
        }
예제 #2
0
        protected LogRecorder(CanPort Port, FileInfo LogFile)
        {
            this.Port = Port;
            this.LogFile = LogFile;
            FileStream = LogFile.Open(FileMode.Append, FileAccess.Write);

            Port.Received += PortReceived;
        }
예제 #3
0
        public static void NetworkTest()
        {
            CanPort port = new CanPort("HW318371");

            port.BitRate     = BaudRate.BR10;
            port.FrameFormat = FrameFormat.StandardFrame;
            port.Mode        = PortMode.NORMAL;

            NetworkController controller = new NetworkController(port, 1);

            controller.Devices.Add(DeviceBase.Create(DeviceType.KIP_MAIN_POWERED_v1));
            controller.Start();
            return;
        }
예제 #4
0
        public static void SerializeNetworkControllerCollectionTest()
        {
            CanPort port = new CanPort("HW318371");

            port.BitRate     = BaudRate.BR10;
            port.FrameFormat = FrameFormat.StandardFrame;
            port.Mode        = PortMode.NORMAL;

            NetworkController controller = new NetworkController(port, 1);

            controller.Devices.Add(DeviceBase.Create(DeviceType.KIP_MAIN_POWERED_v1));

            NetworkControllersCollection collection = new NetworkControllersCollection();

            collection.Add(controller);

            // Сериализуем в файл
            using (FileStream fs = new FileStream("serializedNetworks.bin", FileMode.Create))
            {
                BinaryFormatter bf = new BinaryFormatter();
                bf.Serialize(fs, collection);
            }
        }
예제 #5
0
파일: Program.cs 프로젝트: jionfull/Module
        static void Main(string[] args)
        {
            ModuleManagerFactory.DelegateShowMessage=OutMessage;
               ModuleManagerFactory.LoadFromFile("动态加载模块配置.ini");
               CanPort port=new CanPort(new CanDirFilter(false));
            port.Open();
               while (true)
               {
               CanFrame frame=null;
               port.Read(ref frame, -1);
               if (frame == null) continue;
               StringBuilder sb=new StringBuilder();
               sb.Append("CanId"+frame.CanId.ToString("X4")+ "--数据");
               for(int i=0;i<frame.buf.Length;i++)
               {
                  sb.Append(" ");
                  sb.Append(frame.buf[i].ToString("X2"));
               }
               Console.WriteLine(sb.ToString());
               }

            Console.ReadKey();
        }
예제 #6
0
 public LogEncodingRecorder(CanPort Port, FileInfo LogFile)
     : base(Port, LogFile)
 {
     Encoder = new TEncoder();
 }