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
src/ConfigurationHandler/ConfigurationHandler.cpp@170:f9406996ff5b, 2016-10-03 (annotated)
- Committer:
- jmarkel44
- Date:
- Mon Oct 03 21:57:36 2016 +0000
- Revision:
- 170:f9406996ff5b
- Parent:
- 166:f165ca3f67cd
- Child:
- 195:21df85341cb3
reduced control thread size;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmarkel44 | 0:65cfa4873284 | 1 | /****************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 2 | * |
jmarkel44 | 0:65cfa4873284 | 3 | * File: ConfigurationHandler.cpp |
jmarkel44 | 0:65cfa4873284 | 4 | * Desciption: source for the ICE Configuration Handler |
jmarkel44 | 0:65cfa4873284 | 5 | * |
jmarkel44 | 0:65cfa4873284 | 6 | *****************************************************************************/ |
jmarkel44 | 3:8ea4db957749 | 7 | #include "ConfigurationHandler.h" |
jmarkel44 | 0:65cfa4873284 | 8 | #include "global.h" |
jmarkel44 | 5:5e77a1db4d45 | 9 | #include "SetpointControl.h" |
jmarkel44 | 12:ea87887ca7ad | 10 | #include "TimerControl.h" |
jmarkel44 | 156:44f87c5a83ae | 11 | #include <algorithm> |
jmarkel44 | 12:ea87887ca7ad | 12 | |
jmarkel44 | 156:44f87c5a83ae | 13 | StringSetpointMap setpointTable; // setpoint control object table |
jmarkel44 | 156:44f87c5a83ae | 14 | StringVectorTimerMap timerTable; // timer control object table |
jmarkel44 | 156:44f87c5a83ae | 15 | StringManualMap manualTable; // manual control object table |
jmarkel44 | 5:5e77a1db4d45 | 16 | |
jmarkel44 | 5:5e77a1db4d45 | 17 | // local function prototypes |
jmarkel44 | 5:5e77a1db4d45 | 18 | static int loadPersistentControls(void); |
jmarkel44 | 5:5e77a1db4d45 | 19 | |
jmarkel44 | 74:03ccf04998b5 | 20 | // local helper functions |
jmarkel44 | 5:5e77a1db4d45 | 21 | static int createControl(const Message_t *msg); |
jmarkel44 | 5:5e77a1db4d45 | 22 | static int modifyControl(const Message_t *msg); |
jmarkel44 | 5:5e77a1db4d45 | 23 | static int destroyControl(const Message_t *msg); |
jmarkel44 | 5:5e77a1db4d45 | 24 | |
jmarkel44 | 170:f9406996ff5b | 25 | // sort function for timer controls |
jmarkel44 | 156:44f87c5a83ae | 26 | bool compareStartTime(const TimerControl *lhs, const TimerControl *rhs) { |
jmarkel44 | 156:44f87c5a83ae | 27 | return (lhs->getStartTime() < rhs->getStartTime()); |
jmarkel44 | 156:44f87c5a83ae | 28 | } |
jmarkel44 | 156:44f87c5a83ae | 29 | |
jmarkel44 | 12:ea87887ca7ad | 30 | /***************************************************************************** |
jmarkel44 | 12:ea87887ca7ad | 31 | * Function: ConfigurationHandler() |
jmarkel44 | 12:ea87887ca7ad | 32 | * Description: The ICE Configuration Handler |
jmarkel44 | 12:ea87887ca7ad | 33 | * |
jmarkel44 | 12:ea87887ca7ad | 34 | * @param args (unused) |
jmarkel44 | 12:ea87887ca7ad | 35 | * @return none |
jmarkel44 | 12:ea87887ca7ad | 36 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 37 | void ConfigurationHandler(void const *args) |
jmarkel44 | 0:65cfa4873284 | 38 | { |
jmarkel44 | 12:ea87887ca7ad | 39 | UNUSED(args); |
jmarkel44 | 5:5e77a1db4d45 | 40 | loadPersistentControls(); |
jmarkel44 | 75:96512ccc0443 | 41 | osSignalSet(mainThreadId, sig_config_continue); |
jmarkel44 | 5:5e77a1db4d45 | 42 | |
jmarkel44 | 3:8ea4db957749 | 43 | while ( true ) { |
jmarkel44 | 5:5e77a1db4d45 | 44 | // wait for an event |
jmarkel44 | 5:5e77a1db4d45 | 45 | osEvent evt = MailBox.get(); |
jmarkel44 | 5:5e77a1db4d45 | 46 | if (evt.status == osEventMail) { |
jmarkel44 | 5:5e77a1db4d45 | 47 | Message_t *msg = (Message_t*) evt.value.p; |
jmarkel44 | 5:5e77a1db4d45 | 48 | |
jmarkel44 | 37:7e6986b77f01 | 49 | logInfo("\r%s: mes->action = %d\n", __func__, msg->action); |
jmarkel44 | 37:7e6986b77f01 | 50 | logInfo("\r%s: msg->control = %d\n", __func__, msg->control); |
jmarkel44 | 37:7e6986b77f01 | 51 | logInfo("\r%s: msg->controlFile = %s\n", __func__, msg->controlFile); |
jmarkel44 | 5:5e77a1db4d45 | 52 | |
jmarkel44 | 5:5e77a1db4d45 | 53 | switch ( msg->action ) { |
jmarkel44 | 5:5e77a1db4d45 | 54 | case ACTION_CREATE: { |
jmarkel44 | 5:5e77a1db4d45 | 55 | (void)createControl(msg); |
jmarkel44 | 5:5e77a1db4d45 | 56 | break; |
jmarkel44 | 5:5e77a1db4d45 | 57 | } |
jmarkel44 | 5:5e77a1db4d45 | 58 | case ACTION_MODIFY: { |
jmarkel44 | 5:5e77a1db4d45 | 59 | (void)modifyControl(msg); |
jmarkel44 | 5:5e77a1db4d45 | 60 | break; |
jmarkel44 | 5:5e77a1db4d45 | 61 | } |
jmarkel44 | 5:5e77a1db4d45 | 62 | case ACTION_DESTROY: { |
jmarkel44 | 5:5e77a1db4d45 | 63 | (void)destroyControl(msg); |
jmarkel44 | 5:5e77a1db4d45 | 64 | break; |
jmarkel44 | 5:5e77a1db4d45 | 65 | } |
jmarkel44 | 5:5e77a1db4d45 | 66 | default: |
jmarkel44 | 5:5e77a1db4d45 | 67 | break; |
jmarkel44 | 5:5e77a1db4d45 | 68 | } |
jmarkel44 | 5:5e77a1db4d45 | 69 | |
jmarkel44 | 5:5e77a1db4d45 | 70 | // free the message |
jmarkel44 | 5:5e77a1db4d45 | 71 | MailBox.free(msg); |
jmarkel44 | 5:5e77a1db4d45 | 72 | } |
jmarkel44 | 0:65cfa4873284 | 73 | } |
jmarkel44 | 0:65cfa4873284 | 74 | } |
jmarkel44 | 5:5e77a1db4d45 | 75 | |
jmarkel44 | 12:ea87887ca7ad | 76 | /***************************************************************************** |
jmarkel44 | 12:ea87887ca7ad | 77 | * Function: ConfigurationHandler_showControls() |
jmarkel44 | 13:c80c283f9db2 | 78 | * Description: show the controls |
jmarkel44 | 12:ea87887ca7ad | 79 | * |
jmarkel44 | 12:ea87887ca7ad | 80 | * @param msg |
jmarkel44 | 12:ea87887ca7ad | 81 | * @return none |
jmarkel44 | 12:ea87887ca7ad | 82 | *****************************************************************************/ |
jmarkel44 | 12:ea87887ca7ad | 83 | void ConfigurationHandler_showControls(void) |
jmarkel44 | 12:ea87887ca7ad | 84 | { |
jmarkel44 | 12:ea87887ca7ad | 85 | if ( !timerTable.empty() ) { |
jmarkel44 | 12:ea87887ca7ad | 86 | printf("\rTIMER CONTROLS\n"); |
jmarkel44 | 156:44f87c5a83ae | 87 | StringVectorTimerMap::iterator pos; |
jmarkel44 | 46:4cb96ab2d1c8 | 88 | for ( pos = timerTable.begin(); pos != timerTable.end(); ++pos ) { |
jmarkel44 | 156:44f87c5a83ae | 89 | vector<TimerControl *>::iterator it; |
jmarkel44 | 156:44f87c5a83ae | 90 | for ( it = pos->second.begin(); it != pos->second.end(); ++it ) { |
jmarkel44 | 156:44f87c5a83ae | 91 | (*it)->display(); |
jmarkel44 | 156:44f87c5a83ae | 92 | } |
jmarkel44 | 12:ea87887ca7ad | 93 | } |
jmarkel44 | 12:ea87887ca7ad | 94 | } |
jmarkel44 | 74:03ccf04998b5 | 95 | |
jmarkel44 | 12:ea87887ca7ad | 96 | if ( !setpointTable.empty() ) { |
jmarkel44 | 12:ea87887ca7ad | 97 | printf("\rSETPOINT CONTROLS\n"); |
jmarkel44 | 12:ea87887ca7ad | 98 | StringSetpointMap::iterator pos; |
jmarkel44 | 93:1553fb156915 | 99 | for ( pos = setpointTable.begin(); pos != setpointTable.end(); ++pos ) { |
jmarkel44 | 93:1553fb156915 | 100 | pos->second->display(); |
jmarkel44 | 12:ea87887ca7ad | 101 | } |
jmarkel44 | 12:ea87887ca7ad | 102 | } |
jmarkel44 | 121:650205ffa656 | 103 | |
jmarkel44 | 97:5cf6ab71dcd0 | 104 | if ( !manualTable.empty() ) { |
jmarkel44 | 97:5cf6ab71dcd0 | 105 | printf("MANUAL CONTROLS\n"); |
jmarkel44 | 97:5cf6ab71dcd0 | 106 | StringManualMap::iterator pos; |
jmarkel44 | 97:5cf6ab71dcd0 | 107 | for ( pos = manualTable.begin(); pos != manualTable.end(); ++pos ) { |
jmarkel44 | 97:5cf6ab71dcd0 | 108 | pos->second->display(); |
jmarkel44 | 97:5cf6ab71dcd0 | 109 | } |
jmarkel44 | 97:5cf6ab71dcd0 | 110 | } |
jmarkel44 | 12:ea87887ca7ad | 111 | } |
jmarkel44 | 12:ea87887ca7ad | 112 | |
jmarkel44 | 12:ea87887ca7ad | 113 | /***************************************************************************** |
jmarkel44 | 12:ea87887ca7ad | 114 | * Function: loadPersistentControls() |
jmarkel44 | 12:ea87887ca7ad | 115 | * Description: load persistent controls from flash |
jmarkel44 | 12:ea87887ca7ad | 116 | * |
jmarkel44 | 12:ea87887ca7ad | 117 | * @param none |
jmarkel44 | 12:ea87887ca7ad | 118 | * @return none |
jmarkel44 | 12:ea87887ca7ad | 119 | *****************************************************************************/ |
jmarkel44 | 12:ea87887ca7ad | 120 | static int loadPersistentControls(void) |
jmarkel44 | 12:ea87887ca7ad | 121 | { |
jmarkel44 | 12:ea87887ca7ad | 122 | static bool loaded = false; |
jmarkel44 | 12:ea87887ca7ad | 123 | |
jmarkel44 | 12:ea87887ca7ad | 124 | if ( !loaded ) { // lazy protection |
jmarkel44 | 121:650205ffa656 | 125 | |
jmarkel44 | 77:43e0a3d9e536 | 126 | printf("\rLoading persistent controls: \n"); |
jmarkel44 | 74:03ccf04998b5 | 127 | std::vector<mDot::mdot_file> file_list = GLOBAL_mdot->listUserFiles(); |
jmarkel44 | 156:44f87c5a83ae | 128 | |
jmarkel44 | 126:c85ac6a8e9af | 129 | loaded = true; |
jmarkel44 | 74:03ccf04998b5 | 130 | |
jmarkel44 | 74:03ccf04998b5 | 131 | for (std::vector<mDot::mdot_file>::iterator i = file_list.begin(); i != file_list.end(); ++i) { |
davidjhoward | 162:5e8948b8044d | 132 | printf("\rFile: %s\r\n",i->name); |
jmarkel44 | 74:03ccf04998b5 | 133 | if( strncmp( i->name, CONTROL_SP_STR, strlen(CONTROL_SP_STR)) == 0 ) { |
jmarkel44 | 77:43e0a3d9e536 | 134 | // create the setpoint control |
jmarkel44 | 74:03ccf04998b5 | 135 | Message_t msg; |
jmarkel44 | 74:03ccf04998b5 | 136 | msg.control = CONTROL_SETPOINT; |
jmarkel44 | 74:03ccf04998b5 | 137 | strncpy(msg.controlFile, i->name, sizeof(msg.controlFile)); |
jmarkel44 | 74:03ccf04998b5 | 138 | int rc = createControl(&msg); |
jmarkel44 | 74:03ccf04998b5 | 139 | if ( rc != 0 ) { |
jmarkel44 | 121:650205ffa656 | 140 | logError("%s: failed to load %s", __func__, msg.controlFile); |
jmarkel44 | 74:03ccf04998b5 | 141 | } else { |
jmarkel44 | 74:03ccf04998b5 | 142 | printf("\r control %s loaded.\n", msg.controlFile); |
jmarkel44 | 74:03ccf04998b5 | 143 | } |
jmarkel44 | 74:03ccf04998b5 | 144 | } else if ( strncmp( i->name, CONTROL_TM_STR, strlen(CONTROL_TM_STR)) == 0 ) { |
jmarkel44 | 121:650205ffa656 | 145 | // create the timer control |
jmarkel44 | 74:03ccf04998b5 | 146 | Message_t msg; |
jmarkel44 | 74:03ccf04998b5 | 147 | msg.control = CONTROL_TIMER; |
jmarkel44 | 74:03ccf04998b5 | 148 | strncpy(msg.controlFile, i->name, sizeof(msg.controlFile)); |
jmarkel44 | 74:03ccf04998b5 | 149 | int rc = createControl(&msg); |
jmarkel44 | 74:03ccf04998b5 | 150 | if ( rc != 0 ) { |
jmarkel44 | 121:650205ffa656 | 151 | logError("%s: failed to load %s", __func__, msg.controlFile); |
jmarkel44 | 121:650205ffa656 | 152 | |
jmarkel44 | 74:03ccf04998b5 | 153 | } else { |
jmarkel44 | 74:03ccf04998b5 | 154 | printf("\r control %s loaded.\n", msg.controlFile); |
jmarkel44 | 74:03ccf04998b5 | 155 | } |
jmarkel44 | 74:03ccf04998b5 | 156 | } else if ( strncmp( i->name, CONTROL_MN_STR, strlen(CONTROL_MN_STR)) == 0 ) { |
jmarkel44 | 126:c85ac6a8e9af | 157 | // TODO: delete any timed manual control, not continuous... |
jmarkel44 | 126:c85ac6a8e9af | 158 | GLOBAL_mdot->deleteUserFile(i->name); |
jmarkel44 | 74:03ccf04998b5 | 159 | } else { |
davidjhoward | 162:5e8948b8044d | 160 | printf("\rNot A Control File%s\r\n",i->name); |
jmarkel44 | 74:03ccf04998b5 | 161 | // not a control file |
jmarkel44 | 74:03ccf04998b5 | 162 | } |
davidjhoward | 162:5e8948b8044d | 163 | printf("\rend of loop:%s\r\n",i->name); |
jmarkel44 | 74:03ccf04998b5 | 164 | } |
davidjhoward | 162:5e8948b8044d | 165 | printf("\rOUT OF LOOP\r\n"); |
jmarkel44 | 12:ea87887ca7ad | 166 | } |
jmarkel44 | 12:ea87887ca7ad | 167 | return 0; |
jmarkel44 | 12:ea87887ca7ad | 168 | } |
jmarkel44 | 12:ea87887ca7ad | 169 | |
jmarkel44 | 12:ea87887ca7ad | 170 | /***************************************************************************** |
jmarkel44 | 12:ea87887ca7ad | 171 | * Function: createControl() |
jmarkel44 | 12:ea87887ca7ad | 172 | * Description: creates a new control |
jmarkel44 | 12:ea87887ca7ad | 173 | * |
jmarkel44 | 12:ea87887ca7ad | 174 | * @param none |
jmarkel44 | 12:ea87887ca7ad | 175 | * @return none |
jmarkel44 | 12:ea87887ca7ad | 176 | *****************************************************************************/ |
jmarkel44 | 5:5e77a1db4d45 | 177 | static int createControl(const Message_t *msg) |
jmarkel44 | 5:5e77a1db4d45 | 178 | { |
jmarkel44 | 37:7e6986b77f01 | 179 | logInfo("\r%s invoked\n", __func__); |
jmarkel44 | 5:5e77a1db4d45 | 180 | |
jmarkel44 | 5:5e77a1db4d45 | 181 | switch (msg->control) { |
jmarkel44 | 5:5e77a1db4d45 | 182 | case CONTROL_SETPOINT: { |
jmarkel44 | 46:4cb96ab2d1c8 | 183 | SetpointControl *setpointControl = new SetpointControl; |
jmarkel44 | 28:c410a61238bb | 184 | bool rc = setpointControl->load(msg->controlFile); |
jmarkel44 | 19:9bc8fabeddfa | 185 | if ( rc != true ) { |
jmarkel44 | 19:9bc8fabeddfa | 186 | logError("%s: failed to load %s\n", __func__, msg->controlFile); |
jmarkel44 | 19:9bc8fabeddfa | 187 | delete setpointControl; |
jmarkel44 | 19:9bc8fabeddfa | 188 | } else { |
jmarkel44 | 19:9bc8fabeddfa | 189 | setpointTable[msg->controlFile] = setpointControl; |
jmarkel44 | 74:03ccf04998b5 | 190 | // start the setpoint control |
jmarkel44 | 74:03ccf04998b5 | 191 | setpointControl->start(); |
jmarkel44 | 19:9bc8fabeddfa | 192 | } |
jmarkel44 | 5:5e77a1db4d45 | 193 | break; |
jmarkel44 | 5:5e77a1db4d45 | 194 | } |
jmarkel44 | 5:5e77a1db4d45 | 195 | case CONTROL_TIMER: { |
jmarkel44 | 46:4cb96ab2d1c8 | 196 | TimerControl *timerControl = new TimerControl; |
jmarkel44 | 28:c410a61238bb | 197 | bool rc = timerControl->load(msg->controlFile); |
jmarkel44 | 19:9bc8fabeddfa | 198 | if ( rc != true ) { |
jmarkel44 | 19:9bc8fabeddfa | 199 | logError("%s: failed to load %s\n", __func__, msg->controlFile); |
jmarkel44 | 19:9bc8fabeddfa | 200 | delete timerControl; |
jmarkel44 | 19:9bc8fabeddfa | 201 | } else { |
jmarkel44 | 156:44f87c5a83ae | 202 | timerTable[timerControl->getOutput()].push_back(timerControl); |
jmarkel44 | 156:44f87c5a83ae | 203 | sort(timerTable[timerControl->getOutput()].begin(), |
jmarkel44 | 156:44f87c5a83ae | 204 | timerTable[timerControl->getOutput()].end(), |
jmarkel44 | 156:44f87c5a83ae | 205 | compareStartTime); |
jmarkel44 | 126:c85ac6a8e9af | 206 | timerControl->start(); |
jmarkel44 | 19:9bc8fabeddfa | 207 | } |
jmarkel44 | 5:5e77a1db4d45 | 208 | break; |
jmarkel44 | 5:5e77a1db4d45 | 209 | } |
jmarkel44 | 46:4cb96ab2d1c8 | 210 | case CONTROL_MANUAL: { |
jmarkel44 | 46:4cb96ab2d1c8 | 211 | ManualControl *manualControl = new ManualControl; |
jmarkel44 | 46:4cb96ab2d1c8 | 212 | bool rc = manualControl->load(msg->controlFile); |
jmarkel44 | 46:4cb96ab2d1c8 | 213 | if ( rc != true ) { |
jmarkel44 | 46:4cb96ab2d1c8 | 214 | logError("%s: failed to load %s\n", __func__, msg->controlFile); |
jmarkel44 | 46:4cb96ab2d1c8 | 215 | delete manualControl; |
jmarkel44 | 46:4cb96ab2d1c8 | 216 | } else { |
jmarkel44 | 46:4cb96ab2d1c8 | 217 | manualTable[msg->controlFile] = manualControl; |
jmarkel44 | 97:5cf6ab71dcd0 | 218 | // start the manual control |
jmarkel44 | 97:5cf6ab71dcd0 | 219 | manualControl->start(); |
jmarkel44 | 46:4cb96ab2d1c8 | 220 | } |
jmarkel44 | 46:4cb96ab2d1c8 | 221 | break; |
jmarkel44 | 46:4cb96ab2d1c8 | 222 | } |
jmarkel44 | 19:9bc8fabeddfa | 223 | case CONTROL_PID: |
jmarkel44 | 19:9bc8fabeddfa | 224 | case CONTROL_COMPOSITE: |
jmarkel44 | 5:5e77a1db4d45 | 225 | default: |
jmarkel44 | 46:4cb96ab2d1c8 | 226 | logInfo("\r%s: control type %d not implemented yet...\n", |
jmarkel44 | 46:4cb96ab2d1c8 | 227 | __func__, msg->control); |
jmarkel44 | 5:5e77a1db4d45 | 228 | break; |
jmarkel44 | 5:5e77a1db4d45 | 229 | } |
jmarkel44 | 5:5e77a1db4d45 | 230 | return 0; |
jmarkel44 | 5:5e77a1db4d45 | 231 | } |
jmarkel44 | 12:ea87887ca7ad | 232 | |
jmarkel44 | 12:ea87887ca7ad | 233 | /***************************************************************************** |
jmarkel44 | 12:ea87887ca7ad | 234 | * Function: modifyControl() |
jmarkel44 | 12:ea87887ca7ad | 235 | * Description: modifies a control |
jmarkel44 | 12:ea87887ca7ad | 236 | * |
jmarkel44 | 12:ea87887ca7ad | 237 | * @param msg |
jmarkel44 | 12:ea87887ca7ad | 238 | * @return none |
jmarkel44 | 12:ea87887ca7ad | 239 | *****************************************************************************/ |
jmarkel44 | 5:5e77a1db4d45 | 240 | static int modifyControl(const Message_t *msg) |
jmarkel44 | 5:5e77a1db4d45 | 241 | { |
jmarkel44 | 37:7e6986b77f01 | 242 | logInfo("\r%s invoked\n", __func__); |
jmarkel44 | 46:4cb96ab2d1c8 | 243 | |
jmarkel44 | 46:4cb96ab2d1c8 | 244 | // TODO: can we delete the current object and start a new one? |
jmarkel44 | 5:5e77a1db4d45 | 245 | return 0; |
jmarkel44 | 5:5e77a1db4d45 | 246 | |
jmarkel44 | 5:5e77a1db4d45 | 247 | } |
jmarkel44 | 12:ea87887ca7ad | 248 | |
jmarkel44 | 12:ea87887ca7ad | 249 | /***************************************************************************** |
jmarkel44 | 12:ea87887ca7ad | 250 | * Function: destroyControl() |
jmarkel44 | 12:ea87887ca7ad | 251 | * Description: destroys a controls |
jmarkel44 | 12:ea87887ca7ad | 252 | * |
jmarkel44 | 12:ea87887ca7ad | 253 | * @param msg |
jmarkel44 | 12:ea87887ca7ad | 254 | * @return none |
jmarkel44 | 12:ea87887ca7ad | 255 | *****************************************************************************/ |
jmarkel44 | 5:5e77a1db4d45 | 256 | static int destroyControl(const Message_t *msg) |
jmarkel44 | 5:5e77a1db4d45 | 257 | { |
jmarkel44 | 37:7e6986b77f01 | 258 | logInfo("\r%s invoked\n", __func__); |
jmarkel44 | 12:ea87887ca7ad | 259 | |
jmarkel44 | 12:ea87887ca7ad | 260 | switch ( msg->control ) { |
jmarkel44 | 12:ea87887ca7ad | 261 | case CONTROL_SETPOINT: { |
jmarkel44 | 12:ea87887ca7ad | 262 | StringSetpointMap::iterator pos; |
jmarkel44 | 12:ea87887ca7ad | 263 | pos = setpointTable.find(msg->controlFile); |
jmarkel44 | 12:ea87887ca7ad | 264 | if ( pos != setpointTable.end() ) { |
jmarkel44 | 74:03ccf04998b5 | 265 | pos->second->unregisterControl(); |
jmarkel44 | 12:ea87887ca7ad | 266 | delete (pos->second); |
jmarkel44 | 12:ea87887ca7ad | 267 | setpointTable.erase(pos); |
jmarkel44 | 12:ea87887ca7ad | 268 | } |
jmarkel44 | 12:ea87887ca7ad | 269 | break; |
jmarkel44 | 12:ea87887ca7ad | 270 | } |
jmarkel44 | 12:ea87887ca7ad | 271 | case CONTROL_TIMER: { |
jmarkel44 | 164:7cecd731882e | 272 | StringVectorTimerMap::iterator pos; |
jmarkel44 | 164:7cecd731882e | 273 | #if 0 |
jmarkel44 | 12:ea87887ca7ad | 274 | pos = timerTable.find(msg->controlFile); |
jmarkel44 | 12:ea87887ca7ad | 275 | if ( pos != timerTable.end() ) { |
jmarkel44 | 12:ea87887ca7ad | 276 | delete (pos->second); |
jmarkel44 | 12:ea87887ca7ad | 277 | timerTable.erase(pos); |
jmarkel44 | 12:ea87887ca7ad | 278 | } |
jmarkel44 | 164:7cecd731882e | 279 | #endif |
jmarkel44 | 12:ea87887ca7ad | 280 | break; |
jmarkel44 | 12:ea87887ca7ad | 281 | } |
jmarkel44 | 46:4cb96ab2d1c8 | 282 | case CONTROL_MANUAL: { |
jmarkel44 | 46:4cb96ab2d1c8 | 283 | StringManualMap::iterator pos; |
jmarkel44 | 46:4cb96ab2d1c8 | 284 | pos = manualTable.find(msg->controlFile); |
jmarkel44 | 46:4cb96ab2d1c8 | 285 | if ( pos != manualTable.end() ) { |
jmarkel44 | 97:5cf6ab71dcd0 | 286 | pos->second->unregisterControl(); |
jmarkel44 | 46:4cb96ab2d1c8 | 287 | delete (pos->second); |
jmarkel44 | 46:4cb96ab2d1c8 | 288 | manualTable.erase(pos); |
jmarkel44 | 46:4cb96ab2d1c8 | 289 | } |
jmarkel44 | 46:4cb96ab2d1c8 | 290 | break; |
jmarkel44 | 46:4cb96ab2d1c8 | 291 | } |
jmarkel44 | 12:ea87887ca7ad | 292 | default: |
jmarkel44 | 12:ea87887ca7ad | 293 | break; |
jmarkel44 | 12:ea87887ca7ad | 294 | } |
jmarkel44 | 12:ea87887ca7ad | 295 | return 0; |
jmarkel44 | 20:653923c2f37a | 296 | } |