Software

The software is identical for all versions of the Service USB series. Depending on the interface model there are more or less inputs and outputs available.

Software

Layered system structure between Hard- and Software

 

Start-up

To install, run "SERVICE USB.pkg" from the enclosed CD-ROM.
The frameworks and the AppleScript OSAX is installed. These are all components, which the operating system needs in its delivery status.

Software

Installation must be done on the active system. The administrator password is required for installation. The green light-emitting diode "USB" should now appear on Service USB to show that it is ready for use.

Copy the other folders on the CD onto your harddisk, depending on which programming system you would like to work with. For a first test, it is good practice to use the program "SERVICE Test RB X" or "SERVICE Plus Test" which are found in the folder "Testprograms".

Software

Software on CD-ROM

 

Applications

All programming examples are based on basic commands that are used in the various programs (AppleScript, Adobe Director, 4thDimension, Runtime Revolution, RealBasic, and so on). The programming examples for Filemaker, RagTime and Numbers use AppleScript. In the graphical applications like Scratch and MaxMSP the integration of Service USB is more program like. It doesn´t make sense to use these programmes with Service USB basic instructions.

A framework, which can be found in the path /Library/ Frameworks/Service USB Driver.framework provides the basic commands. The externals, plugins, extensions, wrappers and glue programs for RealBasic, Java, 4th Dimension, Runtime Revolution, MaxMSP, Scratch, Director TCP/IP also access this framework.

The support for AppleScript works on the basis of this framework. It is located in the path /Library/ScriptingAdditions/SERVICE USB.osax

 

Command syntax

The commands may vary depending on the programming support environment and the system used. The type of parameter passing is also slightly different. The basic operation is explained using an output command. The sample command sends a byte to the interface and sets the outputs accordingly. You can, therefore, determine straight away from the LEDs on the interface whether everything is correct.

The syntax for the command "set SERVICE output value", is in:

Runtime Revolution
ServiceUSBSetOutputValue value, deviceID

4th Dimension
err:=Service SetOutputValue (myOutputValue;deviceID)

Adobe Director
SERVICEUSBSetOutputValue myOutputValue, deviceID, timeout

Apple Script
set SERVICE output value 85 device id 0 timeout 0

RealBasic
SERVICEUSBSetOutputValue(Value as Integer, deviceID as Inte-
ger, timeout as Integer) as Integer

MaxMSP
setOutputValue value deviceID

C,C++, ObjectiveC Framework (Xcode) 
OSErr SetOutputValue(UInt8 inValue,DeviceIdentifierRef inDeviceIdentifier=kUseDefaultDeviceIdentifier,UInt32 inTimeout=kDefaultTimeout);

Java
public int ServiceUSB_SetOutputValue(int value, int inDeviceIdentifier, long timeout)

UnixShell (Service USB Tool)
SERVICE_USB_Tool -c set_output -v value [-d deviceID]

TCP/IP (SUSBServer)
set_output value [deviceID]

 

These output commands are the variables value, deviceID and timeout together. An error code is also sent back with programming environments and the framework. This is usually empty in Revolution or 0 in other languages, if the command has been performed properly. The precise error description for values other than 0 can be found in
/Library/Frameworks/Service USB Driver.framework/Headers/ ServiceUSBToolbox.h.

Value is the output value ranging from 0 - 65535, where depending on the interface type only the lower 1,4,8 or 12 bits are used.

deviceID indicates which Service USB is referred to. If just one Service USB is connected, set the Device ID to 0. If several Service USBs are connected, the deviceID will determine which the Service USB command applies to. The deviceID is a four digit number, is equal to the series number and is marked on an adhesive label or stamped in the metal case. Examples are 5001, 1487 or 2516.

Instead of hard coding the deviceID the ID can also be figured out automatically. Sample programs can be found on the CD-ROM.

timeout is mainly set to 0. In Runtime Revolution, AppleScript, MaxMSP and RealBasic timeout and deviceID can be omitted.

 

Example

The relevant decimal value for setting the eight outputs to 0 and 1 alternately is 01010101 = 85.
In this concrete case, the commands are:

Runtime Revolution
SERVICEUSBSetOutputValue 85

4th Dimension
err:=Service SetOutputValue (85;0)

Adobe Director
SERVICEUSBSetOutputValue 85, 0, 0

Apple Script
set SERVICE output value 85

Real Basic
dim errorCode as integer
errorCode = SERVICEUSBSetOutputValue(85, 0, 0)

MaxMSP
setOutputValue 85

C,C++ Framework (Xcode):
SetOutputValue (85,(DeviceIdentifierRef)0,0);

UnixShell
./SERVICE_USB_TOOL -c set_output -v 85

TCP/IP
set_output 85