Beispiel #1
0
        /// <summary>
        /// Initializes the manager.  Reads and parses the actuators
        /// XML file and creates a list of actuators from it.  The 
        /// extension dirs parameter contains the root directory under
        /// which to search for Actuator DLL files.  The directories
        /// are specified in a comma delimited fashion. 
        /// E.g.  Base, Hawking
        /// These are relative to the application execution directory or
        /// to the directory where the ACAT framework has been installed.
        /// It recusrively walks the directories and looks for Actuator 
        /// extension DLL files
        /// </summary>
        /// <param name="extensionDirs">Directories to search</param>
        /// <returns>true on success</returns>
        public bool Init(IEnumerable<String> extensionDirs)
        {
            bool retVal = true;

            // load all the acutators
            if (_actuators == null)
            {
                String configFile = UserManager.GetFullPath(ActuatorConfigFileName);
                _actuators = new Actuators();
                retVal = _actuators.Load(extensionDirs, configFile);
                if (retVal)
                {
                    retVal = init(_actuators);
                }
            }

            if (retVal)
            {
                // load the switchmap config file for the user which contains
                // switch configuration mappings
                String switchConfigFile = UserManager.GetFullPath(SwitchConfigMapFilename);
                retVal = SwitchConfigMap.Load(switchConfigFile);
            }

            return retVal;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes each of the actuators and subscribes to 
        /// events that will be triggered by the actuators
        /// </summary>
        /// <param name="actuators">Actuators object</param>
        /// <returns>true on success</returns>
        private bool init(Actuators actuators)
        {
            bool error = false;

            foreach (IActuator actuator in actuators.Collection)
            {
                Log.Debug("Calling init for " + actuator.Descriptor.Name);
                bool retVal = actuator.Init();
                if (!retVal)
                {
                    error = true;
                }

                Log.Debug("Subscribing to actuator events...");

                // Subscribe to switch events from each actuator
                actuator.EvtSwitchActivated += actuator_EvtSwitchActivated;
                actuator.EvtSwitchDeactivated += actuator_EvtSwitchDeactivated;
                actuator.EvtSwitchTriggered += actuator_EvtSwitchTriggered;
            }

            return !error;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes the manager.  Reads and parses the actuators
        /// XML file and creates a list of actuators from it.  The
        /// extension dirs parameter contains the root directory under
        /// which to search for Actuator DLL files.  The directories
        /// are specified in a comma delimited fashion.
        /// E.g.  Base, Hawking
        /// These are relative to the application execution directory or
        /// to the directory where the ACAT framework has been installed.
        /// It recusrively walks the directories and looks for Actuator
        /// extension DLL files
        /// </summary>
        /// <param name="extensionDirs">Directories to search</param>
        /// <returns>true on success</returns>
        public bool Init(IEnumerable<String> extensionDirs)
        {
            bool retVal = true;

            _initInProgress = true;

            _thread = new Thread(calibrationHandlerThread) { IsBackground = true };
            _thread.Start();

            // load all the acutators
            if (_actuators == null)
            {
                String configFile = UserManager.GetFullPath(ActuatorConfigFileName);
                _actuators = new Actuators();
                retVal = _actuators.Load(extensionDirs, configFile);
                if (retVal)
                {
                    retVal = init();
                }
            }

            if (retVal)
            {
                // load the switchmap config file for the user which contains
                // switch configuration mappings
                String switchConfigFile = UserManager.GetFullPath(SwitchConfigMapFilename);
                retVal = SwitchConfigMap.Load(switchConfigFile);
            }

            _initInProgress = false;

            return retVal;
        }