QSerialIODeviceMultiplexer *EZXMultiplexerPlugin::create
        ( QSerialIODevice *device )
{

        // in the custom.h file as QTOPIA_PHONE_DEVICE and then passed
        // down to us in the "device" parameter.
        QMultiPortMultiplexer *mux = new QMultiPortMultiplexer( device );

        // Add the secondary channel.
        QSerialPort *secondaryMux = QSerialPort::create( "/dev/mux2" );
        mux->addChannel( "secondary", secondaryMux );

        // FIXME use QList
        // open all ports to pass handshake
        QSerialPort *smsMux = QSerialPort::create( "/dev/mux3" );
        mux->addChannel( "sms", smsMux );

        QSerialPort *mux4 = QSerialPort::create( "/dev/mux4" );
        mux->addChannel( "mux4", mux4 );

        QSerialPort *mux5 = QSerialPort::create( "/dev/mux5" );
        mux->addChannel( "mux5", mux5 );

        QSerialPort *mux7 = QSerialPort::create( "/dev/mux7" );
        mux->addChannel( "mux7", mux7 );

        QSerialPort *mux8 = QSerialPort::create( "/dev/mux8" );
        mux->addChannel( "mux8", mux8 );

        QSerialPort *mux9 = QSerialPort::create( "/dev/mux9" );
        mux->addChannel( "mux9", mux9 );

        QSerialPort *mux10 = QSerialPort::create( "/dev/mux10" );
        mux->addChannel( "mux10", mux10 );

        // power on bp
        mux->chat(device,"AT+EPOM=1,0");

        // set bp time from ap
        QDateTime now = QDateTime::currentDateTime();

        mux->chat(device,"AT+CCLK=\"" + now.toString("yy/MM/dd,hh:mm:ss") + "\"" );

        // ??
        mux->chat(device,"AT+EAPF=12,1,0" );
        mux->chat(device,"AT");

        // close unused lines
        mux4->close();
        mux5->close();
        mux7->close();
        mux8->close();
        mux9->close();
        mux10->close();

        return mux;
}
Ejemplo n.º 2
0
QSerialIODeviceMultiplexer *MultiPortMultiplexerPlugin::create( QSerialIODevice *device )
{
    // The primary AT command device, /dev/mux0, is configured
    // in the custom.h file as QTOPIA_PHONE_DEVICE and then passed
    // down to us in the "device" parameter.
    QMultiPortMultiplexer *mux = new QMultiPortMultiplexer( device );

    // Add the secondary channel.
    QSerialPort *secondary = QSerialPort::create( "/dev/mux1" );
    mux->addChannel( "secondary", secondary );

    // Add the data channel.
    QSerialPort *data = QSerialPort::create( "/dev/mux2" );
    mux->addChannel( "data", data );

    // Add the data setup channel, which is the same as "data".
    mux->addChannel( "datasetup", data );
    return mux;
}