diff --git a/Development/Software/Controller API/Service.cpp b/Development/Software/Controller API/Service.cpp index 202a548cae16a0512045bcd0a168c7f7a0ab5dfd..96e6c211582b098fa71938271232d1934b3dad38 100644 --- a/Development/Software/Controller API/Service.cpp +++ b/Development/Software/Controller API/Service.cpp @@ -1,11 +1,6 @@ #include "Service.h" -Service::Service(int id, string name, double frequency) -{ - _id = id; - _name = name; - _frequency = frequency; -} +Service::Service(int id, string name, double frequency) : _id(id), _name(name), _frequency(frequency) {} ServiceInfo Service::info() { diff --git a/Development/Software/Controller API/Source.cpp b/Development/Software/Controller API/Source.cpp index 7831e81e07c01a4f61720e700470e91d2762b3ad..be6dfd3fa94fe238e6206ee19439d001344b7eca 100644 --- a/Development/Software/Controller API/Source.cpp +++ b/Development/Software/Controller API/Source.cpp @@ -2,95 +2,12 @@ #include <iostream> #include <string> -#include "Client.h" -#include "Server.h" -#include "Capsule.h" +#include "LSM9DS0.h" using namespace std; -using namespace Client; -using namespace Server; - -void clientSide() -{ - string address; - bool stop = false; - string message = ""; - - cout << "MAC Address I need to connect to: "; - cin >> address; - - if (!Client::cInit(address)) - { - cout << "That address is not properly formatted." << endl; - return; - } - - Client::cConnect(); - - cout << "Please input your message, if you would like to stop type \"STOP\"" << endl; - - while (Client::cCheckStatus() && !stop) - { - getline(cin, message); - - Capsule cap = Capsule(message); - - if (message.compare("STOP") == 0) stop = true; - - Client::cSendMessage((string)((char*)&cap)); - } - - if (!Client::cCheckStatus()) - { - perror("Oh no!"); - } - - Client::cDisconnect(); - - cout << "Shutting Client Down" << endl;; - - return; -} - -void serverSide() -{ - bool stop = false; - string message = ""; - - Server::sInit(); - - message = Server::sListen(); - - cout << message + " has connected to the server" << endl; - - while (!stop) - { - message = Server::sReadMessage(); - - Capsule cap = (Capsule&)(*message.c_str()); - - - //if (message.compare("STOP") == 0) stop = true; - /*else*/ cout << cap.WhatDoIHave() << endl; - } - - Server::sDisconnect(); - cout << "Shutting Server Down." << endl; - return; -} int main(int argc, char **argv) { - string choice; - - cout << "Would you like to be Client or Server? "; - cin >> choice; - - if (choice.compare("Client") == 0) clientSide(); - else if (choice.compare("Server") == 0) serverSide(); - else cout << "Wrong choice" << endl; - - cout << "Closing program now." << endl; - + return 0; } \ No newline at end of file