diff options
author | Denis Kenzior <denkenz@gmail.com> | 2012-09-27 13:44:34 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2012-10-03 09:10:42 -0500 |
commit | 92685a10a5b40cda596cdfddf79c252c2c0d1e34 (patch) | |
tree | eb78c0bcfef80449c14046faf7fed7463def0648 /tools | |
parent | 575ef1fd16cadce328f8b555e69eb11606655133 (diff) | |
download | ofono-92685a10a5b40cda596cdfddf79c252c2c0d1e34.tar.bz2 |
stktest: Add send_proactive_command utility
Diffstat (limited to 'tools')
-rw-r--r-- | tools/stktest.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/stktest.c b/tools/stktest.c index e141375a..43b97ba1 100644 --- a/tools/stktest.c +++ b/tools/stktest.c @@ -71,6 +71,27 @@ static int modem_mode = 0; static gboolean create_tcp(void); +static const char *to_hex(const unsigned char *data, unsigned int len) +{ + static char buf[512+1]; + unsigned int i; + + for (i = 0; i < len; i++) + sprintf(buf + i * 2, "%02hhX", data[i]); + + buf[i*2] = '\0'; + + return buf; +} + +static void send_proactive_command(const unsigned char *pdu, unsigned int len) +{ + char buf[1024]; + + sprintf(buf, "+CUSATP: %s", to_hex(pdu, len)); + g_at_server_send_unsolicited(emulator, buf); +} + static DBusMessage *stktest_error_invalid_args(DBusMessage *msg) { return g_dbus_create_error(msg, STKTEST_ERROR ".InvalidArguments", |