Home

NET SDK User Manual

image

Contents

1. Use E2prom block15 KeyA AuthSource sm_mifare_lib mifare E2promKeyB 15 Use E2prom block15 KeyB Authenticate if sm132 CMD_Authenticate AuthSource Key BlockNo out ReturnCode textBoxl Text Authentication Success else if ReturnCode 0x4E N textBoxl Text No Tag or Login failed Error Code ReturnCode ToString X2 else if ReturnCode 0x55 textBoxl Text Login failed Error Code ReturnCode ToString X2 else if ReturnCode 0x45 textBoxl Text Invalid Key Format Error Code ReturnCode ToString X2 else if ReturnCode 0 textBoxl Text Communication Error Error Code ReturnCode ToString X2 else textBoxl Text Unknown Error Error Code ReturnCode ToString X2 SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 12 2 6 CMD_Halt This function executes a Halt command on Mifare Tag If the Mifare Tag is selected then after a halt commana all Select Authentication commands needs to be repeated for new operations bool CMD_Halt out byte ReturnCode ReturnCode If the Halt operation is not successful CMD_Halt will return false and the error code can be investigate by this parameter Arguments Possible Return Code 0x00 Communication Error 0x55 UT Halt failed due to RF Field is OFF True Halt command is successful Returns False Halt
2. I Invalid Value Block Returns True Decrement Value operation is successful False Decrement Value operation is not successful SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 24 Example sm_mifare_lib mifare sm132 new sm mifare_lib mifare byte BlockNo 0 long DecValue 0 long NewValue 0 byte ReturnCode 0 BlockNo byte Parse cmb_RWBlockNo Text DecValue Int32 Parse t_IncDec Text if sm132 CMD_DecrementValue BlockNo DecValue out NewValue out ReturnCode textBoxl Text Decrement is successfull textBox_S Text textBox1 Text t_ReadValue Text NewValue ToString else Decrement Value not successful if ReturnCode 0x4E N textBoxl Text No Tag found Error Code ReturnCode ToString X2 else if ReturnCode 0x46 F textBoxl Text Read Failed during verif Error Code ReturnCode ToString X2 else if ReturnCode 0x49 I textBoxl Text Invalid Value Block Error Code ReturnCode ToString X2 else textBoxl Text Communication Error Error Code ReturnCode ToString X2 textBox_S Text textBoxl Text SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 25 2 13 CMD_SwitchRF This Command turns ON or OFF the RF field RF field can be switched off when it is not required This helps to reduce the ac
3. Operating systems other than Microsoft Windows is not supported currently For non windows operating systems communication between the module and the PC Controller can be implemented at low level by managing serial port with the protocol explained in device datasheet 1 1 Supported Devices Mifare SDK supports the following devices M130 Mifare Module M132 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 SM132USB can be downloaded at our web site SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 5 2 PROCEDURES AND FUNCTIONS It is assumed that developer has learn 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 s User Manual documents All commands sent from host PC have immediate response from the Mifare device However there are two response type that Mifare device can send to host while host not requesting These are 1 When
4. ReturnCode 0x46 F textBoxl Text Write Failed Error Code ReturnCode ToString X2 else if ReturnCode 0x58 X textBoxl Text Unable to read after write Error Code ReturnCode ToString X2 else if ReturnCode 0x55 U textBoxl Text Read after write failed Error Code ReturnCode ToString X2 else textBoxl Text Communication Error Error Code ReturnCode ToString X2 textBox_S Text textBox1l Text SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 21 2 11 CMD_IncrementValue This function sends Increment Value command to the mifare device To Increment a value block successfully prior Select Tag and Authentication commands needs to be successful and the format of the block should be a value block in other words the block should have been written value with CMD_WriteValue previously User can select desired increment quantity Application Hint Before performing any read write value operations on a Mifare Tag the tag should be selected first Then the given block needs to be authenticated Value block is a special formatted block and one of Mifare s most important features User can write and read 4 byte signed number to these blocks There are also Increment and Decrement Value commands These commands can add to or subtract from the value block with the determined amount with just one command Mifare tag will handl
5. command is not successful See ReturnCode Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte ReturnCode 0 if sml 32T CMD Halt out ReturnCode textBoxl Text Halt successfull else Halt not successful if ReturnCode 0x55 U textBoxl Text Halt not successfull Error Code ReturnCode ToString X2 else textBoxl Text Communication Error Error Code ReturnCode ToString X2 SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 13 2 7 CMD_ReacdBlock This function sends Read Block Command to the mifare device To Read a block successfully prior Select Tag and Authentication commands needs to be successful Read Block command will read 16 bytes from the specified block Read will be successful only if the given block is authenticated successfully Application Hint Before performing any read write value operations on a Mifare Tag the tag should be selected first Then the given block needs to be authenticated Mifare Classic 1K and 4K blocks consist of 16 bytes data There are 64 blocks 0 63 for Mifare 1K and 256 blocks 0 255 for Mifare 4K tags bool CMD_ReadBlock byte BlockNo out byte BlockData out byte ReturnCode BlockNo Block number to be read BlockData Includes 16 BYTE data of Mifare Block BlockData 0 BlockData 15 ReturnCode If the Read Block command is not successf
6. module resets or power on it sends Firmware Version information to the host 2 When Seek For Tag command is used module will send Tag data as soon as a Tag enters in to the field For both of these situations host needs to check if there is any unread data in serial port input buffer In the example C project this is done by using a timer Timer checks every 500ms if there is unread data at input buffer of the serial port User can develop or modify the code found in Timer Event according to his her needs and take necessary actions according to one of two response type SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 6 2 1 OpenPort This function will open selected port Port needs to be opened before communicating with the Mifare device bool OpenPort string PortName int BaudRate Avguments PortName Port number to be opened g BaudRate Baud rate setting of the port True If port is open ReboEne False If port could not be opened Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare if sm132 OpenPort comboBoxl Text 19200 textBoxl Text Port is initialized and opened timerl Enabled true else textBoxl Text Port could not be opened 2 2 ClosePort This function will close the serial port void ClosePort Arguments None Returns none Example sm_mifar
7. not be used as Value blocks Any other blocks can be used as Value blocks To format a block for Value operation CMD_WriteValue should have been used at first bool CMD_WriteValue byte BlockNo long Value out byte ReturnCode BlockNo Block number to be written with Value Value 4 Byte signed integer value will be written in the block ReturnCode If the Write Value command is not successful then the error code will be passed to this parameter Arguments Possible Return Code 0x00 Communication Error Ox4E N No Tag present 0x46 EF Write Failed 0x55 U Read after write failed 0x58 xX Unable to read after write True Write Value operation is successful Returns False Write Value operation is not successful SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 20 Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte BlockNo 0 long Value 0 byte ReturnCode 0 BlockNo byte Parse cmb_RWBlockNo Text Value Int32 Parse t_WriteValue Text if sm132 CMD_WriteValue BlockNo Value out ReturnCode textBoxl Text Write Value is Successfull textBox_S Text textBox1 Text t_ReadValue Text Value ToString j else WriteValue not successful if ReturnCode 0x4E N textBoxl Text No Tag found Error Code ReturnCode ToString X2 else if
8. to Sector Trailer is not allowed with this function ReturnCode ToString X2 else textBoxl Text Communication Error Error Code ReturnCode ToString X2 textBox_S Text textBoxl Text SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 17 2 9 CMD_ReadValue This function sends Read Value command to the mifare device To Read a value block successfully prior Select Tag and Authentication commands needs to be successful and the format of the block should be value block in other words the block should have been written value with CMD_WriteValue previously Application Hint Before performing any read write value operations on a Mifare Tag the tag should be selected first Then the given block needs to be authenticated Value block is a special formatted block and one of Mifare s most important features User can write and read 4 byte signed number to these blocks There are also Increment and Decrement Value commands These commands can add to or subtract from the value block with the determined amount with just one command Mifare tag will handle addition and subtraction routines Every sector have a special block called Sector Trailer Sector trailer block includes the access conditions and key password information of the blocks that belongs to that sector Block 0 of the Mifare Tag where Mifare Serial number is stored and the Sector Trailer Blocks c
9. Er INA Aa else Read not successful if ReturnCode 0x4E N textBoxl Text No Tag found Error Code ReturnCode ToString X2 else if ReturnCode 0x46 F textBoxl Text Read Failed ReturnCode ToString X2 else textBoxl Text Communication Error Error Code ReturnCode ToString X2 textBox_S Text textBox1l Text SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 15 2 8 CMD_WriteBlock This function sends Write Block command to the mifare device To write a block successfully prior Select Tag and Authentication commands needs to be successful Write Block command will write 16 bytes to the specified block Write will be successful only if the given block is authenticated successfully Writing to sector trailer blocks last block at each sector is not allowed with this function to prevent locking the Tag mistakenly that can happen if user does not have basic information for Mifare applications Application Hint Before performing any read write value operations on a Mifare Tag the tag should be selected first Then the given block needs to be authenticated Mifare Classic 1K and 4K blocks consist of 16 bytes data There are 64 blocks 0 63 for Mifare 1K and 256 blocks 0 255 for Mifare 4K tags bool CMD_WriteBlock byte BlockNo byte BlockData out byte ReturnCode BlockNo Block number to be written BlockDa
10. Parse t_B7 Text System Globalization NumberStyles HexNumber BlockData 7 byte Parse t_B8 Text System Globalization NumberStyles HexNumber BlockData 8 byte Parse t_B9 Text System Globalization NumberStyles HexNumber BlockData 9 byte Parse t_B10 Text System Globalization NumberStyles HexNumber BlockData 10 byte Parse t_B11 Text System Globalization NumberStyles HexNumber BlockData 11 byte Parse t_B12 Text System Globalization NumberStyles HexNumber BlockData 12 byte Parse t_B13 Text System Globalization NumberStyles HexNumber BlockData 13 byte Parse t_B14 Text System Globalization NumberStyles HexNumber BlockData 14 byte Parse t_B15 Text System Globalization NumberStyles HexNumber BlockData 15 byte Parse t_B16 Text System Globalization NumberStyles HexNumber if sm132 CMD_WriteBlock BlockNo BlockData out ReturnCode textBoxl Text Write is Successfull textBox_S Text textBoxl1 Text else Write not successful if ReturnCode 0x4E N textBoxl Text No Tag found Error Code ReturnCode ToString X2 else if ReturnCode 0x46 F textBoxl Text Write Failed ReturnCode ToString X2 else if ReturnCode 0x55 U textBoxl Text Read after write Failed ReturnCode ToString X2 else if ReturnCode 0x58 X textBoxl Text Unable to read after write ReturnCode ToString X2 else if ReturnCode 0x01 textBoxl Text Writing
11. SM130 SM132 USB ONMiIcROoO 7 N Software Development Kit SDK C NET Mifare Class Library USER MANUAL Compatible with NET COMPACT FRAMEWORK 2 0 SonMicro Electronics Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 2 EVALUATION DEVELOPMENT KIT ccccccceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 3 1 INTRODUCTION usunie ninenin ni nnmis pik aint phat td anaamini ais 4 1 1 Supported DEvViCeS sesessscssscecssesesescscecsceoscscscscscsssessoececeoscecscsoscscscscscscsesesescscecscecssssscecsesesesesessse 4 2 PROCEDURES AND FUNCTIONS so vicicssinnsiccniaasscuetoaiienstnisnasndundasdnieananseanndoesninte 5 ZiT OPENPO ananin AO ANASO 6 2 2 OTA Lo EE E A E A A E OA A 6 2 3 CMD_ResetDeViCE siscisseisscdsssusnstussaaiassnccencssleudnsiestnysaisuansoatbeoasschasucdacdansvancGesdeasedevegssaisucinatssdbeossuanesbsases 7 24 CMD SOS CI AG sescece ssnsexsaseicasiescesotsetesvuctoscecenseseasusssocvoeasesensestasoecaedsseaseateeansansosvacentessabessnsoitesteasusesingeidatss 8 2 5 CMD_Authenticate secasscivecinsscisuesssstsvenssicssssadiseineasisadesiositccasasdanscnoednssckhushsnesssstensnsnses snastashndstsausedeusarnanens 10 2 6 CMD_HaAlt cccscssssssssssssssssssssssessssssesesesssssnsssnssssssscesssssssesesssesssessssssssssesesesssesessssssssssscesssesesesesesesessssenes 12 2 7 CMD_RECCBIOCK sssssssssscssssssssssssesessesesesssssesssensesessssacsssssssesesessesssessssosesesscacassse
12. ct 2007 Mifare SDK for NET Framework 2 0 User Manual 4 1 INTRODUCTION This document explains usage of SonMicro Mifare class library written in C C Sharp for NET applications Classes were written in NET Compact Framework 2 0 environment so that the C library can also be used in mobile applications that are running Windows CE Windows Mobile operating systems For developer environments other than NET Such as Delphi Visual Basic etc SonMicro serves ActiveX Library that can be used in wide range of IDE Please refer SM13X_SDK document for ActiveX library which can be found at our web site Users can quickly add Mifare functions to existing software or create new software for Mifare applications easily with the provided library Mifare 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 occurring between the device and the computer Mifare library will handle with that Communication channel is based on Com Port of the Computer Mobile Device Mifare library can also reliably be used with a virtual com port or the USB Serial converters It is strongly recommended for users who are strange fo Mifare first read about Mifare basics Brief information for Mifare and its application can be found in User Manual file at our web page http www sonmicro com 1356 d1356 php
13. e addition and subtraction routines Every sector have a special block called Sector Trailer Sector trailer block includes the access conditions and key password information of the blocks that belongs to that sector Block 0 of the Mifare Tag where Mifare Serial number is stored and the Sector Trailer Blocks could not be used as Value blocks Any other blocks can be used as Value blocks To format a block for Value operation CMD_WriteValue should have been used at first bool CMD_IncrementValue byte BlockNo long IncValue out long NewValue out byte ReturnCode BlockNo Block number to be incremented Value 4 Byte signed integer value to be added incremented to existing value in the block NewValue 4 Byte signed integer value final value after increment is done arguments ReturnCode If the Increment Value command is not successful then the error code will be passed to this parameter Possible Return Code 0x00 Communication Error Ox4E N No Tag present 0x46 F Read Failed during verification 0x49 I Invalid Value Block Returns True Increment Value operation is successful False Increment Value operation is not successful SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 22 Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte BlockNo 0 long IncValue 0 long NewValue 0 b
14. e_lib mifare sm132 new sm_mifare_lib mifare sm132 ClosePort SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 7 2 3 CMD_ResetDevice This function sends reset command to the mifare device Device will reset itself and sends the firmware version information to the PC in a second bool CMD_ResetDevice out string Firmware Firmware Firmware version information will be passed to Arguments i this variable Returns True Reset operation is successful False Reset operation is not successful Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare string Firmware if sm132 CMD_ResetDevice out Firmware textBoxl Text Firmware else textBoxl Text Error Expecting Firmware Version SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 8 2 4 CMD_SeleciTag This function sends Select Tag command to the mifare device Serial number and type of the tag will return if the tag is in the RF field at that time Application Hint Before performing any read write value operations on a Mifare Tag the tag should be selected first For a tag to be selected it should be in the RF Field For Mifare 1K and Mifare 4K tags authentication process should follow the select operation in order to read write value operations on the tag s blocks Select operation can be done in two wa
15. f ReturnCode 0x49 I textBoxl Text Invalid Value Block Error Code ReturnCode ToString X2 else textBoxl Text Communication Error Error Code ReturnCode ToString X2 textBox_S Text textBoxl Text SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 19 2 10 CMD_WriteValue This function sends Write Value command to the mifare device To write a value block successfully prior Select Tag and Authentication commands needs to be successful CMD_WriteValue command will format the determined block for value operation with the given Value Application Hint Before performing any read write value operations on a Mifare Tag the tag should be selected first Then the given block needs to be authenticated Value block is a special formatted block and one of Mifare s most important features User can write and read 4 byte signed number to these blocks There are also Increment and Decrement Value commands These commands can add to or subtract from the value block with the determined amount with just one command Mifare tag will handle addition and subtraction routines Every sector have a special block called Sector Trailer Sector trailer block includes the access conditions and key password information of the blocks that belongs to that sector Block 0 of the Mifare Tag where Mifare Serial number is stored and the Sector Trailer Blocks could
16. ifferent type of authentication conditions and keys There are three types of Authentication source 1 Mifare Default If this option is selected then the Authentication will be done with KeyA and the key OxFF OxFF OxFF OxFF OxFF OxFF Mifare tags coming from the factory can be accessed by this way 2 Provided Key If this option is selected then user can determine the Key Type KeyA or KeyB then determine the 6 byte key 3 E2prom SM13X have internal memory to keep 16 sets of Key Each set memory block have KeyA and KeyB keys User can select one of these keys and determine the key type to be used Once key is burned to SM13X internal memory they cannot be read again so it is useful to store special keys without revealing them bool CMD_Authenticate byte AuthSource byte Key byte BlockNo out byte ReturnCode AuthSource Determines Authentication source and type OxFF Mifare Default KeyA FF FF FF FF FF FF OxAA Provided Key KeyA Key is in Key array below OxBB Provided Key KeyB Key is in Key array below 0x10 E2PROM KeyA E2prom Internal Block 0 0x11 E2PROM KeyA E2prom Internal Block 1 Ox1F E2PROM KeyA E2prom Internal Block 15 0x20 E2PROM KeyB E2prom Internal Block 0 0x21 E2PROM KeyB E2prom Internal Block 1 Arguments Ox2F E2PROM KeyB E2prom Internal Block 15 Key 6 Byte Key if AuthSource is OxAA or OxBB BlockNo Block number of Mifare Tag to be authenticated ReturnCode If the A
17. needs to be authenticated Value block is a special formatted block and one of Mifare s most important features User can write and read 4 byte signed number to these blocks There are also Increment and Decrement Value commands These commands can add to or subtract from the value block with the determined amount with just one command Mifare tag will handle addition and subtraction routines Every sector have a special block called Sector Trailer Sector trailer block includes the access conditions and key password information of the blocks that belongs to that sector Block 0 of the Mifare Tag where Mifare Serial number is stored and the Sector Trailer Blocks could not be used as Value blocks Any other blocks can be used as Value blocks To format a block for Value operation CMD_WriteValue should have been used at first bool CMD_DecrementValue byte BlockNo long DecValue out long NewValue out byte ReturnCode BlockNo Block number to be decremented Value 4 Byte signed integer value to be substracted decremented from the existing value in the block NewValue 4 Byte signed integer value final value after decrement is performed Arguments ReturnCode If the Decrement Value command is not successful then the error code will be passed to this parameter Possible Return Code 0x00 Communication Error Ox4E N No Tag present 0x46 EF Read Failed during verification 0x49
18. nsesesesesscesssossosesees 13 2 8 CMD _WriteBloCK sssesscseesecesecessrecssecossissccssconssecsrsesscssuseoecssecses cvrecorecsactssessscosesesescssacessecocccsssessresesess 15 PAD e fo hrdo LEI E E E A A E 17 2 10 CMD WATS VIG asicsicssccesassussessanensonstdentensas nvansadinessiiessisessuestsaaiesdivevntestod nves ansbeeseankaciQadeiicedsiassiesssseuiies 19 2 11 CMD_INCreMentVAlUG ccssssssssscssesesesssssesssessesesesssnsesessssesesesssesssessssesesesesssarssessesesesesssesesessesesess 21 2 12 CMD_DecrementValue sissies sesisscisecsenstensccisctnscescainedentusasenscitusassasbedaoucssoososdanachenstivsen sitncuetdadnedandaveaiond 23 2 13 CMD_SWIICHKRP sssscssssssssssssssssessssssssssssssssssssscesssesssesssssssssssssssssssesesesesssesssessssssssesesesesesesessnsesessenes 25 3 SALES AND SERVICE INFORMATION cccccccesseeeseeeeeeeeeeeeeseeeesseeeeeeeeeees 26 SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 3 EVALUATION DEVELOPMENT KIT For a 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 or it can be purchased separately For Online Shopping you can visit hitp www sonmicro com shop shop3 ph Figure 1 SM1013 Evaluation Kit Deluxe Figure 2 SM132 USB USB Mifare Reader SonMicro Electronics Revision A 1 O
19. ould not be used as Value blocks Any other blocks can be used as Value blocks To format a block for Value operation CMD_WriteValue should have been used at first bool CMD_ReadValue byte BlockNo out long Value out byte ReturnCode BlockNo Block number formatted as value block Value 4 Byte signed integer value written in the block ReturnCode If the Read Value command is not successful then the error code will be passed to this parameter Arguments Possible Return Code 0x00 Communication Error Ox4E N No Tag present 0x46 F Read Failed 0x49 I Invalid Value Block True Read Value operation is successful Returns False Read Value operation is not successful SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 18 Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte BlockNo 0 long Value 0 byte ReturnCode 0 BlockNo byte Parse cmb_RWBlockNo Text if sm132 CMD_ReadValue BlockNo out Value out ReturnCode textBox1l Text Value Read Successfull textBox_S Text textBox1l Text t_ReadValue Text Value ToString else ReadValue not successful if ReturnCode 0x4E N textBoxl Text No Tag found Error Code ReturnCode ToString X2 else if ReturnCode 0x46 F textBoxl Text Read Failed Error Code ReturnCode ToString X2 else i
20. rial new byte 4 byte ReturnCode 0 byte i if sm132 CMD_SelectTag out TagType out TagSerial out ReturnCode leSsaciyercil Were Wiles Iyjoeel ae Wele Woes HOsicicaline ae VY WA textBoxl Text Tag Serial em 3 Of a lt 4p aise textBoxl Text TagSerial i ToString X2 else Select not successful Mee ReturpnCodes m 0x 55 me ANE textBoxl Text RF Field is off Error Code ReturnCode ToString X2 else if ReturnCode 0 textBoxl Text Communication Error Error Code ReturnCode ToString X2 else textBoxl Text Unknown Error Error Code ReturnCode ToString X2 SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 10 2 5 CMD_ Authenticate This function sends Authentication command to the mifare device This command needs to be sent after Mifare Tag is selected with CMD_Selectlag or CMD_SeekForlag command CMD_Authenticate will return true if Authentication process is successful otherwise returns false and the error code can be read from ReturnCode parameter Application Hint Authentication is necessary to access Mifare Tag blocks To access Mifare blocks tag needs to be selected first Then authentication should follow the select operation After authentication is successful host can read and write Mifare Tag blocks of the authenticated sector Note that every sector can have d
21. ro com Sales htto www sonmicro com sales ph Support htto www sonmicro com ask ph Documents amp Software hitp www sonmicro com 1356 d1356 ohp User Forums http www sonmicro com forums SonMicro Electronics Revision A 1 Oct 2007
22. ta 16 BYTE data to be written to given block BlockData 0 BlockData 15 ReturnCode If the Write Block command is not successful then the error code will be passed to this parameter Arguments Possible Return Code 0x00 Communication Error 0x01 The given block is Sector Trailer Write failed Ox4E N No Tag present Write Failed 0x46 E Write Failed 0x55 U Read after write failed 0x58 X Unable to read after write True Write Block operation is successful Returns i False Write Block operation is not successful SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte BlockNo 0 byte BlockData new byte 16 byte ReturnCode 0 BlockNo byte Parse cmb_RWBlockNo Text BlockData 0 byte Parse t_Bl Text System Globalization NumberStyles HexNumber BlockData 1 byte Parse t_B2 Text System Globalization NumberStyles HexNumber BlockData 2 byte Parse t_B3 Text System Globalization NumberStyles HexNumber BlockData 3 byte Parse t_B4 Text System Globalization NumberStyles HexNumber BlockData 4 byte Parse t_B5 Text System Globalization NumberStyles HexNumber BlockData 5 byte Parse t_B6 Text System Globalization NumberStyles HexNumber BlockData 6 byte
23. tive current consumption The RF field can be switched ON whenever a read or write operation is required bool CMD_SwitchRF bool OnOffState out byte ReturnCode OnoffState Use True to Switch ON RF False to turn off RF ReturnCode If the Switch RF command is not successful then Arguments the error code will be passed to this parameter Possible Return Code 0x00 Communication Error Returns True Switch RF On Off operation is successful False Switch RF On Off operation is not successful Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte ReturnCode 0 if sm132 CMD_SwitchRF false out ReturnCode textBoxl Text RE Switched off elise textBoxl Text Switch Off Error Code ReturnCode ToString X2 if sm132 CMD_ SwitchRF true out ReturnCode textcBOX kex i ll RE SV Echec t Onu else textBoxl Text Switch On Error Code ReturnCode ToString X2 SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 26 3 SALES AND SERVICE INFORMATION To obtain information about SonMicro Electronics products and technical support reference the following information 0 NMICRO SonMicro ELECTRONICS LTD Cankaya M Soguksu C Aslihan Ishani 2 15 Mersin 33070 TURKIYE Phone 90 324 237 21 28 Facsimile 90 324 237 21 86 Email info sonmicro com Web Site htto www sonmic
24. ul then Arguments i the error code will be passed to this parameter Possible Return Code 0x00 Communication Error Ox4E N No Tag present 0x46 FEF Read Failed True Read Block operation is successful Returns False Read Block operation is not successful SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 14 Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte BlockNo 0 byte BlockData new byte 16 byte ReturnCode 0 BlockNo byte Parse cmb_RWBlockNo Text if sm132 CMD_ReadBlock BlockNo out BlockData out ReturnCode textBoxl Text Read Successfull textBox_S Text textBoxl Text Papi lex BlockDatal Ole LoSites ime A2 CEB2 lex BlliockDatal ME EOS Er ina AA CRBS Mexe Block Datal 2n ToS SEr Ing xe ys t_B4 Text BlockData 3 ToString X2 EBS lex BllockDatall4 loStrine xXe y ESBGwlext BllockDatallSlmloString X2 t_B7 Text BlockData 6 ToString X2 t_B8 Text BlockData 7 ToString X2 EERO plex BillockDatallis loString x2 F t_B10 Text BlockData 9 ToString X2 CAB MRTE BillockDatalll LO loString x2 r EER ext BlockDatall lis lositcimc xo EEBISslext BillockDatall ZIRO Str Ing A EB exe B lockDatal SIRTOS SErIng AXA EEBISalext BlockData MIRTO SEEING CK CEBE arexe BillockDatall lS MEOS
25. uthentication operation is not successful function will return false and the error code will be passed to this variable Possible Return Code 0x00 Communication Error 0x55 U Authentication Failed 0x45 E Invalid Key Format or Authentication Failed Ox4E N No Tag or Authentication Failed True Authentication is successful Returns False Authentication is not successful See ReturnCode SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 11 Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte AuthSource OxFF byte BlockNo byte ReturnCode byte Key new byte 6 BlockNo 14 14th Block will be authenticated Sector 3 The following Key will be used only if Provided Key option is selected Key 0 OxCC Key 1 OxCC Key 2 OxCC Key 3 OxCC Key 4 OxCC Key 5 OxCC AuthSource byte sm_mifare_lib ASource KeyTypeA AuthSource byte sm_mifare_lib Asource KeyTypeB The KeyA FF FF FF FF FF FF will be used if Mifare Default option is selected AuthSource byte sm_mifare_lib ASource KeyMifareDefault OxFF Example to Use E2PROM internal keys gt AuthSource sm_mifare_lib mifare E2promKeyA cmb_E2promBlockNo SelectedIndex AuthSource sm_mifare_lib mifare E2promKeyA 0 Use E2prom block0 KeyA AuthSource sm_mifare_lib mifare E2promKeyA 15
26. ys with CMD_SelectTag and CMD_SeekForlag CMD_Selecttag will return the result immediately If there is a tag in the field the details of the tag will return with the serial number If there is no tag in the field relevant error code will be sent In the customer application CMD_SeekForlag can be used to auto detect Mifare Tags or CMD_Selectlag command should be send periodically Response to CMD_SelectTag can be processed immediately in the calling function If CMD_SeekForTag is used then the process is done under Timer Event bool CMD_SelectTag out byte TagType out byte TagSerial out byte ReturnCode TagType Indicates the type of the tag i e Mifare 1K Mifare 4K Mifare UL TagSerial Includes 4 BYTE Serial number of the Mifare Tag at TagSerial 0 TagSerial 1 TagSerial 2 TagSerial 3 Arguments ReturnCode If the select operation is not successful CMD_Select tag will return false When CMD_SelectTag returns false the error code will be passed to this variable Possible Return Code 0x00 Communication Error Ox4E N No Tag present 0x55 U Access failed due to RF Field is OFF True Select operation is successful Returns False Select operation is not successful SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 9 Example sm_mifare_lib mifare sm132 new sm_mifare_lib mifare byte TagType byte TagSe
27. yte ReturnCode 0 BlockNo byte Parse cmb_RWBlockNo Text IncValue Int32 Parse t_IncDec Text if sm132 CMD_IncrementValue BlockNo IncValue out NewValue out ReturnCode textBoxl Text Increment is successfull textBox_S Text textBox1 Text t_ReadValue Text NewValue ToString else Increment Value not successful if ReturnCode 0x4E N textBoxl Text No Tag found Error Code ReturnCode ToString X2 else if ReturnCode 0x46 F textBoxl Text Read Failed during verif Error Code ReturnCode ToString X2 else if ReturnCode 0x49 I textBoxl Text Invalid Value Block Error Code ReturnCode ToString X2 else textBoxl Text Communication Error Error Code ReturnCode ToString X2 textBox_S Text textBoxl Text SonMicro Electronics Revision A 1 Oct 2007 Mifare SDK for NET Framework 2 0 User Manual 23 2 12 CMD_DecrementValue This function sends Decrement Value command to the mifare device To Decrement a value block successfully prior Select Tag and Authentication commands needs to be successful and the format of the block should be a value block in other words the block should have been written value with CMD_WriteValue previously User can select desired decrement quantity Application Hint Before performing any read write value operations on a Mifare Tag the tag should be selected first Then the given block

Download Pdf Manuals

image

Related Search

Related Contents

PowerBook G4 15 pulgadas Manual del usuario (Double  Stoves Richmond 1100E  Raidsonic ST1000-2-S2C-B storage enclosure  Benutzerhandbuch WBalMo4 - DHI-WASY  Electrotécnica  2 - Datatail  EXSYS EX-3516 RAID controller    LevelOne GSW-1676 16 Port Web Smart Switch  StarTech.com 12in Latching SATA Cable  

Copyright © All rights reserved.
Failed to retrieve file