diff --git a/Development/Software/Client API/Client API.vcxproj b/Development/Software/Client API/Client API.vcxproj index c2bfd19115c6b3e25fdce0366a009fc67cd224b4..b736fc01be0550a507ab31a051a565f998e2dc6c 100644 --- a/Development/Software/Client API/Client API.vcxproj +++ b/Development/Software/Client API/Client API.vcxproj @@ -11,16 +11,20 @@ </ProjectConfiguration> </ItemGroup> <ItemGroup> - <ClCompile Include="Communications.cpp" /> + <ClCompile Include="Sources\Communications.cpp" /> <ClCompile Include="Sources\Bluetooth\UnixBluetooth.cpp" /> <ClCompile Include="Sources\Bluetooth\WindowsBluetooth.cpp" /> <ClCompile Include="Sources\Listener\UnixListener.cpp" /> <ClCompile Include="Sources\Listener\WindowsListener.cpp" /> + <ClCompile Include="Sources\Message.cpp" /> </ItemGroup> <ItemGroup> - <ClInclude Include="Communications.h" /> + <ClInclude Include="Headers\Communications.h" /> <ClInclude Include="Headers\Bluetooth.h" /> <ClInclude Include="Headers\Listener.h" /> + <ClInclude Include="Headers\Message.h" /> + <ClInclude Include="Headers\ServiceIDs.h" /> + <ClInclude Include="Headers\ServiceSet.h" /> </ItemGroup> <ItemGroup> <Text Include="README.txt" /> diff --git a/Development/Software/Client API/Client API.vcxproj.filters b/Development/Software/Client API/Client API.vcxproj.filters index 79bb6b7a21a644baf5d82b67ecd3293c513ae2fd..c0430255b210861791a908d65007343b80f6b999 100644 --- a/Development/Software/Client API/Client API.vcxproj.filters +++ b/Development/Software/Client API/Client API.vcxproj.filters @@ -15,9 +15,6 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="Communications.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="Sources\Bluetooth\UnixBluetooth.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -30,6 +27,12 @@ <ClCompile Include="Sources\Listener\UnixListener.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="Sources\Communications.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="Sources\Message.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <Text Include="README.txt"> @@ -37,14 +40,23 @@ </Text> </ItemGroup> <ItemGroup> - <ClInclude Include="Communications.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="Headers\Listener.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="Headers\Bluetooth.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="Headers\Communications.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Headers\ServiceSet.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Headers\ServiceIDs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="Headers\Message.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project> \ No newline at end of file diff --git a/Development/Software/Client API/Communications.cpp b/Development/Software/Client API/Communications.cpp deleted file mode 100644 index a86f06e2fd37609772eb92f4c814fc73b00a11ef..0000000000000000000000000000000000000000 --- a/Development/Software/Client API/Communications.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "Communications.h" - - -bool start() -{ - return true; -} - -bool stop() -{ - return false; -} - -bool connect() -{ - return true; -} - -bool disconnect() -{ - return false; -} - -bool sendMessage() -{ - return true; -} - -bool receiveMessage() -{ - return false; -} \ No newline at end of file diff --git a/Development/Software/Client API/Communications.h b/Development/Software/Client API/Communications.h deleted file mode 100644 index 5e91068bd7eb9c80dc5a93d4879b9f756e1c482a..0000000000000000000000000000000000000000 --- a/Development/Software/Client API/Communications.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifdef __cplusplus - -#define ExternC extern "C" -#define DLLExport __declspec(dllexport) - -#else - -#define ExternC -#define DLLExport -#include <stdbool.h> - -#endif - - - -ExternC DLLExport bool start(); -ExternC DLLExport bool stop(); - -ExternC DLLExport bool connect(); -ExternC DLLExport bool disconnect(); - -ExternC DLLExport bool sendMessage(); -ExternC DLLExport bool receiveMessage(); - - - diff --git a/Development/Software/Client API/Headers/Bluetooth.h b/Development/Software/Client API/Headers/Bluetooth.h index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..7b4d099a0ce9c0bb1b5d2a5b5784806206897c04 100644 --- a/Development/Software/Client API/Headers/Bluetooth.h +++ b/Development/Software/Client API/Headers/Bluetooth.h @@ -0,0 +1,9 @@ +bool sendDataStub() +{ + return true; +} + +bool receiveDataStub() +{ + return true; +} \ No newline at end of file diff --git a/Development/Software/Client API/Headers/Communications.h b/Development/Software/Client API/Headers/Communications.h new file mode 100644 index 0000000000000000000000000000000000000000..8534c651ab71a0155d6004f943a0d1af1da36fae --- /dev/null +++ b/Development/Software/Client API/Headers/Communications.h @@ -0,0 +1,26 @@ +#ifdef __cplusplus + +#define ExternC extern "C" +#define DLLExport __declspec(dllexport) +#include "Message.h" + +#else + +#define ExternC +#define DLLExport +#include <stdbool.h> + +#endif + +#include "ServiceSet.h" + +ExternC DLLExport bool connect(); +ExternC DLLExport bool disconnect(); + +ExternC DLLExport double readSensor(int serviceID); +ExternC DLLExport int readSensors(double buff[], int length, ServiceSet serviceIDs); +ExternC DLLExport bool receiveAudio(); +ExternC DLLExport bool sendAudio(); + + + diff --git a/Development/Software/Client API/Headers/Message.h b/Development/Software/Client API/Headers/Message.h new file mode 100644 index 0000000000000000000000000000000000000000..b472061aa0d53ef8b589be60c9d77ed142c8d031 --- /dev/null +++ b/Development/Software/Client API/Headers/Message.h @@ -0,0 +1,31 @@ +#pragma once + +#include <iostream> +#include <stdio.h> +#include <list> + +using namespace std; + +template <class T> +class Message +{ +public: + Message(string sender, string destination, list<T> data); + ~Message(); + + string getSender(); + string getDestination(); + type_info dataType; + list<T> getData(); + + ostream& operator>>(ostream& os); + + istream& operator<<(istream& is); +private: + string _sender; + string _destination; + + list<T> _data; + +}; + diff --git a/Development/Software/Client API/Headers/ServiceIDs.h b/Development/Software/Client API/Headers/ServiceIDs.h new file mode 100644 index 0000000000000000000000000000000000000000..bc08f038b7b60b2040b53649abdbed7766305e5a --- /dev/null +++ b/Development/Software/Client API/Headers/ServiceIDs.h @@ -0,0 +1,11 @@ +#define GYRO_X 101 +#define GYRO_Y 102 +#define GYRO_Z 103 + +#define ACCEL_X 111 +#define ACCEL_Y 112 +#define ACCEL_Z 113 + +#define MAG_X 121 +#define MAG_Y 122 +#define MAG_Z 123 diff --git a/Development/Software/Client API/Headers/ServiceSet.h b/Development/Software/Client API/Headers/ServiceSet.h new file mode 100644 index 0000000000000000000000000000000000000000..7e2a2fd5db821b4fbfc3a3f1ff6878d079a4b300 --- /dev/null +++ b/Development/Software/Client API/Headers/ServiceSet.h @@ -0,0 +1,11 @@ +#include "ServiceIDs.h" + +typedef struct { + int numServices; + int serviceIDs[]; +} ServiceSet; + +const ServiceSet GyroSet = { 3, { GYRO_X, GYRO_Y, GYRO_Z } }; +const ServiceSet AccelSet = { 3, { ACCEL_X, ACCEL_Y, ACCEL_Z } }; +const ServiceSet MagSet = { 3, { MAG_X, MAG_Y, MAG_Z } }; + diff --git a/Development/Software/Client API/Sources/Communications.cpp b/Development/Software/Client API/Sources/Communications.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5ea8627ff33697773555140ec9a6d17e467b0160 --- /dev/null +++ b/Development/Software/Client API/Sources/Communications.cpp @@ -0,0 +1,37 @@ +#include "../Headers/Communications.h" + +// Connects to a specified bluetooth address +bool connect() +{ + return true; +} + +// Disconnects from the current connection +bool disconnect() +{ + return false; +} + +// Reads from a single sensor +double readSensor(int serviceID) +{ + +} + +// Read from a set of sensors specified +int readSensors(double buff[], int length, ServiceSet serviceIDs) +{ + +} + +// Receive audio from the audio codec +bool receiveAudio() +{ + +} + +// Sends a set of audio to be played by the audio codec +bool sendAudio() +{ + +} \ No newline at end of file diff --git a/Development/Software/Client API/Sources/Message.cpp b/Development/Software/Client API/Sources/Message.cpp new file mode 100644 index 0000000000000000000000000000000000000000..79c6b6fc2854f429d9f28d3149a76d732e2d6faa --- /dev/null +++ b/Development/Software/Client API/Sources/Message.cpp @@ -0,0 +1,24 @@ +#include "../Headers/Message.h" + +template <class T> +Message::Message(string sender, string destination, list<T> data) +{ + _sender = sender; + _destination = destination; + _data = data; +} +template <class T> +string Message<T>::getSender() +{ + return _sender; +} +template <class T> +string Message::getDestination() +{ + return _destination; +} +template <class T> +list<T> Message::getData() +{ + return _data; +} diff --git a/Development/Software/Controller API/Controller API.vcxproj b/Development/Software/Controller API/Controller API.vcxproj index d5cca09c4ad3378f20c785b308d439c39b8ae945..cbbfb7a196f637f0e68ce7c7749424b3d849104a 100644 --- a/Development/Software/Controller API/Controller API.vcxproj +++ b/Development/Software/Controller API/Controller API.vcxproj @@ -25,13 +25,13 @@ <ClCompile Include="Sources\System\Thread.cpp" /> </ItemGroup> <ItemGroup> + <ClInclude Include="Headers\MessagePassing\Message.h" /> <ClInclude Include="Headers\System\Bluetooth.h" /> <ClInclude Include="Headers\Client.h" /> <ClInclude Include="Headers\Communications.h" /> <ClInclude Include="Headers\Service\GyroService.h" /> <ClInclude Include="Headers\Sensor\Joystick.h" /> <ClInclude Include="Headers\MessagePassing\Mailbox.h" /> - <ClInclude Include="Headers\MessagePassing\Message.h" /> <ClInclude Include="Headers\Sensor\MPU9250.h" /> <ClInclude Include="Headers\Server.h" /> <ClInclude Include="Headers\Service\Service.h" /> diff --git a/Development/Software/Controller API/Controller API.vcxproj.filters b/Development/Software/Controller API/Controller API.vcxproj.filters index abeb9180deb855111426e04ef358e036a4a6421b..25ead8173dd5731f04e0dbfb36f8b0cf7f224e3c 100644 --- a/Development/Software/Controller API/Controller API.vcxproj.filters +++ b/Development/Software/Controller API/Controller API.vcxproj.filters @@ -83,9 +83,6 @@ <ClInclude Include="Headers\MessagePassing\Mailbox.h"> <Filter>Header Files\MessagePassing</Filter> </ClInclude> - <ClInclude Include="Headers\MessagePassing\Message.h"> - <Filter>Header Files\MessagePassing</Filter> - </ClInclude> <ClInclude Include="Headers\System\Bluetooth.h"> <Filter>Header Files</Filter> </ClInclude> @@ -104,6 +101,9 @@ <ClInclude Include="Headers\Service\GyroService.h"> <Filter>Header Files\Services</Filter> </ClInclude> + <ClInclude Include="Headers\MessagePassing\Message.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <Text Include="Makefile.txt">