1 /**
2  * \file gammu-keys.h
3  * \author Michal Čihař
4  *
5  * Keys data and functions.
6  */
7 #ifndef __gammu_keys_h
8 #define __gammu_keys_h
9 
10 #ifdef	__cplusplus
11 extern "C" {
12 #endif
13 
14 /**
15  * \defgroup Keys Keys
16  * Keyboard manipulations.
17  */
18 
19 #include <gammu-error.h>
20 #include <gammu-statemachine.h>
21 #include <gammu-types.h>
22 
23 #include <stdlib.h>		/* Needed for size_t declaration */
24 
25 /**
26  * Key event identifiers.
27  *
28  * \ingroup Keys
29  */
30 typedef enum {
31 	GSM_KEY_NONE = 0x00,
32 	GSM_KEY_1 = 0x01,
33 	GSM_KEY_2,
34 	GSM_KEY_3,
35 	GSM_KEY_4,
36 	GSM_KEY_5,
37 	GSM_KEY_6,
38 	GSM_KEY_7,
39 	GSM_KEY_8,
40 	GSM_KEY_9,
41 	GSM_KEY_0,
42 	/**
43 	 * #
44 	 */
45 	GSM_KEY_HASH,
46 	/**
47 	 * *
48 	 */
49 	GSM_KEY_ASTERISK,
50 	/**
51 	 * Power key.
52 	 */
53 	GSM_KEY_POWER,
54 	/**
55 	 * in some phone ie. N5110 sometimes works identical to POWER
56 	 */
57 	GSM_KEY_GREEN,
58 	/**
59 	 * (c) key in some phone: ie. N5110
60 	 */
61 	GSM_KEY_RED,
62 	/**
63 	 * Not available in some phones as separate button: ie. N5110
64 	 */
65 	GSM_KEY_INCREASEVOLUME,
66 	/**
67 	 * Not available in some phones as separate button: ie. N5110
68 	 */
69 	GSM_KEY_DECREASEVOLUME,
70 	GSM_KEY_UP = 0x17,
71 	GSM_KEY_DOWN,
72 	GSM_KEY_MENU,
73 	/**
74 	 * Not available in some phone: ie. N5110
75 	 */
76 	GSM_KEY_NAMES,
77 	/**
78 	 * Left arrow
79 	 */
80 	GSM_KEY_LEFT,
81 	/**
82 	 * Right arrow
83 	 */
84 	GSM_KEY_RIGHT,
85 	/**
86 	 * Software key which has assigned mening on display.
87 	 */
88 	GSM_KEY_SOFT1,
89 	/**
90 	 * Software key which has assigned mening on display.
91 	 */
92 	GSM_KEY_SOFT2,
93 	/**
94 	 * Button on headset
95 	 */
96 	GSM_KEY_HEADSET,
97 	/**
98 	 * Joystick pressed
99 	 */
100 	GSM_KEY_JOYSTICK,
101 	/**
102 	 * Camera button pressed
103 	 */
104 	GSM_KEY_CAMERA,
105 	/**
106 	 * Media player button
107 	 */
108 	GSM_KEY_MEDIA,
109 	/**
110 	 * Multi function key, desktop
111 	 */
112 	GSM_KEY_DESKTOP,
113 	/**
114 	 * Operator button
115 	 */
116 	GSM_KEY_OPERATOR,
117 	/**
118 	 * Return button
119 	 */
120 	GSM_KEY_RETURN,
121 	/**
122 	 * Clear button
123 	 */
124 	GSM_KEY_CLEAR,
125 } GSM_KeyCode;
126 
127 /**
128  * Creates key sequence from string.
129  *
130  * \param text Text to convert.
131  * \param KeyCode Storage for key codes.
132  * \param Length Storage for resulting length.
133  *
134  * \return Error code.
135  *
136  * \ingroup Keys
137  */
138 GSM_Error MakeKeySequence(char *text, GSM_KeyCode * KeyCode, size_t * Length);
139 
140 /**
141  * Emulates key press or key release.
142  *
143  * \ingroup Keys
144  */
145 GSM_Error GSM_PressKey(GSM_StateMachine * s, GSM_KeyCode Key, gboolean Press);
146 #ifdef	__cplusplus
147 }
148 #endif
149 #endif
150 
151 /* Editor configuration
152  * vim: noexpandtab sw=8 ts=8 sts=8 tw=72:
153  */
154