1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 #ifndef OSAL_SYSEVENT_H 9 #define OSAL_SYSEVENT_H 10 11 #include "hdf_dlist.h" 12 13 #define HDF_SYSEVENT 0xFADE 14 15 /* hdf sys event class definition */ 16 #define HDF_SYSEVENT_CLASS_POWER 0x00000001 17 18 /* hdf power event definition */ 19 enum PowerKeventId { 20 KEVENT_POWER_SUSPEND, 21 KEVENT_POWER_DISPLAY_OFF, 22 KEVENT_POWER_RESUME, 23 KEVENT_POWER_DISPLAY_ON, 24 KEVENT_POWER_EVENT_MAX, 25 }; 26 27 struct HdfSysEvent { 28 uint64_t eventClass; 29 uint32_t eventid; 30 const char *content; 31 uint64_t syncToken; 32 }; 33 34 struct HdfSysEventNotifyNode; 35 36 typedef int (*HdfSysEventNotifierFn)( 37 struct HdfSysEventNotifyNode *self, uint64_t eventClass, uint32_t event, const char *content); 38 39 struct HdfSysEventNotifyNode { 40 HdfSysEventNotifierFn callback; 41 struct DListHead listNode; 42 uint64_t classFilter; 43 }; 44 45 int HdfSysEventNotifyRegister(struct HdfSysEventNotifyNode *notifierNode, uint64_t classSet); 46 void HdfSysEventNotifyUnregister(struct HdfSysEventNotifyNode *notifierNode); 47 int HdfSysEventSend(uint64_t eventClass, uint32_t event, const char *content, bool sync); 48 49 #endif // #ifndef OSAL_SYSEVENT_H