<commit_before>/**
 * a class that is used to store each test device so we can send data back to them
 */

'use strict';

function TestDevice(deviceSocket,name,platform,testType,bluetoothAddress) {
    this.socket = deviceSocket;
    this.deviceName = name;
    this.os = platform;
    this.type = testType;
    this.btAddress = bluetoothAddress;
}

TestDevice.prototype.getBluetoothAddress= function(){
    return this.btAddress;
};

TestDevice.prototype.getTestType = function(){
    return this.type;
};

TestDevice.prototype.getName = function(){
    return this.deviceName;
};

TestDevice.prototype.compareSocket = function (socket) {
    return (socket.id === this.socket.id);
};

TestDevice.prototype.getPlatform = function(){
    return this.os;
};

TestDevice.prototype.start_tests = function(data){
    this.socket.emit('start_tests', JSON.stringify({data:data}));
};

TestDevice.prototype.SendCommand = function(command,test,data,dev,btAddresList){
    var self = this;
    var filteredList = [];

    if(btAddresList && this.btAddress){
        btAddresList.forEach(function(item) {
             if(item.address != self.btAddress){
                filteredList.push(item);
            }
        });
    }

    this.socket.emit('command', JSON.stringify({command: command, testName: test, testData:data,devices:dev,addressList:filteredList}));
};

TestDevice.prototype.SendEndUnitTest = function(data){
    this.socket.emit('end_unit_test', JSON.stringify({data:data}));
};

TestDevice.prototype.SendStartUnitTest = function(data){
    this.socket.emit('start_unit_test', JSON.stringify({data:data}));
};

module.exports = TestDevice;<commit_msg>Move most of device handling to the frameworks<commit_after>/**
 * a class that is used to store each test device so we can send data back to them
 */

'use strict';

function TestDevice(deviceSocket, name, platform, testType, tests, bluetoothAddress) {
    this.socket = deviceSocket;
    this.deviceName = name;
    this.platform = platform;
    this.type = testType;
    this.btAddress = bluetoothAddress;
    this.tests = tests;
}

TestDevice.prototype.SendCommand = function(command,test,data,dev,btAddresList){
  var self = this;
  var filteredList = [];

  if(btAddresList && this.btAddress) {
    btAddresList.forEach(function(item) {
    if(item.address != self.btAddress) {
      filteredList.push(item);
    }});
  }

  this.socket.emit('command', JSON.stringify({command: command, testName: test, testData:data,devices:dev,addressList:filteredList}));
};

module.exports = TestDevice;
{'fraction_non_alphanumeric': 0.1320015667841755, 'fraction_numerical': 0.0, 'mean_word_length': 4.2122448979591836, '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': '6789580', 'n_tokens_mistral': 773, 'n_tokens_neox': 763, 'n_words': 155}