void mainDataPrepare() { dataPathCreate(dataPathToday,CONSUMETODAY); dataPathCreate(dataPathMonth,CONSUMEMONTH); dataPathCreate(dataPathYear,CONSUMEYEAR); dataPathCreate(dataPathHistory,CONSUMEHISTORY); //dataPathToday = dataPathCrate(CONSUMETODAY); totalToday = dataGet(dataPathToday); //dataPathMonth = dataPathCrate(CONSUMEMONTH); totalMonth = dataGet(dataPathMonth); //dataPathYear = dataPathCrate(CONSUMEYEAR); totalYear = dataGet(dataPathYear); totalHistory = dataGet(dataPathHistory); // dataPathCrate(path,CONSUMETODAY); //dataPathCrate(dataPathToday,TODAY); // printf("datapath is %s\n", dataPathToday); return; }
void AVReceiver::dataGet(Ecore_Con_Server *srv, void *data, int size) { if (srv != econ) return; if (connection_type == AVR_CON_CHAR) { std::string msg((char *)data, size); dataGet(msg); } else if (connection_type == AVR_CON_BYTES) { char *cdata = (char *)data; std::vector<char> d(cdata, cdata + size); //We don't know how to handle these messages, //so we delegate the processing to the child class //processMessage(vector<char>) has to be inherited ! processMessage(d); } }
void mainDateChangeHandle() { float reset = 0; if(dateCheckChange(oldDay,todayDay)) { /* 1. add totalToday to totalMonth;(totalMonth = totalToday + totalMonth) 2. reset totalToday = 0; */ /* dataReset(dataPathToday,dataPathMonth); totalMonth = dataGet(dataPathMonth); dataStore(dataPathYear, totalMonth); dataStore(dataPathHistory, totalMonth); */ dataStore(dataPathToday,reset); totalToday = dataGet(dataPathToday); dateUpdate(dayPath,todayDay); if(dateCheckChange(oldMonth,todayMonth)) { /* 1. add totalMonth to totalYear;(totalYear = totalMonth + totalYear) 2. reset totalMonth = 0; dataReset(dataPathMonth,dataPathYear); totalYear = dataGet(dataPathYear); dataStore(dataPathHistory, totalHistory); */ dataStore(dataPathMonth,reset); //dataPathMonth = dataPathCrate(CONSUMEMONTH); totalMonth = dataGet(dataPathMonth); //dataPathYear = dataPathCrate(CONSUMEYEAR); dateUpdate(monthPath,todayMonth); if(dateCheckChange(oldYear,todayYear)) { /* 1. add totalYear to totalHistory;(totalYear = totalMonth + totalYear) 2. reset totalYear = 0; */ dataStore(dataPathYear,reset); totalYear = dataGet(dataPathYear); dateUpdate(yearPath,todayYear); //dataReset(dataPathYear,dataPathHistory); } } } return; }