gnokii-users
[Top][All Lists]
Advanced

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

Re: adding to nk7110.c


From: BORBELY Zoltan
Subject: Re: adding to nk7110.c
Date: Thu, 13 Feb 2003 00:49:30 +0100
User-agent: Mutt/1.4i

Hi,

On Tue, Feb 11, 2003 at 05:38:11PM +0000, Tobie Kerridge wrote:
> I'm trying to understand how to add the enterchar function to nk7110.c, 
> in essence I think this effects the file in three places;
> 
> 1 prototyping the function:
> 
>       static gn_error NK7110_EnterChar(gn_data *data, struct 
>       gn_statemachine *state);
> 
> 2 adding a case statement:
> 
>       case GN_OP_EnterChar:
>               return NK7110_EnterChar(data, state);

Ok.

> 3 adding a function called "EnterChar":
> 
>       static gn_error EnterChar(gn_data *data, struct gn_statemachine 
>       *state)
>       {
>               code
>       }

NK7110_EnterChar

> I'm going to base that function on a piece of code from nk6110.c, and 
> use nk6110.txt and nk7110.txt as a guide for the modification. Assuming 
> I'm not oversimplifying the process grossly (I bet I am!) it seems that 
> there are not too many parts of this function which are specific to the 
> 6110, apart from an opening statement:
> 
> nk6100_keytable *keytable = DRVINSTANCE(state)->keytable;
> 
> which I must admit I don't wholly understand, and is my first stumbling 
> block. is "nk6100_keytable" included in one of the header files at the 
> opening of the document? Is there an equivalent  "nk7100_keytable", or 
> is this where the real work lies, or am I talking nonsense?

You can find the nk6100_keytable in include/phones/nk6100.h. The nk6100
driver keeps its phone instance specific state variables in an allocated
block pointed by DRVINSTANCE(state).

When the nk6100 initialises the phone it will get the key assignment
from the phone. The key assignment message contains the characters for
each phone key. The driver builds a reverse table from it. The index
is the character code, the value contains the code of the phone key and
the number of times it must press, e.g.:

    keytable['d'] = { KEY_3, 1 }
    keytable['e'] = { KEY_3, 2 }
    keytable['z'] = { KEY_9, 4 }

The EnterChar function tries to simulate phone press from these information.
Before you call this function assumes if you press a button you will get
an uppercase character (this is the default behaviour in the 6110). If
the specified character is lowercase it must press the HASH (#) key. It
will toggle it into lowercase mode. The ASTERISK key is handled specially
by the 6110. It will display the special characters menu. If this was a
lowercase character it will switch back into uppercase mode. If it was
an uppercase character theoretically we finished. But in this case if
you press this key again after the previous (e.g. AA) it will switch into
the B character. So we press the HASH key twice (switching into lowercase
mode and uppercase again). So you can type two A character in success.

Bye,
Bozo




reply via email to

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