public void Unregister(IPhysicalLayer <ushort> peripheral)
        {
            var key = phys.First(x => x.Value == peripheral).Key;

            phys.Remove(key);
            machine.UnregisterAsAChildOf(this, peripheral);
        }
Пример #2
0
 public void Unregister(IPhysicalLayer <byte> peripheral)
 {
     if (phy != peripheral)
     {
         throw new RegistrationException("Trying to unregister PHY that is currently not registered in this controller");
     }
     phy = null;
 }
Пример #3
0
 public void Register(IPhysicalLayer <byte> peripheral, NullRegistrationPoint registrationPoint)
 {
     if (phy != null)
     {
         throw new RegistrationException("There is already a PHY registered for this controller");
     }
     phy = peripheral;
 }
 public void Register(IPhysicalLayer <ushort> peripheral, PHYRegistrationPoint registrationPoint)
 {
     if (phys.ContainsKey(registrationPoint.Id))
     {
         throw new RecoverableException("Selected registration port is already taken.");
     }
     phys.Add(registrationPoint.Id, peripheral);
     machine.RegisterAsAChildOf(this, peripheral, registrationPoint);
 }
Пример #5
0
        // Constructor
        public DataManager(string roomName, int port = 5055)
        {
            room = roomName;

            //Initialze belief manager with all environment data, the comms manager will broadcast this
            //data on cm.start()

            Serializer ps = new ProtobufSerializer();

            cm = new LocalCommManager(this, ps, new UdpNetwork(port));
            //cm = new PhotonCloudCommManager(this, ps, "app-us.exitgamescloud.com:5055", roomName, 0, 0);
            //cm = new PhotonCloudCommManager(dm, ps, "10.101.5.25:5055", "soa");

            beliefDictionary     = new SortedDictionary <Belief.Key, SortedDictionary <int, Belief> >();
            physicalNetworkLayer = new IdealizedNetworkLayer(new DataManagerWorld(this));

            // Note: Comms manager must be started manually after all initial belief processing is done
        }
Пример #6
0
 public IEnumerable <NullRegistrationPoint> GetRegistrationPoints(IPhysicalLayer <byte> peripheral)
 {
     return((peripheral == phy)
         ? new[] { NullRegistrationPoint.Instance }
         : new NullRegistrationPoint[0]);
 }
 public IEnumerable <PHYRegistrationPoint> GetRegistrationPoints(IPhysicalLayer <ushort> peripheral)
 {
     return(phys.Select(x => new PHYRegistrationPoint(x.Key)));
 }