Reader Friendly Name

RFID SDK for Android 2.0.2.124

Applicable Devices: Handheld Readers RFD40/RFD90

Overview

This Tutorial provides a walk-through of the steps to set Reader Friendly Name  

Create The Project

  • Start by creating a new project in Android Studio. For help, see the Android Studio tutorial.
  • Refer Hello RFID to prepare basic setup to work with RFID Reader and then follow this guide

Details

This feature provides user the capability to rename the reader to any friendly name which will help to identify the reader. Once the API is called and for the friendly name to take effect while discovering devices needs to be detached and attached with USB connection and repaired if its for BT devices. Friendly name the user can provide is restricted for 22 characters only. User can fetch current configured friendly name

Setting it up


String newname = “storeDevice”;
try {
	RFIDResults rfidResults = mConnectedReader.Config.setFriendlyName(newName);
    if(rfidResults == RFIDResults.RFID_API_SUCCESS){
        Toast.makeText(getActivity(),"Rename Success. To see changes" +
                "\nUSB connection: Deattach and attach the reader " +
                "\nBluetooth: Unpair and pair the device",Toast.LENGTH_LONG).show();
    }
    else if(rfidResults == RFIDResults.RFID_COMMAND_OPTION_WITHOUT_DELIMITER){
        Toast.makeText(getActivity(),"Renaming failed. Don't include Space in between words", Toast.LENGTH_SHORT).show();
    }
    else {
        Toast.makeText(getActivity(),"Rename fail. Unknown error",Toast.LENGTH_SHORT).show();
    }

} catch (InvalidUsageException e) {
    if(e.getStackTrace().length>0) {
        Log.e(TAG, e.getStackTrace()[0].toString());
        Log.e(TAG, e.getInfo());
    }
} catch (OperationFailureException e) {
    if( e!= null && e.getStackTrace().length>0)
    { Log.e(TAG, e.getStackTrace()[0].toString()); }
}


/*
 *  Getting the currently set friendly name
 */

try{
	String friendlyName = getFriendlyName();
  } catch (InvalidUsageException e) {
    if(e.getStackTrace().length>0) {
        Log.e(TAG, e.getStackTrace()[0].toString());
        Log.e(TAG, e.getInfo());
    }
} catch (OperationFailureException e) {
    if( e!= null && e.getStackTrace().length>0)
    { Log.e(TAG, e.getStackTrace()[0].toString()); }
}