Winsoft ComPort for Android USB 3.5 for Delphi/C++ Builder XE6 - 10.4 Full Source
Winsoft ComPort for Android USB 3.5 for Delphi/C++ Builder XE6 - 10.4 Full Source
Delphi and C++ Builder serial communication library for USB connected devices for Android.
Features
Uses usb-serial-for-android library
Supports FTDI FT232, FT2232, ...; Prolific PL2303; Silabs CP2102, CP2105, ...; Qinheng CH340; CDC/ACM (Arduino Uno) chips
No special root access privileges needed
Available for Delphi/C++ Builder XE6 - 10.4
Source code included in registered version
Royalty free distribution in applications
What's new
Version 3.5
added Delphi/C++ Builder 10.4 files
bug fixes
Version 3.5
added Delphi/C++ Builder 10.4 files
bug fixes
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;
Tonerror = procedure(Exception: JException) of object;
TOnPermission = procedure(Device: JUsbDevice; Granted: Boolean) of object;
TOnReceivedData = procedure(dаta: TArray) 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; Timeout: Integer = 0): Integer;
function Read(Buffer: TArray; Timeout: Integer = 0): Integer;
function Read(var dаta: Byte; Timeout: Integer = 0): Integer;
function Write(Buffer: TJavaArray; Timeout: Integer = 0): Integer;
function Write(Buffer: TArray; Timeout: Integer = 0): Integer;
function Write(dаta: Byte; Timeout: Integer = 0): Integer;
procedure WriteAsync(Buffer: TJavaArray);
procedure WriteAsync(Buffer: TArray);
procedure WriteAsync(dаta: Byte);
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 read;
property UsbSerialPorts[const Driver: JUsbSerialDriver]: TArray read;
property UsbSerialPort: JUsbSerialPort read;
property UsbManager: JUsbManager read;
property OnDeviceAttached: TOnDeviceAttached read write;
property OnDeviceDetached: TOnDeviceDetached read write;
property onerror: Tonerror read write;
property OnPermission: TOnPermission read write;
property OnReceiveddаta: TOnReceivedData read write;
end;
function ToByteArray(JavaArray: TJavaArray): TArray;
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;
Tonerror = procedure(Exception: JException) of object;
TOnPermission = procedure(Device: JUsbDevice; Granted: Boolean) of object;
TOnReceivedData = procedure(dаta: TArray) 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; Timeout: Integer = 0): Integer;
function Read(Buffer: TArray; Timeout: Integer = 0): Integer;
function Read(var dаta: Byte; Timeout: Integer = 0): Integer;
function Write(Buffer: TJavaArray; Timeout: Integer = 0): Integer;
function Write(Buffer: TArray; Timeout: Integer = 0): Integer;
function Write(dаta: Byte; Timeout: Integer = 0): Integer;
procedure WriteAsync(Buffer: TJavaArray);
procedure WriteAsync(Buffer: TArray);
procedure WriteAsync(dаta: Byte);
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 read;
property UsbSerialPorts[const Driver: JUsbSerialDriver]: TArray read;
property UsbSerialPort: JUsbSerialPort read;
property UsbManager: JUsbManager read;
property OnDeviceAttached: TOnDeviceAttached read write;
property OnDeviceDetached: TOnDeviceDetached read write;
property onerror: Tonerror read write;
property OnPermission: TOnPermission read write;
property OnReceiveddаta: TOnReceivedData read write;
end;
function ToByteArray(JavaArray: TJavaArray): TArray;
Only for V.I.P
Warning! You are not allowed to view this text.