docs: function xbeeCommand(frame) {
      // set frame id
      frame.id = xbeeAPI.nextFrameId();
  
      // We're going to return a promise
      var deferred = Q.defer();
  
      var callback = function(receivedFrame) {
          if (receivedFrame.id == frame.id) {
              // This is our frame's response. Resolve the promise.
              deferred.resolve(receivedFrame);
          }
      };
  
      // Clear up: remove listener after the timeout and a bit, it's no longer needed
      setTimeout(function() {
          xbeeAPI.removeListener("frame_object", callback);
      }, maxWait + 1000);
      
      // Attach callback so we're waiting for the response
      xbeeAPI.on("frame_object", callback);
  
      // Pass the bytes down the serial port
      serialport.write(xbeeAPI.buildFrame(frame));
  
      // Return our promise with a timeout
      return deferred.promise.timeout(maxWait);
  
  }