SDK杂记: Difference between revisions
(Created page with "==在生成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.gene...") |
No edit summary |
||
| Line 20: | Line 20: | ||
权限:CLOUDPOS_SAFE_MODULE | 权限:CLOUDPOS_SAFE_MODULE | ||
前置条件:HSM需存在公私钥对(例如:terminal别名) | 前置条件: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. * * <p> * 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. * </p> * * <p><b>Broadcast Result Actions:</b></p> * <ul> * <li> * Device is out of the geofence: * com.coudpos.ACTION_LOCATION_OUT_OF_BOUND * </li> * <li> * Device has re-entered the geofence after being out of bounds: * com.coudpos.ACTION_LOCATION_IN_OF_BOUND * </li> * <li> * Geofence feature is not enabled on the device: * com.coudpos.ACTION_LOCATION_GEOFENCE_DISABLED * </li> * </ul> * * <p><b>Implementation Details:</b></p> * <ul> * <li>Uses Android broadcast mechanism with action-based filtering</li> * <li>Caller must register a {@link android.content.BroadcastReceiver} to receive results</li> * <li>Result is typically returned shortly after the request is triggered</li> * </ul> * * <p><b>Notes:</b></p> * <ul> * <li>Ensure Terminal is registered before invoking this method</li> * </ul> | |||
*/ | |||
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> | |||
Revision as of 05:32, 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>