<commit_before>var myCharacteristic;

function state() {
  var bufferOut;
	var expected = "";
	var end;
	
	this.start = function(buffer, expectation) {
	  end = 0;
	  bufferOut = buffer;
	  expected = expectation;
	  sendNext(2); //Command has 2 chars
	};
	
	var sendNext = function(sz) {
    var buffer = new ArrayBuffer(sz);
    var view = new Uint8Array(buffer);
    for (var i = 0; i < sz; i++) {
      view[i] = bufferOut[end + i];
    }
    end += sz;
    console.log(view);
    myCharacteristic.writeValue(buffer)
    .catch(error => {
      console.log('Argh! ' + error);
    });
	};
	
	this.verify = function(received) {
	  if (received == expected) {
	    if (expected == "RD-OK") { 
	      expected = "k";
	      sendNext(2); //Sends size
	    }
	    else sendNext(1); //Keeps sending code
	    return true;
	  }
	  else return false;
	};
}

var TM = new state();<commit_msg>SendX and TM working<commit_after>var myCharacteristic;

function state() {
  var bufferOut;
	var expected = "";
	var end;
	
	this.start = function(buffer, expectation) {
	  end = 0;
	  bufferOut = buffer;
	  expected = expectation;
	  sendNext(2); //Command has 2 chars
	};
	
	var sendNext = function(sz) {
    var buffer = new ArrayBuffer(sz);
    var view = new Uint8Array(buffer);
    for (var i = 0; i < sz; i++) {
      view[i] = bufferOut[end + i];
    }
    end += sz;
    console.log(view);
    myCharacteristic.writeValue(buffer)
    .catch(error => {
      console.log('Argh! ' + error);
    });
	};
	
	this.verify = function(received) {
	  if (received == expected) {
	    if (expected == "RD-OK") { 
	      expected = "k";
	      sendNext(2); //Sends size
				return true;
	    }
			else if (expected == "k" & (end) == bufferOut.length) { //End of buffer
				expected = "";
				return true;
			}
	    else sendNext(1); //Keeps sending code
	    return true;
	  }
	  else {
			console.log("Error, did not meet expected response from COISA");
			return false;
		}
	};
}

var TM = new state();
{'fraction_non_alphanumeric': 0.14831573655103067, 'fraction_numerical': 0.007038712921065862, 'mean_word_length': 2.509700176366843, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3757754', 'n_tokens_mistral': 737, 'n_tokens_neox': 662, 'n_words': 182}