📄 ti1_key.c
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) $Workfile:: ti1_key.c $|
| $Author:: Es $ CONDAT GmbH $Revision:: 13 $|
| CREATED: 28.01.99 $Modtime:: 21.01.00 15:05 $|
| STATE : code |
+--------------------------------------------------------------------+
MODULE : TI1_KEY
PURPOSE : keyboard driver interface (TI1 VERSION)
EXPORT :
TO DO :
$History:: ti1_key.c $
*
* ***************** Version 13 *****************
* User: Es Date: 21.01.00 Time: 16:15
* Updated in $/GSM/Condat/MS/SRC/MFW
*
|
| ***************** Version 12 *****************
| User: Le Date: 12.01.00 Time: 12:59
| Updated in $/GSM/Condat/MS/SRC/MFW
*
* ***************** Version 11 *****************
* User: Es Date: 9.07.99 Time: 21:29
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 10 *****************
* User: Es Date: 6.07.99 Time: 18:37
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 9 *****************
* User: Es Date: 6.07.99 Time: 12:41
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 8 *****************
* User: Es Date: 14.04.99 Time: 17:34
* Updated in $/GSM/DEV/MS/SRC/MFW
* moved to CST
*
* ***************** Version 7 *****************
* User: Es Date: 1.04.99 Time: 17:07
* Updated in $/GSM/DEV/MS/SRC/MFW
* removed lots of traces
*
* ***************** Version 6 *****************
* User: Es Date: 20.02.99 Time: 19:24
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 5 *****************
* User: Es Date: 20.02.99 Time: 18:22
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 4 *****************
* User: Es Date: 20.02.99 Time: 14:43
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 3 *****************
* User: Es Date: 17.02.99 Time: 20:00
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 2 *****************
* User: Es Date: 10.02.99 Time: 19:51
* Updated in $/GSM/DEV/MS/SRC/MFW
*
* ***************** Version 1 *****************
* User: Es Date: 9.02.99 Time: 14:53
* Created in $/GSM/DEV/MS/SRC/MFW
* TI display & keyboard interface for MFW
*/
#define ENTITY_MFW
#if defined (NEW_FRAME)
#include "typedefs.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"
#include "prim.h"
#else
#include "stddefs.h"
#include "custom.h"
#include "gsm.h"
#include "vsi.h"
#endif
#include <string.h>
#include "mfw_mfw.h"
#include "mfw_sys.h"
#include "mfw_kbd.h"
#include "gdi.h"
#include "kbd.h"
#include "drv_key.h"
#include "ti1_key.h"
#include "kpd_api.h"
BOOL powered_on=FALSE;
#define POWER_KEY 25
extern void mmiInit(void);
/*
* Marcus: Issue 811: 05:09/2002:
* Moved kbd_map, simkbd_map and config_map to \g23m\Condat\COM\SRC\DRIVER\keypad.c
*/
/* driver callback */
static void kbdCb (drv_SignalID_Type *signal_params);
UBYTE keypad_initialize (void);
void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id,
T_KPD_KEY_STATE key_state,
T_KPD_PRESS_STATE press_state);
static void (*sig) (char,char) = 0; /* kbd signaling function */
static char *keyMap = (char *) kbd_map; /* current keyboard mapping */
T_KPD_SUBSCRIBER subscriber_p; /* keep the subscription indentification value */
typedef struct
{
U32 msg_id;
void (*callback_func)(void *);
U16 src_addr_id;
U16 dest_addr_id;
} T_RV_CHECK;
/* JVJ #1874 - new function to initialize the power key*/
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : key_power_init |
| STATE : code ROUTINE : key_power_init |
+--------------------------------------------------------------------+
PURPOSE : initialize the power key handler in the TI driver
*/
void key_power_init()
{
kbd_Init(kbdCb);
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : ti1_key |
| STATE : code ROUTINE : keyInit |
+--------------------------------------------------------------------+
PURPOSE : initialize keyboard driver
*/
void keyInit (void (*s)(char,char))
{
sig = s;
/*
* read keyboard mapping from EEPROM.
* if this fails set keyboard mapping with default values.
*
* EEPROM reading not now !!!
*/
keyMap = (char *) kbd_map;
//new keypad driver
keypad_initialize ();
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : ti1_key |
| STATE : code ROUTINE : keyExit |
+--------------------------------------------------------------------+
PURPOSE : finalize keyboard driver
*/
void keyExit (void)
{
sig = 0;
//unsubscribe the client from the keypad driver
#ifndef _SIMULATION_
kpd_unsubscribe (&subscriber_p);
#endif
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : ti1_key |
| STATE : code ROUTINE : getKeyIndex |
+--------------------------------------------------------------------+
PURPOSE : returns the index to the key provided (or -1 if no match)
*/
char drvGetKeyIndex( char key)
{
int i;
#ifndef _SIMULATION_
for (i = 0; i < 32; i++)
{
if (keyMap[i] == key)
{
return (i);
}
}
#else
/* TEST only ES!! */
for (i = 0; i < NUM_KPD_KEYS; i++)
{
if (simkbd_map[i] == key)
{
return (i);
}
}
#endif
return (-1); //No match.
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : ti1_key |
| STATE : code ROUTINE : drvKeyUpDown |
+--------------------------------------------------------------------+
PURPOSE : handle key event (called from keyboard)
*/
void drvKeyUpDown (char upDown, char key)
{
TRACE_EVENT_P2("drvKeyUpDown : key = %d : state = %x", key, upDown);
/* JVJ #1705 The first KEY event can only be the Power Key*/
/* This will start MMI */
if ((!powered_on))
{
powered_on =TRUE;
/* JVJ #1705 MMI will be started here */
mmiInit();
return;
}
if (key != (char)0)
{
if ((key >= 48) && (key <=57))
{
key -= 47;
}
else
{
switch(key)
{
case 35:
key = (char)18;
break;
case 42:
key = (char)17;
break;
case 45:
key = (char)11;
break;
case 67:
key = (char)13;
break;
case 69:
key = (char)25;
break;
case 86:
key = (char)16;
break;
case 94:
key = (char)14;
break;
case 97:
key = (char)15;
break;
case 98:
key = (char)12;
break;
default:
key = (char)0;
break;
}
}
kbd_putMakeAndKey( upDown, key);
}
if (!sig) return; /* no event handler */
sig((char)(!upDown),0);
return;
}
/*
+--------------------------------------------------------------------+
| PROJECT : MMI-Framework (8417) MODULE : ti1_key |
| STATE : code ROUTINE : mfw_keystroke |
+--------------------------------------------------------------------+
PURPOSE : handle keystroke primitive (called from aci-pei)
keystroke sent via 'PEI-CONFIG'-primitive
used in Test cases and by RT;
*/
void mfw_keystroke (char * key)
{
char i, number;
if (!sig) return; /* no event handler */
if (!key) return; /* no valid key */
number = 0;
while (strlen(key))
{
if (!strcmp(key,"#*43*1#"))
{
// EF we need to place the key code into the buffer
// together with the inverse of the key status, and then call sig
kbd_putMakeAndKey(0,19); /* simulate HUP */
sig(0,0);
kbd_putMakeAndKey(1,19);
sig(0,0);
key += 7;
continue;
}
if (!strcmp(key,"#*43*0#"))
{
kbd_putMakeAndKey(0,18); /* simulate CALL */
sig(0,0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -