Exemplo n.º 1
0
/**
 * Full-duplex send/receive between UART0 and UART1
 */
void uartLoopBack()
{
  printf("UART Serial IO Tester\n");

  while (true) {
    sendIO(0, 1);
    sendIO(1, 0);
  }
}
Exemplo n.º 2
0
void UISearchPage::menu_Download()
{
        QList<QListViewItem> list = m_view->selectedItems();
        QListViewItem * item;
        QString path;

        for ( item = list.first(); item != 0; item = list.next() )
        {
                path = item->text( UIPageView::Col_Path );

                if ( path.isEmpty() )
                        return ;

                IOMessage * io = new IOMessage( 0 );
                io->setMessageType( IONapsterCodes::DownloadRequest );
                io->insert( "nick",     item->text( UIPageView::Col_Nick ) );
                io->insert( "path",     item->text( UIPageView::Col_Path ) );
                io->insert( "name",     item->text( UIPageView::Col_Name ) );
                io->insert( "speed",    item->text( UIPageView::Col_Link ) );
                io->insert( "bitrate",  item->text( UIPageView::Col_Bitr ) );
                io->insert( "host",     item->text( UIPageView::Col_Host ) );
                io->insert( "time",     item->text( UIPageView::Col_Time ) );
                io->insert( "size",     item->text( UIPageView::Col_Size ) );
                io->insert( "freq",     item->text( UIPageView::Col_Freq ) );
                emit sendIO( io );

                delete io;
        }
}
Exemplo n.º 3
0
void UIChannelDialog::sendIOEvent( IOMessage * io )
{
        switch ( io->messageType() )
        {
        }

        emit sendIO( io );
}
Exemplo n.º 4
0
void UIChannelDialog::slot_ChanToggled( bool all_chans )
{
        m_view->clear();

        m_itemNapster = new QListViewItem( m_view );
        m_itemNapster->setText( Col_Chan, tr( "Napster channels" ) );
        m_itemNapster->setOpen( true );

        m_itemOther = new QListViewItem( m_view );
        m_itemOther->setText( Col_Chan, tr( "Other channels" ) );
        m_itemOther->setOpen( true );

        IOMessage * io = new IOMessage( 0 );

        if ( all_chans == true )
                io->setMessageType( IONapsterCodes::ListAllChansRequest );
        else
                io->setMessageType( IONapsterCodes::ListChansRequest );

        emit sendIO( io );
        delete io;

        toggleEnabled( false );
}
Exemplo n.º 5
0
void UIChannelDialog::slot_Join()
{
        m_view->firstChild();

        QListViewItemIterator it( m_view );
        QListViewItem * item;

        for ( ; ( item = it.current() ); ++it )
        {
                if ( item->text( Col_Size ).isEmpty() == true )
                        continue ;
                if ( item->isSelected() == false )
                        continue ;

                IOMessage * io = new IOMessage( 0 );
                io->setMessageType( IONapsterCodes::ChanJoinRequest );
                io->insert( "rawdata", item->text( Col_Chan ) );
                emit sendIO( io );

                delete io;
        }

        accept();
}
void IONapsterConnection::sendIOEvent( IOMessage * io )
{
        QStringList list;
        QString     data;

        switch ( io->messageType() )
        {
        case IONapsterCodes::RegisteredRequest:
                list.append( io->find( "nick" ) );
                data = IOSupport::quoteJoin( list );
                break;

        case IONapsterCodes::LoginRequest:
                list.append( io->find( "nick" ) );
                list.append( io->find( "pass" ) );
                list.append( io->find( "port" ) );
                list.append( io->find( "client" ) );
                list.append( io->find( "speed" ) );
                data = IOSupport::quoteJoin( list );
                break;

        case IONapsterCodes::LoginCreate:
                list.append( io->find( "nick" ) );
                list.append( io->find( "pass" ) );
                list.append( io->find( "port" ) );
                list.append( io->find( "client" ) );
                list.append( io->find( "speed" ) );
                list.append( io->find( "email" ) );
                data = IOSupport::quoteJoin( list );
                break;

        case IONapsterCodes::DownloadRequest:
                list.append( io->find( "nick" ) );
                list.append( io->find( "path" ) );
                data = IOSupport::quoteJoin( list );
                break;

        case IONapsterCodes::BrowseRequest:
                list.append( io->find( "nick" ) );
                data = IOSupport::quoteJoin( list );
                break;

        default:
                data = io->find( "rawdata" );
                break;
        }

        // verbose ?
        if ( verboseIO() )
                qWarning( "IONapsterConnection::sendIOEvent(IOMessage *): "
                          "type " + QString::number( io->messageType() ) +
                          ": " + data );

        //
        // relay the message
        //

        emit sendIO( io );

        //
        // send the message out
        //

        __stream << (Q_UINT16) data.length();
        __stream << (Q_UINT16) io->messageType();
        __stream.writeRawBytes( data.latin1(), data.length() );

        __num_sio++;
}