Erick / Mbed 2 deprecated ICE_BLE_TEST

Dependencies:   NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed

Fork of ICE by Erick

src/ConfigurationHandler/Controls/SetpointControl.cpp

Committer:
jmarkel44
Date:
2016-09-08
Revision:
20:653923c2f37a
Parent:
19:9bc8fabeddfa
Child:
28:c410a61238bb

File content as of revision 20:653923c2f37a:

/******************************************************************************
 *
 * File:                SetpointControl.cpp
 * Desciption:          ICE Setpoint Control Class implementation
 *
 *****************************************************************************/
#include "SetpointControl.h"
#include "mDot.h"
#include "MbedJSONValue.h"

extern mDot *GLOBAL_mdot;

bool SetpointControl::Load(string _controlFile)
{
    controlFile = _controlFile;

    // try to open the control file
    mDot::mdot_file file = GLOBAL_mdot->openUserFile(controlFile.c_str(), mDot::FM_RDONLY);
    if ( file.fd < 0 ) return false;

    // read the data into a buffer
    unsigned char dataBuf[1024];

    int bytes_read = GLOBAL_mdot->readUserFile(file, dataBuf, sizeof(dataBuf));
    if ( bytes_read ) {
        printf("%s -> %s\n", __func__, dataBuf);
    } else {
        printf("%s: bytes_read = %d\n", __func__, bytes_read);
    }

    // try to parse the file
    //MbedJSONValue data;

    return true;
}