Home

SDK USER MANUAL

image

Contents

1. device intemal memory These keysare organized in 16 blocks and usercan selectthe key with block number without revealing the Key in the communication channel Revision A 1 May 2007 Mifare SDK User Manual 7 Key Type If the Source value is 1 or2 this parameter will be used to determine key type when authenticating Valid Input Value Enumarator Defined Constant 0 TypeA 1 1 29 Keys If the Source value is 1 0r2 this parameter will be used to determine the key to access when authenticating Keys is defined asTS Keys which isa 6 byte array E2prom Block No If the Source value is2 this parameter will be used to determine the location numberof intemal memory block in which the key to be used to authenticate is programmed Valid Input Value Enumarator Defined Constant 0 E2prom BlockO 1 E2prom Block1 15 E2prom Block15 2 2 TS Keys This type structure can be used to passthe parameters of e2prom key Hements of TS Keys Structure 1 Key Byte 6 Quick Example for VB Dim My keys as TS Keys My keys Key 0 amp H30 Key is 30 45 56 73 8B My keys Key 1 amp H45 My keys Key 2 amp H56 My keys Key 3 amp H73 My keys Key 4 amp H8B My keys Key 5 amp HDO Key Key will be used when programming intemal e2prom asthe Master Key Key is defined as byte SonMicro Electronics Revision A 1 May 2007 Mifare S
2. Integer Firmware Version Widestring Arguments Module sends the firmware version after reset in ascii format 0 Successful uns Others Lookat the enorcode table Example for VB Dim error_code As Long Dim firmware As String error_code SMifareX1 CMD_Reset firmware Resets the module firmware version can be found in firmware arg if error_code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 17 3 8 CMD Selectlag This function selects a tag if the tag isin RF field function TSM ifareX C MD_SelectTag varTag_TypeSenal WideString Integer Tag TypeSerial Widestring Arguments Tag_TypeSerial represents the tag type and the serial number of tag in hex string format 0 Successful ons Others Lookat the table Example for VB Dim error code As Long Dim My Tag As String error code SMifareX1 CMD SelectTag My Tag Selects a tag returns the tag type and serial number in hex string format in My Tag argument My Tag 020467DC31 02 is the tag type 31 DC 67 04 is serial number if error code is not zero look at the error code table in order to understand the error 3 9 CMD SeekTag This function seeks a tag and selectsa tag assoon asthe tag presentsin RF field When this command is used the expected response should be retrieved in OnPacketRece
3. Dim my access As TS Access Bytes Key A Key Key A Key Key A Key Key A Key Key A Key Key A Key yog mmmmnmnmm al 1 _ Key B Key Key B Key Key B Key Key B Key Key B Key mm mmm I j 1 my access Byte6 amp my access Byte7 amp HO7 my_access Byte8 amp H80 my_access User_Data amp HEE Sector_No 1 error code SMifareX1 CMD WriteSectorTrailer Sector No my access Key A Key B Write these bytes to the sector block if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 31 3 24 CMD _CreateAccessBytes This function creates access bytes with respectto accessbits function TSMifareX CMD CreateAccessBytes var CO C1 C2 Byte varAccess Bytes TS Access Bytes Integer Arguments Retums 1 2 AccessBytes TS Access Bytes 0 e C2 represent the block bits e Access Bytes represents the sector trailer access bytes Successful Others Lookat the emorcode table Example for VB Dim error code As Long Dim my access Dim Block0O Dim Block1 Dim Block2 Dim Block3 Block0 0 Blockl 0 Block2 0 Block3 4 error_code my_access my_access my access my access the error SonMicro Electronic s As As As As Byte6 Byte7 As TS_Access_B
4. SMifareX1 CMD Authenticaiton Block No My Auth Second Block is authenticated with my auth parameters if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 19 3 11 CMD_FirmwareVersion This function readsthe firmware of the module function TSM ifareX C MD_FirmwareVersion varFimware Version WideString Integer Firmware Version WideString Arguments Firmware version of the module retums this variable with hex string format 0 Successful ons Others Lookat the table Example for VB Dim error code As Long Dim my firmware As String error code SMifareX1 CMD FirmwareVersion my firmware Reads the firmware of the module my firmware 554D20312E30 gt UM 1 0 if error code is not zero look at the error code table in order to understand the error 3 12 CMD_ReadinputPins Readsthe input pins situation function TSM ifareX C MD_ReadInputPins varInput Status Wide String Integer Input Status WideString Arguments Input Status retums the pins situation 0 is low 1 is high 0 Successful PES Others Lookat the erorcode table Example for VB Dim error_code As Long Dim Input Status As String error code SMifareX1 CMD ReadInputPins Input Status Reads the input pins Inputestatus 00 gt all anput pans are l
5. ActiveX control was written in Delphi therefore Delphi Pascal representations will be used to forthe function prototypes Examplesto access ActiveX functions wil be given for Visual Basic Please visit http www sonmicro com to check for new examplesor code samplesfor different development environments Hints for Non Delphi Developers A parameter inside the paranthesis mean argument will be passed to the ActiveX function Function CMD myfunction myvalue Wideshing integer Myvalue as Widestring will be passed to the CMD myfunction Function will retum integer value A parameter inside the paranthesis with var keyword meansargument wil be passed to the ActiveX function whether it is used or not by the ActiveX function and then ActiveX function may modify orupdate the content oroverwrite to the parameter Varisactually pointing to the variable Function CMD Get ComPorts var comports Widesting integer SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 12 3 1 Get ComPorts This function get the list of available com ports if exist in string format function TSMifareX CMD Get ComPorts Varcomports WideString Integer Comports Wide String Arguments Com port namesare retumed ascomma sepaperated in this variable 0 No comport available Paums Others Number of comports Example for VB Dim com count as integer ID rexexoxoscic AE
6. Byte8 amp H80 My Access User Data amp H69 te6 Byte7 Byte8 This type structure is only used to write sectortrailer block Byte6 Byte7 Byte8 will be used to determine foraccessing the Blocks of that Sector They are defined as Byte User Data User Data byte isthe 9 byte ofthe sectortrailer block and it isused to save a byte which sends by user 2 6 TS UL Structure Thistype structure can be used to passthe parameters for write OTP command Elements of TS UL Structure Bytes Byte 4 Quick Example for VB pim My 0tpras T SU T Gt I For i 0 to 3 My Otp Bytes i amp H00 Bytes 00 00 00 00 Next i tes SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 10 2 7 TS UL Lock Structure Thistype structure can be used to passthe parameters for write OTP command Hements of TS UL Lock Structure Bytes Byte 2 Quick Example for VB pim My Lock as TS UL Otp Por i 0 Eo 1 My Lock Bytes i amp H00 Bytes 0 OU CON OON Next i SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 11 3 PROCEDURES AND FUNCTIONS It is assumed that developer hasleam the basics of Mifare and the SonMicro Mifare device Please visit http www sonmicro com 1356 d1356 php to see useful documents and software to get a fast understanding for Mifare and mifare applications For SonMicro Mifare Readers details please reference the relevant product sUser Manual documents
7. Comport List will be empty SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 14 3 3 CMD OpenPort This function creates and opensthe selected ComPort function TSMifareX CMD OpenPort const PortNa me Baud WideString Integer Portname WideString Arguments Baud WideString 0 Successful Others Lookatthe emorcode table Example for VB Pot tm Dim Baud As String Dim error code As Long Baud Port SES OO COMS error code SMifareX1 CMD_OpenPort Port Baud Create and open COM5 with 19200 baud rate if error code is not zero look at the error code table in order to understand the error 3 4 CMD ClosePort This function close and destroy the ComPortt if it wasopened previously function TSMifareX CMD ClosePort Integer Arguments No Arguments 0 Successful DEUM Others Lookatthe emorcode table Example for VB Dim error code As Long error code SMifareX1 CMD ClosePort Close and destroy Com if opened before if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 15 3 5 CMD_AutoMode This function enables disables Auto Mode When Auto mode is enabled Halt Select Tag and Authenticate commands will run automatically before any Read Write operation function TSMifareX CMD Rese
8. com count SMifareX1 CMD Get ComPorts comport list Com Port names can be found in comport list variable as comma seperated format SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 13 3 2 CMD Get Delimineted This function will get the parameter Value that is delimineted with a deliminator string For each call of this function next parameter will be retrieved and the retrieved parameter will be deleted from the original string function TSMifareX CMD Get Delimineted Const Deliminator WideString Var Value Widestring VarOrg Str Widestimg Integer Deliminator Wid eString Value WideString Org Str Wide String Arguments Deliminator can be any string that will be searched in the Org Str Value isthe parameter retrieved from Org_Strthat is delimineted with Deliminator Org_Stris the string that search process will be done in 0 Parameter is found in the Org Str 1 Parameter is not found in the Org Str Example for VB Dim Status As integer Dim Param As String Dim Comport hist As Striug Status SMifareX1 CMD Get Delimineted Param Comport List Note that Comport List string will get shorter until all params are retrieved Mug Orewwgexowzie ches When CMD Get Delimineted is called first time Param will be COM4 and the Comport List will be COM7 Sme yow wine Param will be COM7 and the
9. represents new buad rate of the device 0 Successful Others Lookat the table Example for VB Dim error code As Long Dim OTETAS TS TUL OGP OTP Bytes 0 amp H00 OTP Bytes 1 amp H00 OTP Bytes 2 amp H00 OTP Bytes 3 amp H00 error code SMifareX1 CMD ULWriteOtp OTP Write 00 to all OTP bytes if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 34 3 27 ULWrtelock Thisfunction writesthe Lock bytesto the Lock block of the ULtag function TSM ifareX C MD_WriteLock varLock_ Bytes TS UL Lock Integer Arguments Lock_Bytes TS UL_Lock e Lock bytesrepresents the bytes of the Lock block 0 Successful Others Lookatthe emorcode table Example for VB Dim eror code AsLong Dim Lock Byte AsTS UL Lock Dim sonuc AsInteger Lock Byte Bytes 0 amp HOO Lock Byte Bytes 1 amp 00 emor code SMifarex1 C MD_ULWriteLock Loc k_ Byte Write 00 to all Lock bytes if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 35 3 28 SetDevic eBaudRate This function setsthe device baud rate to the specifie
10. 2 115 Auth Thistype structure can be used to pass parametersfor Authentication command Hements of TS Auth Structure Source Key Type Keys E2prom Block No Quick Example for VB Source Dim My auth as IS Auth My auth My auth My auth My auth My auth My auth My auth My auth Source Key Type Keys Keys Keys Keys Keys Keys Key 0 Key 1 Key 2 Key 3 Key 4 Key 5 Byte Byte TS Keys Byte Provided Key TypeA amp H30 amp H45 amp H56 amp H73 amp H8B amp HDO Provided Key 1 TypeA 0 S0 5 5 VS 8 0 This paramater determines the authentication source There are three available auhentication sources User can use defined constants enumarators or manually enter the value to select the authentication source Valid Input Value Enumarator Defined Constant 0 Mifare Default 1 1 Provided Key 2 2 E2Prom Block No 3 Notes 1 If Source value is 0 then Key TypeA and default key FF FF FF FF FF FF will be used to authenticate 2 3 SonMicro Electronics Key Type Keysand E2prom Block No paramaters will not have any influence on the authentication comma nd If source value is 1 then elements Key Type and Keys in TS Auth type structrure will be used to authenticate If Source value is2 then elements Key Type and E2prom Block No will be used to authentiate There are 16 programmable Keys each for TypeA and
11. DK UserManual 8 2 3 TS Mifare Block Structure Mifare Block structure isused to determine to get orset the bytes of Mifare Block Elements of TS Mifare Block Structure Bytes Byte 16 Quick Example for VB bim My block as IS Mifare Block Dim i As Byte For 1 0 to 15 My block Bytes i amp HFF Next i tes Bytes is used to hold the valuesofthe bytesof Mifare Block defined as 16 bytesof array 2 4 TS Output Pins Structure Thistype is used to set the output pinsof the Mifare module Hements of TS Output Pins Structure Value Byte Quick Example for VB pim as vScOUtput Pins My Pins Value Output 2HIGH OutputlHIGH Value of the Output is 3 Value Value isused to determine the level of the output pins It is defined as Byte Valid Input Value Enumarator Defined Constant 0 Output 2LOW Output1LOW 1 Output 2LOW Output1HIGH 2 Output 2HIGH Output1LOW 3 Output 2HIGH Output1HIG H SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 9 2 5 TS Access Bytes Structure Thistype structure can be used to passthe parametersfor write sectortrailer command orto getthe parametersforcreate access bytescommand Hements of TS Access Bytes Structure 1 Byte6 Byte Byte7 Byte Byte8 Byte User Data Byte Quick Example for VB Dim My Access as TS Access Bytes My Access Byte6 amp HFF Access Bytes FF 07 80 69 My Access Byte7 amp H07 My Access
12. SM130 SM132 USB O 4 Software Development Kit SDK USER MANUAL SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 2 SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 3 EVALUATION DEVELOPMENT KIT Fora fast starting and a product just in days we recommend you to buy one of our development evaluation kits SDK Software Development Kit is included freely in Deluxe versions of the kits orit can be purchased separately ForOnline Shopping you can visit http www sonmicro com shop shop3 php Figure 1 SM 1013 Evaluation Kit Deluxe Figure 2 SM 132 USB USB Mifare Reader SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 4 1 INTRODUCTION This document explains usage of Mifare ActiveX component distributed with the Software Development Kit SDK Users can quickly add Mifare functions to existing software or create new software for Mifare applications easily with the provided library ActiveX library provides high level APIs to communicate with the supported devices See Section 1 1 for the supported devices and useful functions Users never need to know about the communication protocol occuring between the device and the computer ActiveX library will handle with that Communication channel is based on Com Port of the computer and ActiveX component can also reliably be used with virtual com port orthe USB Serial con
13. cs Revision A 1 May 2007 Mifare SDK UserManual 26 3 19 CMD_WhiteValue This function writes the value signed 4 Byte to the specified block function TSM ifareX CMD WriteValue varBlock No Byte var Block Value Integer Integer Block No Byte Arguments Block_Value Integer 4 byte signed e No represents the number of the block e Block Value isthe value of the Block 0 Successful Others Lookatthe erorcode table Example for VB Dim error_code As Long Dim Block_No as Byte Dim Value As Long Value 23400080 Block_No 5 error code SMifareX1 CMD WriteValue Block No Value Writes the value to the fifth block if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 27 3 20 CMD ReadValue This function readsthe value signed 4 Byte from the specified block function TSMifareX CMD ReadValue varBlock No Byte var Block Value Integer Integer Block No Byte Arguments Block_Value Integer 4 byte signed e No represents the number of the block e __ Block Value isthe value of the Block 0 Successful Others Lookat the erorcode table Example for VB Dim error code As Long Dim Block No as Byte Dim Value As Long Block No 5 error code SMifareX1 CMD WriteValue Block No Value Reads the value to the fifth bloc
14. d value function TSMifareX CMD SetDeviceBaudRate varNew Baud Integer Integer Arguments New_Baud Integer e _ New Baud represents the new buad rate of the device 0 Successful Others the erorcode table Example for VB Dim error code As Long Dim Baud rate As Long Baud rate 19200 error code SMifareX1 CMD SetDeviceBaudRate Baud rate Changes the baud rate to 19200 if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 36 3 29 CMD Sleep This function takesthe module to Sleep function TSMifareX CMD Sleep Integer Arguments No Arguments 0 Successful Others Lookatthe emorcode table Example for VB Dim code AsLong emor code SMifareX1 Sleep Takes the module to sleep if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 37 3 30 CMD_Switc hOnRf This function takes RF poweron function TSM ifareX C MD_Switc hOnRf Integer Arguments No Arguments Retums 0 Successful Others Lookatthe emorcode table Example for VB Dim eror code AsLong emor code SMifareX1 SwitchO nRf Takes the Antenna Power on if error code is not zero look at the error code table i
15. e successfully 1 Timeout 2 Unexpected response 3 Data greaterthan 64 byte 4 Checksum enor 5 RF Field is O FF 6 No Tag or Login Failed 7 Argument out of range or Wrong Command 8 Invalid Key Format 9 Read Failed 10 Unable to read after write 11 Write Failed 12 Invalid Value Block 13 Change of Baud rate Failed 14 Com Port has not been created yet 15 Sectortrailer block use sector write function 16 Serial Block you can not write anything 17 OTP orLock Block 18 Com port is already open 19 Com port could not be created SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 40 5 SALES AND SERVIC E INFORMATION To obtain information about SonMicro Electronics products and technical support reference the following information ONMicrRo SonMicro ELECTRONICS LTD Cankaya M Soguksu C Aslihan Ishani 2 15 Mersin 33070 TURKIYE Phone 490 324 237 21 28 Facsimile 90 324 237 21 86 Email info gsonmicro com Web Site http www sonmicro com Sales http www sonmicro com sales php Sup port http www sonmicro com ask php Documents amp Software http www sonmicro com 1356 d 1356 php User Forums http www sonmic ro com forums SonMicro Electronics Revision A 1 May 2007
16. eX DLL is very easy ActiveX Library SM X10 0cx comes with SDK To Register the SMX10 ocx file Go to Start gt Run Type regsvr32 path to the ocxfile If you copy move the ocx file into windows system directory then you do not need to write whole path regsvr32 SM X10 0cx It is not required to move ocxfile to system directory In this case write complete path regsvr32 cA myactivex SM X10 0cx To unregisterthe ActiveX Control use u switch regsvr32 myactivex SMX10 0cx 1 3 Example VB 6 0 Project There isan example Visual Basic 6 project comes with the SDK Before using this project SM X10 0cx should needsto be registered to the Windows OS Project file is not illustrating a professional software but simple commandsto illustrate communication between the Mifare module with ActiveX Control To quickly validate Mifare readerand ActiveX Control Register ActiveX Control as explained above Open Project file in Visual Basic or run Project exe file Select the right com port Openthe com port Click on the Reset Button You should be able to See Firmware Version string in the status bar To Read a block quickly Openthe com port Click Enable Disable Auto Mode to enable the Auto Mode Select Mifare Blockto be read Place atag nearthe antenna Click on the Read Button SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 2 TYPE STRUC TURES
17. ger 4 byte signed var Block No Byte var Decrement Value Block Value Integer Integer Block No represents the numberof the block Increment value representsthe value which is subtracted to the block value Block Value isthe value of the Block Retums 0 Others Lookatthe emorcode table Successful Example for VB Dim error code As Long Dim Block No as Byte Dim Dec value As Long Dim Value As Long Block 5 Dec Value error code SMifareX1 CMD IncValue Block No Ddec Value Value Before increment operation value 7 after increment operation value is 4 if error code is not zero look at the error code table in order to understand the error SonMicro Electronic s Revision A 1 May 2007 Mifare SDK User Manual 30 3 23 CMD_WhiteSectorirailer This function writesthe bytesto the specified sector trailer block function TSM ifa reX C MD_Write Sec torTrailer var Sector No Byte varAccess Bytes TS Access Bytes var KeyA KeyB TS Keys Integer Sector No Byte AccessBytes Integer 4 byte signed Arguments KeyA KeyB Integer 4 byte signed e Sector No represents the number of the sector e Access Bytes represents the sectortrailer access bytes e KeyB are the key values 0 Successful ans Others Lookat emorcode table Example for VB Dim error code As Long Dim Sector No As Byte Dim Key A As TS Keys Dim Key B As TS Keys
18. in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 23 3 16 CMD_WhiteBlock This function writes the data to the specified block of the tag function TSM ifa reX C Write Bloc k var Block_No Byte var Block Buffer TS Mifare Block Integer Block_No Byte Block_Buffer TS Mifare Block Arguments e No represents the block number of the tag Block Bufferis 16 byte of array hex values of the Block bytes 0 Successful Retums Others Lookat the table Example for VB Dim error code As Long Dim Block No As Byte Dim my block As TS Mifare Block Dim i As Byte For 1 0 to 15 my block Bytes i amp 00 Next i Block No 4 error code SMifareX1 CMD WriteBlock Block No block rites my block to the fourth block of the tag if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 24 3 17 CMD StrtoBloc kBuffer This function converts specified string to the 16 byte Block array function TSMifareX CMD StrtoBloc kBuffer var Content Str WideString var Block Buffer TS Mifare Block Integer Content Str widestring Arguments Block_Buffer TS Mifare Block e Content strcontains characters e Block Bufferis 16 byte of array decimal values of the Block bytes Retums 0 Successful Others Loo
19. ive event See Section 3 32 function TSMifareX CMD SeekTag Integer Arguments No Arguments 0 Successful Others Lookatthe emorcode table Example for VB Dim error code As Long error code SMifareX1 CMD SeekTag Seeks a Tag and selects it when the tag presents in RF field So the serial number is coming OnReceive event of the module if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 18 3 10 Authentic ate This function authenticatesthe tag with the specified authentication parameters function TSM ifareX C MD_Authnetic ate var Block_No Byte var Auth_Params TS Auth Integer Block_No Byte Auth_Params TS Auth Arguments Block No representsthe blok numberof the tag Auth Paramsrepresents all authentication parameters in itself 0 Successful Fete Others Lookat the table Example for VB Dim error code As Long Dim my Auth As TS Auth Dim Block No As Byte Block No 2 my auth Source Provided Key Provided Key is the Source of the Auth my auth Key Type Type A Type is A my auth Keys Key 0 amp HFF Key is FF FF FF FF FF FF my auth Keys Key 1 amp HFF my auth Keys Key 2 amp HFF my auth Keys Key 3 amp HFF my auth Keys Key 4 amp HFF my auth Keys Key 5 amp HFF error code
20. k Value variable returns the value if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 28 3 21 CMD IncValue This function inc rements the value of the specified block with the specified value function TSMifareX CMD IncValue var Block No Byte varIncrement Value Block Value Integer Integer Block No Byte Increment Value Integer 4 byte signed Block Value Integer 4 byte signed Arguments e No represents the number of the block e Increment value represents the value which is added to the block value e Block Value isthe value of the Block 0 Successful Others Lookatthe emorcode table Example for VB Dim error code As Long Dim Block No as Byte Dim Inc value As Long Dim Value As Long Block No 5 Inc Value 3 error code SMifareX1 CMD IncValue Block No Inc Value Value Before increment operation value 7 after increment operation value is 10 if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 29 3 22 CMD DecValue This function decrementsthe value of the specified block with the specified value Arguments function TSMifareX CMD DecValue Block No Byte Decrement Value Integer 4 byte signed Block Value Inte
21. katthe erorcode table Example for VB Dim error code As Long Dim My string As String Dim Block Buffer As TS Mifare Block My string SONMICRO MIFARE error code SMifareX1 CMD StrtoBlockBuffer My string Block Buffer converts the SONMICRO MIFARE to type of Mifare Block Buiter 0 83 IOC Butter 1 79 sss if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 25 3 18 CMD BlockBufferToStr This function converts the specified 16 byte Block array to the character String function TSMifareX CMD Bloc kBufferToStr var Block Buffer TS Mifare Block var Block Str WideString Integer Block Buffer TS Mifare Block Block Str widestring Arguments e strcontainscharacters Block Bufferis 16 byte of array decimal valuesofthe Block bytes 0 Successful Retums Others Lookatthe erorcode table Example for VB Dim error code As Long Dim My string As String Dim Block Buffer As TS Mifare Block Block Buffer Bytes 0 83 Block Buffer Bytes 1 79 Block Buffer Bytes 2 78 error code SMifareX1 CMD BlockBufferToStr Block Buffer My string converts the SONMICRO MIFARE to type of Mifare Block My String SON if error_code is not zero look at the error code table in order to understand the error SonMicro Electroni
22. lock 0 Block number of e2prom Key Type 0 Key Type is A Type Keys Key 0 amp HFF Rey i FF FF FF FF FF FF Keys Key 1 amp HFF Keys Key 2 amp HFF Keys Key 3 amp HFF Keys Key 4 amp HFF Keys Key 5 amp HFF error code SMifareX1 CMD WriteE2promKey e2prom block Key Type Keys Writes the key to the specified e2prom Block as Master Key if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 22 3 15 CMD ReadBlock This function readsthe specified block of the tag function TSMifareX CMD ReadBlock varBlock No Byte var Block Buffer TS Mifare Block varBlock Str WideString Integer Block No Byte Block Buffer TS Mifare Block Arguments Block Str Wid eString e No represents the block number of the tag e Bufferis 16 byte of values of the Block bytes e BlockStristhe characters of the Block bytes 0 Successful Others Lookat the erorcode table Example for VB Dim error code As Long Dim Block No As Byte Dim my block As TS Mifare Block Dim my block str As String Block No 3 error code SMifareX1 CMD ULReadBlock Block No my block my block str reads the third block my block returns the values of bytes my block str is the character string of the block bytes if error code is not zero look at the error code table
23. n order to understand the error 3 31 Switc hOffRf This function takes RF power off function TSMifareX CMD SwitchOffRf Integer Arguments No Arguments 0 Successful TUS Others Lookatthe emorcode table Example for VB Dim eror code AsLong emor code SMifareX1 Switc hOffRf Takes the Antenna Power off if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 38 3 32 CMD OnReceive This procedure is used to get the data in SMifareX1 OnPacketReceive event procedure TSMifareX CMD OnReceive varData Type Byte var Packet Str WideString Data Byte Arguments Packet Str Widestring Data Type representsthe type of the incoming packet e Packet Strrepresentsthe incoming data packet Example for VB Dim tag type As Byte Dim my packet As String Call SMifareX1 CmdOnReceive tag type my packet if tag type 2 and my packet C7890654 gt 1K Tag Received nad Serial is 540689C7 SonMicro Electronics Revision A 1 May 2007 da X X 9 M X s Mifare SDK User Manual 39 4 ERROR CODE TABLE Error Codes Codes Meanings 0 Processis don
24. ow if error_code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 20 3 13 WhrteOutputPins Write the value to the output pins function TSM ifareX CMD WriteO utputPins varOutput Value TS Output Pins Integer Output Value TS Output Pins Arguments Output value setsthe output pins 0 Successful ons Others Lookat the table Example for VB Dim error code As Long Dim Output Status As TS Output Pins Output Status Value Output 2HIGH OutputlHIGH error code SMifareX1 CMD WriteOutputPins Output Status Sets the output pins to high if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 21 3 14 WriteE2promKey Thisfunction writesthe key to E2prom Block as Master Key function TSMifareX CMD WriteE2promKey varE2prom Block No Key Type Byte var Keys TS Keys Integer E2prom_Block_no Byte Key_Type Byte Arguments Keys 5 Keys e 2 Block no representsthe block number of the eeprom e Key represents the key type of the key e Keys 0 Successful Others Lookat the table Example for VB Dim Keys As TS Keys Dim error code As Long Dim e2prom block As Byte Dim Key Type As Byte e2prom b
25. t varMode Byte varAuth Params TS Auth Integer Mode Byte Auth Params TS Auth Arguments Mode can be Oorl1 ODisables 1 enables Auto Mode Auth Paramsinclude necessary Authentication parameters and configuration 0 Successful Rete Others Lookatthe emorcode table Example for VB Dim error code As Long Dim my auth As TS Auth my auth Source Provided Key Provided Key Authentication my auth Key Type Type A Key Type my auth Keys Key 0 amp H Textl Text Key my auth Keys Key 1 amp H Text2 Text my auth Keys Key 2 amp H Text3 Text my auth Keys Key 3 S amp H Text4 Text my auth Keys Key 4 SH Text5 Text my auth Keys Key 5 amp H Text6 Text error code SMifareX1 CMD AutoMode 1 my auth Auto mode On SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 16 3 6 CMD Halt This function haltsthe PICC function TSMifareX CMD Halt Integer Arguments No Arguments 0 Successful Others Lookatthe emorcode table Example for VB Dim error code As Long error code SMifareX1 CMD Halt the FICC if error code is not zero look at the error code table in order to understand the error 3 7 CMD Reset This function resets the Mifare module Firmware version string passesinto the Fimware string variable function TSM ifareX C MD_Reset varFimware Version WideString
26. verters It is strongly recommended for users who are strange to Mifare first read about Mifare basics Brief information for Mifare and itsapplication can be found in User Manualfile at our web page http www sonmic ro com 1356 d1356 php Any software development environment that supports Windows ActiveX components can be used to develop your Mifare application with the SonMicro Mifare ActiveX component Followings are the examples for popular software development environments that can use Mifare ActiveX component Delphi 4 Delphi 5 Delphi 6 Delphi 7 Delphi Net Visual Basic Visual C Visual Basic NET Visual C Net Visual Net etc Operating systems other than Microsoft Windows is not supported currently 1 1 Supported Devices Mifare SDK supports the following devices M130 Mifare Module SM132 USB Mifare Reader Integrated with Serial to USB interface and PCB antenna Supported Development kits M1013 Eval kit for SM130 M1013USB Eval Kit for SM132 USB Please note that SM132 USB module is connected over USB interface but the control of these modules is still done in classic serial port manner with the created virtual com port Driver for SM 132USB can be downloaded at our web site SonMicro Electronics Revision A 1 May 2007 Mifare SDK UserManual 5 1 2 How to Register ActiveX DLL ActiveX ocx file should needsto be registered before using it Registering Activ
27. ytes Byte Byte Byte Byte Byte8 if error code is not zero look at the error code table in order to understand SMifareX1 CMD CreateAccessBytes Block0 Blockl Block2 07 80 Revision A 1 Blocks May 2007 Mifare SDK User Manual 32 3 25 ULWrteBlock Thisfunction writesthe bytesto the ULtags block function TSM ifa reX C MD_ULWriteBloc k var Block_No Byte var Block Buffer TS Mifare Block Integer Block_No Byte Block_Buffer TS Mifare Block Arguments e No represents the block number of the tag Block Bufferis 16 byte of array hex values of the Block bytes 0 Successful Retums Others Lookatthe table Example for VB Dim error code As Long Dim Block Buffer As TS Mifare Block Dim Block No As Byte Block Buffer Bytes 0 amp HFF Block Buffer Bytes 1 amp HFF Block Buffer Bytes 2 amp HFF Block Buffer Bytes 3 amp HFF Block No 5 error code SMifareX1 CMD ULWriteBlock Block No Block Buffer write Block buffer to the fifth block if error code is not zero look at the error code table in order to understand the error SonMicro Electronics Revision A 1 May 2007 Mifare SDK User Manual 33 3 26 ULWriteOtp This function writesthe bytesto the block of the ULtag function TSM ifareX C MD_WriteOtp varOTP Bytes TS UL Otp Integer Arguments OTP Bytes TS UL Otp e New Baud

Download Pdf Manuals

image

Related Search

Related Contents

SKP16C62P Tutorial 1  M-Cab 7300096 loudspeaker  Display interattivo con penna Guida per l`utente  Samsung Galaxy 盖乐世 S6 edge 全网通 用户手册  Easypix EasyPhone EP5 4GB Multi  

Copyright © All rights reserved.
Failed to retrieve file