Exemple #1
0
 public Main(ProviderControl providerControl, InvoiceControl invoiceControl, RequestControl requestControl, UsersControl usersControl, ReportControl reportsControl, ProductControl productControl, PersonalDataControl personalDataControl)
 {
     _logger = LogManager.GetCurrentClassLogger();
     _logger.Debug("Iniciando Menu Principal");
     InitializeComponent();
     _providerControl     = providerControl;
     _invoiceControl      = invoiceControl;
     _requestControl      = requestControl;
     _productControl      = productControl;
     _usersControl        = usersControl;
     _reportsControl      = reportsControl;
     _personalDataControl = personalDataControl;
 }
Exemple #2
0
        /// <summary>
        /// Called when the selected WITSML version has changed.
        /// </summary>
        /// <param name="version">The WITSML version.</param>
        public void OnWitsmlVersionChanged(string version)
        {
            // Reset the Proxy when the version changes
            Proxy = CreateProxy();

            // Get the server capabilities for the newly selected version.
            if (!string.IsNullOrEmpty(version))
            {
                GetCapabilities();
            }

            Runtime.Shell.SetApplicationTitle(this);
            RequestControl.OnWitsmlVersionChanged(version);
        }
Exemple #3
0
        public void OnRequestControl(object arg)
        {
            JausAddress targetAddress = GenerateCurrentAddress();

            if (targetAddress == null)
            {
                return;
            }

            RequestControl requestControl = new RequestControl();

            requestControl.SetAuthorityCode(BadgerControlSubsystem.AUTHORITY_LEVEL);
            requestControl.SetSource(badgerControlSubsystem.LocalAddress);
            requestControl.SetDestination(targetAddress);

            Transport.SendMessage(requestControl);
        }
 protected void InvokeRequestControl()
 {
     RequestControl?.Invoke(this);
 }
Exemple #5
0
 /// <summary>
 /// Called when extra options in is changed.
 /// </summary>
 /// <param name="extraOptionsIn">The extra options in.</param>
 public void OnExtraOptionsInChanged(string extraOptionsIn)
 {
     RequestControl.OnExtraOptionsInChanged(extraOptionsIn);
 }
Exemple #6
0
 /// <summary>
 /// Called when request latest values has changed.
 /// </summary>
 /// <param name="requestLatestValues">The request latest values.</param>
 public void OnRequestLatestValuesChanged(int?requestLatestValues)
 {
     RequestControl.OnRequestLatestValuesChanged(requestLatestValues);
 }
Exemple #7
0
 /// <summary>
 /// Called when maximum data rows has changed.
 /// </summary>
 /// <param name="maxDataRows">The maximum data rows.</param>
 public void OnMaxDataRowsChanged(int?maxDataRows)
 {
     RequestControl.OnMaxDataRowsChanged(maxDataRows);
 }
 /// <summary>
 /// Called when data objects changed.
 /// </summary>
 /// <param name="dataObjects">The data objects.</param>
 public void OnDataObjectsChanged(IEnumerable <string> dataObjects)
 {
     RequestControl.OnDataObjectsChanged(dataObjects);
 }
 /// <summary>
 /// Called when data objects changed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="NotifyCollectionChangedEventArgs"/> instance containing the event data.</param>
 public void DataObjectsChangedEvent(object sender, NotifyCollectionChangedEventArgs e)
 {
     RequestControl.OnDataObjectsChanged(DataObjects);
 }
        public virtual void sendRequestControlAction()
        {
            // what should really happen here is that an internal event is called, so that
            // the send happens inside of a sendAction(), rather than here.

            // Now, we need to send a RequestComponentControl to the management service
            RequestControl request_control_msg = new RequestControl();
            request_control_msg.getBody().getRequestControlRec().setAuthorityCode(200);

            // send a message, to this subsystem, this node, component 11.
            // Again, discovery should be used to find the JAUS ID of the service we want to
            // address, rather than hardcoding the address
            JausAddress dest = new JausAddress(jausRouter.getJausAddress().getSubsystemID(),
                      jausRouter.getJausAddress().getNodeID(),
                      (byte)160);
            sendJausMessage(request_control_msg, dest);
        }
        public void OnRequestControl(object arg)
        {
            JausAddress targetAddress = GenerateCurrentAddress();

            if (targetAddress == null)
                return;

            RequestControl requestControl = new RequestControl();
            requestControl.SetAuthorityCode(BadgerControlSubsystem.AUTHORITY_LEVEL);
            requestControl.SetSource(badgerControlSubsystem.LocalAddress);
            requestControl.SetDestination(targetAddress);

            Transport.SendMessage(requestControl);
        }
        protected override void Execute(Component component)
        {
            LocateJoystick();

            if (!isEnabled || destinationAddress == null)
                return;

            // request control and update the GUI to denote this
            if (!hasControl)
            {
                RequestControl requestControl = new RequestControl();
                requestControl.SetDestination(destinationAddress);
                requestControl.SetSource(component.JausAddress);
                Transport.SendMessage(requestControl);

                // update the connection icon for the correct component to orange
                if (destinationAddress.getComponent() == 1)
                    connectionDetails.direct = ConnectionOption.REQUESTING_CONTROL;
                if (destinationAddress.getComponent() == 2)
                    connectionDetails.remote = ConnectionOption.REQUESTING_CONTROL;
                if (destinationAddress.getComponent() == 3)
                    connectionDetails.ai = ConnectionOption.REQUESTING_CONTROL;
                _eventAggregator.GetEvent<ConnectionDetailsEvent>().Publish(connectionDetails);

                return;
            }

            // shut down all components, then resume the one that should be active (i.e. jank hax)
            if (!isReady)
            {
                // shut down all active components
                Shutdown shutdown = new Shutdown();
                int subsys = CurrentDestinationAddress.SubsystemID;
                int node = CurrentDestinationAddress.getNode();
                JausAddress newAddress = new JausAddress(subsys, node, 1);
                QueryStatus queryStatus = new QueryStatus();

                if (componentOneActive)
                {
                    shutdown.SetDestination(newAddress);
                    Transport.SendMessage(shutdown);

                    queryStatus.SetDestination(newAddress);
                    queryStatus.SetSource(component.JausAddress);
                    Transport.SendMessage(queryStatus);
                }
                if (componentTwoActive)
                {
                    newAddress.setComponent(2);
                    shutdown.SetDestination(newAddress);
                    Transport.SendMessage(shutdown);

                    queryStatus.SetDestination(newAddress);
                    queryStatus.SetSource(component.JausAddress);
                    Transport.SendMessage(queryStatus);
                }
                if (componentThreeActive)
                {
                    newAddress.setComponent(3);
                    shutdown.SetDestination(newAddress);
                    Transport.SendMessage(shutdown);

                    queryStatus = new QueryStatus();
                    queryStatus.SetDestination(newAddress);
                    queryStatus.SetSource(component.JausAddress);
                    Transport.SendMessage(queryStatus);
                }

                // force component to boot
                Resume resume = new Resume();
                resume.SetDestination(destinationAddress);
                resume.SetSource(component.JausAddress);
                Transport.SendMessage(resume);

                // see if the component is ready
                queryStatus = new QueryStatus();
                queryStatus.SetDestination(destinationAddress);
                queryStatus.SetSource(component.JausAddress);
                Transport.SendMessage(queryStatus);

                return;
            }

            // send a drive message
            SetLocalVector msg = new SetLocalVector();
            msg.SetDestination(destinationAddress);
            msg.SetSource(component.JausAddress);

            // convert joystick degrees into radians
            // TODO: THIS IS INCORRECT
            msg.SetHeading(joystickQueryThread.XVelocity * (Math.PI / 180));

            //adding 100 to fit into defined setLocalVector MAX_SPEED & MIN_SPEED
            msg.SetSpeed(joystickQueryThread.YVelocity + 100);

            Transport.SendMessage(msg);
        }
        protected override void Execute(Component component)
        {
            LocateJoystick();

            if (!isEnabled || destinationAddress == null)
            {
                return;
            }

            // request control and update the GUI to denote this
            if (!hasControl)
            {
                RequestControl requestControl = new RequestControl();
                requestControl.SetDestination(destinationAddress);
                requestControl.SetSource(component.JausAddress);
                Transport.SendMessage(requestControl);

                // update the connection icon for the correct component to orange
                if (destinationAddress.getComponent() == 1)
                {
                    connectionDetails.direct = ConnectionOption.REQUESTING_CONTROL;
                }
                if (destinationAddress.getComponent() == 2)
                {
                    connectionDetails.remote = ConnectionOption.REQUESTING_CONTROL;
                }
                if (destinationAddress.getComponent() == 3)
                {
                    connectionDetails.ai = ConnectionOption.REQUESTING_CONTROL;
                }
                _eventAggregator.GetEvent <ConnectionDetailsEvent>().Publish(connectionDetails);

                return;
            }

            // shut down all components, then resume the one that should be active (i.e. jank hax)
            if (!isReady)
            {
                // shut down all active components
                Shutdown    shutdown    = new Shutdown();
                int         subsys      = CurrentDestinationAddress.SubsystemID;
                int         node        = CurrentDestinationAddress.getNode();
                JausAddress newAddress  = new JausAddress(subsys, node, 1);
                QueryStatus queryStatus = new QueryStatus();

                if (componentOneActive)
                {
                    shutdown.SetDestination(newAddress);
                    Transport.SendMessage(shutdown);

                    queryStatus.SetDestination(newAddress);
                    queryStatus.SetSource(component.JausAddress);
                    Transport.SendMessage(queryStatus);
                }
                if (componentTwoActive)
                {
                    newAddress.setComponent(2);
                    shutdown.SetDestination(newAddress);
                    Transport.SendMessage(shutdown);

                    queryStatus.SetDestination(newAddress);
                    queryStatus.SetSource(component.JausAddress);
                    Transport.SendMessage(queryStatus);
                }
                if (componentThreeActive)
                {
                    newAddress.setComponent(3);
                    shutdown.SetDestination(newAddress);
                    Transport.SendMessage(shutdown);

                    queryStatus = new QueryStatus();
                    queryStatus.SetDestination(newAddress);
                    queryStatus.SetSource(component.JausAddress);
                    Transport.SendMessage(queryStatus);
                }

                // force component to boot
                Resume resume = new Resume();
                resume.SetDestination(destinationAddress);
                resume.SetSource(component.JausAddress);
                Transport.SendMessage(resume);

                // see if the component is ready
                queryStatus = new QueryStatus();
                queryStatus.SetDestination(destinationAddress);
                queryStatus.SetSource(component.JausAddress);
                Transport.SendMessage(queryStatus);

                return;
            }

            // send a drive message
            SetLocalVector msg = new SetLocalVector();

            msg.SetDestination(destinationAddress);
            msg.SetSource(component.JausAddress);

            // convert joystick degrees into radians
            // TODO: THIS IS INCORRECT
            msg.SetHeading(joystickQueryThread.XVelocity * (Math.PI / 180));

            //adding 100 to fit into defined setLocalVector MAX_SPEED & MIN_SPEED
            msg.SetSpeed(joystickQueryThread.YVelocity + 100);

            Transport.SendMessage(msg);
        }