SDK杂记: Difference between revisions

From wizarPOS
No edit summary
No edit summary
Line 48: Line 48:
</intent-filter>
</intent-filter>
</receiver>
</receiver>
==对于在Q1K/Q2pro上,persist.wp.hw.customerdisplay值可能是size:240x320或者size:272x480,由驱动负责设置。SDK提供获取接口来解析这个属性:
android.util.Size CustomerDisplayDevice.getSize();
cloudpossdkV1.8.2.10_Standard.aar以上开始支持。
Q1K系列,需要bootloader0857+支持 #40099
<uses-permission android:name="android.permission.CLOUDPOS_CUSTOMER_DISPLAY"/>
com.cloudpos.customerdisplay
CustomerDisplayDevice device = (CustomerDisplayDevice) POSTerminal.getInstance(context).getDevice(POSTerminal.DEVICE_NAME_CUSTOMER_DISPLAY);
device.open();
device.close();

Revision as of 06:39, 3 June 2026

在生成CSR的时候,可以输入证书的常用域,包括:countryName, stateOrProvinceName, localityName, organizationName, organizationUnitName, commonName和emailAddress

cloudpossdkV1.8.1.5开始支持 com.cloudpos.hsm.HSMDevice

HSMDevice hsm = (HSMDevice) POSTerminal.getInstance(context) .getDevice(POSTerminal.DEVICE_NAME_HSM); hsm.open();

// 单字段CSR(原接口) X500Principal subject1 = new X500Principal("CN=www.test.com"); byte[] csr1 = hsm.generateCSR("terminal", subject1);

// 多字段CSR(#40841新支持CN/O/OU/C/ST/L) X500Principal subject2 = new X500Principal( "CN=pay.test.com,O=TestPayCorp,OU=Security Dept,C=CN,ST=Guangdong,L=Shenzhen"); byte[] csr2 = hsm.generateCSR("terminal", subject2);

hsm.close();

权限:CLOUDPOS_SAFE_MODULE 前置条件:HSM需存在公私钥对(例如:terminal别名)

主动查询终端是否越界的接口(电子围栏相关)

cloudpossdkV1.8.2.10开始支持, TmsAgent-v5.4.50.3以上开始支持。 com.cloudpos.TerminalSpec

/** * Requests a geofence status check by sending a broadcast to the Terminal. * *

* When this method is invoked, Terminal performs a geofence validation immediately. * The result is delivered asynchronously via broadcast intents. This method does not * return the result directly. *

* *

Broadcast Result Actions:

*

    *
  • * Device is out of the geofence: * com.coudpos.ACTION_LOCATION_OUT_OF_BOUND *
  • *
  • * Device has re-entered the geofence after being out of bounds: * com.coudpos.ACTION_LOCATION_IN_OF_BOUND *
  • *
  • * Geofence feature is not enabled on the device: * com.coudpos.ACTION_LOCATION_GEOFENCE_DISABLED *
  • *

* *

Implementation Details:

*

    *
  • Uses Android broadcast mechanism with action-based filtering
  • *
  • Caller must register a {@link android.content.BroadcastReceiver} to receive results
  • *
  • Result is typically returned shortly after the request is triggered
  • *

* *

Notes:

*

    *
  • Ensure Terminal is registered before invoking this method
  • *
  • /

requestGeofenceBroadcast() //Sample code: TerminalSpec terminalSpec = POSTerminal.getInstance(context).getTerminalSpec(); terminalSpec.requestGeofenceBroadcast();

广播接收: - com.coudpos.ACTION_LOCATION_OUT_OF_BOUND — 终端出围栏 - com.coudpos.ACTION_LOCATION_IN_OF_BOUND — 终端入围栏 - com.coudpos.ACTION_LOCATION_GEOFENCE_DISABLED — 围栏未启用 <receiver android:name="com.cloudpos.api.receiver.LocationReceiver" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="com.coudpos.ACTION_LOCATION_OUT_OF_BOUND" /> </intent-filter> <intent-filter> <action android:name="com.coudpos.ACTION_LOCATION_IN_OF_BOUND" /> </intent-filter> <intent-filter> <action android:name="com.coudpos.ACTION_LOCATION_GEOFENCE_DISABLED" /> </intent-filter> </receiver> ==对于在Q1K/Q2pro上,persist.wp.hw.customerdisplay值可能是size:240x320或者size:272x480,由驱动负责设置。SDK提供获取接口来解析这个属性: android.util.Size CustomerDisplayDevice.getSize(); cloudpossdkV1.8.2.10_Standard.aar以上开始支持。 Q1K系列,需要bootloader0857+支持 #40099

<uses-permission android:name="android.permission.CLOUDPOS_CUSTOMER_DISPLAY"/>

com.cloudpos.customerdisplay CustomerDisplayDevice device = (CustomerDisplayDevice) POSTerminal.getInstance(context).getDevice(POSTerminal.DEVICE_NAME_CUSTOMER_DISPLAY); device.open();

device.close();