Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public MessageActionMapper(GeneralTypeRobot robot)
 {
     _robot = robot;
 }
Ejemplo n.º 3
0
 protected void HandleNewRobot(GeneralTypeRobot newRobot)
 {
     _eventReceiver.OnRobotConnect(newRobot);
 }