20 lines
771 B
C
Raw Normal View History

2022-12-24 14:54:46 +08:00
#include "PikaStdDevice_common.h"
extern PikaEventListener* g_pika_device_event_listener;
void _PikaStdDevice_event_handler(pika_dev* dev, int signal) {
2022-12-27 16:07:22 +08:00
pks_eventListener_sendSignal(g_pika_device_event_listener, (uintptr_t)dev,
2022-12-27 18:53:26 +08:00
signal);
2022-12-24 14:54:46 +08:00
}
void _PikaStdDevice_setCallBack(PikaObj* self,
Arg* eventCallback,
uint32_t eventId) {
obj_setArg(self, "eventCallBack", eventCallback);
/* init event_listener for the first time */
if (NULL == g_pika_device_event_listener) {
2022-12-27 16:07:22 +08:00
pks_eventListener_init(&g_pika_device_event_listener);
2022-12-24 14:54:46 +08:00
}
/* regist event to event listener */
2022-12-27 16:07:22 +08:00
pks_eventListener_registEvent(g_pika_device_event_listener, eventId, self);
2022-12-24 14:54:46 +08:00
}