<commit_before>var assert           = require('assert');
var dgram            = require('dgram');

var debug            = require('simple-debug')('udpcontrol');

var AtCommandCreator = require('./AtCommandCreator');
var meta             = require('../misc/meta');
var constants        = require('../constants');


var DEFAULT_TIMEOUT = 100;  // ms
var DEFAULT_NUM_RETRIES = 3;

var states = {
  NOT_BLOCKED: 'NOT_BLOCKED',
  WAITING_FOR_ACK: 'WAITING_FOR_ACK',
  WAITING_FOR_ACK_RESET: 'WAITING_FOR_ACK_RESET'
};



module.exports = UdpControl;
function UdpControl(options) {
  options = options || {};

  this._sequenceNumber = 0;
  this._socket     = options.socket || dgram.createSocket('udp4');
  this._port       = options.port || constants.ports.AT;
  this._ip         = options.ip ||  constants.DEFAULT_DRONE_IP;
  this.defaultTimeout = options.defaultTimeout || DEFAULT_TIMEOUT;
  this.defaultRetries = options.defaultRetries || DEFAULT_NUM_RETRIES;
  this._cmdCreator = new AtCommandCreator();
  this._cmds       = [];
  this._blockingCmds = [];
  this._blocked = {
    state: states.NOT_BLOCKED,
    cmd: null,
    ackTimer: null
  };
}

meta.methods(AtCommandCreator).forEach(function(methodName) {
  UdpControl.prototype[methodName] = function() {
    var cmd = this._cmdCreator[methodName].apply(this._cmdCreator, arguments);
    if (cmd.blocks) {
      this._blockingCmds.push(cmd);
    } else {
      this._cmds.push(cmd);<commit_msg>Increased default timeout to 500 ms.<commit_after>var assert           = require('assert');
var dgram            = require('dgram');

var debug            = require('simple-debug')('udpcontrol');

var AtCommandCreator = require('./AtCommandCreator');
var meta             = require('../misc/meta');
var constants        = require('../constants');


var DEFAULT_TIMEOUT = 500;  // ms

var states = {
  NOT_BLOCKED: 'NOT_BLOCKED',
  WAITING_FOR_ACK: 'WAITING_FOR_ACK',
  WAITING_FOR_ACK_RESET: 'WAITING_FOR_ACK_RESET'
};



module.exports = UdpControl;
function UdpControl(options) {
  options = options || {};

  this._sequenceNumber = 0;
  this._socket     = options.socket || dgram.createSocket('udp4');
  this._port       = options.port || constants.ports.AT;
  this._ip         = options.ip ||  constants.DEFAULT_DRONE_IP;
  this.defaultTimeout = options.defaultTimeout || DEFAULT_TIMEOUT;
  this._cmdCreator = new AtCommandCreator();
  this._cmds       = [];
  this._blockingCmds = [];
  this._blocked = {
    state: states.NOT_BLOCKED,
    cmd: null,
    ackTimer: null
  };
}

meta.methods(AtCommandCreator).forEach(function(methodName) {
  UdpControl.prototype[methodName] = function() {
    var cmd = this._cmdCreator[methodName].apply(this._cmdCreator, arguments);
    if (cmd.blocks) {
      this._blockingCmds.push(cmd);
    } else {
      this._cmds.push(cmd);
{'fraction_non_alphanumeric': 0.1357674583481035, 'fraction_numerical': 0.004962779156327543, 'mean_word_length': 3.4231974921630095, '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': '890941', 'n_tokens_mistral': 924, 'n_tokens_neox': 902, 'n_words': 158}