mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
OSTC over BLE: take care of credits
Handle credits. Do not just ask for maximum credits all the time as this will stop the download. Also do not let the credits go back to 0 (while this might work, this is not tested). Getting back the 0 credits stops the download, and even when it can be restarted, it is less efficient (and not needed). Notice also that it takes some time before a grant request is honoured. During testing I saw reception of up to 25 packets between request and grant. So a lower bound for the request of 32 packets seems resonable. One aspect the Telit/Stollmann TIO puzzeled me. Sections 4.1 and 4.2 both talk about credits, but my hyphothesis is that there are two credits counters in play. One for traffic either way. This commit only deals with credits granted by Subsurface to the OSTC to send data. Credits granted by the OSTC to allow Subsurface to send new commands is NOT part of this commit, and is seemingly not needed in our scenario. As we only send new commands to the OSTC when a previous one is finished (per HW's interface spec), the OSTC does not run out of credits to receive commands. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
d233725519
commit
b7057c414f
2 changed files with 43 additions and 25 deletions
|
|
@ -32,6 +32,7 @@ public slots:
|
|||
void characteristicWritten(const QLowEnergyCharacteristic &c, const QByteArray &value);
|
||||
void writeCompleted(const QLowEnergyDescriptor &d, const QByteArray &value);
|
||||
dc_status_t setupHwTerminalIo(QList<QLowEnergyCharacteristic>);
|
||||
dc_status_t setHwCredit(unsigned int c);
|
||||
private:
|
||||
QVector<QLowEnergyService *> services;
|
||||
|
||||
|
|
@ -39,6 +40,7 @@ private:
|
|||
QList<QByteArray> receivedPackets;
|
||||
bool isCharacteristicWritten;
|
||||
dc_user_device_t *device;
|
||||
unsigned int hw_credit = 0;
|
||||
|
||||
QList<QUuid> hwAllCharacteristics = {
|
||||
"{00000001-0000-1000-8000-008025000000}", // HW_OSTC_BLE_DATA_RX
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue