1 /**
2  ****************************************************************************************
3  *
4  * @file app_task.h
5  *
6  * @brief Header file - APPTASK.
7  *
8  * Copyright (C) RivieraWaves 2009-2015
9  *
10  *
11  ****************************************************************************************
12  */
13 
14 #ifndef APP_TASK_H_
15 #define APP_TASK_H_
16 
17 /**
18  ****************************************************************************************
19  * @addtogroup APPTASK Task
20  * @ingroup APP
21  * @brief Routes ALL messages to/from APP block.
22  *
23  * The APPTASK is the block responsible for bridging the final application with the
24  * RWBLE software host stack. It communicates with the different modules of the BLE host,
25  * i.e. @ref SMP, @ref GAP and @ref GATT.
26  *
27  * @{
28  ****************************************************************************************
29  */
30 
31 /*
32  * INCLUDE FILES
33  ****************************************************************************************
34  */
35 
36 #include "rwip_config.h"             // SW configuration
37 
38 #if (BLE_APP_PRESENT)
39 
40 #include <stdint.h>         // Standard Integer
41 #include "rwip_task.h"      // Task definitions
42 #include "ke_task.h"        // Kernel Task
43 
44 /*
45  * DEFINES
46  ****************************************************************************************
47  */
48 
49 /// Number of APP Task Instances
50 #define APP_IDX_MAX                 (1)
51 
52 /*
53  * ENUMERATIONS
54  ****************************************************************************************
55  */
56 
57 /// States of APP task
58 enum appm_state
59 {
60     /// Initialization state
61     APPM_INIT,
62     /// Database create state
63     APPM_CREATE_DB,
64     /// Ready State
65     APPM_READY,
66     /// Advertising state
67     APPM_ADVERTISING,
68     /// Connected state
69     APPM_CONNECTED,
70     /// start encypt
71     APPM_START_ENC,
72     /// BO
73     APPM_ENCRYPTED,
74     /// Number of defined states.
75     APPM_STATE_MAX
76 };
77 
78 /// APP Task messages
79 enum appm_msg
80 {
81     APPM_DUMMY_MSG = TASK_FIRST_MSG(TASK_ID_APP),
82 
83     /// Timer used to automatically stop advertising
84     APP_ADV_TIMEOUT_TIMER,
85 
86     #if (BLE_APP_HT)
87     /// Timer used to refresh the temperature measurement value
88     APP_HT_MEAS_INTV_TIMER,
89     #endif //(BLE_APP_HT)
90 
91     #if (BLE_APP_HID)
92     /// Timer used to disconnect the moue if no activity is detecter
93     APP_HID_MOUSE_TIMEOUT_TIMER,
94     #endif //(BLE_APP_HID)
95 };
96 
97 
98 /*
99  * GLOBAL VARIABLE DECLARATIONS
100  ****************************************************************************************
101  */
102 
103 extern const struct ke_state_handler appm_default_handler;
104 extern ke_state_t appm_state[APP_IDX_MAX];
105 
106 /// @} APPTASK
107 
108 #endif //(BLE_APP_PRESENT)
109 
110 #endif // APP_TASK_H_
111