public static bool AssignRobot(Communicator communicator, GeneralTypeRobot robot) { if (robot == null) { throw new ArgumentNullException("robot"); } if (communicator == null) { throw new ArgumentNullException("communicator"); } IPresentationProtocol pp = communicator.GetPresentationProtocol(); if (pp == null) { throw new ArgumentNullException("communicator.GetPresentationProtocol()"); } IDataLink dl = communicator.GetDataLink(); if (dl == null || communicator.GetDataLink().Connected() != true) { throw new InvalidOperationException("Can't assign robot without being connected"); } MessageActionMapper map = new MessageActionMapper(robot); communicator.GetPresentationProtocol().SetReceiver(map); return(true); }
public MessageActionMapper(GeneralTypeRobot robot) { _robot = robot; }
protected void HandleNewRobot(GeneralTypeRobot newRobot) { _eventReceiver.OnRobotConnect(newRobot); }