-
Notifications
You must be signed in to change notification settings - Fork 6k
Revive Point of Service docs from the dead #32079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
a508e81
initial commit
CamSoper 1b2fe18
Fix indent
CamSoper 0f56eb8
better paths
CamSoper 896a8c3
little tweaks
CamSoper 6de7cc6
fix link
CamSoper c1ee1b1
Update docs/framework/additional-apis/index.md
CamSoper 8e9b1dc
initial conversion
CamSoper 4a98aea
tables tables tables
CamSoper e924594
markdownlint pass
CamSoper aa02d5a
missed one
CamSoper 9b9976f
another pass
CamSoper 22185ae
xrefs, part 1
CamSoper e7abfff
Revert "xrefs, part 1"
CamSoper e125549
Populated all the xrefs
CamSoper ee91548
images
CamSoper 9f09106
API reference link
CamSoper 67e1d96
fix toc
CamSoper ce89398
add descriptions
CamSoper 3ff3aab
Removed extra newlines
CamSoper cf8bc93
Fixed table warnings
CamSoper e05261a
fix metadata
CamSoper 7dc497b
Made all the "see alsos" bulleted lists
CamSoper 21e0085
v1.12->v1.14
CamSoper 9c19100
breadcrumbs
CamSoper 5e8e525
Update toc.yml
CamSoper 2b0aa1c
imadork
CamSoper 80ad5ed
Added Terry to authors, updated FAQ
CamSoper d34aeb7
reorder list
CamSoper 9d6c838
Trailing space, whoops
CamSoper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
docs/framework/additional-apis/pos-for-net/adding-plug-and-play-support.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: Adding Plug and Play Support | ||
description: Adding Plug and Play Support (POS for .NET v1.14 SDK Documentation) | ||
ms.date: 03/03/2014 | ||
ms.topic: how-to | ||
ms.custom: pos-restored-from-archive | ||
--- | ||
|
||
# Adding Plug and Play Support (POS for .NET v1.14 SDK Documentation) | ||
|
||
Microsoft Point of Service for .NET (POS for .NET) includes support for Plug and Play devices. By adding Plug and Play support to your Service Objects, applications can become more simple, reliable, and efficient. Service Objects should support it whenever possible. | ||
|
||
Implementing Plug and Play support at the Service Object level is very simple. Once you know the hardware ID of your device, simply add a single attribute to your class, <xref:Microsoft.PointOfService.HardwareIdAttribute>. The **HardwareId** attribute is used by <xref:Microsoft.PointOfService.PosExplorer> to intelligently filter out Service Objects from the list of available devices depending on the state of the device. If the Service Object has a **HardwareId** attribute that refers to an installed Plug and Play device, but that device is not connected, the Service Object will be excluded from the **PosExplorer** device list. This list is returned when applications call <xref:Microsoft.PointOfService.PosExplorer.GetDevices>. | ||
|
||
Service Objects may also have more than one **HardwareId** attribute, in which case **PosExplorer** associates a union of all specified devices with the Service Object. It is possible to override the **HardwareId** attributes or add to the list of associated hardware on the Service Object without rebuilding the Service Object assembly. For information about overriding or adding the **HardwareId** attribute, see [Plug and Play XML Configuration](plug-and-play-xml-configuration.md). | ||
|
||
Only the application is responsible for catching <xref:Microsoft.PointOfService.PosExplorer.DeviceAddedEvent> and <xref:Microsoft.PointOfService.PosExplorer.DeviceRemovedEvent> events and updating its status as appropriate based on the updated device list returned from **PosExplorer**. The Service Object does not need to detect these events. | ||
|
||
## To add a HardwareId attribute to your Service Object class | ||
|
||
1. Determine the range of hardware IDs for the device or devices that your Service Object supports. | ||
|
||
2. Add a **HardwareId** attribute before your class definition using the lowest hardware ID used by your device and the highest. Multiple **HardwareId** attributes may be used to identify multiple ranges of hardware IDs. | ||
|
||
## Example | ||
|
||
The following sample adds a **HardwareId** attribute to the basic template shown in the previous section. | ||
|
||
```csharp | ||
using System; | ||
|
||
using Microsoft.PointOfService; | ||
using Microsoft.PointOfService.BaseServiceObjects; | ||
|
||
namespace SOTemplate | ||
{ | ||
|
||
[HardwareId("HID\\Vid_05e0&Pid_038a", | ||
"HID\\Vid_05e0&Pid_038a")] | ||
|
||
[ServiceObject( | ||
DeviceType.Msr, | ||
"ServiceObjectTemplate", | ||
"Bare bones Service Object class", | ||
1, | ||
9)] | ||
public class MyServiceObject : MsrBase | ||
{ | ||
public MyServiceObject() | ||
{ | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
## See Also | ||
|
||
#### Tasks | ||
|
||
- [Creating a Basic Service Object Code Template](creating-a-basic-service-object-code-template.md) | ||
- [Creating a Service Object Sample](creating-a-service-object-sample.md) | ||
|
||
#### Concepts | ||
|
||
- [Attributes for Identifying Service Objects and Assigning Hardware](attributes-for-identifying-service-objects-and-assigning-hardware.md) | ||
- [Plug and Play XML Configuration](plug-and-play-xml-configuration.md) | ||
|
||
#### Other Resources | ||
|
||
- [Service Object Samples: Getting Started](service-object-samples-getting-started.md) | ||
- [POS for .NET Service Object Architecture](pos-for-net-service-object-architecture.md) |
161 changes: 161 additions & 0 deletions
161
docs/framework/additional-apis/pos-for-net/asynchronous-output-sample.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
--- | ||
title: Asynchronous Output Sample | ||
description: Asynchronous Output Sample (POS for .NET v1.14 SDK Documentation) | ||
ms.date: 03/03/2014 | ||
ms.topic: how-to | ||
ms.custom: pos-restored-from-archive | ||
--- | ||
|
||
# Asynchronous Output Sample (POS for .NET v1.14 SDK Documentation) | ||
|
||
Microsoft Point of Service for .NET (POS for .NET) supports asynchronous output in compliance with the Unified Point Of Service (UnifiedPOS) specification. In the asynchronous output model, the Service Object must queue output requests so that it can return control to the application as quickly as possible. A second thread must then dispatch output to the device and notify applications when the request has been fulfilled, either with an **OutputCompleteEvent** or an **ErrorEvent** event. | ||
|
||
The POS for .NET class library handles most of these functions for the Service Object developer so that there is little, if any, difference between an asynchronous output device and a synchronous output only device. | ||
|
||
## To create the project | ||
|
||
1. Create a Visual Studio class library project. | ||
|
||
2. Add the sample code below to your project. | ||
|
||
3. Add references to the **Microsoft.PointOfService** assemblies. | ||
|
||
4. Compile and copy the Service Object to one of the directories in your Service Object assembly load path. | ||
|
||
## To use the application sample with the Service Object | ||
|
||
- This Service Object can be used with the application sample presented in [Event Handler Sample](event-handler-sample.md). | ||
|
||
## Example | ||
|
||
To output to a **PosPrinter** device, an application will most commonly use the <xref:Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.PrintNormal(Microsoft.PointOfService.PrinterStation,System.String)> method. Notice that the **PosPrinter** Service Object code below does not provide an implementation for this method. Instead, <xref:Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.PrintNormalImpl(Microsoft.PointOfService.PrinterStation,Microsoft.PointOfService.BaseServiceObjects.PrinterState,System.String)> is implemented. This method is called by the POS for .NET library for both synchronous and asynchronous output requests. | ||
|
||
When an application calls an output method, such as **PrintNormal**, the POS for .NET implementation checks the value of the <xref:Microsoft.PointOfService.PosPrinter.AsyncMode> property. If this value is **false**, then the POS for .NET library sends the request to **PrintNormalImpl** immediately and waits for it to return. If the value is **true**, however, then the POS for .NET implementation of **PrintNormal** adds the request to an internally managed queue. While there are items in the queue, a POS for .NET managed thread will send each request, in first-in-first-out (FIFO) order, to the device by calling **PrintNormalImpl**. When **PrintNormalImpl** returns, the library implementation will raise an <xref:Microsoft.PointOfService.PosPrinter.OutputCompleteEvent> in the application. In short, the same Service Object code can support both synchronous and asynchronous output without ever needing to know which output mode is being used. | ||
|
||
```csharp | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading; | ||
using Microsoft.PointOfService; | ||
using Microsoft.PointOfService.BaseServiceObjects; | ||
|
||
[assembly: PosAssembly("Service Object Contractors, Inc.")] | ||
|
||
namespace SOSamples.AsyncOutput | ||
{ | ||
[ServiceObject( | ||
DeviceType.PosPrinter, | ||
"AsyncOutputPrinter", | ||
"Sample Async Printer", | ||
1, | ||
9)] | ||
|
||
public class AsyncOutputSimulator : PosPrinterBase | ||
{ | ||
public AsyncOutputSimulator() | ||
{ | ||
DevicePath = "Sample Async Printer"; | ||
|
||
// Indicate that the Service Object supports | ||
// the receipt printer. | ||
Properties.CapRecPresent = true; | ||
} | ||
|
||
// Note that this method will be called by the POS for .NET | ||
// library code, regardless of whether the print request | ||
// is synchronous or asynchronous. The print request | ||
// queue is managed completely by POS for .NET so the | ||
// Service Object should simply write data to the device | ||
// here. | ||
protected override PrintResults PrintNormalImpl( | ||
PrinterStation station, | ||
PrinterState printerState, | ||
string data) | ||
{ | ||
// Your code to print to the actual hardware would go | ||
// here. | ||
|
||
// For demonstration, however, the code simulates | ||
// that fulfilling this print request took 4 seconds. | ||
Thread.Sleep(4000); | ||
|
||
PrintResults results = new PrintResults(); | ||
return results; | ||
} | ||
|
||
// This method must be implemented by the Service | ||
// Object, and should validate the data to be printed, | ||
// including any escape sequences. This method should throw | ||
// a PosControlException to indicate failure. | ||
protected override void ValidateDataImpl( | ||
PrinterStation station, | ||
string data) | ||
{ | ||
// Insert your validation code here. | ||
return; | ||
} | ||
|
||
#region Implement Abstract PosCommon Members | ||
private string MyHealthText = ""; | ||
|
||
// PosCommon.CheckHealthText. | ||
public override string CheckHealthText | ||
{ | ||
get | ||
{ | ||
// VerifyState(mustBeClaimed, | ||
// mustBeEnabled). | ||
VerifyState(false, false); | ||
return MyHealthText; | ||
} | ||
} | ||
|
||
// PosCommon.CheckHealth. | ||
public override string CheckHealth( | ||
HealthCheckLevel level) | ||
{ | ||
// Verify that device is open, claimed, and enabled. | ||
VerifyState(true, true); | ||
|
||
// Insert your code here: | ||
// check the health of the device and return a | ||
// descriptive string. | ||
|
||
// Cache result in the CheckHealthText property. | ||
MyHealthText = "Ok"; | ||
return MyHealthText; | ||
} | ||
|
||
// PosCommon.DirectIOData. | ||
public override DirectIOData DirectIO( | ||
int command, | ||
int data, | ||
object obj) | ||
{ | ||
// Verify that the device is open. | ||
VerifyState(false, false); | ||
|
||
return new DirectIOData(data, obj); | ||
} | ||
#endregion Implement Abstract PosCommon Members | ||
} | ||
} | ||
``` | ||
|
||
The application code in the [Event Handler Sample](event-handler-sample.md) can be compiled and run with this Service Object. | ||
|
||
## See Also | ||
|
||
#### Tasks | ||
|
||
- [Event Handler Sample](event-handler-sample.md) | ||
|
||
#### Concepts | ||
|
||
- [Event Management](event-management.md) | ||
- [Device Output Models](device-output-models.md) | ||
|
||
#### Other Resources | ||
|
||
- [Developing a Custom Service Object](developing-a-custom-service-object.md) |
39 changes: 39 additions & 0 deletions
39
...os-for-net/attributes-for-identifying-service-objects-and-assigning-hardware.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: Attributes for Identifying Service Objects and Assigning Hardware | ||
description: Attributes for Identifying Service Objects and Assigning Hardware (POS for .NET v1.14 SDK Documentation) | ||
ms.date: 02/27/2008 | ||
ms.topic: how-to | ||
ms.custom: pos-restored-from-archive | ||
--- | ||
|
||
# Attributes for Identifying Service Objects and Assigning Hardware (POS for .NET v1.14 SDK Documentation) | ||
|
||
POS for .NET uses .NET reflection and .NET attributes to locate Service Object assemblies, identify Service Objects within those assemblies, and finally to associate a Plug and Play device with that Service Object. By leveraging these .NET features, <xref:Microsoft.PointOfService.PosExplorer> can identify Service Objects within an assembly and quickly assess their Plug and Play requirements. The expensive process of loading a .NET assembly is delayed until needed by the application. | ||
|
||
In order to provide these features, POS for .NET depends on three different .NET attributes: | ||
|
||
- **PosAssembly** | ||
This is a global, assembly-level attribute that tells **PosExplorer** that this is a POS for .NET assembly which contains one or more Service Objects. Generally, it should be set in your **AssemblyInfo.cs** source file. For an example, see [Setting up a Service Object Project](setting-up-a-service-object-project.md). | ||
- **ServiceObject** | ||
This attribute is applied to the Service Object class and specifies the type, name, and version information for the Service Object. See the [Creating a Basic Service Object Code Template](creating-a-basic-service-object-code-template.md) section for an example. | ||
- **HardwareId** | ||
This attribute is used to specify which hardware IDs will be used by this Service Object. This information is used by **PosExplorer** to filter out Service Objects that use Plug and Play hardware which is not currently plugged in. The **HardwareId** attribute allows multiples, so there may be several attached to a Server Object class. See the sample topic [Adding Plug and Play Support](adding-plug-and-play-support.md) for an example. For a more lengthy discussion of Plug and Play features, including how the **HardwareId** attribute is utilized, see the topics [Adding Plug and Play Support](adding-plug-and-play-support.md) and POS for .NET [POS for .NET Integration with Plug and Play](pos-for-net-integration-with-plug-and-play.md). | ||
|
||
## See Also | ||
|
||
#### Reference | ||
|
||
- <xref:Microsoft.PointOfService.PosAssemblyAttribute> | ||
- <xref:Microsoft.PointOfService.HardwareIdAttribute> | ||
- <xref:Microsoft.PointOfService.ServiceObjectAttribute> | ||
|
||
#### Concepts | ||
|
||
- [Plug and Play Support](plug-and-play-support.md) | ||
- [POS for .NET Registry Settings](pos-for-net-registry-settings.md) | ||
|
||
#### Other Resources | ||
|
||
- [POS for .NET Service Object Architecture](pos-for-net-service-object-architecture.md) | ||
- [System Configuration](system-configuration.md) | ||
- [Service Object Samples: Getting Started](service-object-samples-getting-started.md) |
31 changes: 31 additions & 0 deletions
31
docs/framework/additional-apis/pos-for-net/base-class-directio-method.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: Base Class DirectIO Method | ||
description: Base Class DirectIO Method (POS for .NET v1.14 SDK Documentation) | ||
ms.date: 03/03/2014 | ||
ms.topic: how-to | ||
ms.custom: pos-restored-from-archive | ||
--- | ||
|
||
# Base Class DirectIO Method (POS for .NET v1.14 SDK Documentation) | ||
|
||
The **DirectIO** method and the **DirectIOEvent** event are used to provide functionality to the application that is not otherwise supported by the standard Unified Point Of Service (UnifiedPOS) specification for a particular device type. | ||
|
||
## DirectIO Method | ||
|
||
If a device has features that are not supported by the standard UnifiedPOS specification, a Service Object may implement a **DirectIO** method to give the application access to those features. | ||
|
||
An example might be a **LineDisplay** device that supports multicolor output. Few, if any, **LineDisplay**-type devices support color output, but an independent hardware vendor (IHV) might produce such a device and want to have the new features available to applications. | ||
|
||
Use of this method will make the application nonportable, since the implementation of the **DirectIO** method is vendor-specific. An application that uses a **DirectIO** method on Vendor A's **LineDisplay** device cannot depend on using a Vendor B's device. | ||
|
||
### DirectIOEvent | ||
|
||
This event can be used to send vendor-specific information directly to the application. This event provides a means for a vendor-specific UnifiedPOS service to provide events to the application that are not otherwise supported by the UnifiedPOS control. | ||
|
||
Using this event will make an application incompatible with devices from other vendors. | ||
|
||
## See Also | ||
|
||
#### Other Resources | ||
|
||
- [Developing Service Objects Using Base Classes](developing-service-objects-using-base-classes.md) |
35 changes: 35 additions & 0 deletions
35
docs/framework/additional-apis/pos-for-net/capability-properties.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Capability Properties | ||
description: Capability Properties (POS for .NET v1.14 SDK Documentation) | ||
ms.date: 03/03/2014 | ||
ms.topic: how-to | ||
ms.custom: pos-restored-from-archive | ||
--- | ||
|
||
# Capability Properties (POS for .NET v1.14 SDK Documentation) | ||
|
||
Certain properties cannot be set directly within a Service Object. This comes up most often in the case of capability properties; those with the **Cap** prefix in their names. According to the Unified Point Of Service (UnifiedPOS) specification, these properties must be read-only; therefore, an implementation-specific mechanism is needed for the Service Object to change the value of these properties. | ||
|
||
## BaseClass Properties | ||
|
||
Microsoft Point of Service for .NET (POS for .NET) **Base** classes have a protected property, **Properties**, for this purpose. This property returns a helper class which has writable versions of the read-only properties implemented in the **Base** class. For example, <xref:Microsoft.PointOfService.BaseServiceObjects.PinPadBase> has a property called <xref:Microsoft.PointOfService.BaseServiceObjects.PinPadBase.Properties> that returns an object of type <xref:Microsoft.PointOfService.BaseServiceObjects.PinPadProperties>. And this object contains properties used to set various **PinPad**-specific capability properties, such as <xref:Microsoft.PointOfService.PinPad.CapDisplay>. | ||
|
||
## PosCommon Properties | ||
|
||
In addition to device-specific property classes, all POS for .NET **Base** and **Basic** classes also have a protected property called **CommonProperties** which returns an object of type **CommonProperties**. This helper class is used to modify capability and status properties found in **PosCommon**. | ||
|
||
## Setting Properties Using Helper Classes | ||
|
||
In general, a Service Object should always access the value of its common and class-specific properties using the helper classes. These properties may be written to by the Service Object and always contain the appropriate values. | ||
|
||
The Service Object developer should be aware of what the POS for .NET framework may do when a particular value is changed. For example, the Service Object should generally not change **CommonProperties.State** since this may interfere with the POS for .NET internal state. Similarly, the Service Object developer should be aware that changing **CommonProperties.PowerState** may send a **StatusUpdateEvent** event to the application. | ||
|
||
> [!NOTE] | ||
> When deriving from the POS for .NET **Base** or **Basic** classes, the Service Object should generally not change the value of **CommonProperties.State** to **ControlState.Closed**. Doing so prevents cleanup of the event queue, and POS for .NET may later throw exceptions as it tries to process events already in the queue. | ||
|
||
## See Also | ||
|
||
#### Reference | ||
|
||
- <xref:Microsoft.PointOfService.BaseServiceObjects.PinPadProperties> | ||
- <xref:Microsoft.PointOfService.StatusUpdateEventHandler> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.