00001
00012 #define GITKR_TEL_KEYBOARD_C
00013
00014 #include <stdlib.h>
00015
00016 #include "gitkrdefines.h"
00017
00018 #include "tel_keyboard.h"
00019
00022 int key_of_char(int keynumber){
00023 switch (keynumber){
00024 case KEY_RAUTE:
00025 return 11;
00026 case KEY_STAR:
00027 return 9;
00028 case KEY_ZERO:
00029 return 10;
00030 case KEY_ONE:
00031 return 0;
00032 case KEY_TWO:
00033 return 1;
00034 case KEY_THREE:
00035 return 2;
00036 case KEY_FOUR:
00037 return 3;
00038 case KEY_FIVE:
00039 return 4;
00040 case KEY_SIX:
00041 return 5;
00042 case KEY_SEVEN:
00043 return 6;
00044 case KEY_EIGHT:
00045 return 7;
00046 case KEY_NINE:
00047 return 8;
00048 case KEY_A:
00049 return 12;
00050 case KEY_B:
00051 return 13;
00052 case KEY_C:
00053 return 14;
00054 case KEY_D:
00055 return 15;
00056 }
00057 return 16;
00058 }
00059
00062 char get_ascii_of_key(int key, int key_offset){
00063 int index = 0;
00064 div_t hdiv;
00065 hdiv = div(key_offset, asciiInfo.max_keyOffset[key]);
00066 key_offset = hdiv.rem;
00067 index = asciiInfo.keyPos[key]+key_offset;
00068
00069 return asciiTable[index];
00070 }
00071
00074 int navigation(int key, int table){
00075 switch (table){
00076 case KEY_TABLE_ARROW:
00077 return menueCntlTable[key];
00078 case KEY_TABLE_NUMBER:
00079 return numberTable[key];
00080 case KEY_TABLE_TELEPHONE:
00081 return '*';
00082 }
00083 return '\0';
00084 }