Active Topics

 



Notices


Reply
Thread Tools
Posts: 4 | Thanked: 7 times | Joined on Dec 2009
#11
@白い熊:
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.
 

The Following 2 Users Say Thank You to goodwill For This Useful Post:
Posts: 451 | Thanked: 334 times | Joined on Sep 2009
#12
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?

Last edited by 白い熊; 2009-12-22 at 13:07.
 
qole's Avatar
Moderator | Posts: 7,109 | Thanked: 8,820 times | Joined on Oct 2007 @ Vancouver, BC, Canada
#13
Daniel Wilms from the Maemo team said they're working on getting the Telepathy API documented with examples, but it is a complex task. He said it over here in the "Incoming call hook" thread.
__________________
qole.org --- twitter --- Easy Debian wiki page
Please don't send me a private message, post to the appropriate thread.
Thank you all for your donations!
 

The Following 2 Users Say Thank You to qole For This Useful Post:
Posts: 4 | Thanked: 7 times | Joined on Dec 2009
#14
Originally Posted by 白い熊 View Post
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?
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);
 

The Following 5 Users Say Thank You to goodwill For This Useful 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
 
Posts: 4 | Thanked: 7 times | Joined on Dec 2009
#16
Originally Posted by z3phyr View Post
do you have to type all that code everytime you wanna send a txt
Not really. If you already had dbus_conn and dbus_proxy, just call dbus_g_proxy_call (with the parameter is your text - SMS encoding of course)
 
Posts: 451 | Thanked: 334 times | Joined on Sep 2009
#17
Originally Posted by goodwill View Post
I used dbus_glib to do the job. To send your SMS, I can do something like this.
Thanks. Can you modify it, so it accepts the array of bytes, passed as a comma-delimited string argument maybe, so I can compile this and use from the commandline?
 
Posts: 8 | Thanked: 7 times | Joined on Dec 2009 @ London
#18
Hi,

Is this code everything that I need to add into my code to send sms?
What about phone number where I am sending sms?
 
Posts: 14 | Thanked: 18 times | Joined on Dec 2009
#19
Hi,

I've managed to send an SMS using python D-bus. If you are interested you can check the link in pymaemo wiki http://wiki.maemo.org/PyMaemo#Tutorials or http://www.paraiso.dk/pymaemosms.txt. Hope it'll help.

regards,
shaun
 

The Following 2 Users Say Thank You to shaunramos For This Useful Post:
Posts: 8 | Thanked: 7 times | Joined on Dec 2009 @ London
#20
Thanks for your reply, I tried it but with no success. Where should I put phone number and message?
 
Reply


 
Forum Jump


All times are GMT. The time now is 05:43.