Login & Logout Tutorial

RFID SDK for Android 2.0.2.94

Applicable Devices : FX7500 and FX9600.

Overview

This Tutorial provides a walk-through of the steps to perform Login using RFID3 API

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

Login API allows the users to authenticate themselves before making changes on the reader. In order to change any settings on the reader, performing a login is mandatory. When a login is forced, it will logout any previously active session.

Setting it up

The following are the steps to login the reader

  • Create Reader Management Object
  • Create LoginInfo object with appropriate values
  • Perform login and logout operations.

Creating a Reader Management Object


// create and initialize the Reader Management object.
    ReaderManagement readerManagement = new ReaderManagement(); 
                                                                                                      
                                                

Performing operation

Simple Login with HTTP.


    LoginInfo loginInfo = new LoginInfo("FX9600112233", "userName", "password", SECURE_MODE.HTTP, false);
    try {
            readerManagement.login(loginInfo,READER_TYPE.FX);
        } catch (InvalidUsageException e) {
            e.printStackTrace();
        } catch (OperationFailureException e) {
           e.printStackTrace();
        }

Simple Login with HTTPS.


    LoginInfo loginInfo = new LoginInfo("FX9600112233", "userName", "password", SECURE_MODE.HTTPS, false);
    try {
            readerManagement.login(loginInfo,READER_TYPE.FX);
        } catch (InvalidUsageException e) {
            e.printStackTrace();
        } catch (OperationFailureException e) {
           e.printStackTrace();
        }

Force Login with HTTP.


    LoginInfo loginInfo = new LoginInfo("FX9600112233", "userName", "password", SECURE_MODE.HTTP, true);
    try {
            readerManagement.login(loginInfo,READER_TYPE.FX);
        } catch (InvalidUsageException e) {
            e.printStackTrace();
        } catch (OperationFailureException e) {
            e.printStackTrace();
        }
                                                

Force Login with HTTPS.


LoginInfo loginInfo = new LoginInfo("FX9600112233", "userName", "password", SECURE_MODE.HTTPS, true);
try {
        readerManagement.login(loginInfo,READER_TYPE.FX);
    } catch (InvalidUsageException e) {
        e.printStackTrace();
    } catch (OperationFailureException e) {
        e.printStackTrace();
    }
                                            

Logout.


try {
    readerManagement.logout();
} catch (InvalidUsageException e) {
    e.printStackTrace();
} catch (OperationFailureException e) {
    e.printStackTrace();
}
                                        

Closer look

  • hostname: Reader hostname or the IP address.
  • username: Reader admin username. This is “admin” by default.
  • Password: The password to be used to login as admin.
  • SecureMode Flag: This should be set to SECURE_MODE.HTTPS if the reader is in HTTPS mode and SECURE_MODE.HTTP otherwise.
  • forceLogin: When set to true the login will succeed even if there is another active session. Else login will fail if there is another active session.