_send(buffer) {
    const sequenceNo = this._currentSequenceN;
    // Retry up to 5 times
    return pRetry(() => {
      return new Promise((resolve, reject) => {
        // Send data
        this.connect().then(() => {
          try {
            this.client.write(buffer);

            // Add resolver function
            this._resolvers[sequenceNo] = data => resolve(data);
          } catch (error) {
            reject(error);
          }
        })
          .catch(error => reject(error));
      });
    }, {
      onFailedAttempt: error => {
        debug(`Attempt ${error.attemptNumber} failed. There are ${error.retriesLeft} retries left.`);
      }, retries: 5});
  }
Sends a query to a device. Helper function
that connects to a device if necessary and
wraps the entire operation in a retry.
@private
@param {Buffer} buffer buffer of data
@returns {Promise<any>} returned data for request