# Introduction (/global/en/docs/Terminal/NSDK/Introduction)

## Introduction

### What’s NSDK

NSDK is short for Newland Software Development Kit. It provides Android APIs to enable developers to access Newland POS(Point Of Sale) modules, such as PIN pad, magnetic stripe card, contact/contactless card. It is aimed to be a standard Newland POS SDK. As there is a standard Newland POS SDK in C which is NAPI, NSDK is designed to play the same role as NAPI in Java.

### NSDK vs MESDK

Compared to MESDK:

1. NSDK provides only the basic and standard Newland POS APIs and is not subject to customer-specific modifications. In contrast, MESDK is open to customization and has already incorporated several customer requirements, with plans to continue supporting such requests.

2. NSDK emphasizes the reusability of Newland POS APIs. Since it is fine-grained and free from customer-specific customizations, it offers greater flexibility for customers to build their own SDKs or develop payment applications.

### Device Requirements

NSDK is designed for devices running Android 7.0 and above.
For now, NSDK can be used on the following devices:

| Device Model | OS Firmware         | Platform | Remark                                                          |
| :----------- | :------------------ | :------- | :-------------------------------------------------------------- |
| N910 A7      | `V1.0.19` or higher | Android  |                                                                 |
| N910 Pro     | `V1.1.02` or higher | Android  | `RouteManager` module is only supported on `V1.1.47` or higher. |
| N850 A7      | `V1.0.05` or higher | Android  |                                                                 |
| N700 A7      | `V1.0.06` or higher | Android  |                                                                 |
| CPOS X5      | `V1.0.60` or higher | Android  | Non-security modules supported.                                 |
| N950 A10     | `V1.1.03` or higher | Android  |                                                                 |
| N950 A12     | `V1.0.00` or higher | Android  | `RouteManager` module is only supported on `V1.1.12` or higher. |
| X800         | `V1.0.03` or higher | Android  |                                                                 |
| U2000 A12    | `V1.1.02` or higher | Android  |                                                                 |
| N950K        | `V1.0.01` or higher | Android  |                                                                 |
| N750 A12     | `V1.0.09` or higher | Android  |                                                                 |
| P300 A11     | `V1.1.05` or higher | Android  | `RouteManager` module is only supported on `V1.1.05` or higher. |

And NSDK supports to communicate with external PIN pad devices as below:

| Device Model | OS Firmware                                                                   | Remark                                                |
| :----------- | :---------------------------------------------------------------------------- | :---------------------------------------------------- |
| ME30SU       | `V2.6.8` or higher `V3.0.3` or higher                                         |                                                       |
| SP130        | For External Newland Pin-pad Specification Command Set: `V7.00.29` or higher. | Only `V7.00.29` can support cipher mode to send APDU. |

### What NSDK Provides

NSDK provides two sets of libraries for different development scenarios:

**Packages with internal and external modules**

- `Newland-NSDK-x.x.x.aar`: Including internal modules.
- `NSDK-Plugin-Ext-x.x.x.aar`: Including external modules to interact with external pinpad devices, such as ME51P, SP100 and ME30SU.
- `NSDK-Plugin-Card-x.x.x.jar`: Provides methods, such as `authenticate`, to operate M0, M1, Felica cards. But it is strongly recommended that use Newland-NSDK-RFIC-x.x.x.aar instead.

**Packages with external modules only**

Usually these packages are used when developing applications on common android devices (e.g., android mobile phones):

- `Newland-NSDK-Ext-x.x.x.aar`: Including external modules.
- `NSDK-Plugin-Card-Ext-x.x.x.jar`: Provides methods, such as `authenticate`, to operate M0, M1, Felica cards.

> **INFO**
>
> If you are using proguard rules, please keep:
>
> ```text
> -keep class com.newland.nsdk.*{*;}
> -keep class com.newland.nsdk.**{*;}
> -keep class android.newland.*{*;}
> -keep class android.newland.**{*;}
> ```

### NSDK Scenarios

|                              | Newland-NSDK-x.x.x.aar NSDK-Plugin-card-x.x.x.jar | Newland-NSDK-x.x.x.aar NSDK-Plugin-Ext-x.x.x.aar NSDK-Plugin-card-x.x.x.jar | Newland-NSDK-Ext-x.x.x.aar NSDK-Plugin-card-x.x.x.jar |
| :--------------------------- | :------------------------------------------------ | :-------------------------------------------------------------------------- | :---------------------------------------------------- |
| **N910**                     | √                                                 |                                                                             |                                                       |
| **N700**                     | √                                                 |                                                                             |                                                       |
| **N850**                     | √                                                 |                                                                             |                                                       |
| **N850+SP100/ME51P/ME30SU**  |                                                   | √                                                                           |                                                       |
| **CPOS+ SP100/ME51P/ME30SU** |                                                   | √                                                                           |                                                       |
| **Mobile+ME30SU**            |                                                   |                                                                             | √                                                     |

Below diagram shows layer details of these scenarios:

![](https://docs.newlandnpt.us/assets/_shared/97197ac22997/nsdk_scenarios_layers.png)

## NSDK Architecture

NSDK is designed with "Core Package + Plugin Packages" pattern.

- Core Package: Provides all the main modules of a POS device. For card module, it only supports the cards for EMV/Financial transaction (Magnetic stripe card/EMV Contact card/EMV Contactless card).
- Plugin Packages: Provide additional or less important features. These packages are imported according to user's needs. Following plugin packages are provided by NSDK now:
  - Plugin-Card: This package supports other types of Contact/Contactless cards, such as SAM/Sle44X2 card, M1/M0/Felica card.

![](https://docs.newlandnpt.us/assets/_shared/416ab4ef676b/core_plugin.png)

For more details of NSDK architecture, see below diagram:

![](https://docs.newlandnpt.us/assets/_shared/2afa185bfc30/nsdk_architecture.png)

As the diagram showed:

- NSDK provides POS related interfaces for users to develop applications.
- NSDK provides both internal modules and external modules (with "Ext" prefix in their module names).
- All the modules are managed and accessed by NSDK module manager.
- EMV L3 library is based on NSDK and provided as a single package. It is more convenient for user to use EMV L3 library instead of NSDK to implement transactions.

## NSDK Modules

### Module Manager

Module manager is the main entrance of NSDK. There are “NSDK Module Manager” and “Ext NSDK Module Manager”. Both of them are singleton. All the internal device modules are managed by NSDK Module Manager while all the external device modules are managed by Ext NSDK Module Manager.

![](https://docs.newlandnpt.us/assets/_shared/8d181d4997f2/nsdk_modules.png)

### Internal Modules

|                             |                                                                                                                                                                                                                                                          |
| :-------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **BarcodeDecoder**          | Provides the ability to decode barcode.                                                                                                                                                                                                                  |
| **CardReader**              | Responsible for card searching of Magnetic/Contact/Contactless cards. Concrete card instance can be newed to continue to operate the inserted/tapped card, e.g., CPUContactCard(provided in NSDK core package), M1Card(Provided in NSDK plugin package). |
| **Crypto**                  | Provides crypto interface, e.g., MAC generation, data encryption/decryption.                                                                                                                                                                             |
| **KeyManager**              | Used to manage keys.                                                                                                                                                                                                                                     |
| **PINEntry**                | Used for user to input online PIN or offline PIN.                                                                                                                                                                                                        |
| **DeviceManager**           | Provides device info related interface.                                                                                                                                                                                                                  |
| **Beeper**                  | Provides the ability to beep.                                                                                                                                                                                                                            |
| **LED**                     | Provides the ability to control LED lights.                                                                                                                                                                                                              |
| **CashBox**                 | Provides the ability to open cash box.                                                                                                                                                                                                                   |
| **SettingsManager**         | Provides the ability to set/get system settings configuration, e.g., screen brightness, default input method.                                                                                                                                            |
| **EMVL2Service**            | Provides EMV L2 functions.                                                                                                                                                                                                                               |
| **Printer**                 | Provides the ability to print receipts.                                                                                                                                                                                                                  |
| **RouteManager**            | Provides the ability to configure which network is employed for accessing a specified IP, which includes WIFI, Ethernet and Mobile network.                                                                                                              |
| **BootProvider**            | Provides the ability to set custom boot animation, boot logo and default launcher.                                                                                                                                                                       |
| **DeviceStatisticsManager** | Provides the ability to get the device statistics information.                                                                                                                                                                                           |
| **Recovery**                | Provides the ability to reset A10 device to factory data.                                                                                                                                                                                                |
| **BarcodeScanner**          | Provides the ability to perform hard-scanning decode with N750 hard scanner.                                                                                                                                                                             |
| **SerialPortManager**       | Provides the ability to create instances of different serial port.                                                                                                                                                                                       |
| **GuestDisplayManager**     | Provides the ability to operate guest display screen.                                                                                                                                                                                                    |

### External Modules

Supported by external devices which can be connected to the host terminal via serial port/USB/bluetooth.

|                      |                                                                                                                                                                                                                                                                |
| :------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **ExtScanner**       | Provides the ability to scan barcode.                                                                                                                                                                                                                          |
| **ExtCardReader**    | Responsible for card searching of Magnetic/Contact/Contactless cards. Concrete card instance can be newed to continue to operate the inserted/tapped card, e.g., ExtCPUContactCard(provided in NSDK core package), ExtM1Card(Provided in NSDK plugin package). |
| **ExtCrypto**        | Provides crypto interface, e.g., MAC generation, data encryption/decryption.                                                                                                                                                                                   |
| **ExtKeyManager**    | Used to manage keys.                                                                                                                                                                                                                                           |
| **ExtPINEntry**      | Used for user to input online PIN or offline PIN.                                                                                                                                                                                                              |
| **ExtDeviceManager** | Provides the ability to get device info or operate device, e.g., get device configuration, update FW/App, reboot.                                                                                                                                              |
| **ExtBeeper**        | Provides the ability to beep.                                                                                                                                                                                                                                  |
| **ExtLED**           | Provides the ability to control LED lights.                                                                                                                                                                                                                    |
| **ExtKeyBoard**      | Provides the ability to use the external device as a normal keyboard to input digits or characters.                                                                                                                                                            |
| **ExtDisplay**       | Provides the ability to display text or image on the external device screen.                                                                                                                                                                                   |
| **ExtECDHE**         | Provides the ability to process the ECDHE algorithm.                                                                                                                                                                                                           |
| **ExtESignature**    | Provides the ability to start electronic signature process.                                                                                                                                                                                                    |
| **ExtCardEmulator**  | Provides the ability to handle the card emulation process.                                                                                                                                                                                                     |