From 5fab267f52256d959a739f847c1541a3f854e587 Mon Sep 17 00:00:00 2001
From: Jake <j@kedrahos.com>
Date: Sun, 29 Jan 2017 15:56:25 -0600
Subject: [PATCH] Implemented FindCommand

---
 groundStation/src/backend/commands.c | 11 +++++++++++
 groundStation/src/backend/commands.h |  6 +-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/groundStation/src/backend/commands.c b/groundStation/src/backend/commands.c
index fe8151978..bbd0ee20c 100644
--- a/groundStation/src/backend/commands.c
+++ b/groundStation/src/backend/commands.c
@@ -183,3 +183,14 @@ struct MessageType MessageTypes[MAX_TYPE_ID] =
 	}
 
 };
+
+
+int findCommand(char * str)
+{
+	for (int i = 0; i < MAX_TYPE_ID; i++) {
+		if (strcmp(str, MessageTypes[i].cmdText) == 0) {
+			return i;
+		}
+	}
+	return -1;
+}
diff --git a/groundStation/src/backend/commands.h b/groundStation/src/backend/commands.h
index ecbae2c04..482724a5e 100644
--- a/groundStation/src/backend/commands.h
+++ b/groundStation/src/backend/commands.h
@@ -89,10 +89,6 @@ struct MessageType{
 
 /* Defined in commands.c */
 extern struct MessageType MessageTypes[MAX_TYPE_ID];
-
-/* Legacy functions - no idea what uses these. Please do not delete. */
-float getFloat(unsigned char* str, int pos);
-int getInt(unsigned char* str, int pos);
-/* end legacy crap */
+int findCommand(char * cmdStr);
 
 #endif
-- 
GitLab