Exemplo n.º 1
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("RevealObject");
            //distClient.Subscribe("TimeTick");
            //distClient.Subscribe("StateChange");
            //distClient.Subscribe("ResetSimulation");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "StateTable", true, false);
            bbClient.Subscribe("PhysicalObject", "Throttle", true, false);
            bbClient.Subscribe("PhysicalObject", "FuelCapacity", true, true);
            bbClient.Subscribe("PhysicalObject", "FuelAmount", true, true);
            bbClient.Subscribe("PhysicalObject", "FuelConsumptionRate", true, true);
            bbClient.Subscribe("PhysicalObject", "FuelDepletionState", true, true);
            bbClient.Subscribe("PhysicalObject", "DockedToParent", true, false);

            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 2
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("MoveObject");
            //distClient.Subscribe("TimeTick");
            //distClient.Subscribe("ResetSimulation");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, false);
            bbClient.Subscribe("PhysicalObject", "Velocity", true, false);
            bbClient.Subscribe("PhysicalObject", "Size", true, false);
            bbClient.Subscribe("PhysicalObject", "DockedToParent", true, false);
            bbClient.Subscribe("PhysicalObject", "Capability", true, false);
            bbClient.Subscribe("PhysicalObject", "Vulnerability", true, false);
            bbClient.Subscribe("PhysicalObject", "TargetsInRange", true, true);
            bbClient.Subscribe("PhysicalObject", "State", true, false);
            //bbClient.Subscribe("PhysicalObject", "MaximumSpeed", true, false);
            //bbClient.Subscribe("PhysicalObject", "Throttle", true, false);
            //bbClient.Subscribe("PhysicalObject", "DestinationLocation", true, false);
            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 3
0
 public TextChatServer(string simModelPath, ref SimulationEventDistributor distributor)
 {
     simModelName = simModelPath;
     simModelInfo = smr.readModel(simModelName);
     isRunning = false;
     roomMembership = new Dictionary<string, List<string>>();
     server = new SimulationEventDistributorClient();
     distributor.RegisterClient(ref server);
     
 }
Exemplo n.º 4
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;
            this.dmColorMapping = new Dictionary<string, int>();
            this.teamDefinitions = new Dictionary<string, List<string>>();
            this.networkRosters = new Dictionary<string, List<string>>();
            this.dmTeamsMap = new Dictionary<string, string>();
            this.networkObjects = new Dictionary<string, List<string>>();
            this.listOfObstructionIDs = new List<string>();
            this.obstructions = new Dictionary<string, StateDB.ActiveRegion>();
            this.listOfObjectIDs = new List<string>();
            this.dmOwnedObjects = new Dictionary<string, List<string>>();
            objectViews = new Dictionary<string, ObjectsAttributeCollection>();
            teamClassifications = new Dictionary<string, Dictionary<string, string>>();
            teamClassificationChanges = new Dictionary<string, Dictionary<string, string>>();
            dmViews = new Dictionary<string, ObjectsAttributeCollection>();
            activeDMs = new List<string>();
            activeSensorNetworks = new Dictionary<string, bool>();
            //singletonDMs = new List<string>();
            currentAttacks = new List<Attack>();
            ClassificationsEnum = new List<String>();
            movingObjects = new List<string>();
            randomGenerator = new Random(randomSeed);
            this.dTimeSec = ((double)simModel.GetUpdateFrequency()) / 1000;
            this.dTimeMSec = simModel.GetUpdateFrequency();
            currentTick = 0;
            distributor.RegisterClient(ref distClient);
            blackboard.RegisterClient(ref bbClient);

            // subscribe to events that aren't OwnerObservable

            bbClient.Subscribe("PhysicalObject", "Emitters", true, false);
            bbClient.Subscribe("PhysicalObject", "RemoveOnDestruction", true, false);
            bbClient.Subscribe("PhysicalObject", "ActiveRegionSpeedMultiplier", true, false);
            bbClient.Subscribe("PhysicalObject", "DefaultClassification", true, false);
            bbClient.Subscribe("PhysicalObject", "ClassificationDisplayRules", true, false);

            foreach (KeyValuePair<string, AttributeInfo> kvp in simModel.objectModel.objects["PhysicalObject"].attributes)
            {
                if (kvp.Value.ownerObservable == true)
                {
                    bbClient.Subscribe("PhysicalObject", kvp.Key, true, false);
                }
            }
            bbClient.Subscribe("DecisionMaker", "RoleName", true, false);

            bbClient.Subscribe("SensorNetwork", "DMMembers", true, false);
            bbClient.Subscribe("Region", "Polygon", true, false);
            bbClient.Subscribe("ActiveRegion", "BlocksSensorTypes", true, false);
            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 5
0
 public ReplayLogger(string logsPath, string simModelPath, ref SimulationEventDistributor distributor, string mode)
 {
     logPath = logsPath;
     simModelName = simModelPath;
     simModelInfo = smr.readModel(simModelName);
     isRunning = false;
     logMode = mode;
     //server = new NetworkClient();
     //server.Connect(hostName, Convert.ToInt32(portNumber));
     cc = new SimulationEventDistributorClient();
     distributor.RegisterClient(ref cc);
 }
Exemplo n.º 6
0
 public WhiteboardServer(string simModelPath, ref SimulationEventDistributor distributor)
 {
     simModelName = simModelPath;
     simModelInfo = smr.readModel(simModelName);
     lock (isRunningLock)
     {
         isRunning = false;
     }
     roomMembership = new Dictionary<string, List<string>>();
     roomNextObjectIndex = new Dictionary<string, int>();
     server = new SimulationEventDistributorClient();
     distributor.RegisterClient(ref server);
     
 }
Exemplo n.º 7
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("RevealObject");
            //distClient.Subscribe("MoveObject");
            //distClient.Subscribe("SubplatformLaunch");
            //distClient.Subscribe("WeaponLaunch");
            //distClient.Subscribe("StateChange");
            //distClient.Subscribe("ObjectCollision");
            //distClient.Subscribe("TimeTick");
            //distClient.Subscribe("SubplatformDock");
            //distClient.Subscribe("ResetSimulation");


            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "StateTable", true, false);
            bbClient.Subscribe("PhysicalObject", "State", true, false);
            bbClient.Subscribe("PhysicalObject", "OwnerID", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, true);
            bbClient.Subscribe("PhysicalObject", "Size", true, false);
            bbClient.Subscribe("PhysicalObject", "Velocity", true, true);
            bbClient.Subscribe("PhysicalObject", "MaximumSpeed", true, false);
            bbClient.Subscribe("PhysicalObject", "Throttle", true, true);
            bbClient.Subscribe("PhysicalObject", "DestinationLocation", true, true);
            bbClient.Subscribe("PhysicalObject", "DockedToParent", true, false);
            bbClient.Subscribe("PhysicalObject", "LaunchStarted", true, false);
            bbClient.Subscribe("PhysicalObject", "LaunchEndTime", true, false);
            bbClient.Subscribe("PhysicalObject", "LaunchDone", true, true);
            bbClient.Subscribe("PhysicalObject", "LinkedRegion", true, true);
            bbClient.Subscribe("PhysicalObject", "PursueStarted", true, true);
            bbClient.Subscribe("PhysicalObject", "PursueTargetID", true, true);
            bbClient.Subscribe("PhysicalObject", "ParentObjectID", true, false);
            bbClient.Subscribe("PhysicalObject", "LaunchIsWeapon", true, false);
            bbClient.Subscribe("PhysicalObject", "LaunchWeaponTargetID", true, false);
            bbClient.Subscribe("PhysicalObject", "LaunchDestinationLocation", true, false);
            bbClient.Subscribe("PhysicalObject", "InActiveRegions", true, true);
            bbClient.Subscribe("PhysicalObject", "ActiveRegionSpeedMultiplier", true, true);

           // bbClient.Subscribe("Region", "LinkedObject", true, true);
            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 8
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, false);

            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 9
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("ResetSimulation");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("BaseObject", "ID", true, true);
            
        }
Exemplo n.º 10
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("RevealObject");
            //distClient.Subscribe("StateChange");
            //distClient.Subscribe("ResetSimulation");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("BaseObject", "ID", true, false);
            bbClient.Subscribe("DecisionMaker", "RoleName", true, true);
            bbClient.Subscribe("DecisionMaker", "TeamMember", true, true);
            bbClient.Subscribe("PhysicalObject", "ObjectName", true, true);
            bbClient.Subscribe("PhysicalObject", "OwnerID", true, true);
            bbClient.Subscribe("PhysicalObject", "ClassName", true, true);
            bbClient.Subscribe("PhysicalObject", "Size", true, true);
            bbClient.Subscribe("PhysicalObject", "MaximumSpeed", true, true);
            bbClient.Subscribe("PhysicalObject", "State", true, true);
            bbClient.Subscribe("PhysicalObject", "StateTable", true, true);
            bbClient.Subscribe("PhysicalObject", "Sensors", true, true);
            bbClient.Subscribe("PhysicalObject", "Emitters", true, true);
            bbClient.Subscribe("PhysicalObject", "LaunchDuration", true, true);
            bbClient.Subscribe("PhysicalObject", "AttackDuration", true, true);
            bbClient.Subscribe("PhysicalObject", "EngagementDuration", true, true);
            bbClient.Subscribe("PhysicalObject", "DockingDuration", true, true);
            bbClient.Subscribe("PhysicalObject", "IsWeapon", true, true);
            bbClient.Subscribe("PhysicalObject", "IconName", true, true);
            bbClient.Subscribe("PhysicalObject", "RemoveOnDestruction", true, true);
            bbClient.Subscribe("PhysicalObject", "CustomAttributes", true, true);
            bbClient.Subscribe("PhysicalObject", "CanOwn", true, true);
            bbClient.Subscribe("PhysicalObject", "SubplatformLimit", true, true);
            bbClient.Subscribe("PhysicalObject", "DefaultClassification", true, true);
            bbClient.Subscribe("PhysicalObject", "ClassificationDisplayRules", true, true);
            bbClient.Subscribe("PhysicalObject", "CurrentClassification", true, true);
            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 11
0
        public Form1(string simModel, string host, string port, string user)
        {
            InitializeComponent();
            userID = user;
            hostName = host;
            portNumber = port;
            simModelName = simModel;
            simModelInfo = smr.readModel(simModelName);
            AddToTextBoxText("Welcome " + userID + ".");
            server = new NetworkClient();
            server.Connect(hostName, Convert.ToInt32(portNumber));
            SimulationEventDistributor dist = new SimulationEventDistributor(ref simModelInfo);
            SimulationEventDistributorClient cc = new SimulationEventDistributorClient();

            dist.RegisterClient(ref cc);
            server.Subscribe("TextChat");
            isRunning = true;
            waitForEventsThread = new Thread(new ThreadStart(WaitForEvents));
            waitForEventsThread.Start();

        }
Exemplo n.º 12
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("RevealObject");
            //distClient.Subscribe("SubplatformLaunch");
            //distClient.Subscribe("WeaponLaunch");
            //distClient.Subscribe("SubplatformDock");
            //distClient.Subscribe("TimeTick");
            //distClient.Subscribe("ResetSimulation");
            //distClient.Subscribe("StateChange");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "ParentObjectID", true, true);
            bbClient.Subscribe("PhysicalObject", "OwnerID", true, false);
            bbClient.Subscribe("PhysicalObject", "DockedToParent", true, true);
            bbClient.Subscribe("PhysicalObject", "ChildObjects", true, true);
            bbClient.Subscribe("PhysicalObject", "DockedObjects", true, true);
            bbClient.Subscribe("PhysicalObject", "DockedWeapons", true, true);
            bbClient.Subscribe("PhysicalObject", "LaunchStarted", true, true);
            bbClient.Subscribe("PhysicalObject", "LaunchEndTime", true, true);
            bbClient.Subscribe("PhysicalObject", "LaunchDestinationLocation", true, true);
            bbClient.Subscribe("PhysicalObject", "LaunchDone", true, false);
            bbClient.Subscribe("PhysicalObject", "LaunchDuration", true, false);
            bbClient.Subscribe("PhysicalObject", "DockingStarted", true, true);
            bbClient.Subscribe("PhysicalObject", "DockingEndTime", true, true);
            bbClient.Subscribe("PhysicalObject", "LaunchIsWeapon", true, true);
            bbClient.Subscribe("PhysicalObject", "LaunchWeaponTargetID", true, true);
            bbClient.Subscribe("PhysicalObject", "DockingDuration", true, false);
            bbClient.Subscribe("PhysicalObject", "IsWeapon", true, false);
            bbClient.Subscribe("PhysicalObject", "ClassName", true, false);

            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 13
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("RevealObject");
            //distClient.Subscribe("AttackObject");
            //distClient.Subscribe("RandomSeed");
            //distClient.Subscribe("TimeTick");
            //distClient.Subscribe("StateChange");
            //distClient.Subscribe("ResetSimulation");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, false);
            bbClient.Subscribe("PhysicalObject", "OwnerID", true, false);
            bbClient.Subscribe("PhysicalObject", "State", true, false);
            bbClient.Subscribe("PhysicalObject", "StateTable", true, false);
            bbClient.Subscribe("PhysicalObject", "Capability", true, true);
            bbClient.Subscribe("PhysicalObject", "Vulnerability", true, true);
            bbClient.Subscribe("PhysicalObject", "AttackState", true, true);

            bbClient.Subscribe("PhysicalObject", "CurrentAttacks", true, true);
            bbClient.Subscribe("PhysicalObject", "AttackerList", true, true);
            bbClient.Subscribe("PhysicalObject", "SelfDefenseStartAttack", true, false);
            bbClient.Subscribe("PhysicalObject", "SelfDefenseCapability", true, false);
            bbClient.Subscribe("PhysicalObject", "SelfDefenseTargetID", true, false);
            bbClient.Subscribe("PhysicalObject", "IsWeapon", true, false);
            bbClient.Subscribe("PhysicalObject", "AttackDuration", true, false); //set in static att sim, true for all attacks per state per species
            bbClient.Subscribe("PhysicalObject", "EngagementDuration", true, false);
            objectProxies = new Dictionary<string, SimulationObjectProxy>();

        }
Exemplo n.º 14
0
        //private static List<string> listOfDMs = new List<string>();
        //public void SetListOfDMs(List<string> theList)
        //{
        //    foreach (string dm in theList)
        //    {
        //        if (!listOfDMs.Contains(dm))
        //        {
        //            listOfDMs.Add(dm);
        //        }
        //    }
        //    HandshakeManager.HandshakeManager.AvailableDMs = listOfDMs;
        //}
        //public List<string> GetListOfDMs()
        //{
        //    return listOfDMs;
        //}


        public ViewManager(string simModelPath, ref SimulationEventDistributor distributor, int numberOfSeats)
        {
            simModelName = simModelPath;
            simModelInfo = smr.readModel(simModelName);
            server = new SimulationEventDistributorClient();
            distributor.RegisterClient(ref server);

            //try
            //{
            //    server.Connect(hostName, Convert.ToInt32(portNumber));
            //}
            //catch
            //{
            //    throw new Exception("View Manager cannot connect to Network Server...");
            //}
            //networkConnectionViewer = new NetworkConnectionViewer();
            //eventStreamViewer = new EventStreamViewer();
            handshakeManager = new HandshakeManager.HandshakeManager(ref server, ref simModelInfo);
            authenticationManager = new AuthenticationManager.AuthenticationManager(ref server, ref simModelInfo, numberOfSeats);
            textChat = new TextChatStreamViewer();
            isRunning = true;
            Thread.Sleep(200);
            //HandshakeManager.HandshakeManager.AvailableDMs = listOfDMs;
        }
Exemplo n.º 15
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);
            //distClient.Subscribe("NewObject");
            //distClient.Subscribe("RevealObject");
            //distClient.Subscribe("TimeTick");
            //distClient.Subscribe("HandshakeInitializeGUIDone");
            //distClient.Subscribe("ResetSimulation");

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "OwnerID", true, false);
            bbClient.Subscribe("PhysicalObject", "ClassName", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, false);
            bbClient.Subscribe("PhysicalObject", "Capability", true, false);
            bbClient.Subscribe("PhysicalObject", "Vulnerability", true, false);
            bbClient.Subscribe("PhysicalObject", "IsWeapon", true, false);
            bbClient.Subscribe("PhysicalObject", "PursueStarted", true, false);
            bbClient.Subscribe("PhysicalObject", "PursueTargetID", true, false);
            bbClient.Subscribe("PhysicalObject", "SelfDefenseStartAttack", true, true);
            bbClient.Subscribe("PhysicalObject", "SelfDefenseCapability", true, true);
            bbClient.Subscribe("PhysicalObject", "SelfDefenseTargetID", true, true);
            bbClient.Subscribe("PhysicalObject", "TargetsInRange", true, false);
            bbClient.Subscribe("PhysicalObject", "CurrentAttacks", true, false);
            bbClient.Subscribe("PhysicalObject", "AttackState", true, false);
            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 16
0
        public void Initialize(ref CommonComponents.SimulationModelTools.SimulationModelInfo simModel, ref CommonComponents.SimulationObjectTools.Blackboard blackboard, ref CommonComponents.SimulationEventTools.SimulationEventDistributor distributor)
        {
            IndividualDMIsLoggedIn = false;
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;
            scoreRulesExist = new Dictionary<string, bool>();
            handledAttacks = new List<string>();
            classifications = new Dictionary<string, string>();
            _terminalToDMMap = new Dictionary<string, string>();
            dms = new List<string>();
            objectAssignmentList = new Dictionary<string, string>();
            mostRecentItemsForStimulators = new Dictionary<string,ItemInfo>();
            _attackTargetHashes = new List<string>();
            dms.Add("BAMS DM");
            dms.Add("Firescout DM");
            dms.Add("Individual DM");
            distributor.RegisterClient(ref distClient);

            blackboard.RegisterClient(ref bbClient);
            //only need to register for attributes we're concerned with: ID, OwnerID, Location, DefaultClassification
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, false);
            bbClient.Subscribe("PhysicalObject", "OwnerID", true, false);
            bbClient.Subscribe("PhysicalObject", "State", true, false);
            bbClient.Subscribe("PhysicalObject", "ClassName", true, false);

            bbClient.Subscribe("PhysicalObject", "DefaultClassification", true, false);
            bbClient.Subscribe("PhysicalObject", "CurrentClassification", true, false); //this might not be sent to simulators, only DDD Clients
            bbClient.Subscribe("PhysicalObject", "InActiveRegions", true, false);
            bbClient.Subscribe("PhysicalObject", "DestinationLocation", true, false);
            bbClient.Subscribe("PhysicalObject", "Intent", true, true);


            #region Attributes Specifically For SEAMATE
            bbClient.Subscribe("PhysicalObject", "RevealTime", true, true); //int
            bbClient.Subscribe("PhysicalObject", "DetectTime", true, true); //int
            bbClient.Subscribe("PhysicalObject", "IdentifyTime", true, true); //int 
            bbClient.Subscribe("PhysicalObject", "TrackingTime", true, true); //int, not sure how this will be changed yet.
            bbClient.Subscribe("PhysicalObject", "DestroyedTime", true, true); //int
            bbClient.Subscribe("PhysicalObject", "TrackedBy", true, true);
            bbClient.Subscribe("PhysicalObject", "DestroyedBy", true, true);
            bbClient.Subscribe("PhysicalObject", "IdentifiedBy", true, true);
            bbClient.Subscribe("PhysicalObject", "ClassifiedBy", true, true);
            bbClient.Subscribe("PhysicalObject", "DetectedBy", true, true);
            /*
             * GroundTruthIFF is either "Hostile", "Unknown", or "Friendly".  On reveal, everything should be set to Unknown.
             * If this object attacks any sea vessel, it should be set to "Hostile".
             * UserClassifiedIFF is either "Hostile", "Unknown", or "Friendly", and is set when a user classifies an object.
             * This is their PERCEIVED friendliness of an object.
             */
            bbClient.Subscribe("PhysicalObject", "GroundTruthIFF", true, true); //string 
            bbClient.Subscribe("PhysicalObject", "UserClassifiedIFF", true, true); //string
            bbClient.Subscribe("PhysicalObject", "HostileActionTime", true, true); //int
            bbClient.Subscribe("PhysicalObject", "IsInSeaLane", true, true); //bool
            bbClient.Subscribe("PhysicalObject", "IsGoingTowardsPort", true, true); //bool

            #endregion

            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 17
0
        /// <summary>
        /// Constructs a watcher
        /// </summary>
        /// <param name="inputDelta">Time to sleep between checking ticks</param>
        public TickWatcher(NetworkClient s, string simModel)
        {
            string simModelName = simModel;
            simModelInfo = smr.readModel(simModelName);
            server = s;
            SimulationEventDistributor dist = new SimulationEventDistributor(ref simModelInfo);
            SimulationEventDistributorClient cc = new SimulationEventDistributorClient();

            dist.RegisterClient(ref cc);/////////////////
            server.Subscribe("TimeTick");


        }
Exemplo n.º 18
0
        // Here's the VoIP Evo voice client
		//If you get a compiler error here it's because the COM control is not
		//registered. Run "regsvr32.exe EvoVoIP.dll" in the COM-folder.
		//private static ConaitoLib.EvoVoIP voipclient;

        public VoiceServer(string simModelPath, ref SimulationEventDistributor distributor, DateTime time, bool bIsReplay, double dbReplaySpeed)
        {
            simModelName = simModelPath;
            simModelInfo = smr.readModel(simModelName);
            isRunning = false;
            isLoggedIn = false;
            roomMembership = new Dictionary<string, List<string>>();
            channelIDMap = new Dictionary<string, int>();
            userChannelMap = new Dictionary<int, int>();
            channelUserList = new Dictionary<string, List<int>>();
            userSpeachStartTime = new Dictionary<string, int>();
            lastPlayedVoiceFile = new Dictionary<string, string>();
            server = new SimulationEventDistributorClient();
            distributor.RegisterClient(ref server);
            isReplay = bIsReplay;
            replaySpeed = dbReplaySpeed;
            
            // Start the voice server
            if (!StartConaitoVoiceServer())
            {
                StopConaitoVoiceServer();
                String errorMessage1 = "Failed to start Conaito Voice server application";
                ErrorLog.Write(errorMessage1 + "\n");
                throw new Exception("Failed to start Conaito Voice server application");
            }

            //connect to the Conaito server COM object
            //Instantiate the COM control
            evoadmin = new ConaitoLib.EvoVoIPAdminClass();
            //evoadmin.CloseVoIP();           //this is just in case we were here before
            if (!evoadmin.InitVoIP())
            {
                String errorMessage1 = "Failed to initialize EvoVoIP";
                //System.Windows.Forms.MessageBox.Show(errorMessage1);
                ErrorLog.Write(errorMessage1 + "\n");
                throw new Exception("Failed to initialize the Voice Server");
            }

            //Register some of the Conaito server events we need to know about
            evoadmin.OnCommandError += new ConaitoLib.IEvoVoIPAdminEvents_OnCommandErrorEventHandler(this.evoadmin_OnCommandError);
            evoadmin.OnConnectSuccess += new ConaitoLib.IEvoVoIPAdminEvents_OnConnectSuccessEventHandler(this.evoadmin_OnConnectSuccess);
            evoadmin.OnConnectFailed += new ConaitoLib.IEvoVoIPAdminEvents_OnConnectFailedEventHandler(this.evoadmin_OnConnectFailed);
            evoadmin.OnConnectionLost += new ConaitoLib.IEvoVoIPAdminEvents_OnConnectionLostEventHandler(this.evoadmin_OnConnectionLost);

            evoadmin.OnAccepted += new ConaitoLib.IEvoVoIPAdminEvents_OnAcceptedEventHandler(this.evoadmin_OnAccepted);

            //get the values of the voice server host name and port number from the server options file
            if (ServerOptions.VoiceServerHostname != null) {
                voiceServerHostName = ServerOptions.VoiceServerHostname;
            }
             if (ServerOptions.VoiceServerPort != 0) {
                voiceServerHostPort = ServerOptions.VoiceServerPort;
            }

             if (!evoadmin.Connect(voiceServerHostName, voiceServerHostPort, voiceServerUDPHostPort))
            {
                String errorMessage1 = "Failed to connect to the voice server";
                System.Windows.Forms.MessageBox.Show(errorMessage1);
                ErrorLog.Write(errorMessage1 + "\n");
                throw new Exception("Failed to connect to the voice server");
            }
            //wait until we get connected.
            int tries = 0;
            while (!isRunning && tries < maxTries)
            {
                isRunning = evoadmin.IsConnected();
                tries += 1;
                Thread.Sleep(100);
            }

            //we timed out, so we did not connect
            if (tries == maxTries)
            {
                String errorMessage1 = "Failed to connect to Voice Server";
                //System.Windows.Forms.MessageBox.Show(errorMessage1);
                ErrorLog.Write(errorMessage1 + "\n");
                throw new Exception("Failed to connect to the Voice Server");
            }

            //Log into the admin account of the voice server
            evoadmin.DoAdminLogin(voiceServerAdminUsername, voiceServerAdminPass);

            //wait until we get logged in.
            tries = 0;
            while (!isLoggedIn && tries < maxTries ) 
            {
                isLoggedIn = evoadmin.IsAuthorized();
                tries++;
                Thread.Sleep(100);
            }
            //we timed out, so we did not get logged in
            if (tries == maxTries)
            {
                String errorMessage1 = "Failed to log into Voice Server";
                //System.Windows.Forms.MessageBox.Show(errorMessage1);
                ErrorLog.Write(errorMessage1 + "\n");
                throw new Exception("Failed to log into the Voice Server");
            }
            // clean things up and set things up just in case we or someone else left something in the voice server
            setUpVoiceServer();

            //Register some more of the Conaito server events we need to know about
            evoadmin.OnAddChannel += new ConaitoLib.IEvoVoIPAdminEvents_OnAddChannelEventHandler(this.evoadmin_OnAddChannel);
            evoadmin.OnRemoveChannel += new ConaitoLib.IEvoVoIPAdminEvents_OnRemoveChannelEventHandler(this.evoadmin_OnRemoveChannel);
            evoadmin.OnAddUser += new ConaitoLib.IEvoVoIPAdminEvents_OnAddUserEventHandler(this.evoadmin_OnAddUser);
            evoadmin.OnRemoveUser += new ConaitoLib.IEvoVoIPAdminEvents_OnRemoveUserEventHandler(this.evoadmin_OnRemoveUser);
            evoadmin.OnAudioFileStatus += new ConaitoLib.IEvoVoIPAdminEvents_OnAudioFileStatusEventHandler(this.evoadmin_OnAudioFileStatus);

            //find out if the user wants to record the voice channels
            recordChannels = ServerOptions.EnableVoiceServerRecordings;

            if (recordChannels)
            {
                string audioFilePath;

                // Setup audio file base path
                string scenarioTitle = ServerOptions.DefaultScenarioPath.Remove(ServerOptions.DefaultScenarioPath.LastIndexOf('.'));
                scenarioTitle = scenarioTitle.Remove(0, scenarioTitle.LastIndexOf('\\') + 1);

                if ((ServerOptions.VoiceServerAudioLogDir == null) ||
                    (ServerOptions.VoiceServerAudioLogDir.Length == 0))
                {
                    string assemblyDir = System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;
                    string drive = Path.GetPathRoot(assemblyDir);
                    audioFilePath = Path.Combine(drive, "DDDVoiceRecordings");
                }
                else
                {
                    audioFilePath = ServerOptions.VoiceServerAudioLogDir;
                }
                if (!Directory.Exists(audioFilePath))
                {
                    Directory.CreateDirectory(audioFilePath);
                }
                audioFilePath = Path.Combine(audioFilePath, scenarioTitle);

                if ((!isReplay) && (!Directory.Exists(audioFilePath)))
                {
                    try
                    {
                        Directory.CreateDirectory(audioFilePath);
                    }
                    catch (Exception ex)
                    {
                    }
                }

                if (Directory.Exists(audioFilePath.ToString()))
                {
                    audioFilePath = Path.Combine(audioFilePath, String.Format("{0:yyyyMMddHHmmss}", time));

                    if ((!isReplay) && (!Directory.Exists(audioFilePath)))
                    {
                        try
                        {
                            Directory.CreateDirectory(audioFilePath);
                        }
                        catch (Exception ex)
                        {
                        }
                    }

                    if (Directory.Exists(audioFilePath.ToString()))
                    {
                        voiceServerAudioFilePath = audioFilePath;
                    }
                }
                

                // Setup directory for saved audio files
                evoadmin.DoSubscribe((int)_Subscriptions.SUBSCRIBE_AUDIO);
            }
            
            //setup the client so we can find out when users are talking.
            //voipclient = new ConaitoLib.EvoVoIPClass();

            //register some client events
            //voipclient.OnUserTalking += new ConaitoLib.IEvoVoIPEvents_OnUserTalkingEventHandler(this.voipclient_OnUserTalking);


            //Set up the ping timer
            //pingTimer = new System.Windows.Forms.Timer();
            //this.pingTimer.Tick += new System.EventHandler(this.TimerPinger);
            //pingTimer.Interval = 1000;
            //pingTimer.Start();
        }
Exemplo n.º 19
0
        public void Initialize(ref SimulationModelInfo simModel, ref Blackboard blackboard, ref SimulationEventDistributor distributor)
        {
            this.blackboard = blackboard;
            this.bbClient = new BlackboardClient();
            this.distributor = distributor;
            this.distClient = new SimulationEventDistributorClient();
            this.simModel = simModel;

            distributor.RegisterClient(ref distClient);

            blackboard.RegisterClient(ref bbClient);
            bbClient.Subscribe("PhysicalObject", "ID", true, false);
            bbClient.Subscribe("PhysicalObject", "State", true, false);
            bbClient.Subscribe("PhysicalObject", "OwnerID", true, false);
            bbClient.Subscribe("PhysicalObject", "Location", true, false);
            bbClient.Subscribe("PhysicalObject", "DockedToParent", true, false);

            ScoringDB.Score s = new ScoringDB.Score("DEFENSE", null, null, 1000);
            s.calculateDMs = new List<string>();
            s.calculateDMs.Add("BluePlayer01");
            s.calculateDMs.Add("BluePlayer02");
            s.displayDMs = s.calculateDMs;

            
            s.rules.Add(new ScoringDB.ScoringRule(new ScoringDB.ActorInfo(new ScoringDB.ActorInfo.OwnerInfo(ScoringDB.ActorInfo.OwnerInfo.OwnerType.HostileDM),
                                                                          new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Any, ""),
                                                                          new ScoringDB.ActorInfo.LocationInfo(ScoringDB.ActorInfo.LocationInfo.LocationType.Anywhere, "")),
                                                  new ScoringDB.ConditionInfo(ScoringDB.ConditionInfo.ConditionType.ObjectExists,"",""),
                                                  null,
                                                  -1));
            /*
            s.rules.Add(new ScoringDB.ScoringRule(new ScoringDB.ActorInfo(new ScoringDB.ActorInfo.OwnerInfo(ScoringDB.ActorInfo.OwnerInfo.OwnerType.Myself),
                                                                          new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Any, ""),
                                                                          new ScoringDB.ActorInfo.LocationInfo(ScoringDB.ActorInfo.LocationInfo.LocationType.Anywhere, "")),
                                                  new ScoringDB.ConditionInfo(ScoringDB.ConditionInfo.ConditionType.StateChange, "Dead"),
                                                  new ScoringDB.ActorInfo(new ScoringDB.ActorInfo.OwnerInfo(ScoringDB.ActorInfo.OwnerInfo.OwnerType.HostileDM),
                                                                          new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Any, ""),
                                                                          new ScoringDB.ActorInfo.LocationInfo(ScoringDB.ActorInfo.LocationInfo.LocationType.Anywhere, "")),
                                                  200));
            s.rules.Add(new ScoringDB.ScoringRule(new ScoringDB.ActorInfo(new ScoringDB.ActorInfo.OwnerInfo(ScoringDB.ActorInfo.OwnerInfo.OwnerType.Myself),
                                                                          new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Any, ""),
                                                                          new ScoringDB.ActorInfo.LocationInfo(ScoringDB.ActorInfo.LocationInfo.LocationType.Anywhere, "")),
                                                  new ScoringDB.ConditionInfo(ScoringDB.ConditionInfo.ConditionType.StateChange, "PartlyFunctional"),
                                                  new ScoringDB.ActorInfo(new ScoringDB.ActorInfo.OwnerInfo(ScoringDB.ActorInfo.OwnerInfo.OwnerType.FriendlyDM),
                                                                          new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Any, ""),
                                                                          new ScoringDB.ActorInfo.LocationInfo(ScoringDB.ActorInfo.LocationInfo.LocationType.Anywhere, "")),
                                                  -300));
            s.rules.Add(new ScoringDB.ScoringRule(new ScoringDB.ActorInfo(new ScoringDB.ActorInfo.OwnerInfo(ScoringDB.ActorInfo.OwnerInfo.OwnerType.HostileDM),
                                                                          new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Any, ""),
                                                                          new ScoringDB.ActorInfo.LocationInfo(ScoringDB.ActorInfo.LocationInfo.LocationType.Anywhere, "")),
                                                  new ScoringDB.ConditionInfo(ScoringDB.ConditionInfo.ConditionType.StateChange, "Dead"),
                                                  new ScoringDB.ActorInfo(new ScoringDB.ActorInfo.OwnerInfo(ScoringDB.ActorInfo.OwnerInfo.OwnerType.Myself),
                                                                          new ScoringDB.ActorInfo.IdentifierInfo(ScoringDB.ActorInfo.IdentifierInfo.IdentifierType.Any, ""),
                                                                          new ScoringDB.ActorInfo.LocationInfo(ScoringDB.ActorInfo.LocationInfo.LocationType.Anywhere, "")),
                                                  -1000));
            */

            //ScoringDB.scores["DEFENSE"] = s;

            objectProxies = new Dictionary<string, SimulationObjectProxy>();
        }
Exemplo n.º 20
0
        public void Start(SimulationModelInfo simModel, ref SimulationEventDistributor distributor, string logName, bool loop)
        {
            try
            {
                playerThread = new Thread(new ThreadStart(EventLoop));
                //nc = new NetworkClient();
                //nc.Connect(hostname, port);
                distClient = new SimulationEventDistributorClient();
                distributor.RegisterClient(ref distClient);
                this.simModel = simModel;
                time = 0;
                this.loop = loop;
                this.logname = logName;
                updateFrequency = simModel.simulationExecutionModel.updateFrequency;

                SimulationEvent ev = SimulationEventFactory.BuildEvent(ref simModel, "ResetSimulation");
                distClient.PutEvent(ev);
                LoadEvents(logName);

                playerThread.Start();
            }
            catch (Exception e)
            {
                throw e;
            }
        }