Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
Node: C sendEvent (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnsAnns authored May 13, 2024
2 parents 6db9f6c + 23c374d commit 832b26a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion node/code/inc/EVENTS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cstdint>

enum EVENTS: uint16_t {
extern "C" enum EVENTS: uint16_t {
TERMINATE,
WILDCARD, // Subscribe to all events [Special case]
PING,
Expand Down
2 changes: 1 addition & 1 deletion node/code/inc/dispatch_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DispatchHandler {
* @brief Send an event to the dispatcher.
* @param event The event to send.
*/
static void sendEvent(msg_t *event) {
void sendEvent(msg_t *event) {
if (DISPATCHER_PID == -1) {
cout << "Dispatcher PID not set yet!" << endl;
return;
Expand Down
17 changes: 17 additions & 0 deletions node/code/inc/dispatch_sender.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

#include "shell_commands.hpp"
#include "msg.h"

/**
* @brief Send an event to the dispatcher (with C support)
* @param event The event to send.
*/
extern "C" void sendEvent(msg_t *event) {
if (DISPATCHER_THREAD_ID == -1) {
cout << "Dispatcher PID not set yet!" << endl;
return;
}

msg_try_send(event, DISPATCHER_PID);
}

0 comments on commit 832b26a

Please sign in to comment.