Closed hrueger closed 6 months ago
One more thing I just noticed: the terminal does appear in the stripe dashboard. Therefore, the connection process must somehow work, the method just doesn't return...
Edit: It also works just fine with a WisePos E via Internet.
Edit2: I just managed to get a com.stripe.stripeterminal.external.models.TerminalException: Update failed due to low battery
. I'll charge it up and try again!
Never mind. Turns out: the automatic update after connecting can take very long (>20 minutes for me), I was just not patient enough. You only get an "Updating..." message on the screen after about 15 minutes. For anyone googling, I used the following code:
class MyPhysicalReaderDelegate extends PhysicalReaderDelegate {
@override
FutureOr<void> onStartInstallingUpdate(
ReaderSoftwareUpdate update, Cancellable cancelUpdate) {
print('Starting to install update ${update.version}...');
return super.onStartInstallingUpdate(update, cancelUpdate);
}
@override
FutureOr<void> onReportAvailableUpdate(ReaderSoftwareUpdate update) {
print('Update ${update.version} is available');
return super.onReportAvailableUpdate(update);
}
@override
FutureOr<void> onReportReaderEvent(ReaderEvent event) {
print('Received reader event: $event');
return super.onReportReaderEvent(event);
}
@override
FutureOr<void> onRequestReaderDisplayMessage(ReaderDisplayMessage message) {
print('Received reader display message: $message');
return super.onRequestReaderDisplayMessage(message);
}
@override
FutureOr<void> onRequestReaderInput(List<ReaderInputOption> options) {
print('Received reader input request: $options');
return super.onRequestReaderInput(options);
}
@override
FutureOr<void> onReportBatteryLevelUpdate(
double batteryLevel,
BatteryStatus? batteryStatus,
bool isCharging,
) {
print('Received battery level update: $batteryLevel');
return super
.onReportBatteryLevelUpdate(batteryLevel, batteryStatus, isCharging);
}
@override
FutureOr<void> onReportLowBatteryWarning() {
print('Received low battery warning');
return super.onReportLowBatteryWarning();
}
@override
FutureOr<void> onReportReaderSoftwareUpdateProgress(double progress) {
print('Received reader software update progress: $progress');
return super.onReportReaderSoftwareUpdateProgress(progress);
}
@override
FutureOr<void> onFinishInstallingUpdate(
ReaderSoftwareUpdate? update,
TerminalException? exception,
) {
if (exception != null) {
print('Failed to install update ${update?.version}: $exception');
} else {
print('Finished installing update ${update?.version}');
}
return super.onFinishInstallingUpdate(update, exception);
}
}
PhysicalReaderDelegate delegate = MyPhysicalReaderDelegate();
print('Connecting to reader ${reader.serialNumber}...');
await stripeTerminal?.connectBluetoothReader(reader,
delegate: delegate, locationId: "tml_FZ0cHwWA4UgWlC");
print('Connected to reader ${reader.serialNumber}');
Hi @BreX900, thanks for this library. It looks really cool! However, I'm not able to connect to my BBPOS WisePad 3. I'm using the very simple demo code from below. When using
isSimulated: true
, everything works as expected. However, whenisSimulated: false
, the following happens: the reader does appear in the list, when selecting it, I get the bluetooth popup and the reader now beeps and displays the bluetooth icon continuously. However,Connected to reader [...]
is never printed, theconnectBluetoothReader()
method does not seem to return.Do you have any idea what the problem could be? The properties of the reader say that there's no update available, though I don't know if this would even be set correctly before being fully connected.
Thanks in advance!
pubspec.yaml
main.dart