## Muse Developer Resources | Search this site

### MuseIO Receiver
IMPORTANT NOTE: MuseIOReceiver is deprecated and no longer supported. It was designed as a temporary mobile development aid before LibMuse's release. To develop Muse applications for Android and iOS, please download and work with LibMuse. ## Using MuseIO Receiver Both MuseIOReceiverIOS and MuseIOReceiverDroid use a similar architecture to receive Muse OSC data from another device (namely, a computer) connected to Muse over Bluetooth. See the figure below for an explanation. ## Mobile Code You can download the OSC code for a mobile device here: https://sites.google.com/a/interaxon.ca/muse-developer-site/download/ios-and-android That code contains an OSC receiver which accepts Muse OSC paths and outputs the data to listener functions. It also contains an example receiver which displays the delta, theta, alpha, beta and gamma scores from Muse-IO. The OSC module can be modified to accept different OSC paths and types and the creation of additional receivers and listeners. The code is meant to be taken as an example rather than a stand alone project. ## iOS Example
Within the iOS example you can modify the acceptable paths in the RouterOSCMuseHeadband class: `controlInputNames``[``oscMuseType_eegData``] =` `@"/muse/eeg"``;` This will listen for /muse/eeg paths. Broadcast of eeg occurs as follows: `if (i == oscMuseType_eegData)` `{` `MuseEEGData *eegEntry = [[MuseEEGData alloc] init];` `float eegVal[4];` `args >> eegVal[0] >> eegVal[1] >> eegVal[2] >> eegVal[3] >> osc::EndMessage;` `for(int i = 0; i<4; i++)` `{` `eegEntry->eeg[i] = eegVal[i];` `}` `[self broadcastOSCPacket:eegEntry];` `}` Sending to all receivers here: `if ([packet isMemberOfClass: [MuseEEGData class]])` `{` `if ([listener respondsToSelector:@selector(receivedEEG:)])` `{` `MuseEEGData *eegData = (MuseEEGData *) packet;` `[listener receivedEEG:eegData];` `}` `}` Add receivers with the addOSCPacketListener: `-(void) addOSCPacketListener: (id<OSCListener>) listener` `{` `//Adding new listener to receiver data broadcasts` `[listeners addObject:listener];` `}` Make sure your listener is defined to be a OSCListener as in this example: `@interface MuseIOReceiverViewController : UIViewController <OSCListener>` Within the Router files you will find definitions for all the data types, you can modify and add to these types as you wish.ie: `@interface MuseEEGData : NSObject <NSCopying>` `{` `@public` `float eeg[4];` `double timeStamp;` `}` `@end` Finally you can implement your receivers outlined in OSCListener.h `-(void) receivedEEG: (MuseEEGData *) eegData;` Our example is in MuseIORecieverViewController.mm: `-(void) receivedEEG:(MuseEEGData *)eegData` `{` `//Logging data to verify it's received` `NSLog(@"%@", [NSString stringWithFormat:@"EEG Data: %f : %f : %f : %f", eegData->eeg[0],eegData->eeg[1],eegData->eeg[2],eegData->eeg[3]]);` `}`
Comments