gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sending multiple SMSs via libgnokii


From: Peter Koch
Subject: Sending multiple SMSs via libgnokii
Date: Fri, 25 Mar 2011 22:14:39 +0100

Hi all

I'm trying to send multiple SMS via libgnokii API-calls. There seems to be no documentation for the API - at least I could not find any.

So I looked through the source of the command line utility and tried to figure out how sending a SMS is supposed to work.

Here's what my own application is doing now:

Step 1: declaring some global variables, namely:

static struct gn_statemachine *state=NULL;
static gn_data *data="">static gn_sms sms;

Step 2: Initialising:

gn_lib_phoneprofile_load_from_file("/etc/gnokiirc",NULL,&state);
gn_lib_phone_open(state);

data="">data->sms=&sms;
gn_sms_default_submit(data->sms);

Step 3: Reading the SMSCenter-Number

gn_sms_message_center msg_center; // local variable

data->message_center=&msg_center;
data->message_center->id=1;
gn_sm_functions(GN_OP_GetSMSCenter, data, state);
sms.smsc.type=data->message_center->smsc.type;

Step 4: Sending SMS

sms.user_data[0].type=GN_SMS_DATA_Text;
sprintf(sms.user_data[0].u.text, "%.918s", msg);
sms.user_data[0].length=strlen(sms.user_data[0].u.text);
sms.user_data[1].type=GN_SMS_DATA_None;
gn_sms_send(data, state);

If all these four steps are repeated for each SMS then sending multiple SMS does work but lasts very long.

Of course I would like to do the initialization just once and just repeat step 4 for every SMS. But then gn_sms_send() will either fail after a lenghty timeout or block forever.

So what am I doing wrong?

Peter

reply via email to

[Prev in Thread] Current Thread [Next in Thread]