Platforms to show: All Mac Windows Linux Cross-Platform
/Dongle/SecureDongleX test
Function:
Required plugins for this example: MBS Util Plugin, MBS Dongle Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Dongle/SecureDongleX test
This example is the version from Thu, 6th Feb 2013.
Function:
Required plugins for this example: MBS Util Plugin, MBS Dongle Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Dongle/SecureDongleX test
This example is the version from Thu, 6th Feb 2013.
Project "SecureDongleX test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control WriteButton Inherits PushButton
ControlInstance WriteButton Inherits PushButton
EventHandler Sub Action()
dim retcode as integer = SecureDongleXMBS.Find
if retcode < 0 then
write "Error Finding SecureDongle X: "+str(retcode)
return
end if
if retcode = 0 then
write "No SecureDongle X plugged"
return
end if
write "Found SecureDongle X: "+str(retcode)
dim uid as UInt32 = val(iUID.text)
dim hid as UInt32 = 0
retcode = SecureDongleXMBS.Open(1, uid, hid)
if (retcode < 0) then
write "Error: "+str(retcode)
return
end if
dim handle as integer = retcode
dim block_index as integer = 0
dim buffer as string = "Hello World"+chr(0) // we terminate with NULL Character here as we need to know where to end on reading
retcode = SecureDongleXMBS.Write(handle, block_index, buffer)
if retcode < 0 then
write "Error: "+str(retcode)
return
end if
write "Write OK"
SecureDongleXMBS.Close(handle)
End EventHandler
End Control
Control ReadButton Inherits PushButton
ControlInstance ReadButton Inherits PushButton
EventHandler Sub Action()
dim retcode as integer = SecureDongleXMBS.Find
if retcode < 0 then
write "Error Finding SecureDongle X: "+str(retcode)
return
end if
if retcode = 0 then
write "No SecureDongle X plugged"
return
end if
write "Found SecureDongle X: "+str(retcode)
dim uid as UInt32 = val(iUID.text)
dim hid as UInt32 = 0
retcode = SecureDongleXMBS.Open(1, uid, hid)
if retcode < 0 then
write "Error: "+str(retcode)
return
end if
dim handle as integer = retcode
dim block_index as integer = 0
dim buffer as string
retcode = SecureDongleXMBS.Read(handle, block_index, buffer)
if retcode < 0 then
write "Error: "+str(retcode)
return
end if
dim p as integer = instr(buffer,chr(0))
if p>0 then
buffer = left(buffer, p-1)
end if
write "Read: "+ buffer
SecureDongleXMBS.Close(handle)
End EventHandler
End Control
Control TransformButton Inherits PushButton
ControlInstance TransformButton Inherits PushButton
EventHandler Sub Action()
dim retcode as integer = SecureDongleXMBS.Find
if retcode < 0 then
write "Error Finding SecureDongle X: "+str(retcode)
return
end if
if retcode = 0 then
write "No SecureDongle X plugged"
return
end if
write "Found SecureDongle X: "+str(retcode)
dim uid as UInt32 = val(iUID.text)
dim hid as UInt32 = 0
retcode = SecureDongleXMBS.Open(1, uid, hid)
if retcode < 0 then
write "Error: "+str(retcode)
return
end if
dim handle as integer = retcode
dim buffer as string = "Hello World"
retcode = SecureDongleXMBS.Transform(handle, buffer)
if retcode < 0 then
write "Error: "+str(retcode)
return
end if
write "Transform result: "+EncodingToHexMBS(buffer)
SecureDongleXMBS.Close(handle)
End EventHandler
End Control
Control iUID Inherits TextField
ControlInstance iUID Inherits TextField
End Control
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Sub Write(s as string)
list.AddRow s
End Sub
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS Dongle Plugin.