System-Serial Port

MidiPrimTester
This class simply demonstrates and tests the MIDI primitives. MIDI applications should use Stephen Pope's MIDIPort class, which will replace this one.
The Macintosh, and perhaps some other platforms, can send and receive MIDI data over a serial port by using an external clock signal supplied by an external MIDI adapter to generate the correct MIDI baud rate. Typical clock speeds of such adapters are 1, 2, or 0.5 MHz. This clock speed can be specified when a MIDI port is opened. On other platforms, this clock speed parameter is ignored.
bufferTimeStampFrom:
Return the timestamp from the given MIDI input buffer. Assume the given buffer is at least 4 bytes long.
canTurnOnParameter:
Return true if the given MIDI parameter can be turned on. Leave the parameter in its orginal state.
getDriverParameters
Return a string that describes this platform's MIDI parameters.
getInputForSeconds:onPort:
Collect MIDI input from the given port for the given number of seconds, and answer a string describing the data read.
getPortList
Return a string that describes this platform's MIDI ports.
initialize
Subclasses should redefine this method to perform initializations on instance creation
openPort:andDo:
Open the given MIDI port, evaluate the block, and close the port again. Answer the value of the block.
playDrumRoll:count:onPort:
MidiPrimTester new playDrumRoll: 75 count: 64 onPort: 0
playNoteOnPort:
MidiPrimTester new playNoteOnPort: 0
playScale:onPort:
MidiPrimTester new playScale: 130 onPort: 0
primMIDIClosePort:
primMIDIGetClock
primMIDIGetPortCount
primMIDIGetPortDirectionality:
primMIDIGetPortName:
primMIDIOpenPort:readSemaIndex:interfaceClockRate:
Open the given MIDI port. If non-zero, readSemaIndex specifies the index in the external objects array of a semaphore to be signalled when incoming MIDI data is available. Not all platforms support signalling the read semaphore. InterfaceClockRate specifies the clock rate of the external MIDI interface adaptor on Macintosh computers; it is ignored on other platforms.
primMIDIParameterGet:
primMIDIParameterSet:to:
primMIDIReadPort:into:
primMIDIWritePort:from:at:
SerialPort
This class supports a simple interface to the serial ports of the underlying platform, if it supports serial ports. The mapping of port numbers to hardware ports is platform specific, but typically follows platform ordering conventions. For example, on the Macintosh, port 0 is the modem port and port 1 is the printer port, since in the programmers documentation these ports are referred to as ports A and B.
baudRate
baudRate:
Set the baud rate for this serial port.
close
Close the serial port. Do nothing if the port is not open.
dataBits
dataBits:
Set the number of data bits for this serial port to 5, 6, 7, or 8.
initialize
Default port settings.
inputFlowControlType
inputFlowControlType:
Set the type of input flow control, where:
0 - none
1 - XOn/XOff
2 - hardware handshaking
nextPutAll:
Send the given bytes out this serial port. The port must be open.
openPort:
Open the given serial port, using the settings specified by my instance variables.
outputFlowControlType
outputFlowControlType:
Set the type of output flow control, where:
0 - none
1 - XOn/XOff
2 - hardware handshaking
parityType
parityType:
Set the parity type for this serial port, where:
0 - no parity
1 - odd parity
2 - even parity
primClosePort:
primOpenPort:baudRate:stopBitsType:parityType:dataBits:inFlowControlType:outFlowControlType:xOnByte:xOffByte:
primReadPort:into:startingAt:count:
primWritePort:from:startingAt:count:
printOn:
Append to the argument, aStream, a sequence of characters that
identifies the receiver.
readByteArray
Answer a ByteArray read from this serial port. Answer an empty ByteArray if no data is available. The port must be open.
readInto:startingAt:
Read data into the given String or ByteArray object starting at the given index, and answer the number of bytes read. Does not go past the end of the given String or ByteArray.
readString
Answer a String read from this serial port. Answer the empty String if no data is available. The port must be open.
stopBitsType
stopBitsType:
Set the stop bits type for this serial port, where:
0 - 1.5 stop bits
1 - one stop bit
2 - two stop bits
xOffByte
xOffByte:
Set the value of the XOff byte to be used if XOn/XOff flow control is enabled.
xOnByte
xOnByte:
Set the value of the XOn byte to be used if XOn/XOff flow control is enabled.