more work on aqhome-cgi.
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#define GBAA GWEN_Buffer_AppendArgs
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
VALUEGRAPH_PERIOD_4H=1,
|
||||
VALUEGRAPH_PERIOD_1D,
|
||||
@@ -74,7 +75,6 @@ static int _getAcceptedAgeForPeriod(int period);
|
||||
static void _mkPathForValueAndPeriod(AQH_MODULE *m, const AQH_VALUE *v, int pPeriod, GWEN_BUFFER *dbuf);
|
||||
static uint64_t _getStartTimeForPeriod(int period);
|
||||
static const char *_getModifiersForPeriod(int period);
|
||||
static AQH_VALUE *_getValue(AQH_DATACLIENT *dc, const char *sDeviceName, const char *sValueName);
|
||||
|
||||
static AQDG_GRAPH_DATAPAIR_LIST *_requestDataPairList(AQH_DATACLIENT *dc, const char *valueName,
|
||||
uint64_t tsBegin, uint64_t tsEnd, uint64_t num);
|
||||
@@ -138,7 +138,7 @@ void _runGraphValueWithArgs(AQH_MODULE *m,
|
||||
sDeviceName?sDeviceName:"<empty>", sValueName?sValueName:"<empty>",
|
||||
sPeriod?sPeriod:"<empty>");
|
||||
|
||||
value=_getValue(dc, sDeviceName, sValueName);
|
||||
value=AQH_ModDevices_GetValueForDevice(dc, sDeviceName, sValueName);
|
||||
if (value) {
|
||||
GWEN_BUFFER *fbuf;
|
||||
int rv;
|
||||
@@ -154,7 +154,7 @@ void _runGraphValueWithArgs(AQH_MODULE *m,
|
||||
2,
|
||||
AQH_ValueModality_toString(AQH_Value_GetModality(value)),
|
||||
GWEN_Buffer_GetStart(fbuf),
|
||||
640, 480,
|
||||
AQH_MODDEVICES_GRAPH_WIDTH, AQH_MODDEVICES_GRAPH_HEIGHT,
|
||||
100000);
|
||||
}
|
||||
|
||||
@@ -270,8 +270,8 @@ AQDG_GRAPH *_mkGraphObjectWithTitle(const char *graphTitle, int period, int prec
|
||||
switch(period) {
|
||||
case VALUEGRAPH_PERIOD_4H: s="last 4 hours"; break;
|
||||
case VALUEGRAPH_PERIOD_1D: s="last 24 hours"; break;
|
||||
case VALUEGRAPH_PERIOD_1W: s="last week"; break;
|
||||
case VALUEGRAPH_PERIOD_1M: s="last month"; break;
|
||||
case VALUEGRAPH_PERIOD_1W: s="last 7 days"; break;
|
||||
case VALUEGRAPH_PERIOD_1M: s="last 30 days"; break;
|
||||
default: s="last 24 hours"; break;
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ const char *_getModifiersForPeriod(int period)
|
||||
/* period */
|
||||
switch(period) {
|
||||
case VALUEGRAPH_PERIOD_4H: return "La5";
|
||||
case VALUEGRAPH_PERIOD_1D: return "La15";
|
||||
case VALUEGRAPH_PERIOD_1D: return "La30";
|
||||
case VALUEGRAPH_PERIOD_1W: return "La240";
|
||||
case VALUEGRAPH_PERIOD_1M: return "La480";
|
||||
default: return "La15";
|
||||
@@ -376,39 +376,6 @@ int _getAcceptedAgeForPeriod(int period)
|
||||
|
||||
|
||||
|
||||
AQH_VALUE *_getValue(AQH_DATACLIENT *dc, const char *sDeviceName, const char *sValueName)
|
||||
{
|
||||
AQH_VALUE_LIST *valueList;
|
||||
|
||||
valueList=AQH_DataClient_GetValues(dc, sDeviceName, 0);
|
||||
if (valueList) {
|
||||
AQH_VALUE *value;
|
||||
|
||||
value=AQH_Value_List_First(valueList);
|
||||
while(value) {
|
||||
const char *s;
|
||||
|
||||
s=AQH_Value_GetName(value);
|
||||
if (s && *s && strcasecmp(s, sValueName)==0) {
|
||||
break;
|
||||
}
|
||||
value=AQH_Value_List_Next(value);
|
||||
}
|
||||
|
||||
if (value) {
|
||||
AQH_Value_List_Del(value);
|
||||
AQH_Value_List_free(valueList);
|
||||
return value;
|
||||
}
|
||||
|
||||
AQH_Value_List_free(valueList);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AQDG_GRAPH_DATAPAIR_LIST *_requestDataPairList(AQH_DATACLIENT *dc, const char *valueName,
|
||||
uint64_t tsBegin, uint64_t tsEnd, uint64_t num)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user