<commit_before>var util = require('util');

var noble = require('noble');
var _ = require('lodash');

var BEAN_SERIAL_SERVICE_UUID = 'a495ff10c5b14b44b5121370f02d74de';
var BEAN_SERIAL_CHAR_UUID = 'a495ff11c5b14b44b5121370f02d74de';
var MY_BEAN_NAME = 'Lewey\'s Bean';

Buffer.prototype.toByteArray = function() { return Array.prototype.slice.call(this, 0); };

var connectedBean = null;

noble.on('stateChange', function(state) {
  if (state === 'poweredOn') {
    noble.startScanning();
    console.log('Scanning for BLE devices...');
  } else {
    noble.stopScanning();
    console.log('State changed to ' + '. Scanning stopped.');
  }
});

noble.on('discover', function(peripheral) {
  if (_.contains(peripheral.advertisement.serviceUuids, BEAN_SERIAL_SERVICE_UUID)) {
    var name = peripheral.advertisement.localName;
    var uuid = peripheral.uuid;
    console.log(util.format('Bean discovered (%s @ %s)', name, uuid));
    if (name === MY_BEAN_NAME) {
      noble.stopScanning();
      console.log('Connecting to ' + MY_BEAN_NAME + '...');
      peripheral.connect(function(err) {
        if (err) throw err;
        console.log('Connected!');
        connectedBean = peripheral;
        peripheral.discoverServices([BEAN_SERIAL_SERVICE_UUID], function(err, services) {
          if (err) throw err;
          services.forEach(function(service) {
            service.discoverCharacteristics([BEAN_SERIAL_CHAR_UUID], function(err, characteristics) {
            console.log('  ' + service.uuid);
              if (err) throw err;
              characteristics.forEach(function(characteristic) {<commit_msg>Use Bean UUID, not short name<commit_after>var util = require('util');

var noble = require('noble');
var _ = require('lodash');

var BEAN_SERIAL_SERVICE_UUID = 'a495ff10c5b14b44b5121370f02d74de';
var BEAN_SERIAL_CHAR_UUID = 'a495ff11c5b14b44b5121370f02d74de';
var MY_BEAN_UUID = '03953a79bcd444f1baedba9e201f42f4';

Buffer.prototype.toByteArray = function() { return Array.prototype.slice.call(this, 0); };

var connectedBean = null;

noble.on('stateChange', function(state) {
  if (state === 'poweredOn') {
    noble.startScanning();
    console.log('Scanning for BLE devices...');
  } else {
    noble.stopScanning();
    console.log('State changed to ' + '. Scanning stopped.');
  }
});

noble.on('discover', function(peripheral) {
  if (_.contains(peripheral.advertisement.serviceUuids, BEAN_SERIAL_SERVICE_UUID)) {
    var name = peripheral.advertisement.localName;
    var uuid = peripheral.uuid;
    console.log(util.format('Bean discovered (%s @ %s)', name, uuid));
    if (uuid === MY_BEAN_UUID) {
      noble.stopScanning();
      console.log('Connecting to ' + name + '...');
      peripheral.connect(function(err) {
        if (err) throw err;
        console.log('Connected!');
        connectedBean = peripheral;
        peripheral.discoverServices([BEAN_SERIAL_SERVICE_UUID], function(err, services) {
          if (err) throw err;
          services.forEach(function(service) {
            service.discoverCharacteristics([BEAN_SERIAL_CHAR_UUID], function(err, characteristics) {
            console.log('  ' + service.uuid);
              if (err) throw err;
              characteristics.forEach(function(characteristic) {
{'fraction_non_alphanumeric': 0.13732718894009216, 'fraction_numerical': 0.03195084485407066, 'mean_word_length': 3.774193548387097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1926499', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1066, 'n_words': 190}