//--------------------------------------------------------------------
// getKeyboardOrder
//--------------------------------------------------------------------
bool getKeyboardOrder(Order &order)
{
    order.reset();
    char rep;
    read(0,&rep,1);
  //  printf("read=%d\n", rep);
    switch (rep) {
        // motor
    case 27 : 
        read(0,&rep,1); 
        read(0,&rep,1);
        switch (rep) {
	case 'A' : handleForward(order); break;
	case 'B' : handleBackward(order); break;
	case 'D' : handleLeft(order); break;
	case 'C' : handleRight(order); break;
        }
        break;
    case '8' : handleForward(order); break;
    case '2' : handleBackward(order); break;
    case '4' : handleLeft(order); break;
    case '6' : handleRight(order); break;
        // emergency stop
    case '5' :
    case ' ' : 
        setEmergencyStopOrder(order);
        break; 
    case 'r' :
    case 'R' :    
	order.resetRobotPos=true;
        order.motorReset=1;
        order.speedLeft=0;
        order.speedRight=0;
        break;  
    case 'h' :
    case 'H' : 
        showUsage();
        break;   
    case 'q': 
    case 'Q': 
    case '-':
        quitApplication = true;
        break;
    default:
        break;
    }
    checkMotorOrder(order);
    return true;
}
Exemple #2
0
void SubBarPlayer::xSetup()
{
   //DAVID Setup Background;
   pixBackground.load("/root/kde_application/hdass08/skin/SubBarBackground.png");
   setBackgroundPixmap(pixBackground);
   
   //DAVID Load BtnGraphic
   BtnGraphic[0]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Previous.png");
   BtnGraphic[1]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Previous-Active.png");
   BtnGraphic[2]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Play.png");
   BtnGraphic[3]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Play-Active.png");
   BtnGraphic[4]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Pause.png");
   BtnGraphic[5]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Pause-Active.png");
   BtnGraphic[6]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Next.png");
   BtnGraphic[7]=new QPixmap("/root/kde_application/hdass08/skin/Bar-Player-Btn-Next-Active.png");
  
   
   SubBtnPlayer_PlayNPause =new SkinButton(this);
   SubBtnPlayer_Backword     =new SkinButton(this);
   SubBtn_Forward                =new SkinButton(this);
   
   SubBtnPlayer_Backword->setPixmaps(BtnGraphic[0],BtnGraphic[1]);
   SubBtnPlayer_Backword->setGeometry(336,0,60,80);
   SubBtnPlayer_Backword->show();
   
   SubBtnPlayer_PlayNPause->setPixmaps(BtnGraphic[2],BtnGraphic[3]);
   SubBtnPlayer_PlayNPause->setGeometry(403,0,80,80);
   SubBtnPlayer_PlayNPause->show();
   
   SubBtn_Forward->setPixmaps(BtnGraphic[6],BtnGraphic[7]);
   SubBtn_Forward->setGeometry(484,0,60,80);
   SubBtn_Forward->show();
   
   //DAVID Pos Slider
   playerPosition = new QSlider(0,100,1,0,Qt::Horizontal,this);
   playerPosition->setGeometry( QRect(10,39,300,15) );
   //playerPosition->show();
   
   
   QObject::connect(SubBtnPlayer_PlayNPause, SIGNAL(clicked()), m_player, SLOT(play()));
   QObject::connect(SubBtnPlayer_PlayNPause,SIGNAL(clicked()),this,SLOT(ChangeBtnPlayPauseGraphic()));
   QObject::connect(SubBtn_Forward, SIGNAL(clicked()), m_player, SLOT(next()));
   QObject::connect(SubBtnPlayer_Backword, SIGNAL(clicked()), m_player, SLOT(previous()));

   state=SubBarPlayer::GO;
   
   connect(m_player, SIGNAL(positionMessage(int)), this, SLOT(handlePosition(int )));
   connect(m_player,SIGNAL(trackMessage(int, int, QString, QString, QString )),this,SLOT(handleMessage(int, int, QString, QString, QString )));
   connect(playerPosition, SIGNAL(sliderPressed()), this, SLOT(handleSliderPressed()));
   connect(playerPosition, SIGNAL(sliderReleased()), this, SLOT(handleSliderReleased()));
   
    forwardTimer = new QTimer( this ); // create internal timer
    connect( forwardTimer, SIGNAL(timeout()),this, SLOT(handleForward()) );

    
    backwardTimer = new QTimer( this );
    connect( backwardTimer, SIGNAL(timeout()), this, SLOT(handleBackward()) );
    
    slotReadList();
}