Exemple #1
0
void IntroPhone::activate() {
	error = "";
	a_errorAlpha = anim::fvalue(0);
	show();
	enableAll(true);
}
void SarkofagSupervisor::updateHook() {
  switch (robot_state_) {
    case NOT_OPERATIONAL:

      for (int i = 0; i < number_of_servos_; i++) {
        if (servo_state_[i] != NOT_SYNCHRONIZED) {
          RTT::Attribute<ECServoState> * servo_ec_state = (RTT::Attribute<ECServoState> *) EC
              ->provides(services_names_[i])->getAttribute("state");
          ec_servo_state_ = servo_ec_state->get();

          if (auto_) {
            // set "enable" if powered on
            if (ec_servo_state_ == SWITCH_ON) {
              RTT::OperationCaller<bool(void)> enable;
              enable = EC->provides(services_names_[i])->getOperation("enable");
              enable.setCaller(this->engine());
              enable();
            }
          }

          // servo enabled
          if (ec_servo_state_ == OPERATION_ENABLED) {
            std::cout << services_names_[i] << ": ENABLED" << std::endl;
            servo_state_[i] = NOT_SYNCHRONIZED;
            ++servos_state_changed_;
          }
        }
      }

      // all servos enabled
      if (servos_state_changed_ == number_of_servos_) {
        robot_state_ = NOT_SYNCHRONIZED;
        std::cout << "ROBOT NOT SYNCHRONIZED" << std::endl;
        servos_state_changed_ = 0;
      }
      break;

    case NOT_SYNCHRONIZED:
      if (auto_) robot_state_ = SYNCHRONIZING;
      break;

    case SYNCHRONIZING:
      for (int i = 0; i < number_of_servos_; i++) {
        RTT::Attribute<ECServoState> * servo_state = (RTT::Attribute<ECServoState> *) EC
            ->provides(services_names_[i])->getAttribute("state");
        ec_servo_state_ = servo_state->get();

        if (ec_servo_state_ == OPERATION_ENABLED) {
          switch (servo_state_[i]) {
            case NOT_SYNCHRONIZED:
              if (i == last_servo_synchro_) {
                RTT::OperationCaller<bool(void)> beginHoming;
                beginHoming = EC->provides(services_names_[i])->getOperation("beginHoming");
                beginHoming.setCaller(this->engine());
                beginHoming();
                servo_state_[i] = SYNCHRONIZING;
                std::cout << services_names_[i] << ": SYNCHRONIZING" << std::endl;
              }
              break;
            case SYNCHRONIZING:
              RTT::Attribute<bool> * homing = (RTT::Attribute<bool> *) EC->provides(
                  services_names_[i])->getAttribute("homing_done");
              if (homing->get()) {
                servo_state_[i] = SYNCHRONIZED;
                std::cout << services_names_[i] << ": SYNCHRONIZED" << std::endl;
                last_servo_synchro_ = i+1;
                ++servos_state_changed_;

                // switch Regulator
                disable_vec_.clear();
                enable_vec_.clear();
                enable_vec_.push_back(regulators_names_[i]);
                RTT::OperationCaller<
                bool(const std::vector<std::string> &disable_block_names,
                     const std::vector<std::string> &enable_block_names,
                     const bool strict, const bool force)> switchBlocks;
                switchBlocks = Scheme->getOperation("switchBlocks");
                switchBlocks.setCaller(this->engine());
                switchBlocks(disable_vec_, enable_vec_, true, true);
                std::cout << regulators_names_[i] << ": ENABLED" << std::endl;
              }
              break;
          }
        }
      }
      // all servos synhronized
      if (servos_state_changed_ == number_of_servos_) {
        robot_state_ = SYNCHRONIZED;
        std::cout << "ROBOT SYNCHRONIZED" << std::endl;
        servos_state_changed_ = 0;
      }
      break;

    case SYNCHRONIZED:

      robot_state_ = RUNNING;
      std::cout << "ROBOT READY" << std::endl;
      break;

    case RUNNING:
      if (fault_autoreset_) {
        resetFaultAll();
        enableAll();
      }
      break;
    default:
      break;
  }
}
 void VariablesList::allOffClicked()
 {
   enableAll(false);
 }
 void VariablesList::allOnClicked()
 {
   enableAll(true);
 }
Exemple #5
0
Output::Output() : lengthScale(Mpc), energyScale(EeV), oneDimensional(false), count(0) {
	enableAll();
}
Exemple #6
0
void MediaControl::reparseConfig()
{
//	kdDebug(90200) << "reparseConfig();" << endl;
    _configFrontend->reparseConfiguration();

    if (_player != 0L) // make sure there is no player-object
    {
        _player->disconnect(); // disconnect from all things

        time_slider->disconnect();
        prev_button->disconnect();
        playpause_button->disconnect();
        stop_button->disconnect();
        next_button->disconnect();

        delete slider_tooltip; // tooltip depends on _player : delete it before _player gets deleted
        slider_tooltip = 0L;

        delete _player;
        _player = 0L;
    }

    mLastLen = -1;
    mLastTime = -1;
    mLastStatus = -1;

    QString playerString = _configFrontend->player();


#ifdef HAVE_XMMS
    if (playerString == "XMMS")
    {
        _player = new XmmsInterface ();
        time_slider->setSteps((_configFrontend->mouseWheelSpeed()*1000),
                              (_configFrontend->mouseWheelSpeed()*1000));
    }
    else
#endif
        if (playerString == "JuK")
        {
            _player = new JuKInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "Amarok")
        {
            _player = new AmarokInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "KsCD")
        {
            _player = new KsCDInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "mpd")
        {
            _player = new MpdInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else // Fallback is Noatun
        {
            _player = new NoatunInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }

    //  this signal gets emitted by a playerInterface when the player's playtime changed
    connect(_player, SIGNAL(newSliderPosition(int,int)),
            this, SLOT(setSliderPosition(int,int)));

    connect(_player, SIGNAL(playerStarted()), SLOT(enableAll()));
    connect(_player, SIGNAL(playerStopped()), SLOT(disableAll()));
    connect(_player, SIGNAL(playingStatusChanged(int)), SLOT(slotPlayingStatusChanged(int)));

    // do we use our icons or the default ones from KDE?
    if(_configFrontend->useCustomTheme())
    {
        // load theme
        QString skindir = locate("data", "mediacontrol/"+_configFrontend->theme()+"/");

        // the user has to take care if all pixmaps are there, we only check for one of them
        if (QFile(skindir+"play.png").exists())
        {
            prev_button->setIconSet(SmallIconSet(locate("data",skindir+"prev.png")));
            if (_player->playingStatus() == PlayerInterface::Playing)
                playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"play.png")));
            else
                playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"pause.png")));
            stop_button->setIconSet(SmallIconSet(locate("data",skindir+"stop.png")));
            next_button->setIconSet(SmallIconSet(locate("data",skindir+"next.png")));
        }
        else // icon-theme is invalid or not there
        {
            KNotifyClient::event(winId(), KNotifyClient::warning,
                                 i18n("There was trouble loading theme %1. Please choose" \
                                      " a different theme.").arg(skindir));

            // default to kde-icons, they have to be installed :)
            slotIconChanged();

            // and open prefs-dialog
            preferences();
        }
    }
    else // KDE default-icons, assuming that these icons exist!
    {
        // sets icons from kde
        slotIconChanged();
    }

    slider_tooltip = new MediaControlToolTip(time_slider, _player);

    connect(prev_button, SIGNAL(clicked()), _player, SLOT(prev()));
    connect(playpause_button, SIGNAL(clicked()), _player, SLOT(playpause()));
    connect(stop_button, SIGNAL(clicked()), _player, SLOT(stop()));
    connect(next_button, SIGNAL(clicked()), _player, SLOT(next()));

    connect(time_slider, SIGNAL(sliderPressed()), _player, SLOT(sliderStartDrag()));
    connect(time_slider, SIGNAL(sliderReleased()), _player, SLOT(sliderStopDrag()));
    connect(time_slider, SIGNAL(valueChanged(int)), this, SLOT(adjustTime(int)));
    connect(time_slider, SIGNAL(volumeUp()), _player, SLOT(volumeUp()));
    connect(time_slider, SIGNAL(volumeDown()), _player, SLOT(volumeDown()));
    connect(this, SIGNAL(newJumpToTime(int)), _player, SLOT(jumpToTime(int)));
}