gk_ble_device_flutter 1.0.0 copy "gk_ble_device_flutter: ^1.0.0" to clipboard
gk_ble_device_flutter: ^1.0.0 copied to clipboard

Bloc-based Flutter library to communicate with GK Concept devices via Bluetooth

Build Code format Linting

This library enables the user to connect to a GK Concept device via Bluetooth Low Energy (BLE), to discover devices in the proximity and to subscribe to the device's report stream, notifying the application of the device's activity.

Currently, this library only supports Dropper devices with firmware 0.8.0 and later.

The library uses the Bloc library to separate business logic from the user interface.

Getting started #

When using this library, please make sure to follow the FlutterBluePlus guide, in particular concerning the required permissions for your app.

Usage #

All the core functionality is implemented in BleDeviceCubit.

A complete example with user interface can be found here.

Demo #

This is what the example looks like on Android:

Dropper report message format #

The messages obtained from the report-stream subscription of a Dropper device have the following format:

{
  "#": 27,
  "date": "20-02-14",
  "time": "16:05:04",
  "timestamp": 1644854704,
  "report": true,
  "cycles": 2445,
  "doses": 35,
  "event": 2
}

With the following fields:

field type description
timestamp int UTC timestamp of the report (only relative if the system time was not set via WiFi)
event int event code:
0 (POWERON) machine startup complete
1 (DELIVERYREQ) request to distribute a dose
2 (DELIVERED) distribution successful
3 (PRIMEREQ) request to prime
4 (PRIMED) priming done
5 (UPDATEREQ) request to update firmware
6 (UPDATEOK) update successful
-6 (UPDATEFAIL) update failed
-10 (NOHOMESW) failure to read home switch
cycles int Total number of distributions.
doses int Total number of distributions since last zero.

Permissions for macOS #

For macOS, put the following in your Info.plist:

<key>NSBluetoothAlwaysUsageDescription</key>
<string>The app uses bluetooth to find, connect and transfer data between different devices</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>The app uses bluetooth to find, connect and transfer data between different devices</string>

Also, add this to DebugProfile.entitlements and Release.entitlements:

<key>com.apple.security.device.bluetooth</key>
<true/>
1
likes
110
pub points
0%
popularity

Publisher

verified publishergkconcept.co

Bloc-based Flutter library to communicate with GK Concept devices via Bluetooth

Repository

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, flutter_bloc, flutter_blue_plus, logging, permission_handler

More

Packages that depend on gk_ble_device_flutter