lib/ccznp.js
function CcZnp () {
    EventEmitter.call(this);

    var self = this;

    this.MT = MT;       // export constant

    this._init = false;
    this._resetting = false;
    this._sp = null;
    this._unpi = null;
    this._spinLock = false;
    this._txQueue = [];

    this.on('_ready', function () {
        self._init = true;
        self.emit('ready');
    });

    this._innerListeners = {
        spOpen: function () {
            debug('The serialport ' + self._sp.path + ' is opened.');
            self.emit('_ready');
        },
        spErr: function (err) {
            self._sp.close();
        },
        spClose: function () {
            debug('The serialport ' + self._sp.path + ' is closed.');
            self._txQueue = null;
            self._txQueue = [];
            self._sp = null;
            self._unpi = null;
            self._init = false;
            self.emit('close');
        },
        parseMtIncomingData: function (result) {
            self._parseMtIncomingData(result);
        }
    };
}
function CcZnp () {
    EventEmitter.call(this);

    var self = this;

    this.MT = MT;       // export constant

    this._init = false;
    this._resetting = false;
    this._sp = null;
    this._unpi = null;
    this._spinLock = false;
    this._txQueue = [];

    this.on('_ready', function () {
        self._init = true;
        self.emit('ready');
    });

    this._innerListeners = {
        spOpen: function () {
            debug('The serialport ' + self._sp.path + ' is opened.');
            self.emit('_ready');
        },
        spErr: function (err) {
            self._sp.close();
        },
        spClose: function () {
            debug('The serialport ' + self._sp.path + ' is closed.');
            self._txQueue = null;
            self._txQueue = [];
            self._sp = null;
            self._unpi = null;
            self._init = false;
            self.emit('close');
        },
        parseMtIncomingData: function (result) {
            self._parseMtIncomingData(result);
        }
    };
}
function CcZnp ( ) { EventEmitter . call ( this ) ; var self = this ; this . MT = MT ; // export constant this . _init = false ; this . _resetting = false ; this . _sp = null ; this . _unpi = null ; this . _spinLock = false ; this . _txQueue = [ ] ; this . on ( '_ready' , function ( ) { self . _init = true ; self . emit ( 'ready' ) ; } ) ; this . _innerListeners = { spOpen : function ( ) { debug ( 'The serialport ' + self . _sp . path + ' is opened.' ) ; self . emit ( '_ready' ) ; } , spErr : function ( err ) { self . _sp . close ( ) ; } , spClose : function ( ) { debug ( 'The serialport ' + self . _sp . path + ' is closed.' ) ; self . _txQueue = null ; self . _txQueue = [ ] ; self . _sp = null ; self . _unpi = null ; self . _init = false ; self . emit ( 'close' ) ; } , parseMtIncomingData : function ( result ) { self . _parseMtIncomingData ( result ) ; } } ; }
********************************************************************************************** * CcZnp Class                                                                               ** **********************************************************************************************
********************************************************************************************** * CcZnp Class ** **********************************************************************************************