From 83ef0a99532613151cb8dfbbf1ee9d20e2b6513d Mon Sep 17 00:00:00 2001
From: burneykb <burneykb@iastate.edu>
Date: Mon, 20 Mar 2017 12:24:27 -0500
Subject: [PATCH] Groundstation side compiles. Still need Node file information
 for both sides though

---
 {groundStation/src/backend => common}/bitwise.h  |  0
 {groundStation/src/backend => common}/commands.c |  0
 {groundStation/src/backend => common}/commands.h |  0
 .../src/backend/common => common}/common.txt     |  4 ----
 .../src/backend => common}/controller.h          |  0
 .../common/examples.c => common/examples_c       |  0
 {groundStation/src/backend => common}/packet.c   |  0
 {groundStation/src/backend => common}/packet.h   |  0
 groundStation/Makefile                           | 16 ++++++++++++----
 groundStation/src/backend/backend.c              |  6 +++---
 groundStation/src/backend/callbacks.c            |  2 +-
 groundStation/src/backend/cmHandler.h            |  4 ++--
 groundStation/src/backend/communication.c        |  2 +-
 groundStation/src/backend/getparam.c             |  4 ++--
 groundStation/src/backend/getparam.h             |  4 ++--
 groundStation/src/backend/responseparam.c        |  4 ++--
 groundStation/src/backend/responseparam.h        |  4 ++--
 groundStation/src/backend/setparam.c             |  4 ++--
 groundStation/src/backend/setparam.h             |  4 ++--
 groundStation/src/backend/update.c               |  4 ++--
 groundStation/src/backend/update.h               |  2 +-
 quad/src/quad_app/commands.c                     |  2 +-
 quad/src/quad_app/commands.h                     |  2 +-
 23 files changed, 36 insertions(+), 32 deletions(-)
 rename {groundStation/src/backend => common}/bitwise.h (100%)
 rename {groundStation/src/backend => common}/commands.c (100%)
 rename {groundStation/src/backend => common}/commands.h (100%)
 rename {groundStation/src/backend/common => common}/common.txt (50%)
 rename {groundStation/src/backend => common}/controller.h (100%)
 rename groundStation/src/backend/common/examples.c => common/examples_c (100%)
 rename {groundStation/src/backend => common}/packet.c (100%)
 rename {groundStation/src/backend => common}/packet.h (100%)

diff --git a/groundStation/src/backend/bitwise.h b/common/bitwise.h
similarity index 100%
rename from groundStation/src/backend/bitwise.h
rename to common/bitwise.h
diff --git a/groundStation/src/backend/commands.c b/common/commands.c
similarity index 100%
rename from groundStation/src/backend/commands.c
rename to common/commands.c
diff --git a/groundStation/src/backend/commands.h b/common/commands.h
similarity index 100%
rename from groundStation/src/backend/commands.h
rename to common/commands.h
diff --git a/groundStation/src/backend/common/common.txt b/common/common.txt
similarity index 50%
rename from groundStation/src/backend/common/common.txt
rename to common/common.txt
index cfc783550..3a2009407 100644
--- a/groundStation/src/backend/common/common.txt
+++ b/common/common.txt
@@ -1,7 +1,3 @@
 The common files are:
- - packet.h
- - packet.c
  - setcontrol.h
  - setcontrol.c
- - bitwise.h
- - controller.h
diff --git a/groundStation/src/backend/controller.h b/common/controller.h
similarity index 100%
rename from groundStation/src/backend/controller.h
rename to common/controller.h
diff --git a/groundStation/src/backend/common/examples.c b/common/examples_c
similarity index 100%
rename from groundStation/src/backend/common/examples.c
rename to common/examples_c
diff --git a/groundStation/src/backend/packet.c b/common/packet.c
similarity index 100%
rename from groundStation/src/backend/packet.c
rename to common/packet.c
diff --git a/groundStation/src/backend/packet.h b/common/packet.h
similarity index 100%
rename from groundStation/src/backend/packet.h
rename to common/packet.h
diff --git a/groundStation/Makefile b/groundStation/Makefile
index 052f6bf8a..38c2e2d74 100644
--- a/groundStation/Makefile
+++ b/groundStation/Makefile
@@ -6,10 +6,15 @@ GXX=g++
 CFLAGS= -Wall -pedantic -Wextra -Werror -std=gnu99 -g -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable
 CXXFLAGS= -Wall -pedantic -Wextra -Werror -Wno-reorder -Wno-unused-variable -std=c++0x -g
 INCLUDES = $(foreach dir, $(INCDIR), -I$(dir))
-INCDIR=inc src/vrpn src/vrpn/quat src/vrpn/build $(BESRCDIR) $(CLISRCDIR) $(FESRCDIR)
+INCDIR=inc src/vrpn src/vrpn/quat src/vrpn/build $(COMSRCDIR) $(BESRCDIR) $(CLISRCDIR) $(FESRCDIR)
 LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat 
 OBJDIR=obj
 
+# Common Objects
+COMSRCDIR=../common
+COMSOURCES := $(wildcard $(COMSRCDIR)/*.c )
+COMOBJECTS = $(COMSOURCES:$(COMSRCDIR)/%.c=$(OBJDIR)/%.o)
+
 # Backend Specific Variables
 BEBINARY=BackEnd
 BESRCDIR=src/backend
@@ -31,7 +36,7 @@ FECSOURCES := $(wildcard $(FESRCDIR)/*.c )
 FECOBJECTS = $(FECSOURCES:$(FESRCDIR)/%.c=$(OBJDIR)/%.o)
 
 
-OBJECTS= $(CLIOBJECTS) $(BECOBJECTS) $(BECPPOBJECTS) $(FECOBJECTS)
+OBJECTS= $(COMOBJECTS) $(CLIOBJECTS) $(BECOBJECTS) $(BECPPOBJECTS) $(FECOBJECTS)
 
 # Default target
 all: logs objdir backend cli $(SYMLINKS)
@@ -48,9 +53,12 @@ $(CLIOBJECTS) : $(OBJDIR)/%.o : $(CLISRCDIR)/%.c
 	$(GCC)  $(CFLAGS) -c $^ -o $@ $(INCLUDES) $(LIBS)
 
 
-backend: $(BECPPOBJECTS) $(BECOBJECTS)
+backend: $(COMOBJECTS) $(BECPPOBJECTS) $(BECOBJECTS)
 	$(GXX) $(CXXFLAGS) $^ -o $(BEBINARY) $(INCLUDES) $(LIBS)
 
+$(COMOBJECTS) : $(OBJDIR)/%.o : $(COMSRCDIR)/%.c
+	$(GCC)  $(CFLAGS) -c $^ -o $@ $(INCLUDES) $(LIBS)
+
 $(FECOBJECTS) : $(OBJDIR)/%.o : $(FESRCDIR)/%.c
 	$(GCC)  $(CFLAGS) -c $^ -o $@ $(INCLUDES) $(LIBS)
 
@@ -77,4 +85,4 @@ clean:
 	rm -rf $(OBJDIR)/ $(BEBINARY) $(CLIBINARY)
 
 debug:
-	@echo $(OBJECTS)
+	@echo $(COMOBJECTS)
diff --git a/groundStation/src/backend/backend.c b/groundStation/src/backend/backend.c
index 7b1a01f75..ab4b67920 100644
--- a/groundStation/src/backend/backend.c
+++ b/groundStation/src/backend/backend.c
@@ -30,17 +30,17 @@
 
 //user created includes
 #include "communication.h"
-#include "commands.h"
+#include "../../../common/commands.h"
 #include "vrpn_tracker.hpp"
 #include "type_def.h"
-#include "packet.h"
+#include "../../../common/packet.h"
 #include "responseparam.h"
 #include "update.h"
 #include "config.h"
 #include "cmHandler.h"
 #include "getparam.h"
 #include "setparam.h"
-#include "bitwise.h"
+#include "../../../common/bitwise.h"
 
 #define QUAD_BT_ADDR  "00:06:66:64:61:D6"
 #define QUAD_BT_CHANNEL  0x01
diff --git a/groundStation/src/backend/callbacks.c b/groundStation/src/backend/callbacks.c
index a47d521f2..c5499fadb 100644
--- a/groundStation/src/backend/callbacks.c
+++ b/groundStation/src/backend/callbacks.c
@@ -1,4 +1,4 @@
-#include "commands.h"
+#include "../../../common/commands.h"
 
 /* New stuff - this is nice and clean */
 
diff --git a/groundStation/src/backend/cmHandler.h b/groundStation/src/backend/cmHandler.h
index f2761aa9b..de513f303 100644
--- a/groundStation/src/backend/cmHandler.h
+++ b/groundStation/src/backend/cmHandler.h
@@ -1,7 +1,7 @@
 #ifndef _CMHANDLER_H
 #define _CMHANDLER_H
 
-#include "controller.h"
+#include "../../../common/controller.h"
 
 enum paramIndices {
 	PARAM_ROLL_P	,
@@ -45,4 +45,4 @@ const char * cmToString(int msgType, const struct controller_message *cm);
 
 struct controller_message * stringToCm(const char * string, struct controller_message *cm);
 
-#endif /* _CMHANDLER_H */
\ No newline at end of file
+#endif /* _CMHANDLER_H */
diff --git a/groundStation/src/backend/communication.c b/groundStation/src/backend/communication.c
index a6f14f29c..d0aa5c19a 100644
--- a/groundStation/src/backend/communication.c
+++ b/groundStation/src/backend/communication.c
@@ -1,5 +1,5 @@
 #include "communication.h"
-#include "commands.h"
+#include "../../../common/commands.h"
 #include <string.h>
 #include <ctype.h>
 
diff --git a/groundStation/src/backend/getparam.c b/groundStation/src/backend/getparam.c
index 985807417..16dc0c0a0 100644
--- a/groundStation/src/backend/getparam.c
+++ b/groundStation/src/backend/getparam.c
@@ -1,6 +1,6 @@
 #include "getparam.h"
-#include "commands.h"
-#include "bitwise.h"
+#include "../../../common/commands.h"
+#include "../../../common/bitwise.h"
 
 #include <sys/types.h>
 
diff --git a/groundStation/src/backend/getparam.h b/groundStation/src/backend/getparam.h
index c9d9096df..7e068f167 100644
--- a/groundStation/src/backend/getparam.h
+++ b/groundStation/src/backend/getparam.h
@@ -1,8 +1,8 @@
 #ifndef _getparam_h
 #define _getparam_h
 
-#include "packet.h"
-#include "controller.h"
+#include "../../../common/packet.h"
+#include "../../../common/controller.h"
 
 #include <sys/types.h>
 
diff --git a/groundStation/src/backend/responseparam.c b/groundStation/src/backend/responseparam.c
index f6a8d44b2..eee2f05c3 100644
--- a/groundStation/src/backend/responseparam.c
+++ b/groundStation/src/backend/responseparam.c
@@ -1,6 +1,6 @@
 #include "responseparam.h"
-#include "commands.h"
-#include "bitwise.h"
+#include "../../../common/commands.h"
+#include "../../../common/bitwise.h"
 
 #include <sys/types.h>
 
diff --git a/groundStation/src/backend/responseparam.h b/groundStation/src/backend/responseparam.h
index 5e3224477..4daa8c3ed 100644
--- a/groundStation/src/backend/responseparam.h
+++ b/groundStation/src/backend/responseparam.h
@@ -1,8 +1,8 @@
 #ifndef _responseparam_h
 #define _responseparam_h
 
-#include "packet.h"
-#include "controller.h"
+#include "../../../common/packet.h"
+#include "../../../common/controller.h"
 
 #include <sys/types.h>
 
diff --git a/groundStation/src/backend/setparam.c b/groundStation/src/backend/setparam.c
index c97ed01f4..6aaa71b08 100644
--- a/groundStation/src/backend/setparam.c
+++ b/groundStation/src/backend/setparam.c
@@ -1,6 +1,6 @@
 #include "setparam.h"
-#include "commands.h"
-#include "bitwise.h"
+#include "../../../common/commands.h"
+#include "../../../common/bitwise.h"
 
 #include <sys/types.h>
 
diff --git a/groundStation/src/backend/setparam.h b/groundStation/src/backend/setparam.h
index 671d7aa24..d3d251a2e 100644
--- a/groundStation/src/backend/setparam.h
+++ b/groundStation/src/backend/setparam.h
@@ -1,8 +1,8 @@
 #ifndef _setparam_h
 #define _setparam_h
 
-#include "packet.h"
-#include "controller.h"
+#include "../../../common/packet.h"
+#include "../../../common/controller.h"
 
 #include <sys/types.h>
 
diff --git a/groundStation/src/backend/update.c b/groundStation/src/backend/update.c
index db546e05a..c7553575f 100644
--- a/groundStation/src/backend/update.c
+++ b/groundStation/src/backend/update.c
@@ -1,6 +1,6 @@
 #include "update.h"
-#include "commands.h"
-#include "bitwise.h"
+#include "../../../common/commands.h"
+#include "../../../common/bitwise.h"
 
 #include <sys/types.h>
 
diff --git a/groundStation/src/backend/update.h b/groundStation/src/backend/update.h
index 783a861ca..6491823d7 100644
--- a/groundStation/src/backend/update.h
+++ b/groundStation/src/backend/update.h
@@ -1,7 +1,7 @@
 #ifndef _update_h
 #define _update_h
 
-#include "packet.h"
+#include "../../../common/packet.h"
 
 #include <sys/types.h>
 
diff --git a/quad/src/quad_app/commands.c b/quad/src/quad_app/commands.c
index d1d22a4de..e9bada254 120000
--- a/quad/src/quad_app/commands.c
+++ b/quad/src/quad_app/commands.c
@@ -1 +1 @@
-../../../groundStation/src/backend/commands.c
\ No newline at end of file
+../../../groundStation/src/backend/common/commands.c
\ No newline at end of file
diff --git a/quad/src/quad_app/commands.h b/quad/src/quad_app/commands.h
index 6c32c46d7..92d6b32d4 120000
--- a/quad/src/quad_app/commands.h
+++ b/quad/src/quad_app/commands.h
@@ -1 +1 @@
-../../../groundStation/src/backend/commands.h
\ No newline at end of file
+../../../groundStation/src/backend/common/commands.h
\ No newline at end of file
-- 
GitLab