ImagingTools Core SDK
Public Types | Public Member Functions | List of all members
imtdev::IDeviceDataPersistenceabstract

Interface for device data persistence. More...

#include <IDeviceDataPersistence.h>

Inherits istd::IPolymorphic.

Public Types

enum  StorageType { ST_ROM , ST_EEPROM }
 Device storage types. More...
 
enum  MetaInfo { MIT_SERIAL_NUMBER = idoc::IDocumentMetaInfo::MIT_USER , MIT_VERSION_NUMBER , MIT_FIRMWARE_VERSION }
 Device metadata information types. More...
 

Public Member Functions

virtual bool ReadDeviceMetaInfo (idoc::IDocumentMetaInfo &metaInfo) const =0
 Read metadata from the device.
 
virtual bool ReadDataFromStorage (QByteArray &data, StorageType storageType, ibase::IProgressManager *progressPtr=nullptr) const =0
 Read all data from device storage.
 
virtual bool WriteDataToStorage (const QByteArray &data, StorageType storageType, ibase::IProgressManager *progressPtr=nullptr)=0
 Write all data to device storage.
 
virtual bool RemoveAllData (StorageType storageType)=0
 Delete all data from device storage.
 
virtual bool ResetStorage (StorageType storageType)=0
 Reset storage to initial/factory state.
 
virtual bool IsDeviceReady () const =0
 Check if device is ready for operations.
 

Detailed Description

Interface for device data persistence.

IDeviceDataPersistence provides low-level access to device storage (ROM, EEPROM) for reading and writing data, as well as managing device metadata. This interface enables firmware updates, configuration storage, and metadata retrieval from device hardware.

The interface supports:

Storage Types:
  • ST_ROM: Read-only memory (typically firmware, factory data)
  • ST_EEPROM: Electrically erasable programmable ROM (user configuration, calibration)
Usage Pattern:
// Obtain persistence interface reference (via component system)
IDeviceDataPersistence* pPersistence = // get from component system
// Check if device is ready
if (!pPersistence->IsDeviceReady())
{
// Device not ready for operations
return;
}
// Read device metadata
idoc::IDocumentMetaInfo* pMetaInfo = // create meta info object
if (pPersistence->ReadDeviceMetaInfo(*pMetaInfo))
{
QString serialNum = pMetaInfo->GetMetaInfo(
QString fwVersion = pMetaInfo->GetMetaInfo(
}
// Read all data from EEPROM
QByteArray eepromData;
ibase::IProgressManager* pProgress = // your progress manager
if (pPersistence->ReadDataFromStorage(eepromData,
pProgress))
{
// Process EEPROM data
}
// Write data to EEPROM
QByteArray newData = // prepare configuration data
pPersistence->WriteDataToStorage(newData,
pProgress);
// Reset EEPROM to factory defaults
Interface for device data persistence.
virtual bool WriteDataToStorage(const QByteArray &data, StorageType storageType, ibase::IProgressManager *progressPtr=nullptr)=0
Write all data to device storage.
@ MIT_FIRMWARE_VERSION
Firmware version string.
virtual bool ResetStorage(StorageType storageType)=0
Reset storage to initial/factory state.
@ ST_EEPROM
Electrically erasable programmable ROM (user configuration)
virtual bool IsDeviceReady() const =0
Check if device is ready for operations.
virtual bool ReadDataFromStorage(QByteArray &data, StorageType storageType, ibase::IProgressManager *progressPtr=nullptr) const =0
Read all data from device storage.
virtual bool ReadDeviceMetaInfo(idoc::IDocumentMetaInfo &metaInfo) const =0
Read metadata from the device.
Thread Safety:
Operations should be synchronized as they typically involve hardware communication. Progress tracking enables long-running operations to report status without blocking.
See also
CDeviceDataFilePersistenceComp
IDeviceDataProvider

Definition at line 86 of file IDeviceDataPersistence.h.

Member Enumeration Documentation

◆ MetaInfo

Device metadata information types.

Enumeration of metadata fields that can be read from devices. Extends idoc::IDocumentMetaInfo::MIT_USER for device-specific metadata.

Enumerator
MIT_SERIAL_NUMBER 

Device serial number.

MIT_VERSION_NUMBER 

Device version number.

MIT_FIRMWARE_VERSION 

Firmware version string.

Definition at line 108 of file IDeviceDataPersistence.h.

◆ StorageType

Device storage types.

Enumeration of storage types available on devices.

Enumerator
ST_ROM 

Read-only memory (firmware, factory data)

ST_EEPROM 

Electrically erasable programmable ROM (user configuration)

Definition at line 94 of file IDeviceDataPersistence.h.

Member Function Documentation

◆ IsDeviceReady()

virtual bool imtdev::IDeviceDataPersistence::IsDeviceReady ( ) const
pure virtual

Check if device is ready for operations.

Verifies that the device is in a state where storage operations can be performed.

Returns
true if device is ready, false otherwise
Note
Always check this before performing storage operations

◆ ReadDataFromStorage()

virtual bool imtdev::IDeviceDataPersistence::ReadDataFromStorage ( QByteArray &  data,
StorageType  storageType,
ibase::IProgressManager *  progressPtr = nullptr 
) const
pure virtual

Read all data from device storage.

Reads the complete contents of the specified storage type (ROM or EEPROM). Supports progress tracking for long-running operations.

Parameters
dataOutput buffer to receive storage data
storageTypeType of storage to read from (ST_ROM or ST_EEPROM)
progressPtrOptional progress manager for tracking read progress (can be nullptr)
Returns
true if data was read successfully, false otherwise
See also
StorageType
WriteDataToStorage()

◆ ReadDeviceMetaInfo()

virtual bool imtdev::IDeviceDataPersistence::ReadDeviceMetaInfo ( idoc::IDocumentMetaInfo &  metaInfo) const
pure virtual

Read metadata from the device.

Retrieves device metadata including serial number, version, and firmware version.

Parameters
metaInfoDocument metadata object to populate with device information
Returns
true if metadata was read successfully, false otherwise
See also
MetaInfo
idoc::IDocumentMetaInfo

◆ RemoveAllData()

virtual bool imtdev::IDeviceDataPersistence::RemoveAllData ( StorageType  storageType)
pure virtual

Delete all data from device storage.

Erases all data from the specified storage. This operation is only supported for writable storage types (ST_EEPROM).

Parameters
storageTypeType of storage to clear
Returns
true if storage was cleared successfully, false otherwise
See also
ResetStorage()
Note
Only supported for writable storage types

◆ ResetStorage()

virtual bool imtdev::IDeviceDataPersistence::ResetStorage ( StorageType  storageType)
pure virtual

Reset storage to initial/factory state.

Resets the storage to its initial state, typically restoring factory defaults. This operation is only supported for writable storage types (ST_EEPROM).

Parameters
storageTypeType of storage to reset
Returns
true if storage was reset successfully, false otherwise
See also
RemoveAllData()
Note
Only supported for writable storage types

◆ WriteDataToStorage()

virtual bool imtdev::IDeviceDataPersistence::WriteDataToStorage ( const QByteArray &  data,
StorageType  storageType,
ibase::IProgressManager *  progressPtr = nullptr 
)
pure virtual

Write all data to device storage.

Writes the complete data buffer to the specified storage type. Only writable storage types (ST_EEPROM) support this operation.

Parameters
dataData buffer to write to storage
storageTypeType of storage to write to (typically ST_EEPROM)
progressPtrOptional progress manager for tracking write progress (can be nullptr)
Returns
true if data was written successfully, false otherwise
See also
StorageType
ReadDataFromStorage()
Note
ST_ROM is read-only and cannot be written via this interface