Platforms to show: All Mac Windows Linux Cross-Platform

/Dongle/Rockey/Rockey Tests
Function:
Required plugins for this example: MBS Dongle Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Dongle/Rockey/Rockey Tests
This example is the version from Sun, 17th Mar 2012.
Project "Rockey Tests.xojo_binary_project"
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
EventHandler Sub Open() mainwindow.test End EventHandler
End Class
Class MainWindow Inherits Window
Control List Inherits ListBox
ControlInstance List Inherits ListBox
End Control
Sub test() const RY_FIND = 1 const RY_FIND_NEXT = 2 const RY_OPEN = 3 const RY_CLOSE = 4 const RY_READ = 5 const RY_WRITE = 6 const RY_RANDOM = 7 const RY_SEED = 8 const RY_WRITE_USERID = 9 const RY_READ_USERID = 10 const RY_SET_MODULE = 11 const RY_CHECK_MODULE = 12 const RY_WRITE_ARITHMETIC = 13 const RY_CALCULATE1 = 14 const RY_CALCULATE2 = 15 const RY_CALCULATE3 = 16 const RY_DECREASE = 17 dim r as RockeyMBS dim ret,i as integer dim s as string write "Rockey Test." r=new RockeyMBS r.p1=&hc44c r.p2=&hc8f8 r.p3=&h0799 r.p4=&hc43b ret=r.Rockey(RY_FIND) ret=r.Rockey(RY_OPEN) write "handle "+hex(r.handle) //Write data to user memory write "read/write user memory:" r.p1=0 r.p2=14 r.Buffer.CString(0)="www.ftsafe.com" ret=r.Rockey(RY_WRITE) if ret<>0 then write "FAILED "+str(ret) goto closing end if //Read data form user memory r.p1=0 r.p2=14 // clear memoryblocks first bytes r.Buffer.Long( 0)=0 r.Buffer.Long( 4)=0 r.Buffer.Long( 8)=0 r.Buffer.Long(12)=0 ret=r.Rockey(RY_READ) if ret<>0 then write "FAILED "+str(ret) goto closing end if s=r.Buffer.CString(0) if s<>"www.ftsafe.com" then write "FAILED, the text read is not correct. "+s goto closing end if write "SUCCESS" //Seed function write "seed test:" r.lp2=&h19750316 ret=r.Rockey(RY_SEED) if ret<>0 then write "FAILED" goto closing end if if r.p1=&he33e and r.p2=&h36dc and r.p3=&h1c2f and r.p4=&h9559 then write "SUCCESS" else write "FAILED" goto closing end if //Write UserID r.lp1=&h19760111 //UserID Write "Write UserID:" +hex(r.lp1) ret=r.Rockey(RY_WRITE_USERID) if ret<>0 then write "FAILED" goto closing end if //Read UserID r.lp1=0 //UserID ret=r.Rockey(RY_READ_USERID) Write "Read UserID:" +hex(r.lp1) if ret<>0 or r.LP1<>&h19760111 then write "FAILED" goto closing end if write "SUCCESS" //Set Module write "module test:" r.p1=0 //Module Number r.p2=11 //Module word r.p3=1 //Module Dec Flags (1=allow,0=deny) ret=r.Rockey(RY_SET_MODULE) if ret<>0 then write "FAILED" goto closing end if write "SUCCESS" //Check Module Attrible r.p1=0 ret=r.Rockey(RY_CHECK_MODULE) if ret<>0 then write "FAILED" goto closing end if write "SUCCESS" //Write Arithmetic set write "write arithmetic set:" r.p1=0 r.Buffer.cstring(0)="a=a+e,b=b+f,c=c+g,d=d+h"//define arithmetic set ret=r.Rockey(RY_WRITE_ARITHMETIC) if ret<>0 then write "FAILED" goto closing end if write "SUCCESS" //Calculate 1 write "arithmetic calculate1:" r.lp1=0 r.lp2=0 r.p1=0 r.p2=0 r.p3=0 r.p4=0 ret=r.Rockey(RY_CALCULATE1) if ret<>0 or r.p3<>11 then write "FAILED" goto closing end if write "SUCCESS" //Calculate 2 write "arithmetic calculate2:" r.lp1=0 r.lp2=&h19750316 r.p1=0 r.p2=0 r.p3=0 r.p4=0 ret=r.Rockey(RY_CALCULATE2) if ret<>0 or r.p1<>&he33e or r.p2<>&h36dc or r.p3<>&h1c2f or r.p4<>&h9559 then write "FAILED" goto closing end if write "SUCCESS" //Calculate 3 write "arthmetic calculate3:" r.lp1=0 r.lp2=0 r.p1=0 r.p2=0 r.p3=0 r.p4=0 ret=r.Rockey(RY_CALCULATE3) if ret<>0 or r.p1<>11 then write "FAILED" goto closing end if write "SUCCESS" //Decrease Module word write "decrease module word:" r.p1=0 for i=0 to 10 ret=r.Rockey(RY_DECREASE) if ret<>0 then goto closing end if next r.p1=0 ret=r.Rockey(RY_CHECK_MODULE) if ret<>0 or r.p2<>0 then goto closing end if closing: //Close rockey write "close rockey:" ret=r.Rockey(RY_CLOSE) if ret<>0 then write "FAILED" else write "SUCCESS" end if End Sub
Sub write(s as string) System.DebugLog s List.AddRow s End Sub
End Class
End Project

See also:

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


💬 Ask a question or report a problem
The biggest plugin in space...