-
Notifications
You must be signed in to change notification settings - Fork 1
bladeX Android API
return value PAEW_RET_SUCCESS function success
error code and other value ref https://github.com/extropiescom/bladeX/wiki/Error-Code
convert return value int type to string
input:int type return value,PAEW_RET_XXX
2.int getDeviceList(Object activity, String strFilter, int scanTimeout, Object enumCallback, String[] devNames, int[] devCount)
get device list
activity Object input:Activity object to connect the device
strFilter String input:string for BLE device enum, format device_name[####device_address], device_name could be part of full string, device_address is the mac address
scanTimeout int input:BLE enum timeout value,ms
enumCallback Object input:BLE enum call back,triggerd when found one device. callback type:com.extropies.common.CommonUtility.enumCallback
devNames String[] output:input data array length = PAEW_MAX_DEV_COUNT,output: device name array
devCount int[] output:input array length = 1,output: data count
3.int initContextWithDevName(Object activity, String devName, Object hearBeatCallback, long[] contextHandle)
init lib with device name
activity Object input:Activity object to connect the device
devName String input:device name to connect, device mac address
hearBeatCallback Object input:triggered when receive heartbeat. callback type:com.extropies.common.CommonUtility.heartBeatCallback
contextHandle long[] output:array length = 1 when as input,devica hanld in array element when as output
4.int initContext(Object activity, String strFilter, int scanTimeout, Object enumCallback, int[] devCount, long[] contextHandle)
init lib
activity Object input:Activity object to connect the device
strFilter String input:string for BLE device enum, format device_name[####device_address], device_name could be part of full string, device_address is the mac address
scanTimeout int input:BLE enum timeout value,ms
enumCallback Object input:BLE enum call back,triggerd when found one device. callback type:com.extropies.common.CommonUtility.enumCallback
devNames String[] output:input data array length = PAEW_MAX_DEV_COUNT,output: device name array
contextHandle long[] output:array length = 1 when as input,devica hanld in array element when as output
contextHandle long input:device handle
power off and release lib res
contextHandle long input:device handle
get device info
contextHandle long input:device handle
devIndex int input:device index 0~devcount -1
devInfoType int input:device type info,PAEW_DEV_INFOTYPE_XXX or serval PAEW_DEV_INFOTYPE_XXX
devInfo PAEW_DevInfo[] output:rray length = 1 when as input,devica hanld in array element when as output
get firmware version
pbVersion byte[] output:array length =4 when as input,firmware version array when as output
pnVersionLen int[] output:array length =1 when as input,firmware version length as output
refresh EINK screen
contextHandle long input:device handle
devIndex int input:device index 0~devcount -1
get fingerprint template list
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
FingerPrintID FingerPrintID[] output:array length = 3 when as input, fingerprint template list when as output
fpListCount int[] output:array length = 1 when as input,fingerprint template count
enroll a new finger to first available position
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
enrollCallback Object input:callback of fingerprint enroll, triggered when get a new enroll status. Interface type:com.extropies.bluetoothlib.BlueToothUtility.fpStateCallback
12.int verifyFP(long contextHandle, int devIndex, Object verifyCallback, FingerPrintID[] fpList, int[] fpListCount)
Fingerprint verification
contextHandle long input:device handle
devIndex int input:device index 0~devcount -1
verifyCallback Object input:callback of fingerprint verify, triggered when get a new verify status. Interface type:com.extropies.bluetoothlib.BlueToothUtility.fpStateCallback
FingerPrintID FingerPrintID[] output:array length = 3 when as input,verified fingerprint list as output
fpListCount int[] output:array length = 1 when as input,verified fingerprint count as output
get fingerprint stauts
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
abort fingerprint operation process
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
delete fingerprint template
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
FingerPrintID FingerPrintID[] input:fingerprint list to delete
calibrate fingerprint sensor
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
Init PIN
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
strPIN String input: Initial PIN code
verify PIN
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
strPIN String input:PIN code
change PIN
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
strOldPIN String input:current PIN
strNewPIN String input:PIN to update
format device to clear PIN, fingerprint and all crypto data
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
Generate seed
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
seedLen int input:entropy length,between [16, 32] and can be devided by 4
nN int input:db, N
nT int input:db, T
22.int generateSeed_GetMnes(long contextHandle, int devIndex, int seedLen, String[] strMneWord, int[] checkIndex, int[] checkIndexCount)
Generate Mnemonic Phrase and return,as well as the index for test
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
seedLen int input:entropy length,between [16, 32] and can be devided by 4
strMneWord String[] output:input为一个长度为1的数组,output的数组元素即为生成的助记词组
checkIndex int[] output:input为一个长度为PAEW_MNE_INDEX_MAX_COUNT的数组,output的数组元素即为助记词考试的助记词索引
checkIndexCount int[] output:array length = 1 when as input,index count as output
Mnemonic phrase test result
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
strMneWord String input:Mnemonic phrase string from test,black space between every Mnemonic phrase.
Import Mnemonic phrase
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
strMneWord String input:Mnemonic phrase string to import,black space between every Mnemonic phrase.
Derived address
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
nCoinType byte input:coin type
derivePath int[] input derive path
Get derived address
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
nCoinType byte input:coin type
strAddress String[] output:array length = 1 when as input,address as output
27.int ETHSign(long contextHandle, int devIndex, Object signCallback, byte[] transaction, byte[] signature, int[] sigLen)
Sign ETH transaction
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
signCallback Object input:callback for sign transaction,user authentication mode should be selected in this function. Waiting for user operation on bladeX done by pulling status from it。Interface type:com.extropies.common.CommonUtility.signCallback
transaction byte[] input:transaction data to be signed
signature byte[] output:An array lengh =PAEW_ETH_SIG_MAX_LEN,signature as output
sigLen int[] output:array length = 1 when as input,signature length as output
28.int EOSSign(long contextHandle, int devIndex, Object signCallback, byte[] transaction, byte[] signature, int[] sigLen)
Sign EOS transaction
contextHandle long input:device handle
devIndex int input:input:device index 0~devcount -1
signCallback Object input:callback for sign transaction,user authentication mode should be selected in this function. Waiting for user operation on bladeX done by pulling status from it。Interface type:com.extropies.common.CommonUtility.signCallback
transaction byte[] input:transaction data to be signed, transaction data is serialized result of a json transaction string, prefixed with chain_id (32 bytes) and tailed with zeros (32 bytes)
signature byte[] output:An array lengh =PAEW_ETH_SIG_MAX_LEN,signature as output
sigLen int[] output:array length = 1 when as input,signature length as output
public interface enumCallback { void discoverDevice(String[] strDeviceNames); }
discoverDevice Triggerd when get each device. Function supposed not take too much time.
public interface fpStateCallback { void pushFingerPrintState(int nFPState); }
pushFingerPrintState Triggered when get a state in fingerprint enrollment and verficaiton. Function supposed not take too much time. nFPState is from PAEW_RET_XXXX
public interface signCallback { int getAuthResult(); byte getAuthType(); int getPINResult(); String getPIN(); void putSignState(int nSignState); }
This is how sign function works inside:
1) call getAuthResult to get which operation user selected, continue or cancel
2) call getAuthType to get which user authentication mode user selected, PIN or fingerprint.
3) If user authentication mode is PIN, call getPINResult to detect user has input the PIN or click cancel.
4) If user authentication mode is PIN and user has input PIN and click OK, then aquire PIN value in getPIN and call verify PIN. If failed and PIN retry count not 0, go back to step 1
5) If other error detected, abort whole function.
6) If sign function return fail and user authenticate mode is fingerprint, getPINResult will be called to give user another chance to use PIN to finish the transaction.
public interface heartBeatCallback { void pushHeartBeatData(byte[] heartBeatData); void pushConnectState(boolean connected); }
pushHeartBeatData This interface is called when get heartbeat packet。Format:0x91 || PowerSource || PowerLevel。
PowerSource 1 byte,0x00: usb charging;0x01:,battery using。PowerLevel 1 byte。Function supposed not take too much time.
pushConnectState This interface is called when device connected, disconnected or get heartbeat packet.