aboutsummaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAndreas Lindhé <andreas@lindhe.io>2017-10-31 08:33:46 +0100
committerAndreas Lindhé <andreas@lindhe.io>2017-10-31 08:41:40 +0100
commitbc5ecd6da7f068a12b9ee5397178723481c7a3ea (patch)
tree6ac5bb33df7c3aacde8eb254c4aee1ce1df9dd29 /includes
parent2d5d5be5702867a7a719312a5a148489c3b68f31 (diff)
downloadmidbro-bc5ecd6da7f068a12b9ee5397178723481c7a3ea.tar.gz
midbro-bc5ecd6da7f068a12b9ee5397178723481c7a3ea.tar.bz2
Move all files one level down
Diffstat (limited to 'includes')
-rw-r--r--includes/broevent.h4
-rw-r--r--includes/fifoqueue.h18
-rw-r--r--includes/midbro.h6
-rw-r--r--includes/types.h37
4 files changed, 65 insertions, 0 deletions
diff --git a/includes/broevent.h b/includes/broevent.h
new file mode 100644
index 0000000..5e34f5c
--- /dev/null
+++ b/includes/broevent.h
@@ -0,0 +1,4 @@
+#ifndef BROEVENT_H
+#define BROEVENT_H
+void * bro_event_listener(void * args);
+#endif
diff --git a/includes/fifoqueue.h b/includes/fifoqueue.h
new file mode 100644
index 0000000..75b09c4
--- /dev/null
+++ b/includes/fifoqueue.h
@@ -0,0 +1,18 @@
+#ifndef FIFOQUEUE_H
+#define FIFOQUEUE_H
+#include "types.h"
+
+Fifo_q * init_queue(int size);
+
+Sensor_t * create_sensor_object(int value, int uid);
+
+boolean is_full(Fifo_q * q);
+
+boolean is_empty(Fifo_q * q);
+
+int add_to_queue(Fifo_q * q, Sensor_t * sensor);
+
+Sensor_t * pop_from_queue(Fifo_q * q);
+
+void print_queue(Fifo_q * q);
+#endif
diff --git a/includes/midbro.h b/includes/midbro.h
new file mode 100644
index 0000000..e7143a3
--- /dev/null
+++ b/includes/midbro.h
@@ -0,0 +1,6 @@
+#ifndef MIDBRO_H
+#define MIDBRO_H
+void start_data_capture();
+int request_value();
+void request_n_values(int n, int dest[]);
+#endif
diff --git a/includes/types.h b/includes/types.h
new file mode 100644
index 0000000..149415e
--- /dev/null
+++ b/includes/types.h
@@ -0,0 +1,37 @@
+#ifndef TYPES_H
+#define TYPES_H
+#include <semaphore.h>
+
+#define true 1
+#define false 0
+
+typedef int boolean;
+typedef struct sensor_t Sensor_t;
+typedef struct queue_t Queue_t;
+typedef struct fifo_q Fifo_q;
+
+struct sensor_t{
+ int uid;
+ int value;
+};
+
+struct queue_t{
+ Sensor_t * sensor;
+ Queue_t * next;
+};
+
+struct fifo_q{
+ Queue_t * head;
+ Queue_t * tail;
+ int maxSize;
+ int currentSize;
+ int droppedValues;
+ int largestBufferSize;
+ int valuesReceived;
+ int valuesReleased;
+ sem_t bufferEmptyBlock;
+ sem_t bufferFullBlock;
+ sem_t lock;
+};
+
+#endif