[ Guide of ROKCEY6 SMART Xtra for Director ]

=======================================================================================
Usage:

1.Copy RockeySmart.x32 to Director install dir\xtras.
2.Run Director,Open Message Window,type showxlib command to check if RockeySmart.x32 have been loaded.

Command:
showxlib

Result:
-- XLibraries:
--   Xtra: rockey5
--   Xtra: filextra
--   Xtra: uihelper
--   Xtra: javaconvert
--   Xtra: quicktimesupport
--   Xtra: netlingo
--   Xtra: multiuser
--   Xtra: xmlparser
--   Xtra: mui
--   Xtra: fileio
--   Xtra: beatnik
--   Xtra: activex

The first lib, ROCKEY SMART have been loaded correctly. You have to check the first step if it's not in libs.

3. Check interface of ROCKEY SMART xtra via interface command

Command:
put interface(xtra "ROCKEYSMART")

Result:
new object me

* DIC_Find -- Find ROCKEYSMART. Return the maximum number installed in sy
* DIC_Open integer iDevID -- Open ROCKEYSMART device by index.
* DIC_GetDevName -- Get device name in last open operation
* DIC_OpenByName string devName -- Open ROCKEYSMART device by name.
* DIC_Cmd integer iDevID, integer iCmd -- Do ROCKEYSMART command. You need DIC_Set to set parameters.
* DIC_Close integer iDevID -- Close Specified ROCKEYSMART.
* DIC_Set integer p1, integer p2, integer p3, string vData -- Set command parameter.
* DIC_Get integer p1, integer p2 -- Get command result.
* hex2dec string hex -- convert hexadecimal number to decimal number.
* dec2hex integer dec -- convert decimal number to hexadecimal number.

-- ROCKEYSMART API for Lingo,Release v1.00

==================================================================================

There are all ROCKEY SMART routines:

(1) hex2dec -- convert a hexadecimal string to a decimal number. it's very useful because there are so many hexadecimal defines in ROCKEY5 xtra.

Command:
put hex2dec("8010003C")

Result:
-2146435012

(2) dec2hex -- Convert a decimal number to a hexadecimal string. it's very useful because there are so many hexadecimal defines in ROCKEY5 xtra.

Command:
put dec2hex(-2146435012)

Result:
"8010003c"

(3) DIC_Find

Search for dongle device(s) connected to the computer.

Input: no parameter.

// Return value: Integer
// it is < 0, indicating an error code is returned, for details, please see below.
// If it is = 0, no card reader device exists
// If it is >0, the return value is the number of card reader device(s) 

//(Note: Normally, even if the user does not connect any device, the driver program will report the card presence 
//due to the existence of the driver. It is necessary to confirm the real device presence with command DIC_Open.) 
//Suppose that maximum 32 card reader devices can be connected to a computer. 



(4) DIC_Open integer iDevID 

Open the specified card reader

Input: Integer
iDevID	Card handle,it's a integer value.
it is a enumeration valueany one of 0, 1, 2, ... return value of DIC_Find().
0 means open the first ROCKEY5.

Return: Integer
// >=0				Success, the opened handle is returned
// <0				An error code is returned, for detailed descriptions, please refer to code defined below. (use dec2hex to view hex value).


Tips:

You can call GetDevName to get device name if succeess.

(5) DIC_GetDevName

Return device name of last open 

Input: no parameter.
Return: String
Name of ROCKEY5 device.

(6)DIC_OpenByName string devName

Open ROCKEY5 by name.

Input: String
Name of ROCKEY5 device, can get it via DIC_GetDevName.


Return :Integer
// >=0				Success, the opened handle is returned
// <0				An error code is returned, for detailed descriptions, please refer to code defined below. (use dec2hex to view hex value).

(7) DIC_Set	integer p1, integer p2, integer p3, any vData

Set data for DIC_Cmd.

Input:

 p1		Mode/shift, if the highest bit is 1, it is a mode operationotherwise, it is user defined shift value
 p2		Transfer mode/ size, the highest 2 bits specify the transfer mode, others indicate the operation size
 p3		User Data
 vData  any data,can be integer, string , list, float
 
Mode define: (You can use them without setting p2. use hex2dec to convert to decimal)
FILL					=hex2dec("80000000")
ATR					=hex2dec("80010000")
VOLUME					=hex2dec("80020000")
FACTORY_TIME				=hex2dec("80030000")
HARD_SERIAL				=hex2dec("80040000")
SHIP_TIME				=hex2dec("80050000")
COS_VERSION				=hex2dec("80060000")
ZONE					=hex2dec("80070000")
AGENT					=hex2dec("80080000")
USER1					=hex2dec("80090000")
USER2					=hex2dec("800A0000")
DIR_ID					=hex2dec("800B0000")
DIR_CLASS				=hex2dec("800C0000")
DIR_ATTRIBUTE				=hex2dec("800D0000")
DIR_PRIVILEGE				=hex2dec("800E0000")
FILE_NO					=hex2dec("800F0000")
DIR_NAME				=hex2dec("80100000")
FILE_ID					=hex2dec("80110000")
FILE_CLASS				=hex2dec("80120000")
FILE_ATTRIBUTE				=hex2dec("80130000")
FILE_PRIVILEGE			=	hex2dec("80140000")
FILE_SIZE				=hex2dec("80150000")
FILE_NAME				=hex2dec("80160000")
WRITE_DATA				=hex2dec("80170000")
READ_DATA				=hex2dec("80180000")
RUN_DATA				=hex2dec("80190000")
RANDOM_SIZE				=hex2dec("801A0000")
REMOTE_TAG				=hex2dec("801B0000")
REMOTE_PASS				=hex2dec("801C0000")
UPGRADE_HARD_SERIAL			=hex2dec("801D0000")
UPGRADE_REMOTE_TAG			=hex2dec("801E0000")
UPGRADE_REMOTE_PASS			=hex2dec("801F0000")
REMOTEPASS_STATUS			=hex2dec("80200000")
SUPERPASS_STATUS			=hex2dec("80210000")
SUPERPASS_DATA				=hex2dec("80220000")
FILE_DATA				=hex2dec("80230000")

BY_VALUE				=hex2dec("00000000")
BY_DOUBLE				=hex2dec("40000000")
BY_ARRAY				=hex2dec("80000000")
BY_STRING				=hex2dec("C0000000")

FILEATTR_NORMAL				=hex2dec("00")  -- Normal data file
FILEATTR_EXEC				=hex2dec("10")	-- executable
FILEATTR_DIR				=hex2dec("20")	-- diretory
FILEATTR_UPIGNORE			=hex2dec("40")	-- If the current security level is already higher than that of the executable -       
FILEATTR_INTERNAL			=hex2dec("80")	-- program, the program cannot be executed. 
-- File used by internal program and can not be operated externally.                                                      
                                       			-- If an executable file is marked as internalit has hiding propertysuch files can                                    
                                        		--be viewed when listing directory only if the super password is verified.                                               

Return:Integer,Error code.


(8) DIC_Cmd  integer iDevID, integer iCmd

Complete operations on the specified device 

input:
iDevID	Device handle, return value of DIC_Open, OpenByName.
iCmd	Specific operation, different constants represent different operations, for details, see below.

:
GET_CARD_INFO				=hex2dec("02000000")
GET_HARDWARE_INFO			=hex2dec("00FF1C00")
GET_MANAGER_CODE			=hex2dec("00FF1A00")
GET_CARD_PRIVILEGE			=hex2dec("00FF2200")
GET_REMOTE_INFO				=hex2dec("00FF1e00")
SET_REMOTE_INFO				=hex2dec("00FF1003")
CHECK_REMOTE_INFO			=hex2dec("01FF1003")
GET_CURRENT_DIR				=hex2dec("00001800")
SET_CURRENT_DIR				=hex2dec("0000a400")
GET_CURRENT_FILE			=hex2dec("00001801")
SET_CURRENT_FILE			=hex2dec("0100a400")
GET_PARENT_DIR				=hex2dec("00001802")
SET_PARENT_DIR				=hex2dec("0000a402")
LIST_DIR				=hex2dec("0000b200")
READ_FILE				=hex2dec("0000b000")
WRITE_FILE				=hex2dec("0000d000")
FORMAT_CARD				=hex2dec("0000e000")
CREATE_DIR				=hex2dec("0000e001")
CREATE_FILE				=hex2dec("0100e001")
REMOVE_DIR				=hex2dec("0000ee00")
REMOVE_FILE				=hex2dec("0000ee01")
RANDOM					=hex2dec("00008400")
RUN					=hex2dec("03000000")
CRYPTOTEXT_FILE				=hex2dec("04000000")
PLAINTEXT_FILE				=hex2dec("05000000")

CHECK_SUPER_PASS			=hex2dec("00FF1002")
SET_SUPER_PASS				=hex2dec("00FFF402")
GET_UPGRADE_REMOTE_PASS			=hex2dec("00FF2000")

you need call DIC_Set to set data for every command.

Return :Integer

=0				Success.
else			An error code is returned, for detailed descriptions, please refer to code defined below. (use dec2hex to view hex value).

(9) DIC_Get   integer p1, integer p2 

Get result data from last DIC_Cmd

input:

p1		Mode/shift, if the highest bit is 1it is a mode operationotherwise, it is a user defined shift value
p2		Return mode / size, the highest 2 bits represent return mode, others indicate the operation size

Return :
Any data type, maybe integer, string ,list, float.













