*New - .Net ECR SDK – Integration Library

Prerequisites

Install the required environment before using the SDK.

  • Windows 10 or later
  • .NET Framework or .NET Core runtime
  • JDK 1.8 if the controller layer is used
  • POS Controller service running for device discovery
  • Cashier setup required at first launch

For integration steps, refer to .Net ECR SDK Integration.

Library Import

Add the SDK assemblies to your project.

  • Reference ECR.dll for native functions (pack, parse).
  • Use using System.Runtime.InteropServices; for P/Invoke calls.
  • Copy ECR.dll into the output directory.

Core Components

Use the SDK models to represent devices and configuration data.

Device model

public class Device {
    private String deviceIp;
    private String devicePort;
    private String devId;
    private String slNo;
    private boolean isCom;
    private String comPortNumber;
}

ConfigData model

public class ConfigData {
    private String tcpIP;
    private String tcpPort;
    private String comPortNumber;
    private int retryCount;
    private int connectionTimeOut;
    private boolean isConnectivityFallBackAllowed;
    private int priority1;
    private int priority2;
    private String logPath;
    private boolean isLogsEnabled;
    private int logLevel;
    private int dayToRetainLogs;
    private String cashierId;
    private String cashierName;
}

Configuration Persistence

Store adapter settings in JSON format.

  • File name is defined in PosLibConstant.FILE_NAME.
  • setConfiguration() writes configuration to JSON.
  • getConfiguration() reads configuration from JSON.
  • Parameters include TCP/IP, COM port, retry count, timeout, priorities, and logging.

Runtime Behaviors

The SDK manages connectivity and session state automatically.

  • Auto‑reconnect if the terminal disconnects
  • Heartbeat monitoring to confirm availability
  • Failover from TCP/IP to COM if network fails
  • Configurable logging (path, level, retention days)
  • Session management across transactions

Transaction Flow

Initialize SDK → Scan Device → Configure POS → Connect Device → Pack Request → Execute Transaction → Receive Response → Parse Response