Platforms to show: All Mac Windows Linux Cross-Platform

/USB/IOWarrior/IO Warrior Mac OS X custom read


Required plugins for this example: MBS USB Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /USB/IOWarrior/IO Warrior Mac OS X custom read

This example is the version from Sun, 17th Mar 2012.

Project "IO Warrior Mac OS X custom read.xojo_binary_project"
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control init Inherits Label
ControlInstance init Inherits Label
End Control
Control present Inherits Label
ControlInstance present Inherits Label
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() dim ReportID,n as integer dim v as integer dim d as date dim m as MemoryBlock dim s as string ReportID=0 // kIOWarrior24Interface0 => 2 Byte per Report // kIOWarrior24Interface1 => 7 Byte m=NewMemoryBlock(20) s="" n=io.ReadFromInterface(io.FirstInterfaceOfType(io.kIOWarrior24Interface0),0,4,m) if n=0 then s=hex(m.Long(0))+" " else 'read.text="Error "+str(n) end if n=io.ReadFromInterface(io.FirstInterfaceOfType(io.kIOWarrior24Interface1),0,7,m) if n=0 then s=s+hex(m.Long(0))+" "+hex(m.Long(4)) else 'read.text="Error "+str(n) end if read.text=s End EventHandler
End Control
Control StaticText5 Inherits Label
ControlInstance StaticText5 Inherits Label
End Control
Control read Inherits Label
ControlInstance read Inherits Label
End Control
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
EventHandler Sub Open() dim i,c as integer dim d as IOWarriorCarbonDeviceMBS if TargetMachO then else MsgBox "Please use only with MachO targets on Mac OS X!" quit end if io=new IOWarriorCarbonMBS // custom IDs can be used 'io.USBVendorID=&h1466 'io.USB24DeviceID=&h3000 init.text= str(io.Init)+" init" present.text= str(io.IsPresent)+" present" c=io.CountInterfaces-1 for i=0 to c d=io.InterfaceAtIndex(i) ListBox1.AddRow hex(d.InterfaceHandle) ListBox1.cell(ListBox1.LastIndex,1)=d.SerialNumber ListBox1.Cell(ListBox1.LastIndex,2)=str(d.InterfaceType) next End EventHandler
Property Protected counter As integer
Property Protected io As IOWarriorCarbonMBS
Property Protected last As integer
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

The items on this page are in the following plugins: MBS USB Plugin.


The biggest plugin in space...