<commit_before>var util = require('util')
var bleno = require('bleno')
var Descriptor = bleno.Descriptor
var Characteristic = bleno.Characteristic

var LocalCameraProxyCharacteristic = function (initialStatusObject, stateChangedEmitter) {
  LocalCameraProxyCharacteristic.super_.call(this, {
    uuid: '2A89',
    properties: ['read', 'write', 'writeWithoutResponse'],
    descriptors: [
      new Descriptor({
        uuid: '2901',
        value: 'Gets/sets boolean if local camera proxy is activated'
      })
    ]
  })
  this.status = initialStatusObject
  this._value = new Buffer(0)
  this._updateValueCallback = null
  stateChangedEmitter.on('statusChanged', (newStatus) => { this.status = newStatus })
}

util.inherits(LocalCameraProxyCharacteristic, Characteristic)

LocalCameraProxyCharacteristic.prototype.onReadRequest = function (offset, callback) {
  if (!offset) {
    const tmpValue = this.status && this.status.localCameraProxy ? this.status.localCameraProxy.toString() : 'false'
    this._value = new Buffer(tmpValue)
  }
  callback(this.RESULT_SUCCESS, this._value.slice(offset, this._value.length))
}

LocalCameraProxyCharacteristic.prototype.onWriteRequest = function (data, offset, withoutResponse, callback) {
  if (offset) {
    callback(this.RESULT_ATTR_NOT_LONG)
  } else if (data.length !== 1) {
    callback(this.RESULT_INVALID_ATTRIBUTE_LENGTH)
  } else {
    var shouldActivateString = data.toString('utf8')
    if (shouldActivateString === 'true' || shouldActivateString === 'false') {
      // set and propagate value
      this._value = Buffer.from(data)
      process.send({
        type: 'RequestDeviceStateChange',
        payload: {
          localCameraProxy: (shouldActivateString === 'true')
        }
      })

      callback(this.RESULT_SUCCESS)
    } else {
      callback(this.RESULT_UNLIKELY_ERROR)
    }
  }
}

module.exports = LocalCameraProxyCharacteristic
<commit_msg>Fix length typo<commit_after>var util = require('util')
var bleno = require('bleno')
var Descriptor = bleno.Descriptor
var Characteristic = bleno.Characteristic

var LocalCameraProxyCharacteristic = function (initialStatusObject, stateChangedEmitter) {
  LocalCameraProxyCharacteristic.super_.call(this, {
    uuid: '2A89',
    properties: ['read', 'write', 'writeWithoutResponse'],
    descriptors: [
      new Descriptor({
        uuid: '2901',
        value: 'Gets/sets boolean if local camera proxy is activated'
      })
    ]
  })
  this.status = initialStatusObject
  this._value = new Buffer(0)
  this._updateValueCallback = null
  stateChangedEmitter.on('statusChanged', (newStatus) => { this.status = newStatus })
}

util.inherits(LocalCameraProxyCharacteristic, Characteristic)

LocalCameraProxyCharacteristic.prototype.onReadRequest = function (offset, callback) {
  if (!offset) {
    const tmpValue = this.status && this.status.localCameraProxy ? this.status.localCameraProxy.toString() : 'false'
    this._value = new Buffer(tmpValue)
  }
  callback(this.RESULT_SUCCESS, this._value.slice(offset, this._value.length))
}

LocalCameraProxyCharacteristic.prototype.onWriteRequest = function (data, offset, withoutResponse, callback) {
  if (offset) {
    callback(this.RESULT_ATTR_NOT_LONG)
  } else {
    var shouldActivateString = data.toString('utf8')
    if (shouldActivateString === 'true' || shouldActivateString === 'false') {
      // set and propagate value
      this._value = Buffer.from(data)
      process.send({
        type: 'RequestDeviceStateChange',
        payload: {
          localCameraProxy: (shouldActivateString === 'true')
        }
      })

      callback(this.RESULT_SUCCESS)
    } else {
      callback(this.RESULT_UNLIKELY_ERROR)
    }
  }
}

module.exports = LocalCameraProxyCharacteristic

{'fraction_non_alphanumeric': 0.11383631031724874, 'fraction_numerical': 0.005065315915755798, 'mean_word_length': 4.009345794392523, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4147382', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1080, 'n_words': 217}