isBITalino2 method

Future<bool> isBITalino2()

Returns true if the connected device is BITalino2, false otherwise.

Throws BITalinoException(BITalinoErrorType.NOT_IMPLEMENTED_IOS) if this method is called on IOS devices. Throws BITalinoException(BITalinoErrorType.TIMEOUT) if the timeout limit is reached. Throws BITalinoException(BITalinoErrorType.BT_DEVICE_NOT_CONNECTED) if a device is not connected. Throws BITalinoException(BITalinoErrorType.BT_DEVICE_CANNOT_BE_RECORDING) if the device is recording. Throws BITalinoException(BITalinoErrorType.CUSTOM) if a native exception was raised.

Implementation

Future<bool> isBITalino2() async {
  if (Platform.isIOS)
    throw BITalinoException(BITalinoErrorType.NOT_IMPLEMENTED_IOS);
  if (!connected)
    throw BITalinoException(BITalinoErrorType.BT_DEVICE_NOT_CONNECTED);
  if (recording)
    throw BITalinoException(BITalinoErrorType.BT_DEVICE_CANNOT_BE_RECORDING);
  else if (Platform.isAndroid) return (await _getDescription()).isBitalino2;
  return false;
}