Result Code
Code | Message |
---|---|
1 | Success, get more information with vid |
1001 | Network Error, check network states |
1002 | Server Error |
1005 | VID Not Found |
9012 | VID No Permission, Please check your permission |
100003 | VID APP Signature Error |
100004 | VID APP Certification Error |
100006 | VID VerifyID Not Exist, Check your verify ID. |
Quick Start
-
Attention:
The UHF SDK is only applicable on C4050 by ChainWay. If you need further support, please contact
toolchainsupport@vechain.com.
-
Reference library
repositories { flatDir { dirs 'libs' } } dependencies { implementation(name: 'vechain-verify-sdk', ext: 'aar') implementation 'com.squareup.okhttp3:okhttp:3.13.1' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' implementation 'com.squareup.retrofit2:retrofit:2.4.0' implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0' implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' implementation 'io.reactivex.rxjava2:rxjava:2.1.16' }
-
Request NFC & Internet access in the Android manifest
<uses-permission android:name="android.permission.INTERNET"/>
-
Register SDK, Call this method before you start to verify.
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String verifyID = "verifyId is got from VeChain Toolchain Portal/Developer Center"; /* Register SDK, Call this method before you start to verify. */ VeChainUHFSDK.registerSDK(this, verifyID, new MySignAction()); }
public class MySignAction implements SignAction { /* MySignAction is the implementation of the interface SignAction. The purpose is to sign the incoming pair of challengeId and notifier. onSignResult (signInfo) to notify SDK to continue the registration process. */ @Override public void sign(Context context, String challengeId, SignNotifier signNotifier) { String certString = "Your certificate string"; String certKeyString = "Your certificate key"; String signature = CertUtils.getSignInfo(certString, certKeyString, challengeId); //More Detail about how to sign the challengeId and get signature, refers to Appendix A: FAQ - How to Sign ChallengeID signNotifier.onSignResult(signature, ""); } }
-
Activity which verify the UHF RFID tag
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Initialize UHF module VeChainUHFSDK.initUHF(); } public void onStartUHFClick(View view){ //Setup module power VeChainUHFSDK.setPower(power); VeChainUHFSDK.setAlarm(alarm); UHFChipType chipType = UHFChipType.UHF_CHIP_MR6P; //Start inventory Tag VeChainUHFSDK.readBatchTag(chipType, new UHFBatchCallBack() { @Override public void onSuccess(int resultCode, ArrayList<VerifyResult> arrayList) { if (resultCode != ResultCode.OK) { return; } updateChipInfo(arrayList); } }); } public void onStartUHFClick(View view){ //Stop inventory Tag boolean isStop = VeChainUHFSDK.stopRead(); }
API Reference
Register
/**
* Register SDK
* Call this method before verify the chip.
*
* @param context the context
* @param verifyId is got from VeChain Toolchain Portal/Developer Center;
*/
public static void registerSDK(@NonNull Context context, @NonNull String verifyId, @NonNull SignAction signAction)
Initialize UHF module
/**
* Initialize UHF module
*
*/
public static void initUHF()
readBatchTag
/**
* Read batch RFID tag.
* @param type chipType you want to read: UHFChipType.UHF_CHIP_MR6P, UHFChipType.UHF_CHIP_EM4124, UHFChipType.UHF_CHIP_M4QT
* @param uhfBatchCallBack callback with verify result
*/
public static void readBatchTag(UHFChipType type, UHFBatchCallBack uhfBatchCallBack)
readSingleTag
/**
* Read single RFID tag.
* @param type chipType you want to read: UHFChipType.UHF_CHIP_MR6P, UHFChipType.UHF_CHIP_EM4124, UHFChipType.UHF_CHIP_M4QT
* @param uhfSingleCallBack callback with verify result
*/
public static void readSingleTag(UHFChipType type, UHFSingleCallBack uhfSingleCallBack)
setPower
/**
* Setup UHF module power
*
* @param power
*/
public static void setPower(int power)
getPower
/**
* read power of module
*/
public static int getPower()
setAlarm
/**
* Setup is Alarm
*/
public static void setAlarm(boolean isAlarm)
isPowerOn
/**
* Judge the device is powered on or not.
*
* @return
*/
public static boolean isPowerOn()
get Version
/**
* Get SDK Version
*/
public static String getVersion()
Comments
0 comments
Please sign in to leave a comment.