Permalink
Browse files

restructured the BARTPresentation Logfile

is now really comma separated for easier post-hoc analysis
each log same number of entries
no special characters anymore in Description
MediaObjects return an identifier for logging - easier way to describe them in log
  • Loading branch information...
1 parent 07bf6f4 commit 8e342b693939db2e87a21c9a40d2b86de4347164 lydiatgit committed Apr 18, 2012
View
@@ -28,6 +28,7 @@
NSString* endSetDelimiter;
NSString* triggerIdentifier;
+ NSString* buttonIdentifier;
NSString* eventIdentifier;
NSString* startEventIdentifier;
@@ -43,6 +44,7 @@
@property (readonly) NSString* endSetDelimiter;
@property (readonly) NSString* triggerIdentifier;
+@property (readonly) NSString* buttonIdentifier;
@property (readonly) NSString* eventIdentifier;
@property (readonly) NSString* startEventIdentifier;
@@ -65,6 +67,25 @@
-(NSString*)stringForTriggerNumber:(NSUInteger)triggerNr;
/**
+ * Generates a button press message with a given button.
+ *
+ * \param button The number of the button press that needs to
+ * appear in the message.
+ * \return A message predestinated for logging.
+ */
+-(NSString*)stringForButtonPress:(NSUInteger)button;
+
+/**
+ * Generates an onset time message with a given onset.
+ *
+ * \param t The onset that needs to
+ * appear in the message.
+ * \return A message predestinated for logging.
+ */
+
+-(NSString*)stringForOnsetTime:(NSUInteger)t;
+
+/**
* Converts a NEStimEvent into a log message.
*
* \param event The NEStimEvent to convert.
@@ -73,6 +94,46 @@
-(NSString*)stringForStimEvent:(NEStimEvent*)event;
/**
+ *
+ *
+ * \param event
+ * \return The string
+ */
+-(NSString*)stringForEventDescription:(NEStimEvent*)event;
+
+/**
+ *
+ *
+ * \param event
+ * \return The string
+ */
+-(NSString*)stringForEventDuration:(NEStimEvent*)event;
+
+/**
+ *
+ *
+ * \param event
+ * \return The string
+ */
+-(NSString*)stringForEndEventIdentifier:(NEStimEvent*)event;
+
+/**
+ *
+ *
+ * \param event
+ * \return The string
+ */
+-(NSString*)stringForStartEventIdentifier:(NEStimEvent*)event;
+
+/**
+ *
+ *
+ * \param event
+ * \return The string
+ */
+-(NSString*)stringForEventPos:(NEStimEvent*)event;
+
+/**
* Converts a then action from a constraint into a log message.
*
* \param action The Dictionary describing the action.
View
@@ -20,6 +20,7 @@ @implementation NELogFormatter
@synthesize endSetDelimiter;
@synthesize triggerIdentifier;
+@synthesize buttonIdentifier;
@synthesize eventIdentifier;
@synthesize startEventIdentifier;
@@ -28,14 +29,15 @@ @implementation NELogFormatter
-(id)init
{
if ((self = [super init])) {
- keyValuePairSeperator = @"\t";
- keyValueSeperator = @":";
+ keyValuePairSeperator = @",\t";
+ keyValueSeperator = @",\t";
- beginSetDelimiter = @"\t{";
- entrySeperator = @"\t";
- endSetDelimiter = @"}";
+ beginSetDelimiter = @"\t";
+ entrySeperator = @",\t\t\t";
+ endSetDelimiter = @",\t";
triggerIdentifier = @"Trigger";
+ buttonIdentifier = @"Keyboard";
eventIdentifier = @"Event";
startEventIdentifier = @"Start";
@@ -60,13 +62,24 @@ +(NELogFormatter*)defaultFormatter
-(NSString*)stringForTriggerNumber:(NSUInteger)triggerNr
{
// @"T:triggerNr"
- return [NSString stringWithFormat:@"%@%@%d", triggerIdentifier, keyValueSeperator, triggerNr];
+ //return [NSString stringWithFormat:@"%@%@%d", triggerIdentifier, keyValueSeperator, triggerNr];
+ return [NSString stringWithFormat:@"%lu", triggerNr];
+}
+
+-(NSString*)stringForButtonPress:(NSUInteger)button
+{
+ return [NSString stringWithFormat:@"%lu", button];
+}
+
+-(NSString*)stringForOnsetTime:(NSUInteger)t
+{
+ return [NSString stringWithFormat:@"%lu", t];
}
-(NSString*)stringForStimEvent:(NEStimEvent*)event
{
// @"E:{time,duration,ID}"
- return [NSString stringWithFormat:@"%@%@%@%d%@%d%@%@%@%.0f,%0.f%@",
+ return [NSString stringWithFormat:@"%@%@%@%d%@%d%@%@%@{%.0f %0.f}%@",
eventIdentifier,
keyValueSeperator,
beginSetDelimiter,
@@ -81,6 +94,39 @@ -(NSString*)stringForStimEvent:(NEStimEvent*)event
endSetDelimiter];
}
+-(NSString*)stringForEventDescription:(NEStimEvent*)event
+{
+
+ return [[event mediaObject] getID];
+}
+
+-(NSString*)stringForEventDuration:(NEStimEvent *)event
+{
+ return [NSString stringWithFormat:@"%d",
+ [event duration]];
+}
+
+-(NSString*)stringForEventPos:(NEStimEvent*)event
+{
+ return [NSString stringWithFormat:@"{%.0f_%.0f}",
+ [[event mediaObject] position].x,
+ [[event mediaObject] position].y];
+}
+
+-(NSString*)stringForEndEventIdentifier:(NEStimEvent *)event
+{
+ return [NSString stringWithFormat:@"%@_%@",
+ [[event mediaObject] eventIdentifier],
+ endEventIdentifier];
+}
+
+-(NSString*)stringForStartEventIdentifier:(NEStimEvent *)event
+{
+ return [NSString stringWithFormat:@"%@_%@",
+ [[event mediaObject] eventIdentifier],
+ startEventIdentifier];
+}
+
-(NSString*)stringForActionThen:(NSDictionary *)action
{
return @"t";//[NSString stringWithFormat:@"", ];
View
@@ -31,7 +31,7 @@ -(id)initWithID:(NSString*)objID
//TODO: error handling if file not found!
mTrack = [[QTMovie movieWithURL:[NSURL fileURLWithPath:resolvedPath] error:nil] retain];
}
-
+ mEventTypeDescription = @"Audio";
return self;
}
View
@@ -61,7 +61,7 @@ -(id)initWithID:(NSString*)objID
mPosition = position;
[im release];
}
-
+ mEventTypeDescription = @"Image";
return self;
}
View
@@ -27,12 +27,16 @@
/** the flag if this object depends on a constraint or not*/
BOOL hasConstraint;
+ /* description of the event type used especially for logging*/
+ NSString* mEventTypeDescription;
+
}
@property (readwrite, getter = position, setter = setPosition:) NSPoint mPosition;
@property (readonly, getter = isDependentFromConstraint) BOOL hasConstraint;
-
+@property (readonly, getter = eventIdentifier) NSString *mEventTypeDescription;
+
/**
* Initializes a newly allocated NEMediaObject with an EDL mediaObject
* from the configuration represented by key.
View
@@ -17,6 +17,7 @@ @implementation NEMediaObject
@synthesize mPosition;
@synthesize hasConstraint;
+@synthesize mEventTypeDescription;
-(id)init
{
@@ -25,6 +26,7 @@ -(id)init
mID = @"";
mConstraintID = @"";
hasConstraint = NO;
+ mEventTypeDescription = @"";
}
return self;
View
@@ -26,6 +26,7 @@ -(id)initWithID:(NSString*)objID
else{
hasConstraint = NO;}
}
+ mEventTypeDescription = @"Text";
return self;
}
@@ -49,7 +50,7 @@ -(id)initWithID:(NSString*)objID
else{
hasConstraint = NO;}
}
-
+ mEventTypeDescription = @"Text";
return self;
}
@@ -221,8 +221,9 @@ -(void)triggerArrived:(NSNotification*)aNotification
-(void)buttonWasPressed:(NSNotification *)aNotification
{
- NSString *toLog = [NSString stringWithFormat:@"Button pressed: %u", [[aNotification object] unsignedCharValue]];
- [mLogger log:toLog withTime:mTime];
+ // NSString *toLog = [NSString stringWithFormat:@"Button pressed: %u", [[aNotification object] unsignedCharValue]];
+ [mLogger logButtonPress:[[aNotification object] unsignedIntegerValue] atTrigger:mTriggerCount withTime:mTime];
+ //[mLogger log:toLog withTime:mTime];
}
-(void)requestAdditionOfEventWithTime:(NSUInteger)t
@@ -15,9 +15,12 @@
*/
@interface NEPresentationLogger : NSObject {
- /** An array of NSStrings representing the log. */
+ /** An array of NSDictionaries representing the log. */
NSMutableArray* mMessages;
+ /** An array of NSStrings with some header information for logfile. */
+ NSMutableArray* mGeneralMessages;
+
/** Date format for the timestamp in each message. */
NSDateFormatter* mDateFormatter;
@@ -49,10 +52,25 @@
*
* \param triggerNumber The number of the trigger that needs to
* appear in the message.
+ * \param t onset
*/
-(void)logTrigger:(NSUInteger)triggerNumber withTime:(NSUInteger)t;
/**
+ * Logs a keyboard message.
+ * The message is automatically expanded by a timestamp (time
+ * the message was logged).
+ *
+ * \param button The pressed button ID that needs to
+ * appear in the message.
+ * \param triggerNumber The triggerNumber that needs to
+ * appear in the message.
+ * \param t The onset that needs to
+ * appear in the message.
+ */
+-(void)logButtonPress:(NSUInteger)button atTrigger:(NSUInteger)triggerNumber withTime:(NSUInteger)t;
+
+/**
* Logs conditions from constraint
* The message is automatically expanded by a timestamp (time
* the message was logged).
Oops, something went wrong.

0 comments on commit 8e342b6

Please sign in to comment.