PsychError EyelinkCurrentMode(void) { int iMode = 0; // Add help strings PsychPushHelp(useString, synopsisString, seeAlsoString); // Output help if asked if(PsychIsGiveHelp()) { PsychGiveHelp(); return(PsychError_none); } // Check arguments PsychErrorExit(PsychCapNumInputArgs(0)); PsychErrorExit(PsychRequireNumInputArgs(0)); PsychErrorExit(PsychCapNumOutputArgs(1)); // Verify eyelink is up and running EyelinkSystemIsConnected(); EyelinkSystemIsInitialized(); iMode = eyelink_current_mode(); // Assign output arg PsychCopyOutDoubleArg(1, TRUE, iMode); return(PsychError_none); }
PsychError EyelinkImageModeDisplay(void) { int iResult = 0; // Add help strings PsychPushHelp(useString, synopsisString, seeAlsoString); // Output help if asked if(PsychIsGiveHelp()) { PsychGiveHelp(); return(PsychError_none); } // Check arguments PsychErrorExit(PsychCapNumInputArgs(0)); PsychErrorExit(PsychRequireNumInputArgs(0)); PsychErrorExit(PsychCapNumOutputArgs(1)); // Verify eyelink is up and running EyelinkSystemIsConnected(); EyelinkSystemIsInitialized(); if(0) { // NOTE: Enno's OSX version added this eyelink call. Not sure if we want it or not. eyelink_start_setup(); iResult = image_mode_display(); } else { //mexPrintf("EyelinkImageModeDisplay is not yet implemented.\n"); iResult=0; } // Assign output arg if available PsychCopyOutDoubleArg(1, FALSE, iResult); return(PsychError_none); }
PsychError EyelinkGetNextDataType(void) { int type = 0; //all sub functions should have these two lines PsychPushHelp(useString, synopsisString, seeAlsoString); if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);}; //check to see if the user supplied superfluous arguments PsychErrorExit(PsychCapNumInputArgs(0)); PsychErrorExit(PsychRequireNumInputArgs(0)); PsychErrorExit(PsychCapNumOutputArgs(1)); // Verify eyelink is up and running EyelinkSystemIsConnected(); EyelinkSystemIsInitialized(); type = eyelink_get_next_data(NULL); PsychCopyOutDoubleArg(1, TRUE, type); return(PsychError_none); }
PsychError EyelinkTimeOffset(void) { double offset; //all sub functions should have these two lines PsychPushHelp(useString, synopsisString, seeAlsoString); if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);}; //check to see if the user supplied superfluous arguments PsychErrorExit(PsychCapNumInputArgs(0)); PsychErrorExit(PsychRequireNumInputArgs(0)); PsychErrorExit(PsychCapNumOutputArgs(1)); // Verify eyelink is up and running EyelinkSystemIsConnected(); EyelinkSystemIsInitialized(); offset = eyelink_double_usec_offset()/1000; PsychCopyOutDoubleArg(1, FALSE, offset); return(PsychError_none); }
PsychError EyelinkStopRecording(void) { // Add help strings PsychPushHelp(useString, synopsisString, seeAlsoString); // Output help if asked if(PsychIsGiveHelp()) { PsychGiveHelp(); return(PsychError_none); } // Check arguments PsychErrorExit(PsychCapNumInputArgs(0)); PsychErrorExit(PsychRequireNumInputArgs(0)); PsychErrorExit(PsychCapNumOutputArgs(0)); // Verify eyelink is up and running EyelinkSystemIsConnected(); //EyelinkSystemIsInitialized(); stop_recording(); return(PsychError_none); }
PsychError EyelinkAcceptTrigger(void) { int result; //all sub functions should have these two lines PsychPushHelp(useString, synopsisString, seeAlsoString); if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);}; //check to see if the user supplied superfluous arguments PsychErrorExit(PsychCapNumInputArgs(0)); PsychErrorExit(PsychRequireNumInputArgs(0)); PsychErrorExit(PsychCapNumOutputArgs(1)); // Verify eyelink is up and running EyelinkSystemIsConnected(); EyelinkSystemIsInitialized(); result = eyelink_accept_trigger(); /* if there is an output variable available, assign result to it. */ PsychCopyOutDoubleArg(1, FALSE, result); return(PsychError_none); }
PsychError EyelinkMessage(void) { int i, numInArgs; int status = -1; void **args_ptr = NULL; /* argument list, used as a va_list */ char s[256]; char *formatString; PsychArgFormatType format; double tempValue; char *tempString = NULL; //all sub functions should have these two lines PsychPushHelp(useString, synopsisString, seeAlsoString); if(PsychIsGiveHelp()){PsychGiveHelp();return(PsychError_none);}; //check to see if the user supplied superfluous arguments // PsychErrorExit(PsychCapNumInputArgs(1)); PsychErrorExit(PsychRequireNumInputArgs(1)); PsychErrorExit(PsychCapNumOutputArgs(1)); // Verify eyelink is up and running EyelinkSystemIsConnected(); EyelinkSystemIsInitialized(); PsychAllocInCharArg(1, TRUE, &formatString); numInArgs = PsychGetNumInputArgs(); if (numInArgs > 1) { args_ptr = (void **)mxMalloc((numInArgs-1) * sizeof(char *)); //iterate over each of the supplied inputs. for(i=2;i<=numInArgs;i++){ format = PsychGetArgType(i); switch(format){ case PsychArgType_double: if(PsychGetArgM(i)==1 && PsychGetArgN(i)==1){ PsychCopyInDoubleArg(i, TRUE, &tempValue); args_ptr[i-2] = (void *) (int) tempValue; } else { PsychGiveHelp(); return(PsychError_user); } break; case PsychArgType_char: args_ptr[i-2] = NULL; PsychAllocInCharArg(i, TRUE, &tempString); args_ptr[i-2] = tempString; break; default: PsychGiveHelp(); return(PsychError_user); break; } } } vsprintf(s, formatString, (va_list)args_ptr); status = eyemsg_printf(s); if (args_ptr != NULL) mxFree(args_ptr); /* if there is an output variable available, assign eyecmd_printf status to it. */ PsychCopyOutDoubleArg(1, FALSE, status); return(PsychError_none); }
PsychError EyelinkCommand(void) { int i = 0; int iNumInArgs = 0; int iStatus = -1; PsychArgFormatType psychArgType = PsychArgType_none; double fTempValue = 0.0; char *pstrTemp = NULL; char *pstrFormat = NULL; void **pArgs = NULL; char strCommand[256]; // Clear strings memset(strCommand, 0, sizeof(strCommand)); // Add help strings PsychPushHelp(useString, synopsisString, seeAlsoString); // Output help if asked if(PsychIsGiveHelp()) { PsychGiveHelp(); return(PsychError_none); } // Check arguments PsychErrorExit(PsychRequireNumInputArgs(1)); // PsychErrorExit(PsychCapNumOutputArgs(0)); PsychErrorExit(PsychCapNumOutputArgs(1)); // Verify eyelink is up and running EyelinkSystemIsConnected(); EyelinkSystemIsInitialized(); // Alloc and grab the input format string PsychAllocInCharArg(1, TRUE, &pstrFormat); iNumInArgs = PsychGetNumInputArgs(); // Alloc and grab input args if (iNumInArgs > 1) { pArgs = (void **)mxMalloc((iNumInArgs-1) * sizeof(char *)); // loop over the args for (i = 2; i <= iNumInArgs; i++) { psychArgType = PsychGetArgType(i); switch(psychArgType) { case PsychArgType_double: if ((PsychGetArgM(i) == 1) && (PsychGetArgN(i) == 1)) { PsychCopyInDoubleArg(i, TRUE, &fTempValue); pArgs[i-2] = (void *) (int) fTempValue; } else { PsychGiveHelp(); return(PsychError_user); } break; case PsychArgType_char: pArgs[i-2] = NULL; PsychAllocInCharArg(i, TRUE, &pstrTemp); pArgs[i-2] = pstrTemp; break; default: PsychGiveHelp(); return(PsychError_user); break; } } } // Build eyelink command and execute vsprintf(strCommand, pstrFormat, (va_list)pArgs); iStatus = eyecmd_printf(strCommand); if (pArgs != NULL) { mxFree(pArgs); } // Copy out the command result PsychCopyOutDoubleArg(1, FALSE, iStatus); return(PsychError_none); }