PhysicalBits - Geoff Smith

UsbAccessXtra for Adobe Director

Messages:

General
NameDescription
New
Standard message to create a new instance
OpenById
If you know the device vendor and product ids you can open them with this message. You can use FindUsbDevices to obtain this information.
OpenByProductName
Open a connected usb device using the name
IsOpen
returns true if a device is open, else false
Close
Close an open usb device.
Write
Write data to the Usb hid device.
MonitorChanges
Monitor the usb bus for connections and disconnections and callback into Director when an event occurs.
GetCapabilities
Get the capabilities of an opened device
FindAllUsbDevices
Scan through all the Usb hid devices and return info on each

Reading data
NameDescription
Read
Read data that has been recieved from the Usb hid device.
NumberOfItemsInReadBuffer
Obtain a count of the number of bytes waiting to be read from the input buffer.
ReadPacket
Usb data is transferred in blocks called packets. Often it is preferential to read a packet at a time. This message supports this. The Read message reads all the waiting data and returns them.
NumberOfPacketsInReadBuffer
Obtain the number of packets, rather than bytes, waiting in the input buffer
ReadReport
Read the HID descriptor data
DoNotBufferPackets
Enable or disable the packet buffering option. When false, all packets are put into the input queue when they arrive. If true then only the latest packet is ever in the input queue. The default value is false

Misc
NameDescription
ShowErrorsAsDialogs
Controls if error dialogs are shwn in addtion to the error return. Turn this off is you want your problem to handle errors without informing the user
GetVersionString
Obtain the version number of the xtra as a string. This may be requested when you are reporting bugs or interacting with PhysicalBits support.
GetLicensetype
Returns the license type for this xtra. #Author, #Demo or #Full
GetDemoDaysRemaining
Returns the number of days remaining on a demo license. Returns 0 if authoring license, or a big number if a full license.
privateInstance
Private function
privateGlobal
Private

Detailed Useage Information:

New
Description
Standard message to create a new instance
Format
new xtra
Parameters
objectRef: valid instance of UsbAccessXtra created with
Return Value
A valid object instance or null.
Notes
Example
theXtra = new ( xtra"UsbAccessXtra" )

OpenById
Description
If you know the device vendor and product ids you can open them with this message. You can use FindUsbDevices to obtain this information.
Format
OpenById objectRef me , integer vendorID, integer productID
Parameters
ObjectRef: A valid UsbAccessXtra oject instance
vendorID: Number as found by FindAllUsbDevices
productID: Number as found by FindAllUsbDevices
Return Value
ok or error
Notes
Example

OpenByProductName
Description
Open a connected usb device using the name
Format
OpenByProductName, objectRef me , string name
Parameters
ObjectRef: A valid UsbAccessXtra oject instance
Name: The name of the device
Return Value
ok or Error:
Notes
Example
put theXtra.OpenByProductName("TheDonglething")

IsOpen
Description
returns true if a device is open, else false
Format
IsOpen object objectRef
Parameters
objectRef: valid instance of UsbAccessXtra created with
Return Value
true/false 1/0
Notes
Example
put theXtra.isOpen()

Close
Description
Close an open usb device.
Format
Close object objectRef
Parameters
objectRef: valid instance of UsbAccessXtra created with
Return Value
ok or error
Notes
Example
put theXtra.Close()

Write
Description
Write data to the Usb hid device.
Format
Write object objectRef, {any number of strings or lists} *
Parameters
objectRef: valid instance of UsbAccessXtra created with "new"
* : Any number of parameters, each of which must be a string or list
Return Value
ok or error
Notes
All Usb devices operate in "blocks" of data. It is the users responsibility to send the correct amount of data. If the Write is called with an incorect amount the xtra fills with random data to bring it to a bock size.
Example
put theXtra.Write("Hello')
put theXtra.Write([1,2,3,4,5]
put theXtra.Write("Hello",[1,2,3,4])
put theXtra.Write(["Hello",[1,2,3,4]],"[5,6,7,8])

MonitorChanges
Description
Monitor the usb bus for connections and disconnections and callback into Director when an event occurs.
Format
MonitorChanges objectRef me, string lingoFunctionToCall
Parameters
ObjectRef: A valid UsbAccessXtra object instance
lingoFunctionToCall : The name of a lingo function to call when event occurs
Return Value
Notes
Use "" to disable this feature. The handler is called with one parameter, a list of the status data, eg [#xtraName: "USBAccessXtra", #type: "Device inserted or removed", #id: 71042432]
Example
theXtra.MonitorChanges("TheHandlerToCall") on TheHandlerToCall data put data end

GetCapabilities
Description
Get the capabilities of an opened device
Format
GetCapabilities object objectRef
Parameters
objectRef: valid instance of UsbAccessXtra created with "new"
Return Value
Notes
Device must be sucessfullt opened before calling this message
Example
GetCapabilities

FindAllUsbDevices
Description
Scan through all the Usb hid devices and return info on each
Format
FindAllUsbDevices object objectRef
Parameters
objectRef: valid instance of UsbAccessXtra created with
Return Value
A list of devices, each sub list contains
Notes
ONLY HID devices
Example
put theXtra.FindUsbDevices()

Read
Description
Read data that has been recieved from the Usb hid device.
Format
Read object objectRef
Parameters
objectRef: valid instance of UsbAccessXtra created with
Return Value
A list that contains all the recieved data from the device since the last call to Read. [] indicates that there was no data waiting.
Example
put theXtra.Read()

NumberOfItemsInReadBuffer
Description
Obtain a count of the number of bytes waiting to be read from the input buffer.
Format
NumberOfItemsInReadBuffer object objectRef
Parameters
objectRef: valid instance of UsbAccessXtra created with "new"
Return Value
A number that is the number of bytes wating to be read
Example
put theXtra.NumberOfItemsInReadBuffer()

ReadPacket
Description
Usb data is transferred in blocks called packets. Often it is preferential to read a packet at a time. This message supports this. The Read message reads all the waiting data and returns them.
Format
ReadPacket objectRef me
Parameters
ObjectRef: A valid UsbAccessXtra oject instance
Return Value
Returns a list containg the data in the packet
Example
put theXtra.ReadPAcket()

NumberOfPacketsInReadBuffer
Description
Obtain the number of packets, rather than bytes, waiting in the input buffer
Format
NumberOfPacketsInReadBuffer objectRef me
Parameters
ObjectRef: A valid UsbAccessXtra oject instance
Return Value
Returns the number of packets waiting in the input buffer
Example
put theXtra.NumberOfPacketsInReadBuffer()

ReadReport
Description
Read the HID descriptor data
Format
ReadReport objectRef me
Parameters
ObjectRef: A valid UsbAccessXtra oject instance
Return Value
List of the report data
Example
put theXtra.ReadReport()

DoNotBufferPackets
Description
Enable or disable the packet buffering option. When false, all packets are put into the input queue when they arrive. If true then only the latest packet is ever in the input queue. The default value is false
Format
DoNotBufferPackets objectRef me
Parameters
ObjectRef: A valid UsbAccessXtra oject instance
Return Value
Example
theXtra.DoNotBufferPackets(true)

ShowErrorsAsDialogs
Description
Controls if error dialogs are shwn in addtion to the error return. Turn this off is you want your problem to handle errors without informing the user
Format
ShowErrorsAsDialogs object objectRef, integer truOrFalse
Parameters
objectRef: valid instance of UsbAccessXtra created with "new"
trueOrFalse: true to turn dialogs on, or false to turn them off
Return Value
"ok" or "Error"
Example
theXtra.ShowErrorsAsDialogs(0)

GetVersionString
Description
Obtain the version number of the xtra as a string. This may be requested when you are reporting bugs or interacting with PhysicalBits support.
Format
GetVersionString object objectRef
Parameters
objectRef: valid instance of UsbAccessXtra created with "new"
Return Value
A version string.
Example
put theXtra.GetVersionString()

GetLicensetype
Description
Returns the license type for this xtra. #Author, #Demo or #Full
Format
GetLicenseType object objectRef
Parameters
objectRef: valid instance of UsbAccessXtra created with "new"
Return Value
#Author, #Demo or #Full
Example
put theXtra.GetLicenseType()

GetDemoDaysRemaining
Description
Returns the number of days remaining on a demo license. Returns 0 if authoring license, or a big number if a full license.
Format
GetDemoDaysRemaining object me
Parameters
object me: The value returned from new
Return Value
Integer number
Example
put theXtra.GetDemoDaysRemaining()

privateInstance
Description
Private function
Format
privateInstance
Parameters
Private
Return Value
Notes
for the curious:
0 = invalid:
1 = internal error reporting, 0=off 1=on:
2 = flow control reporting, 0=off 1=on, 0-100 level:
3 = log messages to file, 0=off 1=on, filname:
Example

privateGlobal
Description
Private
Format
privateGlobal
Parameters
Return Value
Example

About Us | Privacy Policy | Legal | Contact Us | ©2009 PhysicalBits