0

我想从 Android 应用程序连接到设备。我已经成功授权了。现在我想按照参考文献中的描述开始自动轮询(请求命令:E0 00 00 40 01,第 30 页,https ://www.acs.com.hk/download-manual/7664/REF-ACR1255U-J1 -1.12.pdf)但我不明白。

我想,我必须加密对读者的请求。这个对吗?如果是,我必须使用哪个键?来自授权流程中最终响应的密钥(会话密钥?)?

为了测试,我使用了演示应用程序(https://www.acs.com.hk/download-driver-unified/9644/ACS-BT-EVK-Android-1.01r2.zip)和 Wireshark 来记录请求。我很惊讶地发现,每次单击“开始轮询”按钮后,请求都会发生变化。无论我多久点击一次,我都希望它是一样的。

与我在参考资料中找到的相比,我希望能对 start polling 命令提供更有用的解释。

4

1 回答 1

0

我刚刚创建了一个自动轮询命令:

private static final byte[] AUTO_POLLING_START = {(byte) 0xE0, 0x00, 0x00, 0x40, 0x01};

然后是我在 onAuthenticationComplete 监听器中执行的一个函数,在成功认证后

private void startPolling() {

    if (bluetoothReader == null) {
        authStatus.setText("Card reader not ready");
        return;
    }
    if (!bluetoothReader.transmitEscapeCommand(AUTO_POLLING_START)) {
        authStatus.setText("Card reader not ready");
    }
}
bluetoothReader.setOnAuthenticationCompleteListener(new BluetoothReader.OnAuthenticationCompleteListener() {
            @Override
            public void onAuthenticationComplete(BluetoothReader bluetoothReader, final int errorCode) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        if (errorCode == BluetoothReader.ERROR_SUCCESS) {
                            authStatus.setText("Authentication Success!");
                            startPolling();

                        } else {
                            authStatus.setText("Authentication Failed!");
                        }
                    }
                });
            }
        });
于 2020-08-21T07:54:27.953 回答