<commit_before>var noble = require('noble'),
    winston = require('winston'),
    _ = require('underscore'),
    app = require('./app');



function maybeSendScan(macAddress, app) {
    app.service('users').find(
        {
            query: {
                macAddress: macAddress
            }
        }).then(function(users) {
            console.log('Users walked by:', users);
    });
}


function startScanning(app) {
    noble.state = "poweredOn";
    noble.startScanning();
    winston.log("info", 'scanning!');

    noble.on("discover", function(peripheral) { 
        var macAddress = peripheral.uuid;
        var rss = peripheral.rssi;
        var localName = peripheral.advertisement.localName; 
        console.log('found device: ', macAddress, ' ', localName, ' ', rss);
        maybeSendScan(macAddress, app);
    });
}

module.exports = {
    startScanning: startScanning  
};
<commit_msg>scanner updated to stop & start on time intervals<commit_after>var noble = require('noble'),
    winston = require('winston'),
    _ = require('underscore'),
    app = require('./app');



function maybeSendScan(macAddress, app) {
    app.service('users').find(
        {
            query: {
                macAddress: macAddress
            }
        }).then(function(users) {
            console.log('Users walked by:', users);
    });
}


function startScanning(app) {
    noble.state = "poweredOn";

    noble.startScanning();
    setInterval(function() {
        winston.log("info", "scanning...");
        // no idea why this doesnt work
        setTimeout(function() {
            noble.stopScanning();
        }, 15000);
        noble.startScanning();
    }, 20000);
    
    winston.log("info", 'scanning!');

    noble.on("discover", function(peripheral) { 
        var macAddress = peripheral.uuid;
        var rss = peripheral.rssi;
        var localName = peripheral.advertisement.localName; 
        console.log('found device: ', macAddress, ' ', localName, ' ', rss);
        maybeSendScan(macAddress, app);
    });
}

module.exports = {
    startScanning: startScanning  
};

{'fraction_non_alphanumeric': 0.1461904761904762, 'fraction_numerical': 0.004761904761904762, 'mean_word_length': 2.433006535947712, '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': '1407040', 'n_tokens_mistral': 644, 'n_tokens_neox': 612, 'n_words': 117}