gnokii-users
[Top][All Lists]
Advanced

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

Re: Statemachine: wait for many types


From: BORBELY Zoltan
Subject: Re: Statemachine: wait for many types
Date: Thu, 13 Feb 2003 00:07:11 +0100
User-agent: Mutt/1.4i

Hi,

On Wed, Feb 12, 2003 at 10:34:23PM +0200, Osma Suominen wrote:
> However, the 3110 protocol is such that the phone usually has different
> return codes (i.e. message types) to indicate a succesful and a failed
> operation. Thus e.g. 0x28 is "SMS sent OK" and 0x29 is "SMS send error".
> 
> The problem is that the driver code doesn't know beforehand if the
> operation will succeed or not, so it has to wait for either of the two
> messages to appear. sm_block(), however, only takes a single expected
> message type as argument. This means that it can't be used for this
> purpose and lower level statemachine functions have to be used instead.
> In practice almost identical copies of the sm_block_timeout() function
> appear in the 3110 driver in many places, and more will come if the 3110
> driver functionality is expanded (e.g. phonebook handling). That is pure
> copy-paste coding and very ugly.

The structure of the FBUS1 frame is the following (from nokia.txt):

    { FrameID, FrameLength, MsgType, {block}, SeqNo, ChkSum }

and the fbus-3110.c code calls statemachine with

    { MsgType, {block}, SeqNo, ChkSum }

The fbus-3110.c code used only by the nk3110.c driver, so we can modify
it. What about if we call sm_incoming_function with a constant message
type? It isn't too nice but it's a one line modification. The nk3110.c
code can decode the original message type from buffer[0].

Bye,
Bozo




reply via email to

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