How to reset transport key/master key: Difference between revisions

From wizarPOS
(Created page with "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...")
 
No edit summary
 
Line 88: Line 88:
</syntaxhighlight>
</syntaxhighlight>
== Download ==
== Download ==
Please download the [http://ftp.wizarpos.com/advanceSDK/IPINPadManagerService.aidl AIDL file].
Please download the [http://ftp.wizarpos.com/advanceSDK/IPINPadManagerService.aidl AIDL file], or the [https://github.com/SmartPOSSamples/PINPadMgrDemo Demo]

Latest revision as of 05:13, 4 July 2024

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