Table of Contents

Devices

Overview

Acuit Pinpoint Workstation has a built-in mechanism for managing integration with external devices called the "device registry," providing functions such as:

  • Allowing a device type to be registered.
  • Instantiating and managing the lifetimes of the concrete objects representing the device(s) of each device type.
  • Providing access to the devices to other code or custom workflows.
  • Allowing devices to be configured via key/value configuration settings.
  • Providing a health check for each device to alert on configuration errors or device problems.
  • Maintaining connections to external devices.

The device registry types are provided via the Acuit.Pinpoint.IO.Abstractions NuGet package.

Concepts

The Device Registry

The device registry is a service provided by Acuit Pinpoint Workstation via the IDeviceRegistry interface.

Device Types

Each device type is represented by a .NET type. While it can be any type, it is typically an interface or abstract class allowing devices of different models or vendors to provide the common services for that device type via different concrete classes that derive from or implement the device type.

Each .NET type registered as a device type can only be registered once. The device type registration specifies information about the device type to the device registry, such as how the devices of that type will be configured.

See the remarks for IDeviceRegistry for requirements and best practices for device types along with concrete device type implementations.

Configured Devices Enumerators

When a device type is registered, a configured devices enumerator (IConfiguredDeviceEnumerator) must be provided that determines what devices are configured for that type. The device registry uses this to enumerate the configured devices and instantiate each device object.

Typically, devices are configured via key/value configuration settings, but this is not required; devices of a particular device type could be configured via some other mechanism or could have no configuration settings at all. The configured devices enumerator can either enumerate a collection of configured devices, or it can produce a single device when a singleton is appropriate for the device type.

These standard configured devices enumerator implementations are provided:

ConfiguredDeviceEnumeratorBase can be used as a base class for implementing custom configured devices enumerators.

Configured Device Type Resolvers

Configured device type enumerators optionally use configured device type resolvers that are used to determine the concrete .NET type to use for each device instance, typically from a "Type" configuration setting.

This is the primary mechanism used to allow different device implementations to be available and selectable for different device models or vendors for a particular device type. Note that this approach also allows custom Acuit Pinpoint Workstation plug-ins to provide new custom device implementations for device types registered by Acuit Pinpoint Workstation or by other plug-ins. For example, a plug-in can add support for a bar code scanner model that isn't natively supported by Acuit Pinpoint Workstation simply by including a public class that implements IBarCodeScanner and follows the rules for concrete device types specified in the remarks for IDeviceRegistry.

Device Names

Each configured devices can optionally have a name. When there are multiple devices of a particular device type, code or workflow activities can use the device name to interact with a specific device.

Connected Devices

Device implementations that must maintain a connection to an external device should implement the IConnectedDevice interface so that the device registry can manage device connections and reflect connection problems via the device health check. The ConnectedDevice abstract base class can be used to simplify implementing that interface.

Built-in Device Types

Acuit Pinpoint Workstation registers these built-in device types:

Device Type .NET Type Configuration Settings
Bar code scanners IBarCodeScanner BarCodeScanning Section
Label print definitions ILabelPrintDefinition LabelPrinting Section
Light stacks (internal) Notifications Section

Using the Device Registry

Registering a Custom Device Type

To register a new device type:

  1. Create a new .NET class library to host the device type. If the device type is specific to one Acuit Pinpoint Workstation plug-in, then the device type can be placed within that plug-in class library. If the device type could be used from multiple plug-ins, then it can be placed within a class library referenced by multiple plug-ins (typically via a shared NuGet package).
  2. Create a new public interface (or abstract class) to represent the new device type. See the remarks for IDeviceRegistry for requirements.
  3. Add one or more classes with the concrete device implementation(s). See the remarks for IDeviceRegistry for requirements.
  4. In the class library initialization code, using the device registry service (IDeviceRegistry) exported by Acuit Pinpoint Workstation, call the RegisterDeviceType(Type, DeviceTypeRegistrationOptions) method to register the device type.

Using Custom Device Types

To use devices of the new device type: