Skip to content

IDeviceAutoAdd

Interface in Oadm.Sdk.Devices · Oadm.Sdk.dll

Adds devices a core plugin saw on the network (the DHCP server’s leases) through the same pipeline as the add page: anonymous Axis check, factory default check, automatic login with the credential list (never passwords of managed devices), then the device is stored like an add from the page and its first full refresh queued. Also follows managed devices to a new address. Implemented by the server; passwords never reach the plugin.

public interface IDeviceAutoAdd
Task<DeviceAutoAddOutcome> AddAsync(string address, string expectedSerial, string source, CancellationToken ct)

Adds the device at address (an IP address) when it is an Axis device with serial number expectedSerial (= MAC address) that OADM does not manage yet. Never throws for device errors.

Parameters

  • address: The IP address the device was seen at.
  • expectedSerial: The serial number (MAC address) the device must report.
  • source: Who found it, for the log and the audit entry (“DHCP server”).
  • ct: Cancels the checks and the login.
Task<DeviceCredentialName> AddCredentialAsync(string userName, string password, CancellationToken ct)

Default implementation

SDK 0.15.0: adds a user name and password to the credential list (encrypted with the server’s key; an equal entry is reused) and returns its entry. The password is never logged. ArgumentException for a password the devices do not take, InvalidOperationException when the list is full.

Parameters

  • userName: The user name (“root”).
  • password: The password, 1 to 64 printable ASCII characters.
  • ct: Cancels the write.
Task<DeviceAutoAddOutcome> AddWithLoginAsync(string address, string expectedSerial, Guid credentialId, IReadOnlyList<string> tags, string source, CancellationToken ct)

Default implementation

SDK 0.15.0: adds the device at address like IDeviceAutoAdd.AddAsync (Axis check first), logged in with one credential list entry instead of trying the list, with tags for all devices (so it lands in the device groups of those tags). A device OADM manages already keeps its record and gets the tags (DeviceAutoAddResult.AlreadyManaged with its id). Never throws for device errors. Older hosts: NotSupportedException.

Parameters

  • address: The IP address of the device.
  • expectedSerial: The serial number (MAC address) the device must report.
  • credentialId: The credential list entry to log in with.
  • tags: Tags the device gets (names; a tag that does not exist yet is created).
  • source: Who adds it, for the log and the audit entry.
  • ct: Cancels the checks and the login.
Task<DeviceFollowResult> FollowAsync(string serial, string address, string source, CancellationToken ct)

The managed device with serial number serial was seen at address: when the record has another IP address, verify the device there and move the record (devices reached by host name keep it).

Task<IReadOnlyList<DeviceCredentialName>> ListCredentialsAsync(CancellationToken ct)

Default implementation

SDK 0.15.0: the entries of the credential list, without passwords, in the order they are tried.

Parameters

  • ct: Cancels the read.
Task<DeviceLook> LookAsync(string address, string expectedSerial, CancellationToken ct)

Default implementation

SDK 0.15.0: what answers at address, without a password: the add page’s anonymous probe and Axis check, and whether it is factory-new (no password yet), always asked of the device itself, also for a managed one (a camera reset to factory default after it was added is new again). A device that is still starting is asked again until it says whether it needs setup, at most 2 minutes (then DeviceLookResult.Starting). Never throws for device errors. Older hosts: NotSupportedException.

Parameters

  • address: The IP address the device was seen at.
  • expectedSerial: The serial number (MAC address) the device must report.
  • ct: Cancels the checks.
Task<DeviceFirstPasswordOutcome> SetFirstPasswordAsync(string address, string expectedSerial, Guid credentialId, string source, CancellationToken ct)

Default implementation

SDK 0.15.0: sets the first root password of a factory-new device, exactly like the add page and the context menu’s “Set password” (HTTPS when the device offers it, POST body only). Right before writing, the device at the address must answer with expectedSerial and still need its first password; otherwise nothing is sent. A managed device keeps the password as its login. The password comes from the credential list (never through the plugin). Never throws for device errors. Older hosts: NotSupportedException.

Parameters

  • address: The IP address of the device.
  • expectedSerial: The serial number (MAC address) the device must report.
  • credentialId: The credential list entry whose password is set (its user must be root).
  • source: Who sets it, for the log and the audit entry (“Provisioning”).
  • ct: Cancels the request.
IDisposable WatchFactoryNew(Action<FactoryNewDevice> found)

Default implementation

SDK 0.15.0: tells the plugin about managed devices that need their first password (status Password not set): a device added that way (the add page, an import, the waiting list, the automatic add) and a managed device whose status turned Password not set (reset to factory default). Called on the thread that stored the device: queue the work, never block. Dispose the answer to stop. Older hosts: NotSupportedException.

Parameters

  • found: Called once per device and change.