Ejemplo n.º 1
0
/*!
    Sends an \c{ENVELOPE} \a env to the SIM toolkit application.  This is typically
    used for selecting items from the main menu.

    The implementation in QModemSimToolkit sends the envelope to the SIM using the
    \c{AT+CSIM} command.  This will need to be overridden by the modem vendor plugin
    if the modem uses some other mechanism for sending envelopes to the SIM.

    \sa sendResponse(), command()
*/
void QModemSimToolkit::sendEnvelope( const QSimEnvelope& env )
{
    QByteArray cmd;
    QByteArray pdu = env.toPdu();
    cmd += (char)0xA0;
    cmd += (char)0xC2;
    cmd += (char)0x00;
    cmd += (char)0x00;
    cmd += (char)pdu.size();
    cmd += pdu;
    service()->chat( "AT+CSIM=" + QString::number( cmd.size() * 2 ) + "," + 
                     QAtUtils::toHex( cmd ) );
}
Ejemplo n.º 2
0
void tst_QSimToolkit::testEncodeEventDownload()
{
    QFETCH( QByteArray, data );
    QFETCH( QByteArray, payload );
    QFETCH( int, event );
    QFETCH( int, sourceDevice );

    // Output a dummy line to give some indication of which test we are currently running.
    qDebug() << "";

    // Check that the envelope PDU can be parsed correctly.
    QSimEnvelope decodedEnv = QSimEnvelope::fromPdu(data);
    QVERIFY( decodedEnv.type() == QSimEnvelope::EventDownload );
    QVERIFY( decodedEnv.sourceDevice() == (QSimCommand::Device)sourceDevice );
    QCOMPARE( (int)decodedEnv.event(), event );
    QCOMPARE( decodedEnv.extensionData(), payload );

    // Check that the original envelope PDU can be reconstructed correctly.
    QByteArray pdu = decodedEnv.toPdu();
    pdu[2] = data[2];      // Handle 0x19 vs 0x99 discrepancy.
    QCOMPARE( pdu, data );
}
Ejemplo n.º 3
0
void NeoSimToolkit::sendEnvelope( const QSimEnvelope& env )
{
    service()->primaryAtChat()->chat
        ( "AT%SATE=\"" + QAtUtils::toHex( env.toPdu() ) + "\"" );
}