LibMuse 6.0.3
com.choosemuse.libmuse.MuseFileReader Class Referenceabstract

Public Member Functions

abstract boolean open ()
 
abstract boolean close ()
 
abstract Result gotoNextMessage ()
 
abstract MessageType getMessageType ()
 
abstract int getMessageId ()
 
abstract long getMessageTimestamp ()
 
abstract AnnotationData getAnnotation ()
 
abstract MuseConfiguration getConfiguration ()
 
abstract MuseVersion getVersion ()
 
abstract ComputingDeviceConfiguration getComputingDeviceConfiguration ()
 
abstract DspData getDsp ()
 
abstract MuseDataPacket getDataPacket ()
 
abstract MuseArtifactPacket getArtifactPacket ()
 

Static Public Member Functions

static native MuseFileReader getFileReader (MuseFile file)
 

Detailed Description

Reads a .muse file formatted according to the Muse protobuf schema. For information about the .muse file format see: http://developer.choosemuse.com/file-formats/muse

MuseFileReader is very similar to ReaderMuse as both classes allow you to parse a file and generate data packets from it. In most instances, ReaderMuse is the better choice at it abstracts the details of the parsing of the file and allows you to handle the data the same way that you would if you were connected to an actual Muse . Use MuseFileReader if you want finer control of the parsing of the file.

When the file reader is created it always starts reading from the beginning of the file to the end.

Threading: It is NOT thread safe, you have to provide your own synchronization mechanism if you plan to calls methods of this class from different threads.

Member Function Documentation

§ close()

abstract boolean com.choosemuse.libmuse.MuseFileReader.close ( )
abstract

Closes the file. Calls MuseFile.close() . You don't have to call close explicitly unless you want to close file immediately. close is called automatically, when the file reader object is destroyed.

§ getAnnotation()

abstract AnnotationData com.choosemuse.libmuse.MuseFileReader.getAnnotation ( )
abstract

Returns annotation data at the current position in the file.

Returns
The annotation data at the current position in the file.
Exceptions
IncorrectMessageTypeIf current message type is not MessageType.ANNOTATION

§ getArtifactPacket()

abstract MuseArtifactPacket com.choosemuse.libmuse.MuseFileReader.getArtifactPacket ( )
abstract

Returns the muse artifact packet data at the current position in the file.

Returns
The muse artifact packet at the current position in the file.
Exceptions
IncorrectMessageTypeIf current message type is not MessageType.ARTIFACT ,

§ getComputingDeviceConfiguration()

abstract ComputingDeviceConfiguration com.choosemuse.libmuse.MuseFileReader.getComputingDeviceConfiguration ( )
abstract

Returns computing device configuration data at the current position in the file.

Returns
The device configuration data at the current position in the file.
Exceptions
IncorrectMessageTypeIf current message type is not MessageType.COMPUTING_DEVICE

§ getConfiguration()

abstract MuseConfiguration com.choosemuse.libmuse.MuseFileReader.getConfiguration ( )
abstract

Returns muse configuration data at the current position in the file.

Returns
The configuration data at the current position in the file.
Exceptions
IncorrectMessageTypeIf current message type is not MessageType.CONFIGURATION

§ getDataPacket()

abstract MuseDataPacket com.choosemuse.libmuse.MuseFileReader.getDataPacket ( )
abstract

Returns the muse data packet data at the current position in the file. Use this method to get EEG, Accelerometer, Battery and Quantization packets.

Returns
The muse data packet data at the current position in the file.
Exceptions
IncorrectMessageTypeIf current message type is not one of:
MessageType.ACCELEROMETER ,
MessageType.ACC_DROPPED ,
MessageType.BATTERY ,
MessageType.EEG ,
MessageType.EEG_DROPPED ,
MessageType.GYRO ,
MessageType.MUSE_ELEMENTS or
MessageType.QUANTIZATION

§ getDsp()

abstract DspData com.choosemuse.libmuse.MuseFileReader.getDsp ( )
abstract

Returns the dsp data at the current position in the file.

Returns
The dsp data at the current position in the file.
Exceptions
IncorrectMessageTypeIf current message type is not MessageType.DSP

§ getFileReader()

static native MuseFileReader com.choosemuse.libmuse.MuseFileReader.getFileReader ( MuseFile  file)
static

Returns an instance of file reader. Automatically opens a file.

Returns
a MuseFileReader instance.

§ getMessageId()

abstract int com.choosemuse.libmuse.MuseFileReader.getMessageId ( )
abstract

Returns the id of the message at the current position in the file or -1 if the id isn't found in the protobuf specification.

Returns
The id of the message at the current position in the file or -1 if the id isn't found in the protobuf specification.

§ getMessageTimestamp()

abstract long com.choosemuse.libmuse.MuseFileReader.getMessageTimestamp ( )
abstract

Returns the timestamp of the message at the current position in the file.

Returns
The timestamp of the message.

§ getMessageType()

abstract MessageType com.choosemuse.libmuse.MuseFileReader.getMessageType ( )
abstract

Returns the type of message at the current position in the file.

Returns
The type of message at the current position in the file.

§ getVersion()

abstract MuseVersion com.choosemuse.libmuse.MuseFileReader.getVersion ( )
abstract

Returns muse version data at the current position in the file.

Returns
The version data at the current position in the file.
Exceptions
IncorrectMessageTypeIf current message type is not MessageType.VERSION

§ gotoNextMessage()

abstract Result com.choosemuse.libmuse.MuseFileReader.gotoNextMessage ( )
abstract

Reads the next message in the protobuf stream.

Returns
The Result object with the status of the read operation.

§ open()

abstract boolean com.choosemuse.libmuse.MuseFileReader.open ( )
abstract

Opens an existing file Use this method if you explicitly closed file and want to open it again. Calls MuseFile.open() .


The documentation for this class was generated from the following file: