You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
5.6 KiB
217 lines
5.6 KiB
// ignore_for_file: always_specify_types
|
|
// ignore_for_file: camel_case_types
|
|
// ignore_for_file: non_constant_identifier_names
|
|
|
|
// AUTO GENERATED FILE, DO NOT EDIT.
|
|
//
|
|
// Generated by `package:ffigen`.
|
|
// ignore_for_file: type=lint
|
|
import 'dart:ffi' as ffi;
|
|
|
|
/// Bindings for `src/flserial.h`.
|
|
///
|
|
/// Regenerate bindings with `dart run ffigen --config ffigen.yaml`.
|
|
///
|
|
class FlserialBindings {
|
|
/// Holds the symbol lookup function.
|
|
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
|
_lookup;
|
|
|
|
/// The symbols are looked up in [dynamicLibrary].
|
|
FlserialBindings(ffi.DynamicLibrary dynamicLibrary)
|
|
: _lookup = dynamicLibrary.lookup;
|
|
|
|
/// The symbols are looked up with [lookup].
|
|
FlserialBindings.fromLookup(
|
|
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
|
lookup)
|
|
: _lookup = lookup;
|
|
|
|
int fl_init(
|
|
int portCount,
|
|
) {
|
|
return _fl_init(
|
|
portCount,
|
|
);
|
|
}
|
|
|
|
late final _fl_initPtr =
|
|
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Int)>>('fl_init');
|
|
late final _fl_init = _fl_initPtr.asFunction<int Function(int)>();
|
|
|
|
int fl_set_callback(
|
|
int flh,
|
|
flcallback cb,
|
|
) {
|
|
return _fl_set_callback(
|
|
flh,
|
|
cb,
|
|
);
|
|
}
|
|
|
|
late final _fl_set_callbackPtr =
|
|
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Int, flcallback)>>(
|
|
'fl_set_callback');
|
|
late final _fl_set_callback =
|
|
_fl_set_callbackPtr.asFunction<int Function(int, flcallback)>();
|
|
|
|
int fl_ports(
|
|
int index,
|
|
int buffsize,
|
|
ffi.Pointer<ffi.Char> buff,
|
|
) {
|
|
return _fl_ports(
|
|
index,
|
|
buffsize,
|
|
buff,
|
|
);
|
|
}
|
|
|
|
late final _fl_portsPtr = _lookup<
|
|
ffi.NativeFunction<
|
|
ffi.Int Function(
|
|
ffi.Int, ffi.Int, ffi.Pointer<ffi.Char>)>>('fl_ports');
|
|
late final _fl_ports =
|
|
_fl_portsPtr.asFunction<int Function(int, int, ffi.Pointer<ffi.Char>)>();
|
|
|
|
int fl_open(
|
|
int flh,
|
|
ffi.Pointer<ffi.Char> portname,
|
|
int baudrate,
|
|
) {
|
|
return _fl_open(
|
|
flh,
|
|
portname,
|
|
baudrate,
|
|
);
|
|
}
|
|
|
|
late final _fl_openPtr = _lookup<
|
|
ffi.NativeFunction<
|
|
ffi.Int Function(
|
|
ffi.Int, ffi.Pointer<ffi.Char>, ffi.Int)>>('fl_open');
|
|
late final _fl_open =
|
|
_fl_openPtr.asFunction<int Function(int, ffi.Pointer<ffi.Char>, int)>();
|
|
|
|
int fl_read(
|
|
int flh,
|
|
int len,
|
|
ffi.Pointer<ffi.Char> buff,
|
|
) {
|
|
return _fl_read(
|
|
flh,
|
|
len,
|
|
buff,
|
|
);
|
|
}
|
|
|
|
late final _fl_readPtr = _lookup<
|
|
ffi.NativeFunction<
|
|
ffi.Int Function(
|
|
ffi.Int, ffi.Int, ffi.Pointer<ffi.Char>)>>('fl_read');
|
|
late final _fl_read =
|
|
_fl_readPtr.asFunction<int Function(int, int, ffi.Pointer<ffi.Char>)>();
|
|
|
|
int fl_write(
|
|
int flh,
|
|
int len,
|
|
ffi.Pointer<ffi.Char> data,
|
|
) {
|
|
return _fl_write(
|
|
flh,
|
|
len,
|
|
data,
|
|
);
|
|
}
|
|
|
|
late final _fl_writePtr = _lookup<
|
|
ffi.NativeFunction<
|
|
ffi.Int Function(
|
|
ffi.Int, ffi.Int, ffi.Pointer<ffi.Char>)>>('fl_write');
|
|
late final _fl_write =
|
|
_fl_writePtr.asFunction<int Function(int, int, ffi.Pointer<ffi.Char>)>();
|
|
|
|
int fl_close(
|
|
int flh,
|
|
) {
|
|
return _fl_close(
|
|
flh,
|
|
);
|
|
}
|
|
|
|
late final _fl_closePtr =
|
|
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Int)>>('fl_close');
|
|
late final _fl_close = _fl_closePtr.asFunction<int Function(int)>();
|
|
|
|
int fl_ctrl(
|
|
int flh,
|
|
int param,
|
|
int value,
|
|
) {
|
|
return _fl_ctrl(
|
|
flh,
|
|
param,
|
|
value,
|
|
);
|
|
}
|
|
|
|
late final _fl_ctrlPtr = _lookup<
|
|
ffi.NativeFunction<ffi.Int Function(ffi.Int, ffi.Int32, ffi.Int)>>(
|
|
'fl_ctrl');
|
|
late final _fl_ctrl = _fl_ctrlPtr.asFunction<int Function(int, int, int)>();
|
|
|
|
int fl_free() {
|
|
return _fl_free();
|
|
}
|
|
|
|
late final _fl_freePtr =
|
|
_lookup<ffi.NativeFunction<ffi.Int Function()>>('fl_free');
|
|
late final _fl_free = _fl_freePtr.asFunction<int Function()>();
|
|
}
|
|
|
|
abstract class FlCtrl {
|
|
static const int FL_CTRL_LAST_ERROR = 0;
|
|
static const int FL_CTRL_IS_PORT_OPEN = 1;
|
|
static const int FL_CTRL_BREAK = 2;
|
|
static const int FL_CTRL_SET_RTS = 3;
|
|
static const int FL_CTRL_GET_CTS = 4;
|
|
static const int FL_CTRL_SET_DTR = 5;
|
|
static const int FL_CTRL_GET_DSR = 6;
|
|
static const int FL_CTRL_SET_BYTESIZE_5 = 7;
|
|
static const int FL_CTRL_SET_BYTESIZE_6 = 8;
|
|
static const int FL_CTRL_SET_BYTESIZE_7 = 9;
|
|
static const int FL_CTRL_SET_BYTESIZE_8 = 10;
|
|
static const int FL_CTRL_SET_PARITY_NONE = 11;
|
|
static const int FL_CTRL_SET_PARITY_ODD = 12;
|
|
static const int FL_CTRL_SET_PARITY_EVEN = 13;
|
|
static const int FL_CTRL_SET_PARITY_MARK = 14;
|
|
static const int FL_CTRL_SET_PARITY_SPACE = 15;
|
|
static const int FL_CTRL_SET_STOPBITS_ONE = 16;
|
|
static const int FL_CTRL_SET_STOPBITS_TWO = 17;
|
|
static const int FL_CTRL_SET_STOPBITS_ONE_POINT_FIVE = 18;
|
|
static const int FL_CTRL_SET_FLOWCONTROL_NONE = 19;
|
|
static const int FL_CTRL_SET_FLOWCONTROL_HARDWARE = 20;
|
|
static const int FL_CTRL_SET_FLOWCONTROL_SOFTWARE = 21;
|
|
static const int FL_CTRL_GET_STATUS_CHANGE = 22;
|
|
static const int FL_CTRL_LAST = 23;
|
|
}
|
|
|
|
abstract class FlError {
|
|
static const int FL_ERROR_OK = 0;
|
|
static const int FL_ERROR_UNKNOW = 1;
|
|
static const int FL_ERROR_PORT_ALLREADY_OPEN = 2;
|
|
static const int FL_ERROR_PORT_NOT_EXIST = 3;
|
|
static const int FL_ERROR_IO = 4;
|
|
static const int FL_ERROR_HANDLER = 5;
|
|
static const int FL_ERROR_LAST = 6;
|
|
}
|
|
|
|
typedef flcallback = ffi.Pointer<ffi.NativeFunction<flcallbackFunction>>;
|
|
typedef flcallbackFunction = ffi.Void Function(
|
|
ffi.UnsignedInt, ffi.UnsignedInt);
|
|
typedef DartflcallbackFunction = void Function(int, int);
|
|
|
|
const int MAX_PORT_NAME_LEN = 512;
|
|
|
|
const int MAX_PORT_COUNT = 128;
|