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.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/ConfigurationHandler/ConfigurationHandler.cpp
- Revision:
- 5:5e77a1db4d45
- Parent:
- 3:8ea4db957749
- Child:
- 10:38d8ece439da
- Child:
- 11:0695c1091129
- Child:
- 12:ea87887ca7ad
diff -r 8ea4db957749 -r 5e77a1db4d45 src/ConfigurationHandler/ConfigurationHandler.cpp --- a/src/ConfigurationHandler/ConfigurationHandler.cpp Tue Sep 06 17:51:37 2016 +0000 +++ b/src/ConfigurationHandler/ConfigurationHandler.cpp Tue Sep 06 19:20:39 2016 +0000 @@ -6,13 +6,88 @@ *****************************************************************************/ #include "ConfigurationHandler.h" #include "global.h" +#include "SetpointControl.h" + +// local function prototypes +static int loadPersistentControls(void); + +static int createControl(const Message_t *msg); +static int modifyControl(const Message_t *msg); +static int destroyControl(const Message_t *msg); + +static int loadPersistentControls(void) +{ + printf("\r%s: stubbed.\n", __func__); + return 0; +} void ConfigurationHandler(void const *args) { - //loadPersistentControls() + loadPersistentControls(); osSignalSet(mainThreadId, sig_continue); - + while ( true ) { - // do stuff + // wait for an event + osEvent evt = MailBox.get(); + if (evt.status == osEventMail) { + Message_t *msg = (Message_t*) evt.value.p; + + printf("\r%s: mes->action = %d\n", __func__, msg->action); + printf("\r%s: msg->control = %d\n", __func__, msg->control); + printf("\r%s: msg->controlFile = %s\n", __func__, msg->controlFile); + + switch ( msg->action ) { + case ACTION_CREATE: { + (void)createControl(msg); + break; + } + case ACTION_MODIFY: { + (void)modifyControl(msg); + break; + } + case ACTION_DESTROY: { + (void)destroyControl(msg); + break; + } + default: + break; + } + + // free the message + MailBox.free(msg); + } } } + +static int createControl(const Message_t *msg) +{ + printf("\r%s invoked\n", __func__); + + switch (msg->control) { + case CONTROL_SETPOINT: { + SetpointControl *setpointControl = new SetpointControl(msg->controlFile); + printf("\r%s: setpoint control file = %s\n", __func__, setpointControl->getControlFile().c_str()); + + break; + } + case CONTROL_TIMER: { + // do something similar here + break; + } + default: + break; + } + return 0; +} +static int modifyControl(const Message_t *msg) +{ + printf("\r%s invoked\n", __func__); + return 0; + +} +static int destroyControl(const Message_t *msg) +{ + printf("\r%s invoked\n", __func__); + return 0; + +}