Muse File read/write questions (iOS)


#1
  1. In the objective-c sample code, file messages are read via the loop

while ([_fileReader gotoNextMessage]) {

However, in the API the call is listed as

  • (nonnull IXNResult *)gotoNextMessage;

since the return value is listed as nonnull, it seems like the sample code will result in an infinite loop. Swift detect this problem and gives the error “Comparing non-optional value of type IXNResult to nil always returns true”. What is the correct way to do this loop in Swift?

  1. I’m confused about the packet types that the the Muse file API supports. IXNMuseFileWriter lets you call addDataPacket(), which can be any of the types listed in IXNMuseDataPacketType. However, in IXNMuseFileReader it says it only supports EEG, Accelerometer, Battery and Quantization packets. Would I be able to save other types in a Muse file, such as EEG derived values (.betaAbsolute,.gammaRelative, etc) ?