Statistics.js 727 B

123456789101112131415161718192021222324252627282930
  1. var Sequence = require('./Sequence');
  2. var Util = require('util');
  3. var Packets = require('../packets');
  4. module.exports = Statistics;
  5. Util.inherits(Statistics, Sequence);
  6. function Statistics(options, callback) {
  7. if (!callback && typeof options === 'function') {
  8. callback = options;
  9. options = {};
  10. }
  11. Sequence.call(this, options, callback);
  12. }
  13. Statistics.prototype.start = function() {
  14. this.emit('packet', new Packets.ComStatisticsPacket());
  15. };
  16. Statistics.prototype['StatisticsPacket'] = function (packet) {
  17. this.end(null, packet);
  18. };
  19. Statistics.prototype.determinePacket = function determinePacket(firstByte) {
  20. if (firstByte === 0x55) {
  21. return Packets.StatisticsPacket;
  22. }
  23. return undefined;
  24. };