1 // Copyright (C) 2018-2020 Alibaba Group Holding Limited
2 // Adaptations to ESP-IDF Copyright (c) 2020 Espressif Systems (Shanghai) Co. Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef _GENIE_EVENT_H_
17 #define _GENIE_EVENT_H_
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif /**< __cplusplus */
22 
23 typedef enum {
24     /* START--- Don't add new ID before this one */
25     GENIE_EVT_START = 0,
26 
27     /* Reset Related Operation */
28     GENIE_EVT_SW_RESET = GENIE_EVT_START,   /* triggered from cloud */
29     GENIE_EVT_HW_RESET_START,               /* triggered from user */
30     GENIE_EVT_HW_RESET_DONE,                /*triggered by reset by repeat module */
31 
32     /* SDK triggered event, with prefix of GENIE_EVT_SDK_MESH_ */
33     GENIE_EVT_SDK_START,
34     GENIE_EVT_SDK_MESH_INIT = GENIE_EVT_SDK_START,
35     GENIE_EVT_SDK_MESH_PBADV_START,
36     GENIE_EVT_SDK_MESH_PBADV_TIMEOUT,
37     GENIE_EVT_SDK_MESH_SILENT_START,
38 
39     GENIE_EVT_SDK_MESH_PROV_START,
40     GENIE_EVT_SDK_MESH_PROV_TIMEOUT,
41     GENIE_EVT_SDK_MESH_PROV_SUCCESS,
42     GENIE_EVT_SDK_MESH_PROV_FAIL,
43 
44     GENIE_EVT_SDK_APPKEY_ADD,
45     GENIE_EVT_SDK_APPKEY_DEL,
46     GENIE_EVT_SDK_APPKEY_UPDATE,
47     GENIE_EVT_SDK_NETKEY_ADD,
48     GENIE_EVT_SDK_NETKEY_DEL,
49     GENIE_EVT_SDK_NETKEY_UPDATE,
50     GENIE_EVT_SDK_SUB_ADD,
51     GENIE_EVT_SDK_SUB_DEL,
52     GENIE_EVT_SDK_HB_SET,
53     GENIE_EVT_SDK_SEQ_UPDATE,
54     GENIE_EVT_SDK_STATE_SYNC,
55     GENIE_EVT_SDK_IVI_UPDATE,
56     GENIE_EVENT_SUB_SET,
57     GENIE_EVENT_HB_SET,
58 
59     GENIE_EVT_SDK_ANALYZE_MSG,
60 
61     GENIE_EVT_SDK_AIS_DISCON,
62     GENIE_EVT_SDK_DELAY_START,
63     GENIE_EVT_SDK_DELAY_END,
64     GENIE_EVT_SDK_TRANS_START,
65     GENIE_EVT_SDK_TRANS_CYCLE,
66     GENIE_EVT_SDK_TRANS_END,
67     GENIE_EVT_SDK_ACTION_DONE,
68 
69     GENIE_EVT_SDK_MESH_PWRON_INDC,
70     GENIE_EVT_SDK_INDICATE,
71     GENIE_EVT_SDK_VENDOR_MSG,
72 
73     /* APP triggered event, with prefix of GENIE_EVT_APP_ */
74     GENIE_EVT_APP_START,
75     GENIE_EVT_APP_FAC_QUIT = GENIE_EVT_APP_START,
76     GENIE_EVT_TIME_OUT,
77 
78     /* Board */
79     GENIE_EVT_BUTTON_TAP,
80     GENIE_EVT_SDK_COLOR_ACTION,
81     GENIE_EVT_RESET_BY_REPEAT_NOTIFY, /* triggered by reset */
82 
83     /* END --- Don't add new ID after this one */
84     GENIE_EVT_END
85 
86 } genie_event_t;
87 
88 /**
89  * @brief The handler for the underlying events. If necessary
90  *      this handler dispatch the user events to applications.
91  *
92  * @param event refers to the event details.
93  * @param args refers to the additional information for the event.
94  */
95 void genie_event(genie_event_t event, void *args);
96 
97 #ifdef __cplusplus
98 }
99 #endif /**< __cplusplus */
100 
101 #endif /* _GENIE_EVENT_H_ */
102