Added event callback functionality in icsneoc

This commit is contained in:
EricLiu2000
2019-08-02 16:32:15 -04:00
parent 4f735a651c
commit 9040edc25d
3 changed files with 46 additions and 5 deletions
+16
View File
@@ -490,6 +490,22 @@ neoversion_t icsneo_getVersion(void) {
return icsneo::GetVersion();
}
int icsneo_addEventCallback(void (*callback)(neoevent_t), void* filter) {
(void)filter; // unused for now
return EventManager::GetInstance().addEventCallback(
EventCallback(
[=](std::shared_ptr<icsneo::APIEvent> evt) {
return callback(*(evt->getNeoEvent()));
}
)
);
}
bool icsneo_removeEventCallback(int id) {
return EventManager::GetInstance().removeEventCallback(id);
}
bool icsneo_getEvents(neoevent_t* events, size_t* size) {
if(size == nullptr) {
EventManager::GetInstance().add(APIEvent::Type::RequiredParameterNull, APIEvent::Severity::Error);