stktest: Add send_proactive_command utility

This commit is contained in:
Denis Kenzior 2012-09-27 13:44:34 -05:00
parent 575ef1fd16
commit 92685a10a5
1 changed files with 21 additions and 0 deletions

View File

@ -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",