Add STK APDU editor
cover Add STK APDU editor
Add to phonesim the capability to symply send STK APDU
Nicolas Bertrand (3):
phonesim: accept STK command without application
controlbase_ui: Add manual stk command editor
control: Link functionnality to STK command editor
src/control.cpp | 12 ++++++++++++ src/control.h | 2 ++ src/controlbase.ui | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/phonesim.cpp | 8 ++++++-- 4 files changed, 66 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/3 phonesim: accept STK command without application
If the STK command is rightly formated, send OK even if the sim application does not handle it. it's needed to be able to manualy send STK command.
--- src/phonesim.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
src/phonesim.cpp +6 -2
@@ -985,8 +985,10 @@ bool SimRules::simCommand( const QString& cmd ) QByteArray response = QAtUtils::fromHex( cmd.mid(start) ); QSimTerminalResponse resp = QSimTerminalResponse::fromPdu( response ); - if ( !toolkitApp || !toolkitApp->response( resp ) ) + if ( ( resp.command().type() == QSimCommand::NoCommand ) || !toolkitApp ) respond( "ERROR" ); + else if ( !toolkitApp->response( resp ) ) + respond( "OK" ); return true; }
@@ -997,8 +999,10 @@ bool SimRules::simCommand( const QString& cmd ) QByteArray envelope = QAtUtils::fromHex( cmd.mid(start) ); QSimEnvelope env = QSimEnvelope::fromPdu( envelope ); - if (!toolkitApp || !toolkitApp->envelope( env ) ) + if ( ( env.type() == QSimEnvelope::NoEnvelope ) || !toolkitApp ) respond( "ERROR" ); + else if ( !toolkitApp->envelope( env ) ) + respond( "OK" ); return true; }
Signature · 1 line
1.7.9.5
PATCH 2/3 controlbase_ui: Add manual stk command editor
In reply to Nicolas Bertrand--- src/controlbase.ui | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
src/controlbase.ui +46 -0
@@ -1161,6 +1161,52 @@ </widget> </item> <item> + <widget class="QGroupBox" name="gbSTKCmd"> + <property name="title"> + <string>STK Command</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <widget class="QPushButton" name="pbSTKCmdSend"> + <property name="geometry"> + <rect> + <x>80</x> + <y>150</y> + <width>141</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string>Send</string> + </property> + </widget> + <widget class="QTextEdit" name="teSTKCmdEditor"> + <property name="geometry"> + <rect> + <x>235</x> + <y>20</y> + <width>401</width> + <height>161</height> + </rect> + </property> + </widget> + <widget class="QPushButton" name="pbSTKClear"> + <property name="geometry"> + <rect> + <x>80</x> + <y>100</y> + <width>141</width> + <height>31</height> + </rect> + </property> + <property name="text"> + <string>Clear</string> + </property> + </widget> + </widget> + </item> + <item> <widget class="QGroupBox" name="gbSATK"> <property name="title"> <string>Application</string>
Signature · 1 line
1.7.9.5
PATCH 3/3 control: Link functionnality to STK command editor
In reply to Nicolas Bertrand--- src/control.cpp | 12 ++++++++++++ src/control.h | 2 ++ 2 files changed, 14 insertions(+)
src/control.cpp +12 -0
@@ -91,6 +91,8 @@ ControlWidget::ControlWidget(const QString &ruleFile, Control *parent) connect(ui->pbAlerting, SIGNAL(clicked()), this, SLOT(setStateAlerting())); connect(ui->pbActive, SIGNAL(clicked()), this, SLOT(setStateConnected())); connect(ui->pbHangup, SIGNAL(clicked()), this, SLOT(setStateHangup())); + connect(ui->pbSTKCmdSend, SIGNAL(clicked()), this, SLOT(STKCmdSend())); + connect(ui->pbSTKClear, SIGNAL(clicked()), this, SLOT(STKClear())); QStringList headers; headers << "Sender" << "Priority" << "Notification Status";
@@ -625,6 +627,16 @@ void Control::handleNewApp() widget->handleNewApp(); } +void ControlWidget::STKCmdSend() +{ + emit unsolicitedCommand( "+CUSATP: " + ui->teSTKCmdEditor->toPlainText() ); +} + +void ControlWidget::STKClear() +{ + ui->teSTKCmdEditor->clear(); +} + void ControlWidget::simAppStart() { if ( ui->cbSimApps->currentIndex() >= 0 )
src/control.h +2 -0
@@ -107,6 +107,8 @@ private slots:void setStateAlerting ();void setStateConnected ();void setStateHangup (); +void STKCmdSend (); +void STKClear (); signals: void unsolicitedCommand(const QString &);
Signature · 1 line
1.7.9.5
Hi Nicolas,
Quoted 7 lines · Nicolas Bertrand
Add to phonesim the capability to symply send STK APDU
Nicolas Bertrand (3):
phonesim: accept STK command without application
controlbase_ui: Add manual stk command editor
control: Link functionnality to STK command editor
Quoted 6 lines
src/control.cpp | 12 ++++++++++++ src/control.h | 2 ++ src/controlbase.ui | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/phonesim.cpp | 8 ++++++-- 4 files changed, 66 insertions(+), 2 deletions(-)
I don't like this idea at all, pasting arbitrary PDUs is slow, error prone and does not encourage any sort of automation. While Phonesim is meant for people who know what they're doing, I'd still like to maintain at least some resemblance of user-friendliness.
If you really need some way of sending PDUs that phonesim is incapable of, feel free to modify the conformance application to emit the PDU in question.
Regards,
-Denis