gnokii-users
[Top][All Lists]
Advanced

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

Re: SMS notifications for the AT driver


From: Bastien Nocera
Subject: Re: SMS notifications for the AT driver
Date: Sun, 08 Jul 2007 12:32:57 +0100

On Sun, 2007-07-08 at 12:22 +0200, Pawel Kot wrote:
> On 7/8/07, Bastien Nocera <address@hidden> wrote:
> > On Sun, 2007-07-08 at 02:28 +0200, Pawel Kot wrote:
> > > Hi,
> > >
> > > On 7/7/07, Bastien Nocera <address@hidden> wrote:
> > > > > +CMTI: "ME",172
> > > > >
> > > > > +CMTI: "ME",175
> > > > >
> > > > > +CMTI: "ME",172
> > > >
> > > > I still have a problem in that the gn_sms_get() gets the wrong message
> > > > from the phone. Any ideas?
> > >
> > > There's another problem. atbus driver is not ready for unsolicited
> > > messages which handling involves sending and receiving data. Handler
> > > function is called before rewinding atbus message buffer. I don't
> > > fully understand atbus_rx_statemachine() code so haven't done any
> > > changes yet. All sm_incoming_function() should be at the end of the
> > > function, but there's probably some side effect of that. Will take a
> > > closer look tomorrow. Any volunteers for that are welcome. Attached
> > > updates Bastien's patch for further testing.
> >
> > How about postponing the call of the notification to the next
> > gn_sm_loop() call?
> 
> Makes sense but how would you want to do it?

typedef struct {
        u8 messagetype;
        char *line;
} gn_at_signal;

in atbux_rx_statemachine():
gn_at_signal *signal;
signal = malloc (sizeof(gn_at_signal));
signal->messagetype = GN_OP_AT_IncomingSMS;
signal->line = malloc(bi->rbuf_pos - 1 - (start - bi->rbuf) + 1);
strncpy (signal->line, start, bi->rbuf_pos - 1 - (start - bi->rbuf));
/* ... append signal to a list */

And in atbus_loop():
while (list != NULL) {
        gn_at_signal *signal = list->data;
        sm_incoming_function(signal->messagetype, strlen(signal->line),
signal->line, sm);
        free (signal->line);
        free (signal);
        //FIXME destroy the list item as well
        list = list->next;
}

> > The atbus driver (which is used by the AT generic, and other AT drivers)
> > is the only one to have such a problem. We could push the event onto a
> > list in atbus_rx_statemachine(), and pop it in atbus_loop().
> 
> List of what?

gn_at_signals in that case.

> > If we do it at the beginning of the atbus_loop, we probably wouldn't
> > waste any time getting notifications.
> 
> Sorry if the questions are too trivial but I just woke up.

The only problem is a good implementation of a list, and fitting it in
the statemachine.

-- 
Bastien Nocera <address@hidden> 





reply via email to

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