View Single Post
Posts: 104 | Thanked: 10 times | Joined on Dec 2009
#15
Originally Posted by goodwill View Post
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);

do you have to type all that code everytime you wanna send a txt