SonMicro Electronics Revision A.1 Oct, 2007
SM130
SM132-USB
Software Development Kit
-
SDK
C#.NET Mifare Class Library
USER MANUAL
Compatible with
.NET COMPACT FRAMEWORK 2.0
Mifare SDK for .NET Framework 2.0 – User Manual
SonMicro Electronics Revision A.1 Oct, 2007
2
EVALUATION / DEVELOPMENT KIT .................................................................... 3
1. INTRODUCTION ................................................................................................. 4
1.1
Supported Devices .......................................................................................................................... 4
2. PROCEDURES AND FUNCTIONS ..................................................................... 5
2.1 OpenPort .................................................................................................................................................... 6
2.2 ClosePort .................................................................................................................................................... 6
2.3 CMD_ResetDevice .................................................................................................................................. 7
2.4 CMD_SelectTag ........................................................................................................................................ 8
2.5 CMD_Authenticate ............................................................................................................................... 10
2.6 CMD_Halt ................................................................................................................................................. 12
2.7 CMD_ReadBlock .................................................................................................................................... 13
2.8 CMD_WriteBlock .................................................................................................................................... 15
2.9 CMD_ReadValue ................................................................................................................................... 17
2.10 CMD_WriteValue ................................................................................................................................. 19
2.11 CMD_IncrementValue ....................................................................................................................... 21
2.12 CMD_DecrementValue ..................................................................................................................... 23
2.13 CMD_SwitchRF ...................................................................................................................................... 25
3. SALES AND SERVICE INFORMATION ........................................................... 26
Mifare SDK for .NET Framework 2.0 – User Manual
SonMicro Electronics Revision A.1 Oct, 2007
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:
http://www.sonmicro.com/shop/shop3.php
Figure 1 – SM1013 Evaluation Kit – Deluxe
Figure 2 – SM132-USB – USB Mifare Reader
Mifare SDK for .NET Framework 2.0 – User Manual
SonMicro Electronics Revision A.1 Oct, 2007
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 to 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
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:
- SM130 Mifare Module
- SM132-USB Mifare Reader (Integrated with Serial-to-USB interface and PCB antenna)
Supported Development kits:
- SM1013 Eval. kit for SM130
- SM1013USB 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.
Mifare SDK for .NET Framework 2.0 – User Manual
SonMicro Electronics Revision A.1 Oct, 2007
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 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. Timer1
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.