PosCommon Information for Service Object Writers

The PosCommon properties and methods are overridden in each device’s basic class, then inherited by the device’s base class. This topic provides a list of those properties and methods, with notes useful to the service object writer. For detailed information about the properties and methods mentioned herein, see the PosCommon class.

CapPowerReporting Property

POS for .NET verifies that the device has been opened, then retrieves the current value of CapPowerReporting.

PowerReporting is initialized to PowerReporting.None. The service object should then set PowerReporting based on the capabilities of the device. If the service object sets PowerReporting to an invalid PowerReporting enumeration value, POS for .NET will throw an Illegal exception.

CapStatisticsReporting Property

POS for .NET verifies that the device has been opened, then retrieves the current value of CapStatisticsReporting.

When statistics are created for the device, POS for .NET sets CapStatisticsReporting to TRUE.

CapUpdateStatistics Property

POS for .NET verifies that the device has been opened, then retrieves the current value of CapUpdateStatistics.

When statistics are created for the device, and if those statistics can be reset or updated, then POS for .NET sets CapUpdateStatistics to TRUE.

Claimed Property

POS for .NET verifies that the device has been opened, then retrieves the current value of Claimed.

Claimed is initialized to FALSE. Claimed should be set to TRUE when the application calls the Claim method, then set back to FALSE when the application calls the Release method.

DeviceDescription Property

POS for .NET verifies that the device has been opened, then retrieves the current value of DeviceDescription.

DeviceEnabled Property

POS for .NET verifies that the device has been opened, then retrieves the current value of DeviceEnabled. To set DeviceEnabled, the device must be both opened and claimed. When the value of DeviceEnabled changes to TRUE, POS for .NET loads the statistics for the device. When DeviceEnabled is set to FALSE, POS for .NET saves the current statistics for the device.

DeviceEnabled is initialized to FALSE.

DeviceName Property

POS for .NET verifies that the device has been opened, then retrieves the current value of DeviceName.

DeviceName should be set by the service object during the Open method.

FreezeEvents Property

POS for .NET verifies that the device has been opened and claimed, then retrieves or sets the current value of FreezeEvents.

FreezeEvents is initialized to FALSE.

PowerNotify Property

POS for .NET verifies that the device has been opened, then retrieves or sets the current value of PowerNotify.

PowerNotify is initialized to PowerNotification.Disabled.

Attempting to set PowerNotify can cause the following exceptions to be thrown:

Value Meaning

Illegal

One of the following conditions has occurred:

The device is enabled;

CapPowerReporting = PowerReporting.None, indicating that the device doesn’t support power notification; or

The specified value isn’t a valid PowerNotification enumeration value.

PowerState Property

POS for .NET verifies that the device has been opened, then retrieves the current value of PowerState. If CapPowerReporting is set to PowerReporting.None, PowerNotify is set to PowerNotify.Disabled, or DeviceEnabled set to FALSE, PowerState is returned as PowerState.Unknown.

PowerState is initialized to PowerState.Unknown. When PowerNotify is set to enabled and DeviceEnabled is TRUE, PowerState should be updated as the service object detects power condition changes. POS for .NET detects the state change when the service object sets PowerState and—if PowerNotify is set to PowerNotification.Enabled—queues a StatusUpdateEvent event, notifying the application.

Setting PowerState can cause the following exceptions to be thrown:

Value Meaning

Illegal

One of the following conditions has occurred:

CapPowerReporting = PowerReporting.Standard and PowerNotify is set to PowerState.Online or PowerState.OffOffline; or

CapPowerReporting = PowerReporting.Advanced and PowerState is set to PowerState.Online or PowerState.Off or PowerState.Offline.

ServiceObjectDescription Property

POS for .NET verifies that the device has been opened, then retrieves the current value of ServiceObjectDescription.

ServiceObjectVersion Property

POS for .NET verifies that the device has been opened, then retrieves the current value of ServiceObjectVersion.

State Property

No device state verification is required—the application can retrieve the current value of State at any time.

State is initialized to ControlState.Closed. If the service object sets State to an invalid ControlState value, POS for .NET throws an Illegal exception. Changes in State cause POS for .NET to queue a StateChangedEvent event.

Claim Method

POS for .NET verifies that the application has the device opened.

If the timeout parameter is set to a value less than -1, POS for .NET throws an exception.

If the device is already claimed by the application, POS for .NET simply returns.

If another application has the device claimed and timeout is reached, POS for .NET throws a Timeout exception.

If Claim is successful, POS for .NET loads the statistics for the device and sets the Claimed property to TRUE.

Close Method

If the application calls Close when State is set to ControlState.Closed, POS for .NET throws a Closed exception. If State is set to ControlState.Busy, POS for .NET throws a Busy exception.

If the DeviceEnabled property is set to TRUE, then POS for .NET disables the device. If the Claimed property is set to TRUE, then POS for .NET releases the device.

Release Method

If the application calls Release when Claimed is set to FALSE, POS for .NET throws an Illegal exception. If State is set to ControlState.Busy, POS for .NET calls the ClearOutput method. If the device is enabled, POS for .NET sets DeviceEnabled to FALSE. POS for .NET clears the event queue, and then sets Claimed to FALSE.

ResetStatistic Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls DeviceStatistics.ResetStatistic.

ResetStatistics() Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls ResetStatistics.

ResetStatistics(categories parameter) Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls ResetStatistics.

ResetStatistics(string parameter) Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls ResetStatistics.

RetrieveStatistic Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls DeviceStatistics.RetrieveStatistic.

RetrieveStatistics() Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls RetrieveStatistics.

RetrieveStatistics(categories parameter) Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls RetrieveStatistics.

RetrieveStatistics(string parameter) Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls RetrieveStatistics.

UpdateStatistic Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls DeviceStatistics.UpdateStatistic.

UpdateStatistics(categories parameter) Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls UpdateStatistics.

UpdateStatistics(statistic array parameter) Method

POS for .NET verifies that the application has opened, claimed, and enabled the device, then calls UpdateStatistics.