Browse Source

Added more functions to manage twinkl messages to the shared library

pull/4/head
Sebastian 6 years ago
parent
commit
e3cffcaf6f
  1. 6
      Makefile
  2. 32
      message_wrapper.c

6
Makefile

@ -7,7 +7,7 @@ CFLAGS = -fPIC -Wall -O2 -I include -I twinkl/include
LDFLAGS =
all : start $(OBJDIR)/twinkl-client
all : start $(OBJDIR)/twinkl-client $(OBJDIR)/twinklclient.so
@echo ":: Done !"
start :
@ -22,10 +22,10 @@ $(OBJDIR)/%.o : %.c Makefile $(HEADERS)
mkdir -p $$(dirname $@)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/twinklsocket.so : $(OBJDIR)/twinklsocket.o
$(OBJDIR)/twinklclient.so : $(OBJDIR)/twinklsocket.o $(OBJDIR)/message_wrapper.o
$(CC) $+ -shared $(LDFLAGS) -o $@
$(OBJDIR)/twinkl-client : $(OBJDIR)/main.o $(OBJDIR)/twinklsocket.so
$(OBJDIR)/twinkl-client : $(OBJDIR)/main.o $(OBJDIR)/twinklsocket.o
$(CC) $+ $(LDFLAGS) -o $@
clean :

32
message_wrapper.c

@ -0,0 +1,32 @@
#include "message.h"
#include <stdlib.h>
// Wrapper for the inline functions in message.h
// Also enforces a consistent naming scheme for symbols in twinklclient.so
struct twinkl_message* twinklmsg_create() {
struct twinkl_message* msg = malloc(sizeof(struct twinkl_message));
twinkl_init_message(msg);
return msg;
}
void twinklmsg_reset(struct twinkl_message *msg) {
twinkl_init_message(msg);
}
void twinklmsg_set_value(struct twinkl_message *msg, uint16_t chan, uint8_t value) {
twinkl_set_value(msg, chan, value);
}
void twinklmsg_unset_value(struct twinkl_message *msg, uint16_t chan) {
twinkl_unset_value(msg, chan);
}
void twinklmsg_set_priority(struct twinkl_message *msg, uint8_t priority) {
twinkl_set_priority(msg, priority);
}
void twinklmsg_destroy(struct twinkl_message* msg) {
free(msg);
}
Loading…
Cancel
Save