Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 21:53c2a598dda1, committed 2015-12-01
- 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 +