openScale method
Open scale connection. Parameters depend on type:
- serial:
path(e.g. "/dev/ttyUSB0") - usb:
indexin device list - ble:
addressfrom device list Returns 0 on success, -4 if USB permission needed, or throws on failure.
Implementation
@override
Future<int> openScale({String? path, int? index, String? address}) async {
final args = <String, Object?>{};
if (path != null) args['path'] = path;
if (index != null) args['index'] = index;
if (address != null) args['address'] = address;
args['connectionType'] = null; // platform uses init type
final result = await methodChannel.invokeMethod<int>('openScale', args);
return result ?? -1;
}