手动管理 POS for .NET 设备(POS for .NET v1.14 SDK 文档)

你不需要使用 POS 设备管理器 (posdm.exe),就可以手动执行大部分 Microsoft Point of Service for .NET (POS for .NET) 设备管理任务。

手动管理 POS for .NET 设备

可以手动编辑 POS for .NET 配置 XML 文件,以复制 posdm.exe 提供的大部分功能。

在注册表项 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\POSfor.NET 下的 Configuration 值中,可以找到 POS for .NET 配置 XML 文件的位置。

配置文件的默认位置是 *%ProgramData%\*Microsoft\Point Of Service\Configuration\Configuration.xml

下表列出了 posdm.exe 命令以及必须添加到配置 xml 文件的等效 XML。

Posdm.exe 命令

说明

Configuration.xml

示例

ADDDEVICE

添加非即插即用的物理设备。

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="[Service Object Name]" Type="[Device Type]">
    <Device HardwarePath="[Hardware Path]" Enabled="yes" PnP="no">
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

Posdm.exe 命令:

Posdm ADDDEVICE COM1 /SONAME:"Microsoft Msr Simulator" /Type:msr

Configuration.xml:

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="Microsoft Msr Simulator" Type="Msr">
    <Device HardwarePath="COM1" Enabled="yes" PnP="no">
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

ADDNAME

将名称添加到设备的名称列表中。

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="[Service Object Name]" Type="[Device Type]">
    <Device HardwarePath="[Hardware Path]" Enabled="yes" PnP="no">
      <LogicalName Name="[Device Name]" />
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

Posdm.exe 命令:

Posdm ADDNAME MyName /SONAME:"Microsoft Msr Simulator" /Path:COM1

Configuration.xml:

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="Microsoft Msr Simulator" Type="Msr">
    <Device HardwarePath="COM1" Enabled="yes" PnP="no">
     <LogicalName Name="MyName" />
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

ADDPROPERTY

将属性添加到设备。

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="[Service Object Name]" Type="[Device Type]">
    <Device HardwarePath="[Hardware Path]" Enabled="yes" PnP="no">
      <Property Name="[Property Name]" Value="[Property Value]" />
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

Posdm.exe 命令:

Posdm addproperty MyProperty MyValue /Name:MyName

Configuration.xml:

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="Microsoft Msr Simulator" Type="Msr">
    <Device HardwarePath="COM1" Enabled="yes" PnP="no">
     <LogicalName Name="MyName" />
     <Property Name="MyProperty" Value="MyValue" />
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

DELETEDEVICE

删除非即插即用的物理设备。

删除 <Device> 节点。

DELETENAME

从设备的名称列表中删除名称

删除 <LogicalName> 节点。

DELETEPROPERTY

从设备中删除属性。

删除 <Property> 节点。

DISABLE

在 POS 设备上禁用 SO。

在 <Device> 节点上设置 Enabled="no"Default="no"

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="[Service Object Name]" Type="[Device Type]">
    <Device HardwarePath="[Hardware Path]" Enabled="no" PnP="no" Default="no">
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

Posdm.exe 命令:

Posdm disable /Path:COM1

Configuration.xml:

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="Microsoft Msr Simulator" Type="Msr">
    <Device HardwarePath="COM1" Enabled="no" PnP="no" Default="no">
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

ENABLE

在 POS 设备上启用 SO。

在 <Device> 节点上设置 Enabled="yes"

INFO

显示设备属性。

不适用

LISTDEVICES

列出目标 <host> 上的 POS 设备。

不适用

LISTNAMES

列出与 POS 设备关联的名称。

不适用

LISTPROPS

列出与设备关联的属性。

不适用

LISTSOS

列出目标 <host> 上的 POS 服务对象。

服务对象搜索路径是注册表项下的所有值:

HKLM\Software\Wow6432Node\Posfor.NET\ControlAssemblies

默认搜索路径为:

%CommonProgramFiles(x86)%\Microsoft Shared\Point Of Service\Control Assemblies\

POS for .NET 将尝试加载在这些路径中找到的所有服务对象 DLL。

SETDEFAULT

将一个设备设置为其 <type> 的默认值。

在 <Device> 节点上设置 Default="yes"

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="[Service Object Name]" Type="[Device Type]">
    <Device HardwarePath="[Hardware Path]" Enabled="yes" PnP="no" Default="yes">
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

Posdm.exe 命令:

Posdm SETDEFAULT ON /Path:COM1

Configuration.xml:

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="Microsoft Msr Simulator" Type="Msr">
    <Device HardwarePath="COM1" Enabled="yes" PnP="no"  Default="yes">
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

SETPATH

设置非即插即用 POS 设备 <path>。

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="[Service Object Name]" Type="[Device Type]">
    <Device HardwarePath="[Hardware Path]" Enabled="yes" PnP="no">
    </Device>
  </ServiceObject>
</PointOfServiceConfig>

Posdm.exe 命令:

Posdm SETPATH COM2 /SONAME:"Microsoft Msr Simulator" /Type:msr

Configuration.xml:

<PointOfServiceConfig Version="1.0">
  <ServiceObject Name="Microsoft Msr Simulator" Type="Msr">
    <Device HardwarePath="COM2" Enabled="yes" PnP="no">
    </Device>
  </ServiceObject>
</PointOfServiceConfig>