OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
619 stars 107 forks source link

Children cannot become valid again. #297

Open Takkaryx opened 4 months ago

Takkaryx commented 4 months ago

If the path_remove function of a proxy child is correctly called, the child is considered not valid no matter if there are any other paths still valid. or even if a path is added again after the fact.

This is particularly present relevant in the case of a DFU process occurring while there is a SimpleBLE process ongoing.

The device will (most likely) reboot, and all paths from the proxy will be removed. but then new ones will be added back.

Because of this bug, the Proxy is still considered invalid even though there are paths and communucations again. but it means that later the Adapter call std::vector<std::shared_ptr<Device>> Adapter::device_paired_get() will believe the Proxy is invalid even though it is technically valid now.

proposal:

────────────────────────────────────────────────────────────────────────────────────────┐
• 164: void Proxy::path_add(const std::string& path, SimpleDBus::Holder managed_interfa │
────────────────────────────────────────────────────────────────────────────────────────┘
            on_child_created(child_path);
        }
    }
    _valid = true;
}

bool Proxy::path_remove(const std::string& path, SimpleDBus::Holder options) {

proxy.patch

(I have a branch locally that does this, but I don't have permission to push to this repo)