openDAQ
Open data acquisition platform
DeviceUpdateOptionsPtr Class Reference

Defines how a given device should be updated. More...

Inherits ObjectPtr< IDeviceUpdateOptions >.

Detailed Description

Defines how a given device should be updated.

Allows for specifying how a device and its subdevices are to be updated when loading a configuration.

The device options object can be created using a serialized openDAQ JSON setup. The options are structured hierarchically, so that options for subdevices are stored in the parent device options. The following metadata is read from the setup: local ID, manufacturer, serial number, and connection string.

For each individual device in the setup, the update mode can be specified. The update mode defines how the device is updated when loading:

  • Load: Updates the device. Adds the device if missing.
  • UpdateOnly: The device is updated, but not added if missing.
  • Skip: The device is not updated. Does neither add nor remove the device.
  • Remove: Removes the device from the tree, if present.
  • Remap: Same as load, but removes old device (if present) and uses the new manufacturer, serial number, and connection string to add a new one and update.

Remapping

When the update mode is set to Remap, the device is removed and added again with the new manufacturer, serial number, and connection string. This can be used when swapping out a device with a different one of the same make/model. This option will try and load the same settings used to configure the original device to the new one.

When loading, the new manufacturer + serial number combination will have priority over the new connection string. In case a device with the new manufacturer + serial number combination is not found, the new connection string will be used as fallback. If the remapping fails (e.g. due to missing device with the new manufacturer + serial number combination and invalid connection string), the original device will be removed (if present) and no new device will be added.

Signal->Input port connections will be preserved when remapping, assuming the new device has the same signal and input port structure and IDs.

Public Member Functions

daq::StringPtr getLocalId () const
 Gets the local ID of the device. The local ID is obtained from the JSON key for the device entry. More...
 
daq::StringPtr getManufacturer () const
 Gets the manufacturer of the device, as written in the setup string. More...
 
daq::StringPtr getSerialNumber () const
 Gets the serial number of the device, as written in the setup string. More...
 
daq::StringPtr getConnectionString () const
 Gets the connection string of the device, as written in the setup string. More...
 
void setNewManufacturer (const daq::StringPtr &manufacturer) const
 Sets the new manufacturer of the device to be used for remapping. More...
 
daq::StringPtr getNewManufacturer () const
 Gets the new manufacturer of the device to be used for remapping. More...
 
void setNewSerialNumber (const daq::StringPtr &serialNumber) const
 Sets the new serial number of the device to be used for remapping. More...
 
daq::StringPtr getNewSerialNumber () const
 Gets the new serial number of the device to be used for remapping. More...
 
void setNewConnectionString (const daq::StringPtr &connectionString) const
 Sets the new connection string of the device to be used for remapping. More...
 
daq::StringPtr getNewConnectionString () const
 Gets the new connection string of the device to be used for remapping. More...
 
daq::DeviceUpdateMode getUpdateMode () const
 Gets the update mode for the device. More...
 
void setUpdateMode (daq::DeviceUpdateMode mode) const
 Sets the update mode for the device. More...
 
daq::ListPtr< daq::IDeviceUpdateOptions > getChildDeviceOptions () const
 Gets the list of child device options for the device. These are used to configure subdevices of the current device. More...