public CanServos(CanConnection comm) { _communication = comm; _communication.FrameReceived += _communication_FrameReceived; _servos = new Dictionary <ServomoteurID, CanServo>(); _canBoards = new List <CanBoard> { CanBoard.CanServo1, CanBoard.CanServo2, CanBoard.CanServo3, CanBoard.CanServo4, CanBoard.CanServo5, CanBoard.CanServo6 }; Enum.GetValues(typeof(ServomoteurID)).Cast <ServomoteurID>().ToList().ForEach(id => _servos.Add(id, new CanServo(id, _communication))); }
// .ctor public GladeApp(string[] args) { Application.Init(); Glade.XML gxml = new Glade.XML(null, "gui.glade", "window1", null); gxml.Autoconnect(this); CanConnection conn = new CanConnection("roulette", 2342); InitMoods(); InitLampe(); InitBorg(); Application.Run(); }
/// <summary> /// Initialise toutes les connexions /// </summary> public static void Init() { _connectionsCan = new Dictionary <CanBoard, CanSubConnection>(); EnableConnection = new Dictionary <Board, bool>(); UDPBoardConnection = new Dictionary <Board, Connection>(); AllConnections = new List <Connection>(); ConnectionIO = AddUDPConnection(Board.RecIO, IPAddress.Parse("10.1.0.14"), 12324, 12314); ConnectionIO.Name = Board.RecIO.ToString(); ConnectionMove = AddUDPConnection(Board.RecMove, IPAddress.Parse("10.1.0.11"), 12321, 12311); ConnectionMove.Name = Board.RecMove.ToString(); ConnectionCanBridge = AddUDPConnection(Board.RecCan, IPAddress.Parse("10.1.0.15"), 12325, 12315); ConnectionCanBridge.Name = Board.RecCan.ToString(); ConnectionCan = new CanConnection(Board.RecCan); _connectionsCan.Add(CanBoard.CanServo1, new CanSubConnection(ConnectionCan, CanBoard.CanServo1)); _connectionsCan.Add(CanBoard.CanServo2, new CanSubConnection(ConnectionCan, CanBoard.CanServo2)); _connectionsCan.Add(CanBoard.CanServo3, new CanSubConnection(ConnectionCan, CanBoard.CanServo3)); _connectionsCan.Add(CanBoard.CanServo4, new CanSubConnection(ConnectionCan, CanBoard.CanServo4)); _connectionsCan.Add(CanBoard.CanServo5, new CanSubConnection(ConnectionCan, CanBoard.CanServo5)); _connectionsCan.Add(CanBoard.CanServo6, new CanSubConnection(ConnectionCan, CanBoard.CanServo6)); ConnectionCanAlim = new CanSubConnection(ConnectionCan, CanBoard.CanAlim); _connectionsCan.Add(CanBoard.CanAlim, ConnectionCanAlim); _connectionsCan.Values.ToList().ForEach(o => AllConnections.Add(o)); // En remplacement des tests de connexion des ConnexionCheck, pour les syncroniser _linkTestConnections = ThreadManager.CreateThread(link => TestConnections()); _linkTestConnections.Name = "Tests de connexion"; _linkTestConnections.StartInfiniteLoop(); }