v1.0.14 Making non fatal if we cannot find cat-printers because

of dbus limitations
This commit is contained in:
Sergiotarxz 2024-11-14 13:25:34 +01:00
parent 67deb962bc
commit 6a1c772cf6
2 changed files with 18 additions and 4 deletions

View File

@ -28,7 +28,8 @@ has _window => ( is => 'rw' );
has _bluetooth_printers => ( is => 'rw', default => sub { [] } );
has _usb_printers => ( is => 'rw', default => sub { [] } );
has _cat_printers => ( is => 'rw', default => sub { [] } );
has _stop_timeout => ( is => 'rw' );
has _stop_timeout => ( is => 'rw' );
has _show_cat_printer_experimental_error => ( is => 'rw' );
sub _build__select($self) {
return IO::Select->new;
@ -143,8 +144,8 @@ sub _read_cat_printers($self) {
use Data::Dumper;
my $device_path = '/org/bluez/hci0';
$service->get_object( $device_path, 'org.bluez.Adapter1' )->StartDiscovery;
$service->get_object( $device_path, 'org.bluez.Adapter1' )->SetDiscoveryFilter(
{ Transport => Net::DBus::dbus_string('le') } );
$service->get_object( $device_path, 'org.bluez.Adapter1' )
->SetDiscoveryFilter( { Transport => Net::DBus::dbus_string('le') } );
my $items = $object->GetManagedObjects;
$object->get_service->get_bus->get_connection->disconnect;
@ -205,7 +206,14 @@ sub start($self) {
return 0 if $self->_stop_timeout;
eval {
$self->_read_usb_printers;
$self->_read_cat_printers;
eval { $self->_read_cat_printers; };
if ($@) {
if ( !$self->_show_cat_printer_experimental_error ) {
warn "Unable to read Cat-Printers"
. " (Maybe you need bluez experimental): $@";
}
$self->_show_cat_printer_experimental_error(1);
}
$self->_read_bluetooth_printers;
$self->_update_box;
};

View File

@ -30,6 +30,12 @@
<releases>
<release version="v1.0.14" date="2024-11-14">
<description>
<p>The required bluez API for Cat-Printers is not warranted to be there
because it is experimental in some versions, making non fatal the unability to find the API.</p>
</description>
</release>
<release version="v1.0.13" date="2024-11-12">
<description>
<p>Make discount to show the previous price</p>