Set timestampCreation on created devices, show that in aqhome-tool.
This commit is contained in:
@@ -207,6 +207,7 @@ AQH_DEVICE *_getOrCreateDeviceForDriver(AQHOME_DATA *aqh, GWEN_MSG_ENDPOINT *epD
|
|||||||
AQH_Device_SetDriver(device, serviceName);
|
AQH_Device_SetDriver(device, serviceName);
|
||||||
AQH_Device_SetNameForDriver(device, nameForDriver);
|
AQH_Device_SetNameForDriver(device, nameForDriver);
|
||||||
AQH_Device_SetNameForSystem(device, GWEN_Buffer_GetStart(buf));
|
AQH_Device_SetNameForSystem(device, GWEN_Buffer_GetStart(buf));
|
||||||
|
AQH_Device_SetTimestampCreation(device, (uint64_t) time(NULL));
|
||||||
AQH_Storage_AddDevice(aqh->storage, device);
|
AQH_Storage_AddDevice(aqh->storage, device);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -185,14 +185,7 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs)
|
|||||||
|
|
||||||
device=AQH_Device_List_First(deviceList);
|
device=AQH_Device_List_First(deviceList);
|
||||||
while(device) {
|
while(device) {
|
||||||
uint64_t deviceId;
|
Utils_PrintDevice(device);
|
||||||
const char *deviceName;
|
|
||||||
|
|
||||||
deviceId=AQH_Device_GetId(device);
|
|
||||||
deviceName=AQH_Device_GetNameForSystem(device);
|
|
||||||
|
|
||||||
fprintf(stdout, "%lu\t%s\n", (unsigned long int) deviceId, deviceName?deviceName:"");
|
|
||||||
|
|
||||||
device=AQH_Device_List_Next(device);
|
device=AQH_Device_List_Next(device);
|
||||||
}
|
}
|
||||||
AQH_Device_List_free(deviceList);
|
AQH_Device_List_free(deviceList);
|
||||||
|
|||||||
@@ -298,5 +298,31 @@ void Utils_PrintMeanData(const uint64_t *dataPoints, uint32_t numValues, const c
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Utils_PrintDevice(const AQH_DEVICE *device)
|
||||||
|
{
|
||||||
|
GWEN_TIMESTAMP *ts;
|
||||||
|
uint64_t deviceId;
|
||||||
|
const char *deviceName;
|
||||||
|
uint64_t timestamp;
|
||||||
|
|
||||||
|
deviceId=AQH_Device_GetId(device);
|
||||||
|
deviceName=AQH_Device_GetNameForSystem(device);
|
||||||
|
timestamp=AQH_Device_GetTimestampCreation(device);
|
||||||
|
ts=timestamp?GWEN_Timestamp_fromLocalTime((time_t) timestamp):NULL;
|
||||||
|
if (ts)
|
||||||
|
fprintf(stdout, "%lu\t%s\t%04d/%02d/%02d-%02d:%02d:%02d\n",
|
||||||
|
deviceId,
|
||||||
|
deviceName,
|
||||||
|
GWEN_Timestamp_GetYear(ts),
|
||||||
|
GWEN_Timestamp_GetMonth(ts),
|
||||||
|
GWEN_Timestamp_GetDay(ts),
|
||||||
|
GWEN_Timestamp_GetHour(ts),
|
||||||
|
GWEN_Timestamp_GetMinute(ts),
|
||||||
|
GWEN_Timestamp_GetSecond(ts));
|
||||||
|
else
|
||||||
|
fprintf(stdout, "%lu\t%s\t\n",
|
||||||
|
deviceId,
|
||||||
|
deviceName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,9 @@
|
|||||||
#include <gwenhywfar/db.h>
|
#include <gwenhywfar/db.h>
|
||||||
#include <gwenhywfar/endpoint.h>
|
#include <gwenhywfar/endpoint.h>
|
||||||
|
|
||||||
|
#include <aqhome/data/value.h>
|
||||||
|
#include <aqhome/data/device.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GWEN_MSG_ENDPOINT *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs);
|
GWEN_MSG_ENDPOINT *Utils_SetupIpcEndpoint(GWEN_DB_NODE *dbArgs);
|
||||||
@@ -31,6 +34,8 @@ void Utils_PrintDataPoints(const uint64_t *dataPoints, uint32_t numValues, const
|
|||||||
void Utils_PrintSingleDataPoint(uint64_t timestamp, double data, const char *valueUnits);
|
void Utils_PrintSingleDataPoint(uint64_t timestamp, double data, const char *valueUnits);
|
||||||
void Utils_PrintMeanData(const uint64_t *dataPoints, uint32_t numValues, const char *valueUnits);
|
void Utils_PrintMeanData(const uint64_t *dataPoints, uint32_t numValues, const char *valueUnits);
|
||||||
|
|
||||||
|
void Utils_PrintDevice(const AQH_DEVICE *device);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user