Pointer Entity¶
API Documentation: [cpp] [python] [.NET] [LabVIEW]
Access the reflex pad from a host computer.
The Pointers access the pad which is a shared memory area on a BrainStem module. The interface allows the use of the brainstem scratchpad from the host, and provides a mechanism for allowing the host application and brainstem relexes to communicate.
The Pointer allows access to the pad in a similar manner as a file pointer accesses the underlying file. The cursor position can be set via setOffset. A read or write of a character short or int can be made from that cursor position. In addition the mode of the pointer can be set so that the cursor position automatically increments or set so that it does not. This allows for multiple reads of the same pad value, or reads of multi-record values, via an incrementing pointer.
Offset (Get/Set)¶
pointer [ index ] . getOffset <= (unsigned char) Offset
pointer [ index ] . setOffset => (unsigned char) offset
Gets or sets the current cursor position for the pointer.
Mode (Get/Set)¶
pointer [ index ] . getMode <= (unsigned char) mode
pointer [ index ] . setMode => (unsigned char) mode
Get or set the pointer mode, static (0 default) or incrementing (1).
Char (Get/Set)¶
pointer [ index ] . getChar <= (unsigned char) value
pointer [ index ] . setChar => (unsigned char) value
Get or set a character value into the scratchpad at the current pointer offset. This will increment the pointer by 1 byte if the pointer mode is set to increment.
Short (Get/Set)¶
pointer [ index ] . getShort <= (unsigned short) value
pointer [ index ] . setShort => (unsigned short) value
Get or set a short value into the scratchpad at the current pointer offset. This will increment the pointer by 2 bytes if the pointer mode is set to increment.
Int (Get/Set)¶
pointer [ index ] . getInt <= (unsigned int) value
pointer [ index ] . setInt => (unsigned int) value
Get or set an int value into the scratchpad at the current pointer offset. This will increment the pointer by 4 bytes if the pointer mode is set to increment.
Code Examples¶
C++¶
// All commands return aErr values when errors are encountered and aErrNone on
// success. Get calls will fill the variable with the returned value.
stem.pointer[0].getOffset(&offset);
stem.pointer[0].setOffset(4);
stem.pointer[0].getMode(&mode);
stem.pointer[1].setMode(1);
stem.pointer[1].getChar(&value);
stem.pointer[1].setChar(6);
stem.pointer[1].getShort(&value);
stem.pointer[1].setShort(600);
stem.pointer[1].getInt(&value);
stem.pointer[1].setInt(600000);
Reflex¶
//Get calls will fill the variable with the returned value.
stem.pointer[0].getOffset(offset);
stem.pointer[0].setOffset(4);
stem.pointer[0].getMode(mode);
stem.pointer[1].setMode(1);
stem.pointer[1].getChar(value);
stem.pointer[1].setChar(6);
stem.pointer[1].getShort(value);
stem.pointer[1].setShort(600);
stem.pointer[1].getInt(value);
stem.pointer[1].setInt(600000);
Python¶
result = stem.pointer[0].getOffset()
print result.value
err = stem.pointer[0].setOffset(4)
result = stem.pointer[0].getMode(mode)
print result.value
err = stem.pointer[1].setMode(1)
result = stem.pointer[1].getChar()
print result.value
err = stem.pointer[1].setChar(6)
result = stem.pointer[1].getShort()
result.value
err = stem.pointer[1].setShort(600)
result = stem.pointer[1].getInt()
result.value
result = stem.pointer[1].setInt(600000)