added devices, added command getdevices.
This commit is contained in:
@@ -49,6 +49,7 @@ AQH_STORAGE *AQH_Storage_new(void)
|
||||
AQH_STORAGE *sto;
|
||||
|
||||
GWEN_NEW_OBJECT(AQH_STORAGE, sto);
|
||||
sto->deviceList=AQH_Device_List_new();
|
||||
sto->valueList=AQH_Value_List_new();
|
||||
sto->dataFileList=AQH_DataFile_List_new();
|
||||
|
||||
@@ -62,6 +63,7 @@ void AQH_Storage_free(AQH_STORAGE *sto)
|
||||
if (sto) {
|
||||
AQH_DataFile_List_free(sto->dataFileList);
|
||||
AQH_Value_List_free(sto->valueList);
|
||||
AQH_Device_List_free(sto->deviceList);
|
||||
free(sto->dataFileFolder);
|
||||
free(sto->stateFile);
|
||||
|
||||
@@ -123,6 +125,44 @@ AQH_VALUE *AQH_Storage_GetValueByNameForSystem(const AQH_STORAGE *sto, const cha
|
||||
|
||||
|
||||
|
||||
void AQH_Storage_AddDevice(AQH_STORAGE *sto, AQH_DEVICE *device)
|
||||
{
|
||||
if (sto && device) {
|
||||
uint64_t id;
|
||||
|
||||
id=++(sto->lastDeviceId);
|
||||
AQH_Device_SetId(device, id);
|
||||
AQH_Device_List_Add(device, sto->deviceList);
|
||||
AQH_Storage_AddRuntimeFlags(sto, AQH_STORAGE_RTFLAGS_MODIFIED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
AQH_DEVICE_LIST *AQH_Storage_GetDeviceList(const AQH_STORAGE *sto)
|
||||
{
|
||||
return sto?sto->deviceList:NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AQH_DEVICE *AQH_Storage_GetDeviceById(const AQH_STORAGE *sto, uint64_t id)
|
||||
{
|
||||
return sto?AQH_Device_List_GetById(sto->deviceList, id):NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AQH_DEVICE *AQH_Storage_GetDeviceByNameForSystem(const AQH_STORAGE *sto, const char *s)
|
||||
{
|
||||
return sto?AQH_Device_List_GetByNameForSystem(sto->deviceList, s):NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
uint32_t AQH_Storage_GetRuntimeFlags(const AQH_STORAGE *sto)
|
||||
{
|
||||
return sto?sto->runtimeFlags:0;
|
||||
|
||||
Reference in New Issue
Block a user