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