Repository navigation
workspace sdk credential readers
Credential readers capture credential data from external hardware such as card readers, biometric scanners, and access control devices. They integrate into Security Center's credential management workflows for creating new credentials and retrieving existing ones.
Security Center natively supports common credential readers such as USB desktop card readers and door-based card swipe detection. Use custom credential readers when you need to capture credential data from hardware or protocols that Security Center does not natively support. Examples include:
- Capturing biometric data from a fingerprint or palm vein scanner.
- Reading credentials from a proprietary smart card protocol.
- Receiving mobile credentials through a custom NFC or Bluetooth protocol.
The SDK provides two base classes:
-
CredentialReaderfor general-purpose credential reading. -
CardholderCredentialReaderfor readers that need to know which cardholder the credential is being assigned to.
Credential readers appear in both Security Desk and Config Tool. The system presents registered readers when an operator performs credential operations such as adding a credential from a cardholder's page, opening the credential management task, or returning a card. The system manages the full lifecycle:
- The module registers the credential reader with the workspace during
Load. - When a credential workflow opens, the system filters available readers by calling
SupportsOperationMode().OperationModeis mutable context and can be assigned during reader selection or changed later. - The system calls
CreateView()to obtain the reader's interface and displays it in the credential management dialog. - The system calls
Activate()to start the reader, which begins listening for hardware events. - When the reader detects a credential, it raises
CredentialRetrieved(new credential) orExistingCredentialRetrieved(existing credential in the system). - The system reads the credential data from the event arguments.
- The system calls
Deactivate()when the workflow completes, andDispose()to release resources.
For CardholderCredentialReader, CardholderId is always null while Activate() runs. When the workflow supplies a cardholder, the system assigns CardholderId after activation and raises CarholderIdChanged each time the value changes, including when it is cleared. Handle CarholderIdChanged, or read CardholderId at the moment you need it, instead of checking it in Activate().
Inherit from CredentialReader and implement the abstract members:
public class MyCredentialReader : CredentialReader
{
public override string Name => "My Credential Reader";
public override Guid UniqueId => new Guid("A1B2C3D4-E5F6-7890-ABCD-EF1234567890");
public override bool IsValid => m_isConnected;
public override OperationMode OperationMode { get; set; }
public override bool SupportsOperationMode(OperationMode mode)
{
return mode == OperationMode.Creation
|| mode == OperationMode.Retrieval;
}
public override UIElement CreateView()
{
return new MyReaderControl();
}
public override void Activate()
{
// Start listening for credential scans
}
public override void Deactivate()
{
// Stop listening for credential scans
}
public override void Dispose()
{
// Release hardware resources
}
}| Member | Type | Description |
|---|---|---|
Name |
Property (abstract) | Display name shown for the reader. |
UniqueId |
Property (abstract) | Unique identifier for this reader component. |
IsValid |
Property (abstract) | Whether the reader is in a valid state and ready to read credentials. |
OperationMode |
Property (abstract) | The current operation mode of the reader. |
Priority |
Property (virtual) | Display order when multiple readers are available. Lower values appear first. Defaults to int.MaxValue. |
Activate() |
Method (abstract) | Called when the reader is activated. Start listening for credential scans. |
Deactivate() |
Method (abstract) | Called when the reader is deactivated. Stop listening for credential scans. |
CreateView() |
Method (abstract) | Create the reader's visual interface. Returns a new UIElement each time it is called. |
SupportsOperationMode(OperationMode) |
Method (abstract) | Return true when the reader supports the specified operation mode. |
Dispose() |
Method (abstract) | Release resources used by the reader. |
When the reader detects a credential, raise the appropriate event:
// New credential detected
var format = new WiegandStandardCredentialFormat(FACILITY_CODE, CARD_NUMBER);
OnCredentialRetrieved(new CredentialRetrievedEventArgs(format));
// Existing credential detected
OnExistingCredentialRetrieved(new ExistingCredentialRetrievedEventArgs(credentialGuid));| Event | Description |
|---|---|
CredentialRetrieved |
Raised when a new credential is detected. The CredentialRetrievedEventArgs contains the CredentialFormat data. |
ExistingCredentialRetrieved |
Raised when an existing credential is detected. The ExistingCredentialRetrievedEventArgs contains the credential entity Guid. |
The system uses SupportsOperationMode() to filter readers for the active workflow. OperationMode is mutable context and can be assigned during reader selection or changed later. Do not assume it has its final value when Activate() runs. Read its current value when handling a scan.
| Value | Workflow | Description |
|---|---|---|
Creation |
Adding a new credential to a cardholder | The reader produces new credential data. If the detected credential already exists in the system, the workflow rejects it. |
Retrieval |
Returning a card, finding a visitor by credential | The reader identifies an existing credential. If the detected credential is not found in the system, the workflow rejects it. |
BatchCreation |
Enrolling multiple credentials in a single session | The reader produces new credential data in a batch enrollment page. |
All |
General credential management with both creation and retrieval rights | The reader accepts both new and existing credentials. |
CardholderCredentialReader is an alternative base class for readers that need cardholder context. It shares the same abstract members and events as CredentialReader, but adds a CardholderId property that the system sets when the reader operates within a cardholder workflow, such as adding a credential from a cardholder's page.
Use CardholderCredentialReader instead of CredentialReader when the reader's behavior or interface depends on which cardholder is being enrolled. For example, a reader can query the cardholder's existing credentials to prevent duplicate enrollment or display the cardholder's name in its interface for operator confirmation.
public class MyCardholderReader : CardholderCredentialReader
{
// Implement the same abstract members as CredentialReader
public MyCardholderReader()
{
CarholderIdChanged += OnCardholderIdChanged;
}
public override void Activate()
{
// CardholderId is always null at this point.
// Start listening for credential scans.
}
private void OnCardholderIdChanged(object sender, Guid? cardholderId)
{
if (cardholderId.HasValue)
{
// The workflow now operates within a cardholder context.
}
}
public override void Dispose()
{
CarholderIdChanged -= OnCardholderIdChanged;
// Release hardware resources
}
}| Member | Type | Description |
|---|---|---|
CardholderId |
Property (Guid?) | The contextual cardholder identifier. null when the reader is not loaded in a cardholder context. |
CarholderIdChanged |
Event | Raised when the contextual cardholder identifier changes. Note: the event name in the SDK is spelled CarholderIdChanged (missing 'd'). |
Important
This component requires a valid SDK certificate.
Register the reader in your module's Load method:
public class SampleModule : Module
{
private MyCredentialReader m_reader;
public override void Load()
{
m_reader = new MyCredentialReader();
m_reader.Initialize(Workspace);
Workspace.Components.Register(m_reader);
}
public override void Unload()
{
if (m_reader != null)
{
Workspace.Components.Unregister(m_reader);
}
}
}- About the Workspace SDK: Workspace SDK architecture and module lifecycle.
- About components: The component registry and registration lifecycle.
- About credential encoders: Sending credential data to external encoding hardware.
- About Workspace SDK certificates: Certificate requirements for workspace components.
- Overview
- Connecting to Security Center
- SDK certificates
- Referencing SDK assemblies
- ASP.NET hosting
- SDK compatibility
- Migrating to modern .NET
- Entities
- Entity cache
- Entity loading, cache, and query options
- Detecting entity changes
- Entity change event reference
- Transactions
- Security Center events
- Actions
- Security Desk
- Custom events
- Event-to-actions
- Managing macros
- ReportManager
- ReportManager query reference
- Access control raw events
- DownloadAllRelatedData and StrictResults
- Privileges
- Partitions
- Entity write restrictions
- About custom fields
- About video
- About cameras
- Enrolling a video unit
- Ingesting third-party video
- Archiver and auxiliary archiver roles
- Archive transfer
- About access control
- About cardholders and credentials
- About doors, areas, elevators, and access points
- About access rules and schedules
- About access control units and interface modules
- Enrolling an access control unit
- Door templates
- Visitors
- Mobile credentials
- About threat levels
- About alarms
- About incidents
- Maps
- Logging
- Overview
- Localization
- Certificates
- Lifecycle
- Threading
- State management
- Configuration
- Restricted configuration
- Events
- Queries
- Request manager
- Database
- Entity ownership
- Engine extensions
- Entity mappings
- Server management
- Custom privileges
- Custom entity types
- Resolving non-SDK assemblies
- Deploying plugins
- Modern .NET support
- Overview
- Localization
- Certificates
- Creating modules
- Tasks
- Pages
- Components
- Tile extensions
- Services
- Contextual actions
- Custom actions
- Options extensions
- Configuration pages
- Monitors
- Shared components
- Commands
- Extending events
- Map extensions
- Timeline providers
- Image extractors
- Credential encoders
- Credential readers
- Cardholder fields extractors
- Badge printers
- Content builders
- Dashboard widgets
- Incidents
- Logon providers
- Pinnable content builders
- Custom report pages
- Overview
- Getting started
- Media file formats
- MediaPlayer
- VideoSourceFilter
- MediaExporter
- MediaFile
- G64 converters
- FileCryptingManager
- PlaybackSequenceQuerier
- PlaybackStreamReader
- OverlayFactory
- PtzCoordinatesManager
- AudioTransmitter
- AudioRecorder
- AnalogMonitorController
- Camera blocking
- Overview
- Getting started
- Referencing entities
- Entity operations
- About access control in the Web SDK
- About video in the Web SDK
- Users and user groups
- Partitions
- Custom fields
- Custom card formats
- Actions
- Events and alarms
- Incidents
- Reports
- Tasks
- Macros
- Custom entity types
- System endpoints
- Performance guide
- Reference
- Endpoints
- Constants
- Enumerations
- Under the hood
- Troubleshooting