How to reset transport key/master key

From wizarPOS
Revision as of 05:13, 4 July 2024 by Mahong (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The system provides the AIDL interface to reset tranport key and master key. When connect the service, the package name is com.wizarpos.wizarviewagentassistant, and the class name is com.wizarpos.wizarviewagentassistant.PINPadMgrService. When the application uses the interface, it must import wizarviewagentassistant.

API Overview

resetMasterKey

boolean resetMasterKey(int slot);

Reset master key to default 0x38 of 16 bytes.

Parameters
slot int: key index, from 0 to 49.
Returns
boolean whether reset successfully.

resetTransferKey

boolean resetTransferKey(int slot);

Reset transport key to default 0x38 of 16 bytes.

Parameters
slot int: key index, from 0 to 49.
Returns
boolean whether reset successfully.

Snippet code

  • Bind Service
    public void bindPINPadMgrService() {
        try {
            boolean result = startConnectService(MainActivity.this,
                    "com.wizarpos.wizarviewagentassistant",
                    "com.wizarpos.wizarviewagentassistant.PINPadMgrService", this);

            writerInLog("bind service result" + result, R.id.log_default);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    protected boolean startConnectService(Context mContext, String packageName, String className, ServiceConnection connection) {
        boolean isSuccess = startConnectService(mContext, new ComponentName(packageName, className), connection);
        return isSuccess;
    }

    protected boolean startConnectService(Context context, ComponentName comp, ServiceConnection connection) {
        Intent intent = new Intent();
        intent.setPackage(comp.getPackageName());
        intent.setComponent(comp);
        boolean isSuccess = context.bindService(intent, connection, Context.BIND_AUTO_CREATE);
        Logger.debug("bind service (%s, %s)", isSuccess, comp.getPackageName(), comp.getClassName());
        return isSuccess;
    }
     @Override
    public void onServiceConnected(ComponentName name, IBinder service) {
        try {
            writerInLog("onServiceConnected:" + service, R.id.log_success);
            pinPadManagerService = IPINPadManagerService.Stub.asInterface(service);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onServiceDisconnected(ComponentName name) {

    }
    IPINPadManagerService pinPadManagerService;
  • API calling
  result = pinPadManagerService.resetTransferKey(0);
  writerInLog("resetTransferKey(0): result = " + result, R.id.log_default);

  result = pinPadManagerService.resetMasterKey(0);
  writerInLog("resetMasterKey(0): result = " + result, R.id.log_default);

Download

Please download the AIDL file, or the Demo