From f7a49cce1673b9cdfc13e8b5f338ed137f2ad9e4 Mon Sep 17 00:00:00 2001
From: burneykb <burneykb@iastate.edu>
Date: Fri, 24 Mar 2017 16:59:24 -0500
Subject: [PATCH] removed common folder, linking from quad side

---
 ci-build.sh                         |   3 +-
 common/commands.c                   | 283 ---------------------------
 common/commands.h                   |  75 --------
 common/common.txt                   |   3 -
 common/examples_c                   |  77 --------
 groundStation/Makefile              |  17 +-
 groundStation/src/backend/backend.c |  12 +-
 groundStation/src/backend/nodes.c   |   2 +-
 groundStation/src/backend/output.c  |   2 +-
 groundStation/src/backend/param.c   |   2 +-
 groundStation/src/backend/source.c  |   2 +-
 groundStation/src/backend/update.c  |   2 +-
 groundStation/src/cli/cli_nodes.c   |   1 -
 quad/src/quad_app/commands.c        | 284 +++++++++++++++++++++++++++-
 quad/src/quad_app/commands.h        |  76 +++++++-
 15 files changed, 378 insertions(+), 463 deletions(-)
 delete mode 100644 common/commands.c
 delete mode 100644 common/commands.h
 delete mode 100644 common/common.txt
 delete mode 100644 common/examples_c
 mode change 120000 => 100644 quad/src/quad_app/commands.c
 mode change 120000 => 100644 quad/src/quad_app/commands.h

diff --git a/ci-build.sh b/ci-build.sh
index f2ee59eb3..9e0a02bdc 100644
--- a/ci-build.sh
+++ b/ci-build.sh
@@ -3,4 +3,5 @@
 set -e
 
 # Quad Libraries and Boot image
-cd quad && make boot
+(cd quad && make)
+(cd groundstation && make) 
diff --git a/common/commands.c b/common/commands.c
deleted file mode 100644
index 9111f1050..000000000
--- a/common/commands.c
+++ /dev/null
@@ -1,283 +0,0 @@
-#include "commands.h"
-
-/* This file defines the commands structure.
- * This is the canonical reference for all commands
- * used. This file can be used - unchanged - on both the quad side
- * and on the ground station side. The commands.h file is also entirely
- * portable and may be used unchanged.
- *
- * This file (commands.c) and the matching header (commands.h)
- * are fully portable (quad + groundStation).
- * 
- * To use this file, three non-portable files must also exist:
- *  - callbacks.h. Typedef for command_cb
- *  - cb_default.h. Implementation of cb_default.
- *  - callbacks.c file. Contains implemented callbacks.
- *
- * There are two mandatory things that must be implemented in
- * other files for this to work: First, in callbacks.h, create a typedef
- * for command_cb. See the callbacks.h of the ground station for an
- * example.
- *
- * Second, in cb_default.h, implement the function
- * cb_default. This function should do nothing; it will be the 
- * default action for an unimplemented callback. Note that because
- * the function is implemented in the .h file, cb_default.h MUST NOT
- * be included in any other file!
- *
- * To implement callbacks, simply define them in callbacks.c.
- *
- *
- * EXTENDING COMMANDS.C
- *
- * To extend this file, simply add the new type (typically
- * a Setter, Getter, and Response) and create weak aliases below.
- *
- * Ensure the Quad and GroundStation always maintain this file in sync!
- *
- */
-
-/*
- * List of callbacks. DO NOT MODIFY THESE IN THIS FILE -
- * Simply implement a function with the same name
- * in a different file (callbacks.c) and these will
- * be overridden.
- */
-
-/* Grab the default callback implementation */
-#include "cb_default.h"
-
-/* Misc. callbacks */
-command_cb cb_debug __attribute__((weak, alias("cb_default")));
-command_cb cb_packetlog __attribute__((weak, alias("cb_default")));
-command_cb cb_getpacketlogs __attribute__((weak, alias("cb_default")));
-command_cb cb_update __attribute__((weak, alias("cb_default")));
-command_cb cb_beginupdate __attribute__((weak, alias("cb_default")));
-command_cb cb_log __attribute__((weak, alias("cb_default")));
-command_cb cb_response __attribute__((weak, alias("cb_default")));
-command_cb cb_logend __attribute__((weak, alias("cb_default")));
-
-/* Callbacks for configuration */
-command_cb cb_setparam __attribute__((weak, alias("cb_default")));
-command_cb cb_getparam __attribute__((weak, alias("cb_default")));
-command_cb cb_respparam __attribute__((weak, alias("cb_default")));
-
-command_cb cb_setsource __attribute__((weak, alias("cb_default")));
-command_cb cb_getsource __attribute__((weak, alias("cb_default")));
-command_cb cb_respsource __attribute__((weak, alias("cb_default")));
-
-command_cb cb_getoutput __attribute__((weak, alias("cb_default")));
-command_cb cb_respoutput __attribute__((weak, alias("cb_default")));
-
-command_cb cb_getnodes __attribute__((weak, alias("cb_default")));
-command_cb cb_respnodes __attribute__((weak, alias("cb_default")));
-
-command_cb cb_addnode __attribute__((weak, alias("cb_default")));
-command_cb cb_respaddnode __attribute__((weak, alias("cb_default")));
-
-
-/*
- * Command structure.
- * This array is used to keep track of the callback functions
- * for commands between the quad and the ground station.
- *
- * There is one callback function pointer associated with each
- * element in this struct array.
- *
- * DO NOT change this struct without updating the
- * "MessageTypeID" struct in commands.h as well
- */
-struct MessageType MessageTypes[MAX_TYPE_ID] =
-{
-	// DEBUG
-	{
-		// Command text
-		"debug",
-		// Type of the command data
-		stringType,
-		// Function pointer
-		&cb_debug
-	},
-	// PACKETLOG
-	{
-		// Command text
-		"packetlog",
-		// Type of the command data
-		stringType,
-		// Function pointer
-		&cb_packetlog
-	},
-	// GETPACKETLOGS
-	{
-		// Command text
-		"getpacketlogs",
-		// Type of the command data
-		stringType,
-		// Function pointer
-		&cb_getpacketlogs
-	},
-	// UPDATE
-	{
-		// Command text
-		"update",
-		// Type of the command data
-		stringType,
-		// Function pointer
-		&cb_update
-	},
-	// BEGINUPDATE
-	{
-		// Command text
-		"beginupdate",
-		// Type of the command data
-		stringType,
-		// Function pointer
-		&cb_beginupdate
-	},
-	// LOG
-	{
-		// Command text
-		"log",
-		// Type of the command data
-		stringType,
-		// Function pointer
-		&cb_log
-	},
-	// RESPONSE
-	{
-		// Command text
-		"response",
-		// Type of the command data
-		stringType,
-		// Function pointer
-		&cb_response
-	},
-	// SETPARAM
-	{
-		// Command text
-		"setparam",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_setparam
-	},
-	// GETPARAM
-	{
-		// Command text
-		"getparam",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_getparam
-	},
-	// RESPPARAM
-	{
-		// Command text
-		"respparam",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_respparam
-	},
-	// SETSOURCE
-	{
-		// Command text
-		"setsource",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_setsource
-	},
-	// GETSOURCE
-	{
-		// Command text
-		"getsource",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_getsource
-	},
-	// RESPSOURCE
-	{
-		// Command text
-		"respsource",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_respsource
-	},
-	// GETOUTPUT
-	{
-		// Command text
-		"getoutput",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_respoutput
-	},
-	// RESPOUTPUT
-	{
-		// Command text
-		"respoutput",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_respoutput
-	},
-	// GETNODES
-	{
-		// Command text
-		"getnodes",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_getnodes
-	},
-	// RESPNODES
-	{
-		// Command text
-		"respnodes",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_respnodes
-	},
-	// ADDNODE
-	{
-		// Command text
-		"addnode",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_addnode
-	},
-	// RESPADDNODE
-	{
-		// Command text
-		"respaddnode",
-		// Type of the command data
-		floatType,
-		// Function pointer
-		&cb_respaddnode
-	},
-	// LOG_END
-	{
-		// Command text
-		"logend",
-		// Type of the command data
-		stringType,
-		// Function pointer
-		&cb_logend
-	}
-};
-
-int findCommand(char * str)
-{
-	int i;
-	for (i = 0; i < MAX_TYPE_ID; i++) {
-		if (strncmp(str, MessageTypes[i].cmdText, strlen(str)) == 0) {
-			return i;
-		}
-	}
-	return -1;
-}
diff --git a/common/commands.h b/common/commands.h
deleted file mode 100644
index d4b0f2e2c..000000000
--- a/common/commands.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef __COMMANDS_H
-#define __COMMANDS_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "callbacks.h"
-
-#define MAX_CMD_TEXT_LENGTH 100
-
-enum Message{
-	BEGIN_CHAR = 0xBE,
-	END_CHAR   = 0xED
-};
-
-/*
- * Enumeration of the data types that a callback function may use
- * doubleType should get added here at some point
- */
-enum DataType
-{
-	floatType,            // 00
-	intType,              // 01
-	stringType            // 02
-};
-
-/*
- * Message type IDs used to know what kind of message we are dealing with
- * Enumeration used to index the MessageTypes array in commands.c
- *
- * DO NOT change items in the middle of this enum or you will break backwards compatibility.
- *     - Add new message types in the slot between MAX_TYPE_ID and the one before it
- * DO NOT change this enum without also updating the "MessageTypes" array
- * in commands.c to match.
- */
-enum MessageTypeID{
-	DEBUG_ID,             // 00
-	PACKETLOG_ID,         // 01
-	GETPACKETLOGS_ID,     // 02
-	UPDATE_ID,            // 03
-	BEGINUPDATE_ID,       // 04
-	LOG_ID,               // 05
-	RESPONSE_ID,          // 06
-	SETPARAM_ID,          // 07 - Setting node parameters.
-	GETPARAM_ID,          // 08 - Getting node parameters.
-	RESPPARAM_ID,         // 09 - Responding with node parameters.
-	SETSOURCE_ID,         // 10 - Setting node input source block_id & output_id
-	GETSOURCE_ID,         // 11 - Getting node input source block_id & output_id
-	RESPSOURCE_ID,        // 12 - Responding with node input source block_id & output_id
-	GETOUTPUT_ID,         // 13 - Getting node output
-	RESPOUTPUT_ID,        // 14 - Responding with node output
-	GETNODES_ID,          // 15 - Getting node IDs from current comp_graph
-	RESPNODES_ID,         // 16 - Responding with node IDs from current comp_graph
-	ADDNODE_ID,			  // 17 - Add a node of specified type_id
-	RESPADDNODE_ID,		  // 18 - Responding with the block_id of the newly added node
-	LOG_END_ID,           // 19 - Responding with controller parameters. Example: PID constants
-	MAX_TYPE_ID           // 20 - Just used to keep track of the size. Must remain at the end
-};
-
-/*
- * Message type struct used to keep track of the callback function
- * pointers located in commands.c
- */
-struct MessageType{
-	char cmdText[MAX_CMD_TEXT_LENGTH];
-	char cmdDataType;
-	command_cb * functionPtr;
-};
-
-/* Defined in commands.c */
-extern struct MessageType MessageTypes[MAX_TYPE_ID];
-int findCommand(char * cmdStr);
-
-#endif /* __COMMANDS_H */
diff --git a/common/common.txt b/common/common.txt
deleted file mode 100644
index 3a2009407..000000000
--- a/common/common.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-The common files are:
- - setcontrol.h
- - setcontrol.c
diff --git a/common/examples_c b/common/examples_c
deleted file mode 100644
index 036ddeb3c..000000000
--- a/common/examples_c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "packet.h"
-#include "setcontrol.h"
-#include "commands.h"
-
-#include <sys/types.h>
-
-
-/* This example is close to how the ground station will handle things. It
- * shouldn't be too hard to adapt it to work on the quad side.
- */
-
-static int next_msg_id = 0;
-
-int SendSetControl()
-{
-	struct metadata m;
-	struct controller_message cm;
-
-	cm.id = ROLL_ID;        /* Roll controller */
-	cm.value_id = KI_ID;    /* I coefficient */
-	cm.value = 42.00f;      /* An appropriate value */
-
-	uint8_t data[64];
-	m.msg_id = next_msg_id++;
-	/* Fills in the rest of the metadata automatically */
-	if (EncodeSetcontrol(&m, data, 64, &cm) < 0) {
-		return -1;
-	}
-
-	uint8_t packet[128];
-	ssize_t length;
-	if ((length = EncodePacket(packet, 128, &m, data)) < 0) {
-		return -1;
-	}
-
-	/* Now you can send the packet
-	 * sendThePacket(packet, length);
-	 */
-
-	return 0;
-}
-
-
-/* Process incoming packets */
-int receive_packet(uint8_t * packet, size_t length)
-{
-	struct metadata m;
-	uint8_t data[128];
-
-	/* Will fail if checksum is bad, etc */
-	if (DecodePacket(&m, data, 128, packet, length) < 0) {
-		return -1;
-	}
-
-	/* Let's pretend that the callbacks have signature
-	 * void cb(
-	 *     const struct metadata * m,
-	 *     const uint8_t * data);
-	 *
-	 * Call the callback.
-	 */
-	(*MessageTypes[m.msg_type].functionPtr)(&m, data);
-
-	return 0;
-}
-
-/* An example of a setcontrol callback. Arguments
- * aren't important, as long as we have access
- * to the packet bytes and the length
- */
-void cb_setcontrol(const struct metadata *m, const uint8_t *data)
-{
-	struct controller_message cm;
-	DecodeSetcontrol(&cm, m, data);
-
-	/* cm now has populated controller ID, value ID, and value */
-}
diff --git a/groundStation/Makefile b/groundStation/Makefile
index 47356c05d..76fb0bf38 100644
--- a/groundStation/Makefile
+++ b/groundStation/Makefile
@@ -6,14 +6,14 @@ 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 $(COMSRCDIR) $(BESRCDIR) $(CLISRCDIR) $(FESRCDIR)
-LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat 
+INCDIR=../quad/inc src/vrpn src/vrpn/quat src/vrpn/build $(BESRCDIR) $(CLISRCDIR) $(FESRCDIR)
+LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat -lcomputation_graph -L../quad/lib -lquad_app
 OBJDIR=obj
 
 # Common Objects
-COMSRCDIR=../common
-COMSOURCES := $(wildcard $(COMSRCDIR)/*.c )
-COMOBJECTS = $(COMSOURCES:$(COMSRCDIR)/%.c=$(OBJDIR)/%.o)
+# COMSRCDIR=../common
+# COMSOURCES := $(wildcard $(COMSRCDIR)/*.c )
+# COMOBJECTS = $(COMSOURCES:$(COMSRCDIR)/%.c=$(OBJDIR)/%.o)
 
 # Backend Specific Variables
 BEBINARY=BackEnd
@@ -36,7 +36,7 @@ FECSOURCES := $(wildcard $(FESRCDIR)/*.c )
 FECOBJECTS = $(FECSOURCES:$(FESRCDIR)/%.c=$(OBJDIR)/%.o)
 
 
-OBJECTS= $(COMOBJECTS) $(CLIOBJECTS) $(BECOBJECTS) $(BECPPOBJECTS) $(FECOBJECTS)
+OBJECTS=$(CLIOBJECTS) $(BECOBJECTS) $(BECPPOBJECTS) $(FECOBJECTS)
 
 # Default target
 all: logs objdir backend cli $(SYMLINKS)
@@ -53,12 +53,9 @@ $(CLIOBJECTS) : $(OBJDIR)/%.o : $(CLISRCDIR)/%.c
 	$(GCC)  $(CFLAGS) -c $^ -o $@ $(INCLUDES) $(LIBS)
 
 
-backend: $(COMOBJECTS) $(BECPPOBJECTS) $(BECOBJECTS)
+backend: $(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)
 
diff --git a/groundStation/src/backend/backend.c b/groundStation/src/backend/backend.c
index 382a525c0..97d12318d 100644
--- a/groundStation/src/backend/backend.c
+++ b/groundStation/src/backend/backend.c
@@ -29,7 +29,7 @@
 #include <netinet/tcp.h>
 
 //user created includes
-#include "../../../common/commands.h"
+#include "commands.h"
 #include "vrpn_tracker.hpp"
 #include "type_def.h"
 #include "packet.h"
@@ -766,11 +766,11 @@ static void quad_recv() {
 	}
 	respBufLen += respLen;
 
-	// printf("packetFromQuad = '");
-	// for(int i = 0; i < (int)respBufLen; ++i) {
-	// 	printf(" %.2x ", respBuf[i]);
-	// }
-	// printf("'\n");
+	printf("packetFromQuad = '");
+	for(int i = 0; i < (int)respBufLen; ++i) {
+		printf(" %.2x ", respBuf[i]);
+	}
+	printf("'\n");
 
 	while(respBufLen){
 		datalen = DecodePacket(&m, data, CMD_MAX_LENGTH, respBuf, respBufLen);
diff --git a/groundStation/src/backend/nodes.c b/groundStation/src/backend/nodes.c
index 4db73c6f4..119fac877 100644
--- a/groundStation/src/backend/nodes.c
+++ b/groundStation/src/backend/nodes.c
@@ -2,7 +2,7 @@
 #include <inttypes.h>
 
 #include "nodes.h"
-#include "../../../common/commands.h"
+#include "commands.h"
 #include "bitwise.h"
 
 
diff --git a/groundStation/src/backend/output.c b/groundStation/src/backend/output.c
index f293f3ec7..d72f04bcd 100644
--- a/groundStation/src/backend/output.c
+++ b/groundStation/src/backend/output.c
@@ -2,7 +2,7 @@
 #include <inttypes.h>
 
 #include "output.h"
-#include "../../../common/commands.h"
+#include "commands.h"
 #include "bitwise.h"
 
 
diff --git a/groundStation/src/backend/param.c b/groundStation/src/backend/param.c
index 15b049dba..8912b65f9 100644
--- a/groundStation/src/backend/param.c
+++ b/groundStation/src/backend/param.c
@@ -2,7 +2,7 @@
 #include <inttypes.h>
 
 #include "param.h"
-#include "../../../common/commands.h"
+#include "commands.h"
 #include "bitwise.h"
 
 enum GetparamData {
diff --git a/groundStation/src/backend/source.c b/groundStation/src/backend/source.c
index ab319d251..683a3011f 100644
--- a/groundStation/src/backend/source.c
+++ b/groundStation/src/backend/source.c
@@ -2,7 +2,7 @@
 #include <inttypes.h>
 
 #include "source.h"
-#include "../../../common/commands.h"
+#include "commands.h"
 #include "bitwise.h"
 
 
diff --git a/groundStation/src/backend/update.c b/groundStation/src/backend/update.c
index 1f51f0be7..db546e05a 100644
--- a/groundStation/src/backend/update.c
+++ b/groundStation/src/backend/update.c
@@ -1,5 +1,5 @@
 #include "update.h"
-#include "../../../common/commands.h"
+#include "commands.h"
 #include "bitwise.h"
 
 #include <sys/types.h>
diff --git a/groundStation/src/cli/cli_nodes.c b/groundStation/src/cli/cli_nodes.c
index ff067dd57..79d0633fb 100644
--- a/groundStation/src/cli/cli_nodes.c
+++ b/groundStation/src/cli/cli_nodes.c
@@ -27,7 +27,6 @@ int cli_getnodes(struct backend_conn * conn, int argc, char ** argv) {
 
 	node_data = malloc(sizeof(*node_data) * num_nodes);
 
-
 	if (frontend_getnodes(conn, node_data, &num_nodes)) {
 		free(node_data);
 		return 1;
diff --git a/quad/src/quad_app/commands.c b/quad/src/quad_app/commands.c
deleted file mode 120000
index e9bada254..000000000
--- a/quad/src/quad_app/commands.c
+++ /dev/null
@@ -1 +0,0 @@
-../../../groundStation/src/backend/common/commands.c
\ No newline at end of file
diff --git a/quad/src/quad_app/commands.c b/quad/src/quad_app/commands.c
new file mode 100644
index 000000000..9111f1050
--- /dev/null
+++ b/quad/src/quad_app/commands.c
@@ -0,0 +1,283 @@
+#include "commands.h"
+
+/* This file defines the commands structure.
+ * This is the canonical reference for all commands
+ * used. This file can be used - unchanged - on both the quad side
+ * and on the ground station side. The commands.h file is also entirely
+ * portable and may be used unchanged.
+ *
+ * This file (commands.c) and the matching header (commands.h)
+ * are fully portable (quad + groundStation).
+ * 
+ * To use this file, three non-portable files must also exist:
+ *  - callbacks.h. Typedef for command_cb
+ *  - cb_default.h. Implementation of cb_default.
+ *  - callbacks.c file. Contains implemented callbacks.
+ *
+ * There are two mandatory things that must be implemented in
+ * other files for this to work: First, in callbacks.h, create a typedef
+ * for command_cb. See the callbacks.h of the ground station for an
+ * example.
+ *
+ * Second, in cb_default.h, implement the function
+ * cb_default. This function should do nothing; it will be the 
+ * default action for an unimplemented callback. Note that because
+ * the function is implemented in the .h file, cb_default.h MUST NOT
+ * be included in any other file!
+ *
+ * To implement callbacks, simply define them in callbacks.c.
+ *
+ *
+ * EXTENDING COMMANDS.C
+ *
+ * To extend this file, simply add the new type (typically
+ * a Setter, Getter, and Response) and create weak aliases below.
+ *
+ * Ensure the Quad and GroundStation always maintain this file in sync!
+ *
+ */
+
+/*
+ * List of callbacks. DO NOT MODIFY THESE IN THIS FILE -
+ * Simply implement a function with the same name
+ * in a different file (callbacks.c) and these will
+ * be overridden.
+ */
+
+/* Grab the default callback implementation */
+#include "cb_default.h"
+
+/* Misc. callbacks */
+command_cb cb_debug __attribute__((weak, alias("cb_default")));
+command_cb cb_packetlog __attribute__((weak, alias("cb_default")));
+command_cb cb_getpacketlogs __attribute__((weak, alias("cb_default")));
+command_cb cb_update __attribute__((weak, alias("cb_default")));
+command_cb cb_beginupdate __attribute__((weak, alias("cb_default")));
+command_cb cb_log __attribute__((weak, alias("cb_default")));
+command_cb cb_response __attribute__((weak, alias("cb_default")));
+command_cb cb_logend __attribute__((weak, alias("cb_default")));
+
+/* Callbacks for configuration */
+command_cb cb_setparam __attribute__((weak, alias("cb_default")));
+command_cb cb_getparam __attribute__((weak, alias("cb_default")));
+command_cb cb_respparam __attribute__((weak, alias("cb_default")));
+
+command_cb cb_setsource __attribute__((weak, alias("cb_default")));
+command_cb cb_getsource __attribute__((weak, alias("cb_default")));
+command_cb cb_respsource __attribute__((weak, alias("cb_default")));
+
+command_cb cb_getoutput __attribute__((weak, alias("cb_default")));
+command_cb cb_respoutput __attribute__((weak, alias("cb_default")));
+
+command_cb cb_getnodes __attribute__((weak, alias("cb_default")));
+command_cb cb_respnodes __attribute__((weak, alias("cb_default")));
+
+command_cb cb_addnode __attribute__((weak, alias("cb_default")));
+command_cb cb_respaddnode __attribute__((weak, alias("cb_default")));
+
+
+/*
+ * Command structure.
+ * This array is used to keep track of the callback functions
+ * for commands between the quad and the ground station.
+ *
+ * There is one callback function pointer associated with each
+ * element in this struct array.
+ *
+ * DO NOT change this struct without updating the
+ * "MessageTypeID" struct in commands.h as well
+ */
+struct MessageType MessageTypes[MAX_TYPE_ID] =
+{
+	// DEBUG
+	{
+		// Command text
+		"debug",
+		// Type of the command data
+		stringType,
+		// Function pointer
+		&cb_debug
+	},
+	// PACKETLOG
+	{
+		// Command text
+		"packetlog",
+		// Type of the command data
+		stringType,
+		// Function pointer
+		&cb_packetlog
+	},
+	// GETPACKETLOGS
+	{
+		// Command text
+		"getpacketlogs",
+		// Type of the command data
+		stringType,
+		// Function pointer
+		&cb_getpacketlogs
+	},
+	// UPDATE
+	{
+		// Command text
+		"update",
+		// Type of the command data
+		stringType,
+		// Function pointer
+		&cb_update
+	},
+	// BEGINUPDATE
+	{
+		// Command text
+		"beginupdate",
+		// Type of the command data
+		stringType,
+		// Function pointer
+		&cb_beginupdate
+	},
+	// LOG
+	{
+		// Command text
+		"log",
+		// Type of the command data
+		stringType,
+		// Function pointer
+		&cb_log
+	},
+	// RESPONSE
+	{
+		// Command text
+		"response",
+		// Type of the command data
+		stringType,
+		// Function pointer
+		&cb_response
+	},
+	// SETPARAM
+	{
+		// Command text
+		"setparam",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_setparam
+	},
+	// GETPARAM
+	{
+		// Command text
+		"getparam",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_getparam
+	},
+	// RESPPARAM
+	{
+		// Command text
+		"respparam",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_respparam
+	},
+	// SETSOURCE
+	{
+		// Command text
+		"setsource",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_setsource
+	},
+	// GETSOURCE
+	{
+		// Command text
+		"getsource",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_getsource
+	},
+	// RESPSOURCE
+	{
+		// Command text
+		"respsource",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_respsource
+	},
+	// GETOUTPUT
+	{
+		// Command text
+		"getoutput",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_respoutput
+	},
+	// RESPOUTPUT
+	{
+		// Command text
+		"respoutput",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_respoutput
+	},
+	// GETNODES
+	{
+		// Command text
+		"getnodes",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_getnodes
+	},
+	// RESPNODES
+	{
+		// Command text
+		"respnodes",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_respnodes
+	},
+	// ADDNODE
+	{
+		// Command text
+		"addnode",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_addnode
+	},
+	// RESPADDNODE
+	{
+		// Command text
+		"respaddnode",
+		// Type of the command data
+		floatType,
+		// Function pointer
+		&cb_respaddnode
+	},
+	// LOG_END
+	{
+		// Command text
+		"logend",
+		// Type of the command data
+		stringType,
+		// Function pointer
+		&cb_logend
+	}
+};
+
+int findCommand(char * str)
+{
+	int i;
+	for (i = 0; i < MAX_TYPE_ID; i++) {
+		if (strncmp(str, MessageTypes[i].cmdText, strlen(str)) == 0) {
+			return i;
+		}
+	}
+	return -1;
+}
diff --git a/quad/src/quad_app/commands.h b/quad/src/quad_app/commands.h
deleted file mode 120000
index 92d6b32d4..000000000
--- a/quad/src/quad_app/commands.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../groundStation/src/backend/common/commands.h
\ No newline at end of file
diff --git a/quad/src/quad_app/commands.h b/quad/src/quad_app/commands.h
new file mode 100644
index 000000000..d4b0f2e2c
--- /dev/null
+++ b/quad/src/quad_app/commands.h
@@ -0,0 +1,75 @@
+#ifndef __COMMANDS_H
+#define __COMMANDS_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "callbacks.h"
+
+#define MAX_CMD_TEXT_LENGTH 100
+
+enum Message{
+	BEGIN_CHAR = 0xBE,
+	END_CHAR   = 0xED
+};
+
+/*
+ * Enumeration of the data types that a callback function may use
+ * doubleType should get added here at some point
+ */
+enum DataType
+{
+	floatType,            // 00
+	intType,              // 01
+	stringType            // 02
+};
+
+/*
+ * Message type IDs used to know what kind of message we are dealing with
+ * Enumeration used to index the MessageTypes array in commands.c
+ *
+ * DO NOT change items in the middle of this enum or you will break backwards compatibility.
+ *     - Add new message types in the slot between MAX_TYPE_ID and the one before it
+ * DO NOT change this enum without also updating the "MessageTypes" array
+ * in commands.c to match.
+ */
+enum MessageTypeID{
+	DEBUG_ID,             // 00
+	PACKETLOG_ID,         // 01
+	GETPACKETLOGS_ID,     // 02
+	UPDATE_ID,            // 03
+	BEGINUPDATE_ID,       // 04
+	LOG_ID,               // 05
+	RESPONSE_ID,          // 06
+	SETPARAM_ID,          // 07 - Setting node parameters.
+	GETPARAM_ID,          // 08 - Getting node parameters.
+	RESPPARAM_ID,         // 09 - Responding with node parameters.
+	SETSOURCE_ID,         // 10 - Setting node input source block_id & output_id
+	GETSOURCE_ID,         // 11 - Getting node input source block_id & output_id
+	RESPSOURCE_ID,        // 12 - Responding with node input source block_id & output_id
+	GETOUTPUT_ID,         // 13 - Getting node output
+	RESPOUTPUT_ID,        // 14 - Responding with node output
+	GETNODES_ID,          // 15 - Getting node IDs from current comp_graph
+	RESPNODES_ID,         // 16 - Responding with node IDs from current comp_graph
+	ADDNODE_ID,			  // 17 - Add a node of specified type_id
+	RESPADDNODE_ID,		  // 18 - Responding with the block_id of the newly added node
+	LOG_END_ID,           // 19 - Responding with controller parameters. Example: PID constants
+	MAX_TYPE_ID           // 20 - Just used to keep track of the size. Must remain at the end
+};
+
+/*
+ * Message type struct used to keep track of the callback function
+ * pointers located in commands.c
+ */
+struct MessageType{
+	char cmdText[MAX_CMD_TEXT_LENGTH];
+	char cmdDataType;
+	command_cb * functionPtr;
+};
+
+/* Defined in commands.c */
+extern struct MessageType MessageTypes[MAX_TYPE_ID];
+int findCommand(char * cmdStr);
+
+#endif /* __COMMANDS_H */
-- 
GitLab