Winsoft ComPort for Android USB v3.3 for Delphi/C++ Builder XE6 - 10.3 Full Source

Winsoft ComPort for Android USB v3.3 for Delphi/C++ Builder XE6 - 10.3 Full Source

Winsoft ComPort for Android USB v3.3 for Delphi/C++ Builder XE6 - 10.3 Full Source
Winsoft ComPort for Android USB v3.3 for Delphi/C++ Builder XE6 - 10.3 Full Source


Delphi and C++ Builder serial communication library for USB connected devices for Android.

uses usb-serial-for-android library
supports FT232R, CDC/ACM (Arduino Uno), CP2102 and CH34x chips
no special root access privileges needed
available for Delphi/C++ Builder XE6 - 10.3
source code included in registered version
royalty free distribution in applications

API
type
  TDataBits = (db5, db6, db7, db8);
  TParity = (paNone, paOdd, paEven, paMark, paSpace);
  TStopBits = (sb1, sb15, sb2);

  TOnDeviceAttached = procedure(Device: JUsbDevice) of object;
  TOnDeviceDetached = procedure(Device: JUsbDevice) of object;

  EUsbSerialError = class(Exception);

  TUsbSerial = class
    constructor Create;

    function GetDevice(Driver: JUsbSerialDriver): JUsbDevice;
    function GetDevice(Port: JUsbSerialPort): JUsbDevice;

    function HasPermission(UsbDevice: JUsbDevice): Boolean;
    procedure RequestPermission(UsbDevice: JUsbDevice);

    procedure Connect(Port: JUsbSerialPort);
    procedure Disconnect;

    procedure Open;
    procedure Close;

    function Read(Buffer: TJavaArray<Byte>; Timeout: Integer = 0): Integer;
    function Read(Buffer: TArray<Byte>; Timeout: Integer = 0): Integer;
    function Read(var Data: Byte; Timeout: Integer = 0): Integer;

    function Write(Buffer: TJavaArray<Byte>; Timeout: Integer = 0): Integer;
    function Write(Buffer: TArray<Byte>; Timeout: Integer = 0): Integer;
    function Write(Data: Byte; Timeout: Integer = 0): Integer;

    function Purge: Boolean;
    function PurgeInput: Boolean;
    function PurgeOutput: Boolean;

    property BaudRate: Integer read write;
    property CD: Boolean read;
    property Connected: Boolean read;
    property CTS: Boolean read;
    property DataBits: TDataBits read write;
    property DSR: Boolean read;
    property DTR: Boolean read write;
    property Opened: Boolean read;
    property Parity: TParity read write;
    property RI: Boolean read;
    property RTS: Boolean read write;
    property StopBits: TStopBits read write;
    property UsbDevice: JUsbDevice read;
    property UsbDeviceConnection: JUsbDeviceConnection read;
    property UsbSerialDrivers: TArray<JUsbSerialDriver> read;
    property UsbSerialPorts[const Driver: JUsbSerialDriver]: TArray<JUsbSerialPort> read;
    property UsbSerialPort: JUsbSerialPort read;
    property UsbManager: JUsbManager read;

    property OnDeviceAttached: TOnDeviceAttached read write;
    property OnDeviceDetached: TOnDeviceDetached read write;
  end;

function ToByteArray(JavaArray: TJavaArray<Byte>): TArray<Byte>;


What's new

added TDataBits enumeration
added TParity enumeration
added TStopBits enumeration
added EUsbSerialError class
added TUsbSerial class
added USB broadcast listener
removed LoadUsbSerial procedure
removed GetUsbManager function
removed GetUsbDeviceConnection function
removed GetDrivers function
removed GetPorts function
updated Android declarations
added API.TXT file
improved demo examples


Only for V.I.P
Warning! You are not allowed to view this text.