Sense constructor

Sense(
  1. String address, {
  2. ApiMode api = ApiMode.SCIENTISST,
})

ScientISST Device class

Parameters

address : String The device Bluetooth MAC address ("xx:xx:xx:xx:xx:xx")

Exceptions

INVALID_ADDRESS : if the address is not valid

Implementation

Sense(this.address, {ApiMode api = ApiMode.SCIENTISST}) {
  // verify given address
  final re = RegExp(
      r'^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}|(?:[0-9a-fA-F]{2}-){5}[0-9a-fA-F]{2}|(?:[0-9a-fA-F]{2}){5}[0-9a-fA-F]{2}$');
  if (!re.hasMatch(address))
    throw SenseException(SenseErrorType.INVALID_ADDRESS);

  if (api != ApiMode.SCIENTISST &&
      api != ApiMode.JSON &&
      api != ApiMode.BITALINO)
    throw SenseException(SenseErrorType.INVALID_PARAMETER);

  this._apiMode = api;
}