aqhome-nodes: write db on fini(). Extract info from DEVICE message.
This commit is contained in:
@@ -90,6 +90,21 @@ void AqHomed_NodeMsgToDb(AQHOMED *aqh, const GWEN_MSG *msg)
|
||||
|
||||
|
||||
|
||||
void AqHomed_WriteNodeDb(AQHOMED *aqh)
|
||||
{
|
||||
if (aqh->dbFile) {
|
||||
GWEN_DB_NODE *dbNodeDb;
|
||||
|
||||
AQH_NodeDb_ClearModified(aqh->nodeDb);
|
||||
dbNodeDb=GWEN_DB_Group_new("nodeDb");
|
||||
AQH_NodeDb_toDb(aqh->nodeDb, dbNodeDb);
|
||||
GWEN_DB_WriteFile(dbNodeDb, aqh->dbFile, GWEN_DB_FLAGS_DEFAULT);
|
||||
GWEN_DB_Group_free(dbNodeDb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void _handleMsgValue2(AQHOMED *aqh, const GWEN_MSG *msg)
|
||||
{
|
||||
AQH_NODE_INFO *ni;
|
||||
@@ -192,7 +207,14 @@ void _handleMsgDevice(AQHOMED *aqh, const GWEN_MSG *msg)
|
||||
uid=AQH_DeviceMsg_GetUid(msg);
|
||||
ni=_getOrCreateNodeAndUpdateUidAddr(aqh, msg, uid);
|
||||
if (ni) {
|
||||
// TODO
|
||||
AQH_NodeInfo_SetManufacturer(ni, AQH_DeviceMsg_GetManufacturer(msg));
|
||||
AQH_NodeInfo_SetDeviceType(ni, AQH_DeviceMsg_GetDeviceType(msg));
|
||||
AQH_NodeInfo_SetDeviceVersion(ni, (AQH_DeviceMsg_GetDeviceVersion(msg)<<8)+AQH_DeviceMsg_GetDeviceRevision(msg));
|
||||
AQH_NodeInfo_SetFirmwareVersion(ni,
|
||||
(AQH_DeviceMsg_GetFirmwareVariant(msg)<<24) |
|
||||
(AQH_DeviceMsg_GetFirmwareVersionMajor(msg)<<16) |
|
||||
(AQH_DeviceMsg_GetFirmwareVersionMinor(msg)<<8) |
|
||||
AQH_DeviceMsg_GetFirmwareVersionPatchlevel(msg));
|
||||
_updateTimestampLastChange(ni);
|
||||
AQH_NodeDb_SetModified(aqh->nodeDb);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user