blueetothNameAnoymizer function

Datum blueetothNameAnoymizer(
  1. Datum datum
)

A BluetoothDatum anonymizer function. Anonymizes the name and discovery name of each discovered bluetooth device. Bluetooth devices' names may contain participants' real name because people use their names to name their computers and phones.

Implementation

Datum blueetothNameAnoymizer(Datum datum) {
  assert(datum is BluetoothDatum);
  BluetoothDatum bt = datum as BluetoothDatum;
  for (var result in bt.scanResult) {
    result.bluetoothDeviceName =
        sha1.convert(utf8.encode(result.bluetoothDeviceName)).toString();
    result.advertisementName =
        sha1.convert(utf8.encode(result.advertisementName)).toString();
  }
  return bt;
}