File: PsychHIDReceiveReportsStop.c

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (58 lines) | stat: -rw-r--r-- 2,098 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 *    PsychToolbox/Source/Common/PsychHID/PsychHIDReceiveReportsStop.c
 *
 *    PROJECTS: PsychHID
 *
 *    PLATFORMS:  All
 *
 *    AUTHORS:
 *
 *    denis.pelli@nyu.edu           dgp
 *    mario.kleiner.de@gmail.com    mk
 *
 *    HISTORY:
 *    4/7/05  dgp    Wrote it, based on PsychHIDGetReport.c
 *
 */

#include "PsychHID.h"

static char useString[] = "err = PsychHID('ReceiveReportsStop', deviceNumber)";
static char synopsisString[] =
    "Stop receiving and saving reports from the specified USB HID device.\n"
    "Calling ReceiveReports enables callbacks (forever) for the incoming reports from that device; "
    "call ReceiveReportsStop to halt acquisition of further reports for this device; "
    "you can resume acquisition by calling ReceiveReports again. "
    "Call GiveMeReports to get all the received reports and empty PsychHID's internal store for that device. "
    "\"deviceNumber\" specifies which device. "
    "The returned value \"err.n\" is zero upon success and a nonzero error code upon failure, "
    "as spelled out by \"err.name\" and \"err.description\". ";

static char seeAlsoString[] = "SetReport, ReceiveReports, GiveMeReports";

PsychError PSYCHHIDReceiveReportsStop(void)
{
    PsychGenericScriptType *outErr;
    const char *fieldNames[] = {"n", "name", "description"};
    char *name = "", *description = "";
    long error = 0;
    int deviceIndex;

    PsychPushHelp(useString,synopsisString,seeAlsoString);
    if (PsychIsGiveHelp()) { PsychGiveHelp(); return(PsychError_none); };

    PsychErrorExit(PsychCapNumOutputArgs(1));
    PsychErrorExit(PsychCapNumInputArgs(1));

    PsychCopyInIntegerArg(1, TRUE, &deviceIndex);

    error = ReceiveReportsStop(deviceIndex);
    PsychHIDErrors(NULL, error, &name, &description);

    PsychAllocOutStructArray(1, kPsychArgOptional, -1, 3, fieldNames, &outErr);
    PsychSetStructArrayStringElement("name", 0, name, outErr);
    PsychSetStructArrayStringElement("description", 0, description, outErr);
    PsychSetStructArrayDoubleElement("n", 0, (double) error, outErr);

    return(PsychError_none);
}