Oscar Schofield / Mbed 2 deprecated Elec350_OBS

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Oschofield
Date:
Tue Dec 01 13:18:49 2015 +0000
Parent:
20:85a44ddbdc41
Commit message:
added the App.h and app.cpp files to library;

Changed in this revision

app.cpp Show annotated file Show diff for this revision Revisions of this file
app.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app.cpp	Tue Dec 01 13:18:49 2015 +0000
@@ -0,0 +1,25 @@
+#include "app.h"
+#include "mbed.h"
+
+App::App(string name, Serial* serialPort) // Constructor - Names the app and allocates the Serial Port info.
+{
+    this -> name = name;
+    this -> serialPort = serialPort;    
+}
+
+string App::getName() // returns the Applications name
+{
+    return this -> name;
+}
+
+void App::start()
+{
+    string message = "Application " + this->name + " has Started. \r\n";
+    this->serialPort -> puts(message.c_str());
+}
+
+void App::stop()
+{
+    string message = "Application " + this->name + " terminated. \r\n";
+    this->serialPort -> puts(message.c_str());
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app.h	Tue Dec 01 13:18:49 2015 +0000
@@ -0,0 +1,23 @@
+#ifndef _APP_H_
+#define _APP_H_
+
+#include <string>
+#include "mbed.h"
+
+class App
+{
+    protected: 
+        string name;
+        Serial* serialPort;
+        
+    public:
+        App(string name, Serial* serialPort);   //constructor 
+        string getName();                       //returns the App name
+        virtual void start();
+        virtual void run() = 0;
+        virtual void stop();
+
+};
+
+#endif 
+