ailink

##中文

AiLink probe and probe box protocol data processing Flutter library.

Necessary condition

  1. Acquired AILink Bluetooth communication protocol
  2. Have smart devices that support AILink Bluetooth module
  3. Have knowledge of Flutter development and debugging

UUID Description

  1. FFE1: Write A7 data
  2. FFE2: Monitor A7 data changes
  3. FFE3: Write A6 data and monitor A6 data changes

Android

  1. Add maven { url 'https://jitpack.io' } in android/build.gradle file
    allprojects {
        repositories {
            google()
            mavenCentral()
            //add
            maven { url 'https://jitpack.io' }
        }
    }
  1. Modify minSdkVersion 21 in the android/app/build.gradle file
    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.elinkthings.ailink_food_probe_example"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.cn/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion 21 //flutter.minSdkVersion
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }
  1. To use the flutter_blue_plus library, you need to add the required permissions to android/app/src/main/AndroidManifest.xml
    <manifest xmlns:android="http://schemas.android.com/apk/res/android">
        <uses-permission android:name="android.permission.BLUETOOTH" />
        <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android">

iOS

  1. When using the flutter_blue_plus library, you need to add the required permissions to ios/Runner/Info.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>NSBluetoothAlwaysUsageDescription</key>
            <string>Need BLE permission</string>
            <key>NSBluetoothPeripheralUsageDescription</key>
            <string>Need BLE permission</string>
            <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
            <string>Need Location permission</string>
            <key>NSLocationAlwaysUsageDescription</key>
            <string>Need Location permission</string>
            <key>NSLocationWhenInUseUsageDescription</key>
            <string>Need Location permission</string>
        </dict>
    </plist>

Flutter

ElinkProbeCmdUtils

  1. Get version information:
    final cmd = getVersion();
  1. Sync time:
    syncTime({DateTime? dateTime})
  1. Get battery level:
  final cmd = getBattery();
  1. Switch unit:
    final cmd = switchUnit(unit); //0: °C, 1: °F
  1. Set data:
  import 'package:ailink_food_probe/model/elink_probe_info.dart';

  ElinkProbeInfo probeInfo;
  final cmd = setProbeInfo(probeInfo);
  1. Get data:
    final cmd = getProbeInfo();
  1. Clear data:
    final cmd = clearProbeInfo();
  1. Switch unit:
    final cmd = switchUnitBox(unit); //0: °C, 1: °F
  1. Get probe data (based on the probe's MAC address):
    List<int> probeMac;
    final cmd = getBoxProbeInfo(probeMac);
  1. Set probe data (only the alarm temperature in the probe data is processed by the device, other data is not processed):
    import 'package:ailink_food_probe/model/elink_probe_info.dart';

    ElinkProbeInfo probeInfo;
    final cmd = setBoxProbeInfo(probeInfo);
  1. Clear probe data (based on the probe's MAC address):
    List<int> probeMac;
    final cmd = clearBoxProbeInfo(probeMac);

For specific usage, please see example