comparison src/cs/services/mks/mks_handle_message.c @ 0:92470e5d0b9e

src: partial import from FC Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 01:28:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92470e5d0b9e
1 /**
2 * @file mks_handle_msg.c
3 *
4 * Coding of the mks_handle_msg function, which is called when the SWE
5 * receives a new message.
6 *
7 * @author Laurent Sollier (l-sollier@ti.com)
8 * @version 0.1
9 */
10
11 /*
12 * History:
13 *
14 * Date Author Modification
15 * ----------------------------------------
16 * 11/19/2001 L Sollier Create
17 *
18 *
19 * (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved
20 */
21
22 #include "mks/mks_api.h"
23 #include "mks/mks_i.h"
24 #include "mks/mks_messages_i.h"
25
26 #include "rv/rv_general.h"
27 #include "rvf/rvf_api.h"
28 #include "rvm/rvm_use_id_list.h"
29
30 /**
31 * @name Functions implementation
32 *
33 */
34 /*@{*/
35
36 /**
37 * function: mks_handle_msg
38 */
39 T_RV_RET mks_handle_msg(T_RV_HDR *msg_p)
40 {
41 if (msg_p != NULL)
42 {
43 switch (msg_p->msg_id)
44 {
45 /* A new magic key sequence is added */
46 case MKS_INFOS_KEY_SEQUENCE_MSG:
47 {
48 T_MKS_INFOS_KEY_SEQUENCE_MSG* msg_infos_key_sequence_p= (T_MKS_INFOS_KEY_SEQUENCE_MSG*) msg_p;
49
50 MKS_SEND_TRACE("MKS: 'Add magic key sequence' message received", RV_TRACE_LEVEL_DEBUG_LOW);
51
52 mks_add_key_sequence_i(msg_infos_key_sequence_p);
53 break;
54 }
55
56 /* A magic key sequence is removed */
57 case MKS_REMOVE_KEY_SEQUENCE_MSG:
58 {
59 T_MKS_REMOVE_KEY_SEQUENCE_MSG* msg_remove_key_sequence_p= (T_MKS_REMOVE_KEY_SEQUENCE_MSG*) msg_p;
60
61 MKS_SEND_TRACE("MKS: 'Remove magic key sequence' message received", RV_TRACE_LEVEL_DEBUG_LOW);
62
63 mks_remove_key_sequence_i(msg_remove_key_sequence_p);
64 break;
65 }
66
67
68 /* Process a key released */
69 case KPD_KEY_EVENT_MSG:
70 {
71 T_KPD_KEY_EVENT_MSG* msg_key_event_p= (T_KPD_KEY_EVENT_MSG*) msg_p;
72
73 mks_check_key_sequence(msg_key_event_p);
74 break;
75 }
76
77 /* Check the subscription status */
78 case KPD_STATUS_MSG:
79 {
80 T_KPD_STATUS_MSG* msg_keypad_status_p= (T_KPD_STATUS_MSG*) msg_p;
81
82 if (msg_keypad_status_p->operation == KPD_SUBSCRIBE_OP)
83 {
84 if (msg_keypad_status_p->status_value == KPD_PROCESS_OK)
85 {
86 MKS_SEND_TRACE("MKS: Keypad subscription OK", RV_TRACE_LEVEL_DEBUG_LOW);
87 }
88 else
89 {
90 MKS_SEND_TRACE("MKS: Keypad subscription failed", RV_TRACE_LEVEL_ERROR);
91 }
92 }
93 else
94 {
95 MKS_SEND_TRACE("MKS: Unexpected keypad status message received", RV_TRACE_LEVEL_ERROR);
96 }
97
98 break;
99 }
100
101 default:
102 {
103 /* Unknow message has been received */
104 MKS_SEND_TRACE("MKS: Message received unknown", RV_TRACE_LEVEL_ERROR);
105 break;
106 }
107 }
108
109 /* Free message */
110 rvf_free_buf(msg_p);
111 }
112
113 return RV_OK;
114 }
115
116 /*@}*/