|
2009-12-22
, 13:03
|
Posts: 451 |
Thanked: 334 times |
Joined on Sep 2009
|
#12
|
|
2009-12-22
, 18:25
|
|
Moderator |
Posts: 7,109 |
Thanked: 8,820 times |
Joined on Oct 2007
@ Vancouver, BC, Canada
|
#13
|
|
2009-12-23
, 02:15
|
Posts: 4 |
Thanked: 7 times |
Joined on Dec 2009
|
#14
|
Yeah, I know, noticed... Just tried to trick it, if it'd maybe work without an array inside an array.
Can you write a simple C wrapper that would send the second argument to the first argument when called from a commandline, that we could compile and use for the purpose of sending CLI SMSes? I can't. Anyone else?
#include <dbus/dbus.h> #include <dbus/dbus-glib.h> #define MYTYPE (dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_UCHAR_ARRAY)) DBusGConnection* dbus_conn; DBusGProxy* dbus_proxy; dbus_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); dbus_proxy = dbus_g_proxy_new_for_name(dbus_conn, "com.nokia.phone.SMS", "/com/nokia/phone/SMS/ba212ae1","com.nokia.csd.SMS.Outgoing"); GPtrArray* ptrarray; GArray* array; guchar values[] = {33,5,11,145,33,67,101,135,9,241,0,0,10,225,112,56,28,14,135,195,225,48}; ptrarray = g_ptr_array_new(); array = g_array_new(FALSE, FALSE, sizeof(guchar)); g_array_append_vals(array, values, sizeof(values)/sizeof(guchar)); g_ptr_array_add(ptrarray, (gpointer)array); dbus_g_proxy_call_no_reply(dbus_proxy, "Send", MY_TYPE, ptrarray, G_TYPE_STRING,"",G_TYPE_INVALID); g_ptr_array_free(ptrarray,TRUE); g_object_unref(dbus_proxy); dbus_g_connection_unref(dbus_conn);
The Following 5 Users Say Thank You to goodwill For This Useful Post: | ||
|
2009-12-23
, 02:29
|
Posts: 104 |
Thanked: 10 times |
Joined on Dec 2009
|
#15
|
I used dbus_glib to do the job. To send your SMS, I can do something like this.
Code:#include <dbus/dbus.h> #include <dbus/dbus-glib.h> #define MYTYPE (dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_UCHAR_ARRAY)) DBusGConnection* dbus_conn; DBusGProxy* dbus_proxy; dbus_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); dbus_proxy = dbus_g_proxy_new_for_name(dbus_conn, "com.nokia.phone.SMS", "/com/nokia/phone/SMS/ba212ae1","com.nokia.csd.SMS.Outgoing"); GPtrArray* ptrarray; GArray* array; guchar values[] = {33,5,11,145,33,67,101,135,9,241,0,0,10,225,112,56,28,14,135,195,225,48}; ptrarray = g_ptr_array_new(); array = g_array_new(FALSE, FALSE, sizeof(guchar)); g_array_append_vals(array, values, sizeof(values)/sizeof(guchar)); g_ptr_array_add(ptrarray, (gpointer)array); dbus_g_proxy_call_no_reply(dbus_proxy, "Send", MY_TYPE, ptrarray, G_TYPE_STRING,"",G_TYPE_INVALID); g_ptr_array_free(ptrarray,TRUE); g_object_unref(dbus_proxy); dbus_g_connection_unref(dbus_conn);
|
2009-12-23
, 02:41
|
Posts: 4 |
Thanked: 7 times |
Joined on Dec 2009
|
#16
|
|
2009-12-23
, 07:40
|
Posts: 451 |
Thanked: 334 times |
Joined on Sep 2009
|
#17
|
|
2009-12-28
, 23:18
|
Posts: 8 |
Thanked: 7 times |
Joined on Dec 2009
@ London
|
#18
|
|
2009-12-28
, 23:48
|
Posts: 14 |
Thanked: 18 times |
Joined on Dec 2009
|
#19
|
|
2009-12-29
, 00:22
|
Posts: 8 |
Thanked: 7 times |
Joined on Dec 2009
@ London
|
#20
|
The structure of data for the method call is array of array of byte but you used array of byte in your command line.
Unfortunately, dbus-send doesn't support complex structure. So, you have to write a simple program to send dbus command.
Hope it helped.