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/Controls/SetpointControl.cpp@20:653923c2f37a, 2016-09-08 (annotated)
- Committer:
- jmarkel44
- Date:
- Thu Sep 08 15:01:52 2016 +0000
- Revision:
- 20:653923c2f37a
- Parent:
- 19:9bc8fabeddfa
- Child:
- 28:c410a61238bb
added cloud data handler and control task
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmarkel44 | 14:cc916fa8dd11 | 1 | /****************************************************************************** |
jmarkel44 | 14:cc916fa8dd11 | 2 | * |
jmarkel44 | 19:9bc8fabeddfa | 3 | * File: SetpointControl.cpp |
jmarkel44 | 20:653923c2f37a | 4 | * Desciption: ICE Setpoint Control Class implementation |
jmarkel44 | 14:cc916fa8dd11 | 5 | * |
jmarkel44 | 14:cc916fa8dd11 | 6 | *****************************************************************************/ |
jmarkel44 | 13:c80c283f9db2 | 7 | #include "SetpointControl.h" |
jmarkel44 | 14:cc916fa8dd11 | 8 | #include "mDot.h" |
jmarkel44 | 20:653923c2f37a | 9 | #include "MbedJSONValue.h" |
jmarkel44 | 13:c80c283f9db2 | 10 | |
jmarkel44 | 14:cc916fa8dd11 | 11 | extern mDot *GLOBAL_mdot; |
jmarkel44 | 14:cc916fa8dd11 | 12 | |
jmarkel44 | 20:653923c2f37a | 13 | bool SetpointControl::Load(string _controlFile) |
jmarkel44 | 20:653923c2f37a | 14 | { |
jmarkel44 | 19:9bc8fabeddfa | 15 | controlFile = _controlFile; |
jmarkel44 | 20:653923c2f37a | 16 | |
jmarkel44 | 19:9bc8fabeddfa | 17 | // try to open the control file |
jmarkel44 | 14:cc916fa8dd11 | 18 | mDot::mdot_file file = GLOBAL_mdot->openUserFile(controlFile.c_str(), mDot::FM_RDONLY); |
jmarkel44 | 19:9bc8fabeddfa | 19 | if ( file.fd < 0 ) return false; |
jmarkel44 | 20:653923c2f37a | 20 | |
jmarkel44 | 20:653923c2f37a | 21 | // read the data into a buffer |
jmarkel44 | 20:653923c2f37a | 22 | unsigned char dataBuf[1024]; |
jmarkel44 | 20:653923c2f37a | 23 | |
jmarkel44 | 20:653923c2f37a | 24 | int bytes_read = GLOBAL_mdot->readUserFile(file, dataBuf, sizeof(dataBuf)); |
jmarkel44 | 20:653923c2f37a | 25 | if ( bytes_read ) { |
jmarkel44 | 20:653923c2f37a | 26 | printf("%s -> %s\n", __func__, dataBuf); |
jmarkel44 | 20:653923c2f37a | 27 | } else { |
jmarkel44 | 20:653923c2f37a | 28 | printf("%s: bytes_read = %d\n", __func__, bytes_read); |
jmarkel44 | 20:653923c2f37a | 29 | } |
jmarkel44 | 20:653923c2f37a | 30 | |
jmarkel44 | 20:653923c2f37a | 31 | // try to parse the file |
jmarkel44 | 20:653923c2f37a | 32 | //MbedJSONValue data; |
jmarkel44 | 20:653923c2f37a | 33 | |
jmarkel44 | 19:9bc8fabeddfa | 34 | return true; |
jmarkel44 | 19:9bc8fabeddfa | 35 | } |
jmarkel44 | 19:9bc8fabeddfa | 36 |