本文整理汇总了C++中QSimCommand::toPdu方法的典型用法代码示例。如果您正苦于以下问题:C++ QSimCommand::toPdu方法的具体用法?C++ QSimCommand::toPdu怎么用?C++ QSimCommand::toPdu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSimCommand
的用法示例。
在下文中一共展示了QSimCommand::toPdu方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testEncodeSendDTMF
void tst_QSimToolkit::testEncodeSendDTMF()
{
QFETCH( QByteArray, data );
QFETCH( QByteArray, resp );
QFETCH( int, resptype );
QFETCH( QString, text );
QFETCH( QString, number );
QFETCH( int, iconId );
QFETCH( bool, iconSelfExplanatory );
QFETCH( QByteArray, textAttribute );
QFETCH( QString, html );
QFETCH( int, options );
// Output a dummy line to give some indication of which test we are currently running.
qDebug() << "";
// Check that the command PDU can be parsed correctly.
QSimCommand decoded = QSimCommand::fromPdu(data);
QVERIFY( decoded.type() == QSimCommand::SendDTMF );
QVERIFY( decoded.destinationDevice() == QSimCommand::Network );
QCOMPARE( decoded.text(), text );
QCOMPARE( decoded.number(), number );
QCOMPARE( (int)decoded.iconId(), iconId );
QCOMPARE( decoded.iconSelfExplanatory(), iconSelfExplanatory );
QCOMPARE( decoded.textAttribute(), textAttribute );
if ( !textAttribute.isEmpty() )
QCOMPARE( decoded.textHtml(), html );
// Check that the original command PDU can be reconstructed correctly.
QByteArray encoded = decoded.toPdu( (QSimCommand::ToPduOptions)options );
QCOMPARE( encoded, data );
// Check that the terminal response PDU can be parsed correctly.
QSimTerminalResponse decodedResp = QSimTerminalResponse::fromPdu(resp);
QVERIFY( data.contains( decodedResp.commandPdu() ) );
if ( resptype < 0x0100 ) {
QVERIFY( decodedResp.result() == (QSimTerminalResponse::Result)resptype );
QVERIFY( decodedResp.causeData().isEmpty() );
QVERIFY( decodedResp.cause() == QSimTerminalResponse::NoSpecificCause );
} else {
QVERIFY( decodedResp.result() == (QSimTerminalResponse::Result)(resptype >> 8) );
QVERIFY( decodedResp.causeData().size() == 1 );
QVERIFY( decodedResp.cause() == (QSimTerminalResponse::Cause)(resptype & 0xFF) );
}
// Check that the original terminal response PDU can be reconstructed correctly.
QCOMPARE( decodedResp.toPdu(), resp );
}
示例2: testEncodeRefresh
void tst_QSimToolkit::testEncodeRefresh()
{
QFETCH( QByteArray, data );
QFETCH( QByteArray, resp );
QFETCH( int, resptype );
QFETCH( int, refreshtype );
QFETCH( int, numfiles );
QFETCH( QString, fileids );
QFETCH( int, options );
// Output a dummy line to give some indication of which test we are currently running.
qDebug() << "";
// Check that the command PDU can be parsed correctly.
QSimCommand decoded = QSimCommand::fromPdu(data);
QVERIFY( decoded.type() == QSimCommand::Refresh );
QVERIFY( decoded.destinationDevice() == QSimCommand::ME );
QCOMPARE( (int)decoded.refreshType(), refreshtype );
if ( numfiles > 0 ) {
QCOMPARE( decoded.extensionField(0x92)[0] & 0xFF, numfiles );
QCOMPARE( decoded.extensionField(0x92).mid(1), QAtUtils::fromHex(fileids) );
} else {
QCOMPARE( decoded.extensionField(0x92), QByteArray() );
}
// Check that the original command PDU can be reconstructed correctly.
QByteArray encoded = decoded.toPdu( (QSimCommand::ToPduOptions)options );
QCOMPARE( encoded, data );
// Check that the terminal response PDU can be parsed correctly.
QSimTerminalResponse decodedResp = QSimTerminalResponse::fromPdu(resp);
QVERIFY( data.contains( decodedResp.commandPdu() ) );
if ( resptype < 0x0100 ) {
QVERIFY( decodedResp.result() == (QSimTerminalResponse::Result)resptype );
QVERIFY( decodedResp.causeData().isEmpty() );
QVERIFY( decodedResp.cause() == QSimTerminalResponse::NoSpecificCause );
} else {
QVERIFY( decodedResp.result() == (QSimTerminalResponse::Result)(resptype >> 8) );
QVERIFY( decodedResp.causeData().size() == 1 );
QVERIFY( decodedResp.cause() == (QSimTerminalResponse::Cause)(resptype & 0xFF) );
}
// Check that the original terminal response PDU can be reconstructed correctly.
QCOMPARE( decodedResp.toPdu(), resp );
}
示例3: command
/*!
Sends a proactive SIM command, \a cmd, to the ME, and instructs
SimApplication to invoke \a slot on \a target when the response
arrives back. The \a options provides extra information about
how the command should be transmitted to the ME in PDU form.
For \c SetupMenu commands, \a target and \a slot should be null.
When the user responds to the main menu, mainMenuSelection() or
mainMenuHelpRequest() will be invoked.
\sa mainMenuSelection(), mainMenuHelpRequest()
*/
void SimApplication::command( const QSimCommand& cmd,
QObject *target, const char *slot,
QSimCommand::ToPduOptions options )
{
// Record the command details, together with the type of
// TERMINAL RESPONSE or ENVELOPE that we expect in answer.
d->currentCommand = cmd.toPdu( options );
d->expectedType = cmd.type();
d->target = target;
d->slot = slot;
// Send an unsolicited notification to indicate that a new
// proactive SIM command is available. If we are already in
// the middle of processing a TERMINAL RESPONSE or ENVELOPE,
// then delay the unsolicited notification until later.
if ( d->rules && !d->inResponse ) {
d->rules->unsolicited
( "*TCMD: " + QString::number( d->currentCommand.size() ) );
}
}
示例4: testEncodePowerOnCard
void tst_QSimToolkit::testEncodePowerOnCard()
{
QFETCH( QByteArray, data );
QFETCH( QByteArray, resp );
QFETCH( QByteArray, atr );
QFETCH( int, resptype );
QFETCH( int, device );
QFETCH( int, options );
// Output a dummy line to give some indication of which test we are currently running.
qDebug() << "";
// Check that the command PDU can be parsed correctly.
QSimCommand decoded = QSimCommand::fromPdu(data);
QVERIFY( decoded.type() == QSimCommand::PowerOnCard );
QVERIFY( decoded.destinationDevice() == (QSimCommand::Device)( device + 0x10 ) );
// Check that the original command PDU can be reconstructed correctly.
QByteArray encoded = decoded.toPdu( (QSimCommand::ToPduOptions)options );
QCOMPARE( encoded, data );
// Check that the terminal response PDU can be parsed correctly.
QSimTerminalResponse decodedResp = QSimTerminalResponse::fromPdu(resp);
QVERIFY( data.contains( decodedResp.commandPdu() ) );
if ( resptype < 0x0100 ) {
QVERIFY( decodedResp.result() == (QSimTerminalResponse::Result)resptype );
QVERIFY( decodedResp.causeData().isEmpty() );
QVERIFY( decodedResp.cause() == QSimTerminalResponse::NoSpecificCause );
} else {
QVERIFY( decodedResp.result() == (QSimTerminalResponse::Result)(resptype >> 8) );
QVERIFY( decodedResp.causeData().size() == 1 );
QVERIFY( decodedResp.cause() == (QSimTerminalResponse::Cause)(resptype & 0xFF) );
}
QCOMPARE( decodedResp.extensionField(0xA1), atr );
// Check that the original terminal response PDU can be reconstructed correctly.
QCOMPARE( decodedResp.toPdu(), resp );
}
示例5: testEncodeSendSMS
void tst_QSimToolkit::testEncodeSendSMS()
{
QFETCH( QByteArray, data );
QFETCH( QByteArray, resp );
QFETCH( QByteArray, tpdu );
QFETCH( int, resptype );
QFETCH( QString, text );
QFETCH( QString, number );
QFETCH( bool, smsPacking );
QFETCH( int, iconId );
QFETCH( bool, iconSelfExplanatory );
QFETCH( QByteArray, textAttribute );
QFETCH( QString, html );
QFETCH( int, options );
// Output a dummy line to give some indication of which test we are currently running.
qDebug() << "";
// Check that the command PDU can be parsed correctly.
QSimCommand decoded = QSimCommand::fromPdu(data);
QVERIFY( decoded.type() == QSimCommand::SendSMS );
QVERIFY( decoded.destinationDevice() == QSimCommand::Network );
QCOMPARE( decoded.text(), text );
if ( text.isEmpty() ) {
if ( ( options & QSimCommand::EncodeEmptyStrings ) != 0 )
QVERIFY( decoded.suppressUserFeedback() );
else
QVERIFY( !decoded.suppressUserFeedback() );
} else {
QVERIFY( !decoded.suppressUserFeedback() );
}
QCOMPARE( decoded.number(), number );
QCOMPARE( decoded.smsPacking(), smsPacking );
QCOMPARE( (int)decoded.iconId(), iconId );
QCOMPARE( decoded.iconSelfExplanatory(), iconSelfExplanatory );
QCOMPARE( decoded.textAttribute(), textAttribute );
if ( !textAttribute.isEmpty() )
QCOMPARE( decoded.textHtml(), html );
// Check the final TPDU. If packing is specified, we have to parse the SMS
// and then re-encode it with the 7-bit alphabet.
QByteArray newtpdu = decoded.extensionField(0x8B);
if ( smsPacking ) {
// Add dummy service center address that isn't in the TPDU before decoding.
QSMSMessage msg = QSMSMessage::fromPdu( QByteArray( 1, 0 ) + newtpdu );
msg.setDataCodingScheme( msg.dataCodingScheme() & 0xF3 ); // Convert to 7-bit
// Convert back into a pdu and strip off the dummy service center address.
newtpdu = msg.toPdu().mid(1);
}
// The TPDU in the command will have a message reference of 0.
// We need to change it to the transmission message reference of 1
// before we do the comparison.
newtpdu[1] = (char)1;
QCOMPARE( newtpdu, tpdu );
// Check that the original command PDU can be reconstructed correctly.
QByteArray encoded = decoded.toPdu( (QSimCommand::ToPduOptions)options );
QCOMPARE( encoded, data );
// Check that the terminal response PDU can be parsed correctly.
QSimTerminalResponse decodedResp = QSimTerminalResponse::fromPdu(resp);
QVERIFY( data.contains( decodedResp.commandPdu() ) );
if ( resptype < 0x0100 ) {
QVERIFY( decodedResp.result() == (QSimTerminalResponse::Result)resptype );
QVERIFY( decodedResp.causeData().isEmpty() );
QVERIFY( decodedResp.cause() == QSimTerminalResponse::NoSpecificCause );
} else {
QVERIFY( decodedResp.result() == (QSimTerminalResponse::Result)(resptype >> 8) );
QVERIFY( decodedResp.causeData().size() == 1 );
QVERIFY( decodedResp.cause() == (QSimTerminalResponse::Cause)(resptype & 0xFF) );
}
// Check that the original terminal response PDU can be reconstructed correctly.
QCOMPARE( decodedResp.toPdu(), resp );
}