From 63dd4aa757536cbdbc57179fb9166ebcf64cb725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Tue, 19 Dec 2017 08:22:22 +0100 Subject: [PATCH] fixed some bugs --- CMakeLists.txt | 4 ++-- gex/TF_Integration.c | 5 ++--- gex/gex_client.c | 2 +- gex/gex_client.h | 6 +----- gex/gex_defines.h | 16 ++++++++++++++++ gex/gex_helpers.c | 4 +++- gex/gex_helpers.h | 4 ++-- gex/{gex_client_internal.h => gex_internal.h} | 4 ++++ 8 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 gex/gex_defines.h rename gex/{gex_client_internal.h => gex_internal.h} (94%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0119c9..f431bd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ set(SOURCE_FILES gex/gex_client.h gex/gex_helpers.c gex/gex_helpers.h - gex/gex_client_internal.h + gex/gex_internal.h gex/gex_message_types.h gex/utils/hexdump.c gex/utils/hexdump.h @@ -24,7 +24,7 @@ set(SOURCE_FILES gex/protocol/TinyFrame.c gex/protocol/TinyFrame.h gex/utils/type_coerce.h -) + gex/gex_defines.h) include_directories( gex diff --git a/gex/TF_Integration.c b/gex/TF_Integration.c index df204d4..41a32d7 100644 --- a/gex/TF_Integration.c +++ b/gex/TF_Integration.c @@ -1,12 +1,11 @@ -#include "TinyFrame.h" -#include "gex_client.h" #include #include #include #include #include -#include "gex_client_internal.h" +#include "TinyFrame.h" +#include "gex_internal.h" void TF_WriteImpl(TinyFrame *tf, const uint8_t *buff, size_t len) { diff --git a/gex/gex_client.c b/gex/gex_client.c index 8d61b69..db92d32 100644 --- a/gex/gex_client.c +++ b/gex/gex_client.c @@ -12,7 +12,7 @@ #include "gex_client.h" #include "serial.h" -#include "gex_client_internal.h" +#include "gex_internal.h" #include "gex_message_types.h" #include "gex_helpers.h" #include "utils/payload_parser.h" diff --git a/gex/gex_client.h b/gex/gex_client.h index 7b65a9a..ea26a1c 100644 --- a/gex/gex_client.h +++ b/gex/gex_client.h @@ -9,11 +9,7 @@ #include #include #include "TinyFrame.h" - -typedef struct gex_client_ GexClient; - -/** Callback for spontaneous reports from units */ -typedef void (*GEX_ReportListener)(GexClient *gex, const char *unit, uint8_t code, const uint8_t *payload, uint32_t len); +#include "gex_defines.h" /** * Bind a report listener diff --git a/gex/gex_defines.h b/gex/gex_defines.h new file mode 100644 index 0000000..0920e40 --- /dev/null +++ b/gex/gex_defines.h @@ -0,0 +1,16 @@ +// +// Created by MightyPork on 2017/12/19. +// + +#ifndef GEX_CLIENT_GEX_DEFINES_H +#define GEX_CLIENT_GEX_DEFINES_H + +#include +#include + +typedef struct gex_client_ GexClient; + +/** Callback for spontaneous reports from units */ +typedef void (*GEX_ReportListener)(GexClient *gex, const char *unit, uint8_t code, const uint8_t *payload, uint32_t len); + +#endif //GEX_CLIENT_GEX_DEFINES_H diff --git a/gex/gex_helpers.c b/gex/gex_helpers.c index 55bfb63..ba28f1e 100644 --- a/gex/gex_helpers.c +++ b/gex/gex_helpers.c @@ -2,8 +2,10 @@ // Created by MightyPork on 2017/12/19. // +#include + +#include "gex_defines.h" #include "gex_helpers.h" -#include "gex_client_internal.h" /** Delete recursively all GEX callsign look-up table entries */ void destroy_unit_lookup(GexClient *gex) diff --git a/gex/gex_helpers.h b/gex/gex_helpers.h index c1605e9..1a276ce 100644 --- a/gex/gex_helpers.h +++ b/gex/gex_helpers.h @@ -5,8 +5,8 @@ #ifndef GEX_CLIENT_GEX_HELPERS_H #define GEX_CLIENT_GEX_HELPERS_H -#include "gex_client_internal.h" -#include "gex_client.h" +#include "gex_internal.h" +#include "gex_defines.h" /** Delete recursively all GEX callsign look-up table entries */ void destroy_unit_lookup(GexClient *gex); diff --git a/gex/gex_client_internal.h b/gex/gex_internal.h similarity index 94% rename from gex/gex_client_internal.h rename to gex/gex_internal.h index 48d1153..3bd29cb 100644 --- a/gex/gex_client_internal.h +++ b/gex/gex_internal.h @@ -5,6 +5,10 @@ #ifndef GEX_CLIENT_GEX_CLIENT_INTERNAL_H #define GEX_CLIENT_GEX_CLIENT_INTERNAL_H +#include +#include +#include "gex_client.h" + struct gex_unit_lu { char *name; //!< Unit name char *type; //!< Unit type