code: func (n *Driver) parsePacket(buf *bytes.Buffer) {
  	for buf.Len() > 0 {
  		b, _ := buf.ReadByte()
  		switch b {
  		case CodeEx:
  			n.Publish(n.Event("extended"), nil)
  		case CodeSignalQuality:
  			ret, _ := buf.ReadByte()
  			n.Publish(n.Event("signal"), ret)
  		case CodeAttention:
  			ret, _ := buf.ReadByte()
  			n.Publish(n.Event("attention"), ret)
  		case CodeMeditation:
  			ret, _ := buf.ReadByte()
  			n.Publish(n.Event("meditation"), ret)
  		case CodeBlink:
  			ret, _ := buf.ReadByte()
  			n.Publish(n.Event("blink"), ret)
  		case CodeWave:
  			buf.Next(1)
  			var ret = make([]byte, 2)
  			buf.Read(ret)
  			n.Publish(n.Event("wave"), int16(ret[0])<<8|int16(ret[1]))
  		case CodeAsicEEG:
  			ret := make([]byte, 25)
  			i, _ := buf.Read(ret)
  			if i == 25 {
  				n.Publish(n.Event("eeg"), n.parseEEG(ret))
  			}
  		}
  	}
  }
docs: // parsePacket publishes event according to data parsed