本文整理汇总了C++中QSimCommand::addExtensionField方法的典型用法代码示例。如果您正苦于以下问题:C++ QSimCommand::addExtensionField方法的具体用法?C++ QSimCommand::addExtensionField怎么用?C++ QSimCommand::addExtensionField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSimCommand
的用法示例。
在下文中一共展示了QSimCommand::addExtensionField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testDeliverRefresh
void tst_QSimToolkit::testDeliverRefresh()
{
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() << "";
// Clear the client/server state.
server->clear();
deliveredCommand = QSimCommand();
// Compose and send the command.
QSimCommand cmd;
cmd.setType( QSimCommand::Refresh );
cmd.setRefreshType( (QSimCommand::RefreshType)refreshtype );
if ( numfiles > 0 ) {
QByteArray extData;
extData += (char)numfiles;
extData += QAtUtils::fromHex( fileids );
cmd.addExtensionField( 0x92, extData );
}
server->emitCommand( cmd );
// Wait for the command to arrive in the client.
QVERIFY( QFutureSignal::wait( this, SIGNAL(commandSeen()), 100 ) );
// Verify that the command was delivered exactly as we asked.
QVERIFY( deliveredCommand.type() == cmd.type() );
QVERIFY( deliveredCommand.refreshType() == cmd.refreshType() );
QVERIFY( deliveredCommand.extensionData() == cmd.extensionData() );
QCOMPARE( deliveredCommand.toPdu( (QSimCommand::ToPduOptions)options ), data );
// The response should have been sent immediately.
QCOMPARE( server->responseCount(), 1 );
QCOMPARE( server->envelopeCount(), 0 );
if ( resptype != 0x0003 ) {
QCOMPARE( server->lastResponse(), resp );
} else {
// We cannot test the "additional EF's read" case because the qtopiaphone
// library will always respond with "command performed successfully".
QByteArray resp2 = resp;
resp2[resp2.size() - 1] = 0x00;
QCOMPARE( server->lastResponse(), resp2 );
}
}
示例2: testUISendSMS
void tst_QSimToolkit::testUISendSMS()
{
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 );
Q_UNUSED(html);
Q_UNUSED(options);
// Skip tests that we cannot test using the "simapp" UI.
if ( resptype == 0x0004 ) { // Icon not displayed
QSKIP( "", SkipSingle );
}
// Output a dummy line to give some indication of which test we are currently running.
qDebug() << "";
// Create the command to be tested.
QSimCommand cmd;
cmd.setType( QSimCommand::SendSMS );
cmd.setDestinationDevice( QSimCommand::Network );
cmd.setText( text );
if ( text.isEmpty() && ( options & QSimCommand::EncodeEmptyStrings ) != 0 )
cmd.setSuppressUserFeedback( true );
cmd.setNumber( number );
cmd.setSmsPacking( smsPacking );
cmd.setIconId( (uint)iconId );
cmd.setIconSelfExplanatory( iconSelfExplanatory );
cmd.setTextAttribute( textAttribute );
QByteArray newtpdu = tpdu;
if ( smsPacking ) {
// To prevent truncation of the 1.4.1 test data during 7-bit to 8-bit conversion,
// we extract the TPDU from "data" rather than use "tpdu".
newtpdu = QSimCommand::fromPdu( data ).extensionField(0x8B);
}
newtpdu[1] = (char)0;
cmd.addExtensionField( 0x8B, newtpdu );
// Set up the server with the command, ready to be selected
// from the "Run Test" menu item on the test menu.
server->startUsingTestMenu( cmd );
QVERIFY( waitForView( SimMenu::staticMetaObject ) );
// Clear the server state just before we request the actual command under test.
server->clear();
// Select the first menu item.
select();
// Wait for the text to display. If user feedback is suppressed, then
// the command is supposed to be performed silently.
if ( cmd.suppressUserFeedback() )
QVERIFY( !waitForView( SimText::staticMetaObject ) );
else
QVERIFY( waitForView( SimText::staticMetaObject ) );
// Check that the response is what we expected. The response is
// sent automatically by the back-end and is always "success".
QCOMPARE( server->responseCount(), 1 );
QCOMPARE( server->envelopeCount(), 0 );
QCOMPARE( server->lastResponse(), resp );
}
示例3: testDeliverSendSMS
void tst_QSimToolkit::testDeliverSendSMS()
{
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 );
Q_UNUSED(html);
// Output a dummy line to give some indication of which test we are currently running.
qDebug() << "";
// Clear the client/server state.
server->clear();
deliveredCommand = QSimCommand();
// Compose and send the command.
QSimCommand cmd;
cmd.setType( QSimCommand::SendSMS );
cmd.setDestinationDevice( QSimCommand::Network );
cmd.setText( text );
if ( text.isEmpty() && ( options & QSimCommand::EncodeEmptyStrings ) != 0 )
cmd.setSuppressUserFeedback( true );
cmd.setNumber( number );
cmd.setSmsPacking( smsPacking );
cmd.setIconId( (uint)iconId );
cmd.setIconSelfExplanatory( iconSelfExplanatory );
cmd.setTextAttribute( textAttribute );
QByteArray newtpdu = tpdu;
if ( smsPacking ) {
// To prevent truncation of the 1.4.1 test data during 7-bit to 8-bit conversion,
// we extract the TPDU from "data" rather than use "tpdu".
newtpdu = QSimCommand::fromPdu( data ).extensionField(0x8B);
}
newtpdu[1] = (char)0;
cmd.addExtensionField( 0x8B, newtpdu );
server->emitCommand( cmd );
// Wait for the command to arrive in the client.
QVERIFY( QFutureSignal::wait( this, SIGNAL(commandSeen()), 100 ) );
// Verify that the command was delivered exactly as we asked.
QVERIFY( deliveredCommand.type() == cmd.type() );
QVERIFY( deliveredCommand.text() == cmd.text() );
QVERIFY( deliveredCommand.suppressUserFeedback() == cmd.suppressUserFeedback() );
QVERIFY( deliveredCommand.number() == cmd.number() );
QVERIFY( deliveredCommand.smsPacking() == cmd.smsPacking() );
QVERIFY( deliveredCommand.iconId() == cmd.iconId() );
QVERIFY( deliveredCommand.iconSelfExplanatory() == cmd.iconSelfExplanatory() );
QVERIFY( deliveredCommand.extensionData() == cmd.extensionData() );
QVERIFY( deliveredCommand.textAttribute() == cmd.textAttribute() );
QCOMPARE( deliveredCommand.toPdu( (QSimCommand::ToPduOptions)options ), data );
// The terminal response should have been sent immediately to ack reception of the command.
QCOMPARE( server->responseCount(), 1 );
QCOMPARE( server->envelopeCount(), 0 );
if ( resptype != 0x0004 ) {
QCOMPARE( server->lastResponse(), resp );
} else {
// We cannot test the "icon not displayed" case because the qtopiaphone
// library will always respond with "command performed successfully".
// Presumably the Qtopia user interface can always display icons.
QByteArray resp2 = resp;
resp2[resp2.size() - 1] = 0x00;
QCOMPARE( server->lastResponse(), resp2 );
}
}