Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve bt_device object to include more details about the device #792

Closed
mdmohsin7 opened this issue Sep 8, 2024 · 4 comments
Closed
Assignees

Comments

@mdmohsin7
Copy link
Collaborator

Including bt_device object to have firmware version, and firmware details as part of the object, instead of separate preferences, ideally includes bootloader, fwver, etc.

Screenshot 2024-09-08 at 11 16 19 AM
@mdmohsin7
Copy link
Collaborator Author

Screenshot 2024-09-18 at 7 47 59 PM

Should we change the device type from friend to devKit1?

@mdmohsin7
Copy link
Collaborator Author

mdmohsin7 commented Sep 18, 2024

There are two different objects basically holding the same information to an extent. And both of them are dependent on each other (DeviceInfo and BTDeviceStruct)

class DeviceInfo {
  String modelNumber;
  String firmwareRevision;
  String hardwareRevision;
  String manufacturerName;
  DeviceType type;
  }
class BTDeviceStruct {
String name;
String id;
int? rssi;
List<int>? fwver;
DeviceType? type;
}

The DeviceInfo object has methods to read characteristics to get data like the firmware version, hardware name etc., But it depends on BtDeviceStruct to differentiate between device type using the type property. And in many places in the code, both of them are being used together.

Both of them can be combined together to have a unified object for device details.

 class BtDevice {
   String name;
   String id;
   int? rssi;
   DeviceType type;
   BtDeviceInfo? btDeviceInfo;
  }

class BtDeviceInfo {
 String modelNumber;
 String firmwareRevision;
 String hardwareRevision;
 String manufacturerName;
 }

The BtDevice will also includes methods to convert BluetoothDevice (from flutter_blue_plus) to BtDevice etc., apart from the already existing methods, getters and setters. The BtDeviceInfo is basically DeviceInfo but renamed to DeviceInfo

@josancamon19
Copy link
Contributor

That makes sense

@mdmohsin7
Copy link
Collaborator Author

Closing it as it has been clubbed with #828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants