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; }
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); } }