Class UsbAdapterDevice
public sealed class UsbAdapterDevice : IUsbDevice, IDevice, IImageSettings, IPtz, IFramingModeControl, IFramingZoneControl, IFeatureControl, IMultiCameraDevice
- Inheritance
-
UsbAdapterDevice
- Implements
- Inherited Members
Properties
Client
public ICameraUsbClient Client { get; init; }
Property Value
- ICameraUsbClient
ConnectionState
Device ConnectionState
Once a device disconnects, it will not reconnect to the same instance.
public ConnectionState ConnectionState { get; }
Property Value
ConnectionType
Device ConnectionType
public ConnectionType ConnectionType { get; }
Property Value
FirmwareChecker
Get an IFirmwareChecker used for getting info on the latest available firmware release, and parsing information from firmware files that are relevant for the device.
public IFirmwareChecker FirmwareChecker { get; init; }
Property Value
Id
Unique device identifier.
public string Id { get; }
Property Value
LastActivity
UTC timestamp that records the last device activity.
public DateTime LastActivity { get; }
Property Value
Manufacturer
Device Manufacturer
public Manufacturer Manufacturer { get; }
Property Value
- Manufacturer
Model
Device Model
public DeviceModel Model { get; }
Property Value
- DeviceModel
ProductId
public ushort ProductId { get; }
Property Value
RawSerial
public string RawSerial { get; }
Property Value
Serial
Device Serial
public string Serial { get; }
Property Value
VendorId
public ushort VendorId { get; }
Property Value
Methods
AddFeatureOption(FeatureOption, CancellationToken)
Add a FeatureOption to the device
public Task<Result> AddFeatureOption(FeatureOption feature, CancellationToken ct = default)
Parameters
featureFeatureOptionFeatureOption to add
ctCancellationToken
Returns
EraseLog(CancellationToken)
Erase device logs
public Task<Result> EraseLog(CancellationToken ct = default)
Parameters
Returns
GetBrightness(CancellationToken)
Get the device brightness setting value
public Task<Result<double>> GetBrightness(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
GetCanvasEnhanceMode(CancellationToken)
Get canvas enhance mode status.
public Task<Result<Toggle?>> GetCanvasEnhanceMode(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
GetConnectedCameras(CancellationToken)
public Task<Result<IList<CameraStatus>>> GetConnectedCameras(CancellationToken ct = default)
Parameters
Returns
GetDetector(DetectorOptions?, CancellationToken)
Get an IDetector used for subscribing to detections
public Task<Result<IDetector>> GetDetector(DetectorOptions? options = null, CancellationToken ct = default)
Parameters
optionsDetectorOptionsctCancellationToken
Returns
GetDeviceFeatureStatus(CancellationToken)
Get the current state of the supported features of the device based on its runtime state
public Task<Result<DeviceFeatureStatus>> GetDeviceFeatureStatus(CancellationToken ct = default)
Parameters
Returns
- Task<Result<DeviceFeatureStatus>>
The current state of supported features in the device's present state
Remarks
Returns the features that are currently available given the device's current state and mode. Some features may be disabled or unavailable depending on the active framing mode, configuration, or other runtime conditions. This is dynamic and can change as the device state changes. Use this method to determine which features can be used in the current context.
GetExclusiveLockStatus(CancellationToken)
public Task<Result<ExclusiveLockStatus>> GetExclusiveLockStatus(CancellationToken ct)
Parameters
Returns
GetFaceBasedExposure(CancellationToken)
Get the device FaceBasedExposure setting value
public Task<Result<Toggle>> GetFaceBasedExposure(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
GetFeatureOptions(CancellationToken)
Get device FeatureOptions
public Task<Result<IList<FeatureOption>>> GetFeatureOptions(CancellationToken ct = default)
Parameters
Returns
- Task<Result<IList<FeatureOption>>>
A result with the current device feature options
GetFirmwareParser()
Obsolete: Use FirmwareChecker instead
[Obsolete("Use FirmwareChecker instead. Method will be removed in SDK version 3.")]
public IFirmwareParser GetFirmwareParser()
Returns
GetFirmwareUpgrader(string, CancellationToken)
Get a IFirmwareUpgrader used for upgrading the device
public Task<IFirmwareUpgrader> GetFirmwareUpgrader(string firmwarePath, CancellationToken ct = default)
Parameters
firmwarePathstringFile path to a valid device firmware.
ctCancellationToken
Returns
Remarks
To get a valid firmware, see GetLatestFirmwareReleaseInfo(FirmwareChannel, CancellationToken)
GetFirmwareVersion(CancellationToken)
Get the firmware version of the device
public Task<Result<FirmwareVersion>> GetFirmwareVersion(CancellationToken ct = default)
Parameters
Returns
- Task<Result<FirmwareVersion>>
A result containing the current version of the device
GetFramingMode(CancellationToken)
Get the current framing mode of the camera
public Task<Result<FramingMode>> GetFramingMode(CancellationToken ct = default)
Parameters
Returns
- Task<Result<FramingMode>>
A FramingValue Result.
GetFramingSubscriber(FramingSubscriberOptions, CancellationToken)
Get an IFramingSubscriber used for subscribing to device framing (PTZ) changes
public Task<Result<IFramingSubscriber>> GetFramingSubscriber(FramingSubscriberOptions options, CancellationToken ct = default)
Parameters
optionsFramingSubscriberOptionsctCancellationToken
Returns
- Task<Result<IFramingSubscriber>>
A cancellation token
GetFramingZone(CancellationToken)
Get a FramingZone with width and depth values for the framing zone
public Task<Result<FramingZone>> GetFramingZone(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
GetFramingZonePeopleDetectionResults(CancellationToken)
[Obsolete("Use GetFramingZonePersonDetections instead. Method will be removed in SDK version 3.")]
public Task<Result<IList<FramingZonePersonDetectionResult>>> GetFramingZonePeopleDetectionResults(CancellationToken ct = default)
Parameters
Returns
GetFramingZonePersonDetections(CancellationToken)
Get stream of FramingZonePersonDetections that are detected within the framing zone
public IAsyncEnumerable<IList<FramingZonePersonDetection>> GetFramingZonePersonDetections(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
- IAsyncEnumerable<IList<FramingZonePersonDetection>>
A stream of framing zone detections
Exceptions
- NotSupportedException
When API call is unsupported
- ExclusiveLockException
When device is locked for firmware update
- OperationCanceledException
When operation is canceled
- RpcException
When a device or USB proxy RPC call fails
- Exception
On device internal or unexpected SDK errors
GetFramingZoneToggle(CancellationToken)
Get the current Framing Zone on/off toggle value
public Task<Result<Toggle>> GetFramingZoneToggle(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
GetFwVersion(CancellationToken)
Obsolete: Use GetFirmwareVersion instead
[Obsolete("Use GetFirmwareVersion instead. Method will be removed in SDK version 3.")]
public Task<Result<SemVersion>> GetFwVersion(CancellationToken ct = default)
Parameters
Returns
GetLatestFirmwareReleaseInfo(FirmwareChannel, CancellationToken)
Obsolete: Use FirmwareChecker instead
[Obsolete("Use FirmwareChecker.GetLatestFirmwareReleaseInfo() instead. Method will be removed in SDK version 3.")]
public Task<Result<FirmwareInfo>> GetLatestFirmwareReleaseInfo(FirmwareChannel channel = FirmwareChannel.Stable, CancellationToken ct = default)
Parameters
channelFirmwareChannelctCancellationToken
Returns
GetLog(Stream, CancellationToken)
Get device logs.
public Task<Result> GetLog(Stream outputStream, CancellationToken ct = default)
Parameters
outputStreamStreamA stream to write the logs to
ctCancellationToken
Returns
GetName(CancellationToken)
Get device name
public Task<Result<string>> GetName(CancellationToken ct = default)
Parameters
Returns
GetPan(CancellationToken)
Get the pan value of the device
The value is normalized in the range [-1.0, 1.0].
public Task<Result<double>> GetPan(CancellationToken ct = default)
Parameters
Returns
GetPerspectiveCorrection(CancellationToken)
Get the device perspective correction mode
public Task<Result<PerspectiveCorrection>> GetPerspectiveCorrection(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
- Task<Result<PerspectiveCorrection>>
A result with the current perspective correction mode
GetPtz(CancellationToken)
Obsolete: Use the individual set methods for pan, tilt and zoom instead
[Obsolete("Use the individual get methods for pan, tilt and zoom instead. Method will be removed in SDK version 3.")]
public Task<Result<Ptz>> GetPtz(CancellationToken ct = default)
Parameters
Returns
GetSaturation(CancellationToken)
Get the device saturation setting value
public Task<Result<double>> GetSaturation(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
GetStreamStatus(CancellationToken)
Get current stream status (stream name, active?, size)
public Task<Result<StreamStatusContainer>> GetStreamStatus(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
- Task<Result<StreamStatusContainer>>
A Stream status result
GetSupportedFeatures(CancellationToken)
Get supported features of the device based on its firmware version
public Task<Result<SupportedFeatures>> GetSupportedFeatures(CancellationToken ct = default)
Parameters
Returns
- Task<Result<SupportedFeatures>>
The features supported by the device firmware
Remarks
Returns the features that the device firmware supports. This is determined by the firmware version and represents the full capability set of the device. It is recommended to call this method on device connection to understand the device's capabilities.
GetTilt(CancellationToken)
Get the tilt value of the device
The value is normalized in the range [-1.0, 1.0].
public Task<Result<double>> GetTilt(CancellationToken ct = default)
Parameters
Returns
GetTime(CancellationToken)
Get the device internal time
public Task<Result<DateTime>> GetTime(CancellationToken ct = default)
Parameters
Returns
GetUptime(CancellationToken)
Get the device uptime
public Task<Result<TimeSpan>> GetUptime(CancellationToken ct = default)
Parameters
Returns
GetUsbAdapterFwVersion(CancellationToken)
[Obsolete("Use GetFirmwareVersion instead. Method will be removed in SDK version 3.")]
public Task<Result<SemVersion>> GetUsbAdapterFwVersion(CancellationToken ct = default)
Parameters
Returns
GetZoom(CancellationToken)
Get the zoom values of the device
The value is normalized in the range [0.0, 1.0].
public Task<Result<double>> GetZoom(CancellationToken ct = default)
Parameters
Returns
IsFramingZoneEnabled(CancellationToken)
[Obsolete("Use GetFramingZoneState instead. Method will be removed in SDK version 3.")]
public Task<Result<bool>> IsFramingZoneEnabled(CancellationToken ct = default)
Parameters
Returns
IsGreaterThanCurrentVersion(FirmwareInfo, CancellationToken)
Obsolete: Use GetFirmwareVersion in combination with FirmwareChecker instead
[Obsolete("Use GetFirmwareVersion().CompareTo() instead. Method will be removed in SDK version 3.")]
public Task<Result<bool>> IsGreaterThanCurrentVersion(FirmwareInfo firmwareInfo, CancellationToken ct = default)
Parameters
firmwareInfoFirmwareInfoctCancellationToken
Returns
PersistCurrentImageSettings(CancellationToken)
Persist the current brightness and saturation values in the active camera storage slot
public Task<Result> PersistCurrentImageSettings(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
PersistCurrentPtz(CancellationToken)
Persist the current PTZ values in the active camera storage slot
public Task<Result> PersistCurrentPtz(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
Reboot(CancellationToken)
Reboot the device.
public Task<Result> Reboot(CancellationToken ct = default)
Parameters
Returns
Remarks
After calling this method successfully, the device instance will disconnect. To communicate with the device after it has booted, use the new IDevice instance emitted in the DeviceConnected event
ReleaseExclusiveLock(CancellationToken)
public Task<Result> ReleaseExclusiveLock(CancellationToken ct)
Parameters
Returns
ReportAudioOutputLevel(int, double[], CancellationToken)
Report the current host audio output level to the device
public Task<Result> ReportAudioOutputLevel(int sampleRate, double[] samples, CancellationToken ct = default)
Parameters
sampleRateintApproximate sample rate, in samples per second
samplesdouble[]Output level samples, in the normalized range [0.0, 1.0]
ctCancellationToken
Returns
RestorePersistentImageSettings(CancellationToken)
Restore the brightness and saturation values from the active camera storage slot
public Task<Result> RestorePersistentImageSettings(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
RestorePersistentPtz(CancellationToken)
Restore PTZ values from active camera storage slot
public Task<Result> RestorePersistentPtz(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
SetBrightness(double, CancellationToken)
Set the device brightness setting value. To persist the set value, call PersistCurrentImageSettings(CancellationToken).
public Task<Result> SetBrightness(double value, CancellationToken ct = default)
Parameters
valuedoubleThe new value, in the range [-1.0, 1.0]
ctCancellationTokenA cancellation token
Returns
SetCanvasEnhanceMode(Toggle, CancellationToken)
Set canvas enhance mode.
public Task<Result> SetCanvasEnhanceMode(Toggle value, CancellationToken ct = default)
Parameters
valueToggleThe new value.
ctCancellationTokenA cancellation token
Returns
SetFaceBasedExposure(Toggle, CancellationToken)
Set and persist the device FaceBasedExposure setting value
public Task<Result> SetFaceBasedExposure(Toggle value, CancellationToken ct = default)
Parameters
valueToggleThe new value. For accepted values, query GetSupportedFeatures(CancellationToken)
ctCancellationTokenA cancellation token
Returns
SetFramingMode(FramingMode, CancellationToken)
Set device framing mode
public Task<Result> SetFramingMode(FramingMode value, CancellationToken ct = default)
Parameters
valueFramingModeThe new value. For accepted values, query GetSupportedFeatures(CancellationToken)
ctCancellationToken
Returns
SetFramingZone(FramingZone, CancellationToken)
Set the device FramingZone width and depth values
public Task<Result> SetFramingZone(FramingZone value, CancellationToken ct = default)
Parameters
valueFramingZoneThe new value
ctCancellationTokenA cancellation token
Returns
SetFramingZoneToggle(Toggle, CancellationToken)
Set the current Framing Zone on/off toggle value
public Task<Result> SetFramingZoneToggle(Toggle toggle, CancellationToken ct = default)
Parameters
toggleToggleA toggle value to turn the feature on or off
ctCancellationTokenA cancellation token
Returns
SetPan(double, CancellationToken)
Set the device pan value
public Task<Result> SetPan(double value, CancellationToken ct = default)
Parameters
valuedoubleThe new Pan value, in the range [-1.0, 1.0]
ctCancellationTokenA cancellation token
Returns
SetPerspectiveCorrection(PerspectiveCorrection, CancellationToken)
Set device perspective correction mode
[Obsolete("Not supported. PerspectiveCorrection is always on for Crew/L1/S1 firmware >= 1.8.11.")]
public Task<Result> SetPerspectiveCorrection(PerspectiveCorrection value, CancellationToken ct = default)
Parameters
valuePerspectiveCorrectionThe new value
ctCancellationTokenA cancellation token
Returns
SetPtz(double?, double?, double?, CancellationToken)
Obsolete: Use the individual set methods for pan, tilt and zoom instead
[Obsolete("Use the individual set methods for pan, tilt and zoom instead. Method will be removed in SDK version 3.")]
public Task<Result> SetPtz(double? panValue = null, double? tiltValue = null, double? zoomValue = null, CancellationToken ct = default)
Parameters
panValuedouble?tiltValuedouble?zoomValuedouble?ctCancellationToken
Returns
SetSaturation(double, CancellationToken)
Set the device saturation setting value. To persist the set value, call PersistCurrentImageSettings(CancellationToken).
public Task<Result> SetSaturation(double value, CancellationToken ct = default)
Parameters
valuedoubleThe new value, in the range [-1.0, 1.0]
ctCancellationTokenA cancellation token
Returns
SetTilt(double, CancellationToken)
Set the device tilt value
public Task<Result> SetTilt(double value, CancellationToken ct = default)
Parameters
valuedoubleThe new Tilt value, in the range [-1.0, 1.0]
ctCancellationTokenA cancellation token
Returns
SetTime(DateTime, CancellationToken)
Set the device internal time
public Task<Result> SetTime(DateTime value, CancellationToken ct = default)
Parameters
valueDateTimeThe new value
ctCancellationToken
Returns
SetZoom(double, CancellationToken)
Set the device zoom value
public Task<Result> SetZoom(double value, CancellationToken ct = default)
Parameters
valuedoubleThe new Zoom value, in the range [0.0, 1.0]
ctCancellationTokenA cancellation token
Returns
SubscribeToStreamStatusChange(CancellationToken)
Subscribe to get continuous stream status when a stream opens/closes
try
{
await foreach (var streamStatus in device.SubscribeToStreamStatusChange(ct))
{
Console.WriteLine($"Received stream status: {streamStatus}");
}
}
catch (Exception ex)
{
Console.WriteLine($"Error receiving stream statuses: {ex.Message}");
}
public IAsyncEnumerable<StreamStatusContainer> SubscribeToStreamStatusChange(CancellationToken ct = default)
Parameters
ctCancellationTokenA cancellation token
Returns
- IAsyncEnumerable<StreamStatusContainer>
A stream of call status events
Exceptions
- NotSupportedException
When API call is unsupported
- ExclusiveLockException
When device is locked for firmware update
- OperationCanceledException
When operation is canceled
- RpcException
When a device or USB proxy RPC call fails
- Exception
On device internal or unexpected SDK errors
TakeExclusiveLock(int, string, CancellationToken)
public Task<Result> TakeExclusiveLock(int timeout, string reason, CancellationToken ct)
Parameters
timeoutintreasonstringctCancellationToken
Returns
ToggleFramingZone(Toggle, CancellationToken)
[Obsolete("Use SetFramingZoneState instead. Method will be removed in SDK version 3.")]
public Task<Result> ToggleFramingZone(Toggle toggle, CancellationToken ct = default)
Parameters
toggleTogglectCancellationToken