mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
27 lines
983 B
C
27 lines
983 B
C
#include "PikaStdDevice_BaseDev.h"
|
|
#include "BaseObj.h"
|
|
#include "PikaObj.h"
|
|
#include "dataStrs.h"
|
|
|
|
PikaEventListener* g_pika_device_event_listener;
|
|
|
|
void PikaStdDevice_BaseDev_addEventCallBack(PikaObj* self, Arg* eventCallBack) {
|
|
obj_setArg(self, "eventCallBack", eventCallBack);
|
|
/* init event_listener for the first time */
|
|
if (NULL == g_pika_device_event_listener) {
|
|
pks_eventLisener_init(&g_pika_device_event_listener);
|
|
}
|
|
if (PIKA_RES_OK != obj_runNativeMethod(self, "platformGetEventId", NULL)) {
|
|
obj_setErrorCode(self, 1);
|
|
__platform_printf("Error: Method %s no found.\r\n",
|
|
"platformGetEventId");
|
|
}
|
|
uint32_t eventId = obj_getInt(self, "eventId");
|
|
pks_eventLicener_registEvent(g_pika_device_event_listener, eventId, self);
|
|
}
|
|
|
|
void PikaStdDevice_BaseDev_platformGetEventId(PikaObj* self) {
|
|
obj_setErrorCode(self, 1);
|
|
obj_setSysOut(self, "[error] platform method need to be override.");
|
|
}
|