annotate src/cs/services/fcbm/fcbm_kpd_if.c @ 255:1a4413c4eb7e

FCHG: missed charging start event in BSIM mode
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 May 2021 23:20:23 +0000
parents baa738eeb842
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
230
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module implements the interface to KPD for FCBM.
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include "fcbm/fcbm_env.h"
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include "fcbm/fcbm_func_i.h"
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "kpd/kpd_api.h"
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "rv/rv_general.h"
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "rvf/rvf_api.h"
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "rvm/rvm_use_id_list.h"
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 static T_KPD_SUBSCRIBER fcbm_kpd_sub;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 T_RV_RET fcbm_subscribe_kpd(void)
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 {
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 T_RV_RET rc;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 T_RV_RETURN return_path;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 T_KPD_VIRTUAL_KEY_TABLE notified_keys;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return_path.callback_func = 0;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 return_path.addr_id = fcbm_addr_id;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 notified_keys.nb_notified_keys = KPD_NB_PHYSICAL_KEYS;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 notified_keys.notified_keys[0] = KPD_KEY_0;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 notified_keys.notified_keys[1] = KPD_KEY_1;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 notified_keys.notified_keys[2] = KPD_KEY_2;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 notified_keys.notified_keys[3] = KPD_KEY_3;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 notified_keys.notified_keys[4] = KPD_KEY_4;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 notified_keys.notified_keys[5] = KPD_KEY_5;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 notified_keys.notified_keys[6] = KPD_KEY_6;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 notified_keys.notified_keys[7] = KPD_KEY_7;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 notified_keys.notified_keys[8] = KPD_KEY_8;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 notified_keys.notified_keys[9] = KPD_KEY_9;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 notified_keys.notified_keys[10] = KPD_KEY_UP;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 notified_keys.notified_keys[11] = KPD_KEY_DOWN;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 notified_keys.notified_keys[12] = KPD_KEY_SOFT_LEFT;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 notified_keys.notified_keys[13] = KPD_KEY_SOFT_RIGHT;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 notified_keys.notified_keys[14] = KPD_KEY_CONNECT;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 notified_keys.notified_keys[15] = KPD_KEY_DISCONNECT;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 notified_keys.notified_keys[16] = KPD_KEY_STAR;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 notified_keys.notified_keys[17] = KPD_KEY_DIESE;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 notified_keys.notified_keys[18] = KPD_KEY_LEFT;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 notified_keys.notified_keys[19] = KPD_KEY_RIGHT;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 notified_keys.notified_keys[20] = KPD_KEY_ENTER;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 notified_keys.notified_keys[21] = KPD_KEY_VOL_UP;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 notified_keys.notified_keys[22] = KPD_KEY_VOL_DOWN;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 notified_keys.notified_keys[23] = KPD_KEY_RECORD;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 rc = kpd_subscribe(&fcbm_kpd_sub, KPD_DEFAULT_MODE, &notified_keys,
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 return_path);
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 if (rc != RV_OK) {
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 rvf_send_trace("kpd_subscribe() failed", 22, rc,
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 return rc;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 }
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /* long press and repeat times are dummies copied from MFW */
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 rc = kpd_define_key_notification(fcbm_kpd_sub, &notified_keys,
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 KPD_FIRST_PRESS_NOTIF |
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 KPD_RELEASE_NOTIF, 30, 50);
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 if (rc != RV_OK)
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 rvf_send_trace("kpd_define_key_notification() failed", 36, rc,
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 return rc;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 }
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 T_RV_RET fcbm_unsubscribe_kpd(void)
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 {
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 T_RV_RET rc;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 rc = kpd_unsubscribe(&fcbm_kpd_sub);
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 if (rc != RV_OK)
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 rvf_send_trace("kpd_unsubscribe() failed", 24, rc,
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 return rc;
baa738eeb842 FCBM code implemented in first pass
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 }