lib/events.js
function decode(events) {
  let indexList = [];
  let eventsByte = parseInt(events, 16);

  if(eventsByte & APPEARANCE_MASK) {
    indexList.push(APPEARANCE);
  }
  if(eventsByte & DISPLACEMENT_MASK) {
    indexList.push(DISPLACEMENT);
  }
  if(eventsByte & PACKETS_MASK) {
    indexList.push(PACKETS);
  }
  if(eventsByte & KEEPALIVE_MASK) {
    indexList.push(KEEPALIVE);
  }
  if(eventsByte & DISAPPEARANCE_MASK) {
    indexList.push(DISAPPEARANCE);
  }

  return indexList;
}
function decode(events) {
  let indexList = [];
  let eventsByte = parseInt(events, 16);

  if(eventsByte & APPEARANCE_MASK) {
    indexList.push(APPEARANCE);
  }
  if(eventsByte & DISPLACEMENT_MASK) {
    indexList.push(DISPLACEMENT);
  }
  if(eventsByte & PACKETS_MASK) {
    indexList.push(PACKETS);
  }
  if(eventsByte & KEEPALIVE_MASK) {
    indexList.push(KEEPALIVE);
  }
  if(eventsByte & DISAPPEARANCE_MASK) {
    indexList.push(DISAPPEARANCE);
  }

  return indexList;
}
function decode ( events ) { let indexList = [ ] ; let eventsByte = parseInt ( events , 16 ) ; if ( eventsByte & APPEARANCE_MASK ) { indexList . push ( APPEARANCE ) ; } if ( eventsByte & DISPLACEMENT_MASK ) { indexList . push ( DISPLACEMENT ) ; } if ( eventsByte & PACKETS_MASK ) { indexList . push ( PACKETS ) ; } if ( eventsByte & KEEPALIVE_MASK ) { indexList . push ( KEEPALIVE ) ; } if ( eventsByte & DISAPPEARANCE_MASK ) { indexList . push ( DISAPPEARANCE ) ; } return indexList ; }
Decode the given hexadecimal string byte as an index list of events.
@param {String} rssi The given events as a bitmask hexadecimal string.
@return {Array} The corresponding index list of events.
Decode the given hexadecimal string byte as an index list of events .