flutter_reactive_ble icon indicating copy to clipboard operation
flutter_reactive_ble copied to clipboard

Add support for writing to descriptors

Open ened opened this issue 4 years ago • 9 comments

Extends the plugins to support writing to specific descriptors. I have copied the approach from QualifiedCharacteristic to become a QualifiedDescriptor.

There are quite a few generated files (tests, protobuf) which are a bit tedious to handle. Appreciate if someone could point me to a developer docs page.

iOS implementation is still TBD.

ened avatar Nov 17 '21 07:11 ened

thanks! so far it looks good

remonh87 avatar Nov 19 '21 18:11 remonh87

@werediver @remonh87 944e2a9cae75e937431dc843693033462694d53f is not strictly part of this MR, but was needed for compatibility when including this package on iOS. Should it be separate?

ened avatar Nov 23 '21 10:11 ened

Some comments regarding 944e2a9.

I suppose it's fine to include those changes in this pull request, but please go through all the comments already left by me.

Aside from those comments, the commit history of this pull request is dirty: contains merge commits (better rebase your feature branches), doesn't seem well structured and includes commit messages mentioning work-in-progress (WIP). If you are not going to clean the history up at some point (through interactive rebase), the pull request should be squashed before merging (can be done at the moment of merging through GitHub interface). It's okay, just don't be surprised.

werediver avatar Nov 23 '21 10:11 werediver

Some comments regarding 944e2a9.

I suppose it's fine to include those changes in this pull request, but please go through all the comments already left by me.

OK & yes will do.

Aside from those comments, the commit history of this pull request is dirty: contains merge commits (better rebase your feature branches), doesn't seem well structured and includes commit messages mentioning work-in-progress (WIP). If you are not going to clean the history up at some point (through interactive rebase), the pull request should be squashed before merging (can be done at the moment of merging through GitHub interface). It's okay, just don't be surprised.

Oh yes, I was fully expecting to squash all the commits before removing the Draft label.

Thank you for the reviews.

ened avatar Nov 23 '21 11:11 ened

I can test the project setup on the m1 machine (I have one) if needed.

remonh87 avatar Nov 23 '21 18:11 remonh87

Reminding of my earlier question:

@ened Do descriptors always have 16-bit IDs and cannot have longer or shorter IDs?

CBDescriptor.id has type CBUUID and that thing can contain IDs of different length, typically 128, 32, or 16 bits, while strictly 16 bits is reserved in Protobuf structure.

I'd suggest to find a suitable example in existing Protobuf structures and reuse it.

  • [x] Rework or clarify Protobuf descriptor ID format

werediver avatar Nov 29 '21 08:11 werediver

Reminding of my earlier question:

@ened Do descriptors always have 16-bit IDs and cannot have longer or shorter IDs?

CBDescriptor.id has type CBUUID and that thing can contain IDs of different length, typically 128, 32, or 16 bits, while strictly 16 bits is reserved in Protobuf structure.

I'd suggest to find a suitable example in existing Protobuf structures and reuse it.

  • [x] Rework or clarify Protobuf descriptor ID format

At the moment, the code defines DescriptorAddress like this:

message DescriptorAddress {
    string deviceId = 1;
    Uuid serviceUuid = 2;
    Uuid characteristicUuid = 3;
    Uuid descriptorUuid = 4;
}

and Uuid is defined as:

message Uuid {
    bytes data = 1;
}

So that looks good?

ened avatar Nov 29 '21 11:11 ened

At the moment, the code defines DescriptorAddress like this:

message DescriptorAddress {
    string deviceId = 1;
    Uuid serviceUuid = 2;
    Uuid characteristicUuid = 3;
    Uuid descriptorUuid = 4;
}

and Uuid is defined as:

message Uuid {
    bytes data = 1;
}

So that looks good?

Oh, sure, it looks good. I misread a piece of protobuf specification, sorry.

werediver avatar Nov 29 '21 13:11 werediver

I need to be able to read a characteristic's user descriptor... Does this PR just include writes?

albydarned avatar Apr 18 '22 22:04 albydarned