[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sending multiple SMSs via libgnokii
From: |
Pawel Kot |
Subject: |
Re: Sending multiple SMSs via libgnokii |
Date: |
Fri, 25 Mar 2011 22:19:23 +0100 |
Hi,
On Fri, Mar 25, 2011 at 22:14, Peter Koch <address@hidden> wrote:
> 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.
Use case of multiple is not much different than single SMS.
> Step 1: declaring some global variables, namely:
>
> static struct gn_statemachine *state=NULL;
> static gn_data *data=NULL;
> static gn_sms sms;
They do not need to be global.
> Step 2: Initialising:
>
> gn_lib_phoneprofile_load_from_file("/etc/gnokiirc",NULL,&state);
> gn_lib_phone_open(state);
I'd call this step 2b.
> data=&state->sm_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.
What exactly lasts very long? And what means very long? It usually
takes 1-2 seconds to send out the SMS.
> 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.
You'd need to repeat only step 2b and 4.
take care,
--
Pawel Kot