mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
- Create `Include/` folder for all main projects - Fix some issues here and there (found while moving things) - All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
#include "tt_message_queue.h"
|
|
#include <Tactility/MessageQueue.h>
|
|
|
|
#define HANDLE_TO_MESSAGE_QUEUE(handle) ((tt::MessageQueue*)(handle))
|
|
|
|
extern "C" {
|
|
|
|
MessageQueueHandle tt_message_queue_alloc(uint32_t capacity, uint32_t messageSize) {
|
|
return new tt::MessageQueue(capacity, messageSize);
|
|
}
|
|
|
|
void tt_message_queue_free(MessageQueueHandle handle) {
|
|
delete HANDLE_TO_MESSAGE_QUEUE(handle);
|
|
}
|
|
|
|
bool tt_message_queue_put(MessageQueueHandle handle, const void* message, TickType_t timeout) {
|
|
return HANDLE_TO_MESSAGE_QUEUE(handle)->put(message, timeout);
|
|
}
|
|
|
|
bool tt_message_queue_get(MessageQueueHandle handle, void* message, TickType_t timeout) {
|
|
return HANDLE_TO_MESSAGE_QUEUE(handle)->get(message, timeout);
|
|
}
|
|
|
|
uint32_t tt_message_queue_get_capacity(MessageQueueHandle handle) {
|
|
return HANDLE_TO_MESSAGE_QUEUE(handle)->getCapacity();
|
|
}
|
|
|
|
uint32_t tt_message_queue_get_message_size(MessageQueueHandle handle) {
|
|
return HANDLE_TO_MESSAGE_QUEUE(handle)->getMessageSize();
|
|
}
|
|
|
|
uint32_t tt_message_queue_get_count(MessageQueueHandle handle) {
|
|
return HANDLE_TO_MESSAGE_QUEUE(handle)->getCount();
|
|
}
|
|
|
|
uint32_t tt_message_queue_get_space(MessageQueueHandle handle) {
|
|
return HANDLE_TO_MESSAGE_QUEUE(handle)->getSpace();
|
|
}
|
|
|
|
bool tt_message_queue_reset(MessageQueueHandle handle) {
|
|
return HANDLE_TO_MESSAGE_QUEUE(handle)->reset();
|
|
}
|
|
|
|
}
|