From efbc858de47c2dfb8ff18a444fea6527ac29d4c7 Mon Sep 17 00:00:00 2001
From: Jake Drahos <j@kedrahos.com>
Date: Thu, 2 Feb 2017 01:31:33 -0600
Subject: [PATCH] Finished renamification

There might be some lingering old uses of "xyzcontrol"
instead of "xyzparam", but whatever.
---
 groundStation/src/backend/backend.c    | 12 +++++------
 groundStation/src/backend/getcontrol.h | 28 --------------------------
 groundStation/src/backend/getparam.c   | 18 ++++++++---------
 groundStation/src/backend/getparam.h   |  8 ++++----
 groundStation/src/backend/response.c   | 18 ++++++++---------
 groundStation/src/backend/response.h   |  8 ++++----
 groundStation/src/backend/setparam.c   | 18 ++++++++---------
 groundStation/src/backend/setparam.h   |  8 ++++----
 8 files changed, 45 insertions(+), 73 deletions(-)
 delete mode 100644 groundStation/src/backend/getcontrol.h

diff --git a/groundStation/src/backend/backend.c b/groundStation/src/backend/backend.c
index 4ad1e7d95..006ef0a9a 100644
--- a/groundStation/src/backend/backend.c
+++ b/groundStation/src/backend/backend.c
@@ -34,7 +34,7 @@
 #include "vrpn_tracker.hpp"
 #include "type_def.h"
 #include "packet.h"
-#include "respcontrol.h"
+#include "response.h"
 #include "update.h"
 #include "config.h"
 #include "cmHandler.h"
@@ -77,7 +77,7 @@ static void quad_recv();
 /* Checks to see if socket has disconnected. Returns 1 on disconnect, else returns 0 */
 static int wasDisconnected(int fd);
 /* handle controller responses from quad to frontend */
-static void handleRespcontrol(struct metadata *m, uint8_t * data);
+static void handleResponse(struct metadata *m, uint8_t * data);
 
 
 /* Thread-safe wrappers */
@@ -715,18 +715,18 @@ static void quad_recv() {
 			printf("(Backend): Command '%s' ignored\n", MessageTypes[m.msg_type].cmdText);
 			break;
 		case RESPONSE_ID:
-			handleRespcontrol(&m, data);
+			handleResponse(&m, data);
 			break;
 		default:
 			printf("(Backend): message type %d unrecognized\n", m.msg_type);
 	}
 }
 
-static void handleRespcontrol(struct metadata *m, uint8_t * data)
+static void handleResponse(struct metadata *m, uint8_t * data)
 {
 	struct controller_message cm;
-	if (DecodeRespcontrol(&cm, m, data) < 0) {
-		warnx("DecodeRespcontrol error");
+	if (DecodeResponse(&cm, m, data) < 0) {
+		warnx("DecodeResponse error");
 		return;
 	}
 
diff --git a/groundStation/src/backend/getcontrol.h b/groundStation/src/backend/getcontrol.h
deleted file mode 100644
index edbb85081..000000000
--- a/groundStation/src/backend/getcontrol.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _getcontrol_h
-#define _getcontrol_h
-
-#include "packet.h"
-#include "controller.h"
-
-#include <sys/types.h>
-
-
-/* Creates data and metadata for a getcontrol packet.
- * Returns data size.
- */
-ssize_t EncodeGetcontrol(
-		struct metadata *m, /* Out */
-		uint8_t *data,      /* Out */
-		size_t data_size,   /* Data buffer max size */
-		const struct controller_message *cm); /* Value is not used; only IDs */
-
-/* Decode a metadata and data to populate a message
- * Returns 0 on success, -1 on failure
- */
-int DecodeGetcontrol(
-		struct controller_message *cm, /* Out. Value is undefined */
-		const struct metadata *m,      /* In */
-		const uint8_t * data);         /* In */
-
-
-#endif
diff --git a/groundStation/src/backend/getparam.c b/groundStation/src/backend/getparam.c
index f20c5e17c..34c90fa28 100644
--- a/groundStation/src/backend/getparam.c
+++ b/groundStation/src/backend/getparam.c
@@ -1,46 +1,46 @@
-#include "getcontrol.h"
+#include "getparam.h"
 #include "commands.h"
 #include "bitwise.h"
 
 #include <sys/types.h>
 
-enum GetcontrolData {
+enum GetparamData {
 	CTRL_ID,
 	CTRLVAL_ID,
-	GC_DATA_SIZE
+	GP_DATA_SIZE
 };
 
 /* Creates data and metadata for a respcontrol packet
  * Returns data size.
  */
-ssize_t EncodeGetcontrol(
+ssize_t EncodeGetparam(
         struct metadata * m,        /* data_len and msg_type will be populated*/
         uint8_t * data,             /* Output buffer */
         size_t data_size,           /* Max buffer size */
         const struct controller_message * cm)       /* Message to encode */
 {
 	m->msg_type = GETPARAM_ID;
-	m->data_len = GC_DATA_SIZE;
+	m->data_len = GP_DATA_SIZE;
 
-	if (data_size < GC_DATA_SIZE) {
+	if (data_size < GP_DATA_SIZE) {
 		return -1;
 	}
 
 	data[CTRL_ID] = cm->id;
 	data[CTRLVAL_ID] = cm->value_id;
 
-	return GC_DATA_SIZE;
+	return GP_DATA_SIZE;
 }
 
 /* Decode a metadata and data to populate a controller.
  * Returns 0 on success, -1 on failure.
  */
-int DecodeGetcontrol(
+int DecodeGetparam(
         struct controller_message * cm,     /* Decoded controller message */
         const struct metadata * m,          /* Metadata to aid in decoding */
         const uint8_t * data)               /* Data to decode */
 {
-	if (m->data_len < GC_DATA_SIZE) {
+	if (m->data_len < GP_DATA_SIZE) {
 		return -1;
 	}
 	if (m->msg_type != GETPARAM_ID) {
diff --git a/groundStation/src/backend/getparam.h b/groundStation/src/backend/getparam.h
index edbb85081..c9d9096df 100644
--- a/groundStation/src/backend/getparam.h
+++ b/groundStation/src/backend/getparam.h
@@ -1,5 +1,5 @@
-#ifndef _getcontrol_h
-#define _getcontrol_h
+#ifndef _getparam_h
+#define _getparam_h
 
 #include "packet.h"
 #include "controller.h"
@@ -10,7 +10,7 @@
 /* Creates data and metadata for a getcontrol packet.
  * Returns data size.
  */
-ssize_t EncodeGetcontrol(
+ssize_t EncodeGetparam(
 		struct metadata *m, /* Out */
 		uint8_t *data,      /* Out */
 		size_t data_size,   /* Data buffer max size */
@@ -19,7 +19,7 @@ ssize_t EncodeGetcontrol(
 /* Decode a metadata and data to populate a message
  * Returns 0 on success, -1 on failure
  */
-int DecodeGetcontrol(
+int DecodeGetparam(
 		struct controller_message *cm, /* Out. Value is undefined */
 		const struct metadata *m,      /* In */
 		const uint8_t * data);         /* In */
diff --git a/groundStation/src/backend/response.c b/groundStation/src/backend/response.c
index 604eb5899..c85f5e401 100644
--- a/groundStation/src/backend/response.c
+++ b/groundStation/src/backend/response.c
@@ -1,32 +1,32 @@
-#include "respcontrol.h"
+#include "response.h"
 #include "commands.h"
 #include "bitwise.h"
 
 #include <sys/types.h>
 
-enum RespcontrolData {
+enum ResponseData {
 	CTRL_ID,
 	CTRLVAL_ID,
 	VAL_1,
 	VAL_2,
 	VAL_3,
 	VAL_4,
-	RC_DATA_SIZE
+	RESP_DATA_SIZE
 };
 
 /* Creates data and metadata for a respcontrol packet
  * Returns data size.
  */
-ssize_t EncodeRespcontrol(
+ssize_t EncodeResponse(
         struct metadata * m,        /* data_len and msg_type will be populated*/
         uint8_t * data,             /* Output buffer */
         size_t data_size,           /* Max buffer size */
         const struct controller_message * cm)       /* Message to encode */
 {
 	m->msg_type = RESPONSE_ID;
-	m->data_len = RC_DATA_SIZE;
+	m->data_len = RESP_DATA_SIZE;
 
-	if (data_size < RC_DATA_SIZE) {
+	if (data_size < RESP_DATA_SIZE) {
 		return -1;
 	}
 
@@ -37,18 +37,18 @@ ssize_t EncodeRespcontrol(
 	data[VAL_3] = FloatByte3(cm->value);
 	data[VAL_4] = FloatByte4(cm->value);
 
-	return RC_DATA_SIZE;
+	return RESP_DATA_SIZE;
 }
 
 /* Decode a metadata and data to populate a controller.
  * Returns 0 on success, -1 on failure.
  */
-int DecodeRespcontrol(
+int DecodeResponse(
         struct controller_message * cm,     /* Decoded controller message */
         const struct metadata * m,          /* Metadata to aid in decoding */
         const uint8_t * data)               /* Data to decode */
 {
-	if (m->data_len < RC_DATA_SIZE) {
+	if (m->data_len < RESP_DATA_SIZE) {
 		return -1;
 	}
 	if (m->msg_type != RESPONSE_ID) {
diff --git a/groundStation/src/backend/response.h b/groundStation/src/backend/response.h
index a23c22550..565458a8f 100644
--- a/groundStation/src/backend/response.h
+++ b/groundStation/src/backend/response.h
@@ -1,5 +1,5 @@
-#ifndef _respcontrol_h
-#define _respcontrol_h
+#ifndef _response_h
+#define _response_h
 
 #include "packet.h"
 #include "controller.h"
@@ -10,7 +10,7 @@
 /* Creates data and metadata for a respcontrol packet.
  * Returns data size.
  */
-ssize_t EncodeRespcontrol(
+ssize_t EncodeResponse(
 		struct metadata *m, /* Out */
 		uint8_t *data,      /* Out */
 		size_t data_size,   /* Data buffer max size */
@@ -19,7 +19,7 @@ ssize_t EncodeRespcontrol(
 /* Decode a metadata and data to populate a message
  * Returns 0 on success, -1 on failure
  */
-int DecodeRespcontrol(
+int DecodeResponse(
 		struct controller_message *cm, /* Out */
 		const struct metadata *m,      /* In */
 		const uint8_t * data);         /* In */
diff --git a/groundStation/src/backend/setparam.c b/groundStation/src/backend/setparam.c
index e088fe657..c97ed01f4 100644
--- a/groundStation/src/backend/setparam.c
+++ b/groundStation/src/backend/setparam.c
@@ -1,32 +1,32 @@
-#include "setcontrol.h"
+#include "setparam.h"
 #include "commands.h"
 #include "bitwise.h"
 
 #include <sys/types.h>
 
-enum SetcontrolData {
+enum SetparamData {
 	CTRL_ID,
 	CTRLVAL_ID,
 	VAL_1,
 	VAL_2,
 	VAL_3,
 	VAL_4,
-	SC_DATA_SIZE
+	SP_DATA_SIZE
 };
 
 /* Creates data and metadata for a setcontrol packet
  * Returns data size.
  */
-ssize_t EncodeSetcontrol(
+ssize_t EncodeSetparam(
         struct metadata * m,        /* data_len and msg_type will be populated*/
         uint8_t * data,             /* Output buffer */
         size_t data_size,           /* Max buffer size */
         const struct controller_message * cm)       /* Message to encode */
 {
 	m->msg_type = SETPARAM_ID;
-	m->data_len = SC_DATA_SIZE;
+	m->data_len = SP_DATA_SIZE;
 
-	if (data_size < SC_DATA_SIZE) {
+	if (data_size < SP_DATA_SIZE) {
 		return -1;
 	}
 
@@ -37,18 +37,18 @@ ssize_t EncodeSetcontrol(
 	data[VAL_3] = FloatByte3(cm->value);
 	data[VAL_4] = FloatByte4(cm->value);
 
-	return SC_DATA_SIZE;
+	return SP_DATA_SIZE;
 }
 
 /* Decode a metadata and data to populate a controller.
  * Returns 0 on success, -1 on failure.
  */
-int DecodeSetcontrol(
+int DecodeSetparam(
         struct controller_message * cm,     /* Decoded controller message */
         const struct metadata * m,          /* Metadata to aid in decoding */
         const uint8_t * data)               /* Data to decode */
 {
-	if (m->data_len < SC_DATA_SIZE) {
+	if (m->data_len < SP_DATA_SIZE) {
 		return -1;
 	}
 	if (m->msg_type != SETPARAM_ID) {
diff --git a/groundStation/src/backend/setparam.h b/groundStation/src/backend/setparam.h
index b7f880bce..671d7aa24 100644
--- a/groundStation/src/backend/setparam.h
+++ b/groundStation/src/backend/setparam.h
@@ -1,5 +1,5 @@
-#ifndef _setcontrol_h
-#define _setcontrol_h
+#ifndef _setparam_h
+#define _setparam_h
 
 #include "packet.h"
 #include "controller.h"
@@ -9,7 +9,7 @@
 /* Creates data and metadata for a setcontrol packet
  * Returns data size.
  */
-ssize_t EncodeSetcontrol(
+ssize_t EncodeSetparam(
 		struct metadata * m,        /* data_len and msg_type will be populated*/
 		uint8_t * data,             /* Output buffer */
 		size_t data_size,           /* Max buffer size */
@@ -18,7 +18,7 @@ ssize_t EncodeSetcontrol(
 /* Decode a metadata and data to populate a controller.
  * Returns 0 on success, -1 on failure.
  */
-int DecodeSetcontrol(
+int DecodeSetparam(
 		struct controller_message * cm,     /* Decoded controller message */
 		const struct metadata * m,          /* Metadata to aid in decoding */
 		const uint8_t * data);              /* Data to decode */
-- 
GitLab