About intercepting SMS with destination port number in Qtopia 2.1 (phone edition)

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Hi,

I am working on an application that handles SMS
with destination port number in Qtopia 2.1 (phone
edition). The idea is to let qtmail to handle all
normal SMS, and let my application to handle all
SMS with destination port number. Based on info
at these two links (see below) I came up with
a solution:

http://doc.trolltech.com/qtopia2.1/html/phonelibrary.html#9-1
http://doc.trolltech.com/qtopia2.1/html/qpeapplication.html#appMessage

I've been testing my application for quite some
time. So far all SMS with destination port number
are delivered to qtmail. None of the SMS are
passed to my application. I've spent some time
to search on various Qtopia forums, still couldn't
find any useful hints. Hope some of you could
kindly give me some enlightenments on this issue.
Thanks in advance!

What I've done so far can be summaried as below:

Suppose I want my application to intercept SMS
with destination port number 3456. (Ideal case
is that the application can intercept SMS
with any given destination port number).

1. Register the smsapp service

1.1 Create file "/opt/Qtopia/service/smsapp/3456/smstest":

[Extensions]
[Standard]
Version = 100

1.2 Create file "/opt/Qtopia/service/smsapp.service":

[Extensions]
[Standard]
Version = 100
/opt/Qtopia/services # cat smsapp.service
[Translation]
File=QtopiaServices
Context=SMS
[Service]
Actions = smsApplicationDatagram(SMSMessage)
Name[]=smsapp/3456
[smsApplicationDatagram(SMSMessage)]

2. Build executable that handles SMS in
"opt/Qtopia/bin/smstest"

Functions/Class related to SMS handling
are listed below:

int main( int argc, char** argv )
{
QPEApplication app(argc, argv);
QMainWindow *mainWindow = new SMSTest(&app, 0, 0, 0);
app.showMainWidget(mainWindow);
return app.exec();
}

SMSTest::SMSTest( QPEApplication * qapplication,
QWidget* parent, const char* name, WFlags fl )

: QMainWindow( parent, name, fl )
{
this->qapplication = qapplication;

Init();

}

void
SMSTest::Init()
{
this->showMaximized();

connect( qapplication, SIGNAL( appMessage( const QCString&, const
QByteArray& ) ),
this, SLOT( receiveSMS( const QCString&, const QByteArray& ) ) );
}


void
SMSTest::receiveSMS( const QCString& msg, const QByteArray& data )
{
trace("receiveSMS() - 01\n");

QDataStream stream( data, IO_ReadOnly );
if ( msg == "smsApplicationDatagram(SMSMessage)") {
trace("receiveSMS() -02\n");
SMSMessage smsMsg;
stream >> smsMsg;
}
}


Site Timeline