RFID讀寫模塊Wince開發指南

支持RFID讀(dú)寫模塊(kuài)在Wince5.0和Wince6.0系統應用

目錄
簡介
RFID模塊選型
RFID模塊Wince API-基礎函數
RFID模塊Wince API-ISO14443A函數
RFID模塊Wince API-CPU卡函數
RFID模塊Wince API-ISO14443B函數
RFID模塊Wince API-ISO15693函數

友我科技高頻RFID讀寫模塊集成瞭原裝進口的高性能射頻芯片 ,配以多重硬件和軟件保護,運行穩定可靠。公司在多年的射頻開發和現場經驗上,不斷地完善和開發出新的RFID産品,以适應各個行業和平台的使用需求。這些RFID模塊支持ISO14443-A Mifare One S50,S70,UltraLight,MifarePro,ISO14443-B SR176, ISO15693 ,I CODE SL2 和其他相關兼容卡片。針對WINCE系統,我們發布瞭yw20x.dll,方便工程師将友我科技的模塊潛入到wince系統中。

目前,友我科技的模塊和wince動态庫yw20x.dll可以使用在wince5.0和wince6.0,net frame 2.0及以上的系統環境。同時,友我科技爲客戶提供網絡tcpip的wince解決方案和動态庫dll,相關需求請聯系客服。

RFID模塊型号列表

型号

支持卡協議

供電電壓

接口

尺寸
(mm)

支持卡片

YW-201

ISO14443A

+5V

IIC,UART(TTL)

20*40

Mifare S50,S70,CPU

YW-201C

ISO14443A

+5V

IIC,UART(TTL)

60*60

Mifare S50,S70,CPU

YW-201C3

ISO14443A

+3.3V

IIC,UART(TTL)

60*60

Mifare S50,S70,CPU

YW-202

ISO14443A
ISO14443B

+5V

IIC,UART(TTL)

20*40

Mifare S50,S70,CPU,SR512

YW-202C

ISO14443A
ISO14443B

+5V

IIC,UART(TTL)

60*60

Mifare S50,S70,CPU,SR512

YW-203

ISO15693

+5V

IIC,UART(TTL)

20*40

ICode,TagIT,, MB89R118B

YW-203C

ISO15693

+5V

IIC,UART(TTL)

60*60

ICode,TagIT,, MB89R118B

YW-204

ISO14443A
ISO14443B
ISO15693

+5V

IIC,UART(TTL)

20*40

Mifare S50,S70,CPU,SR512, ICode,TagIT,, MB89R118B

YW-204C

ISO14443A
ISO14443B
ISO15693

+5V

IIC,UART(TTL)

60*60

Mifare S50,S70,CPU,SR512, ICode,TagIT,, MB89R118B

YW-401

ISO14443A

+3.3V

IIC,UART(TTL)

38*38

Mifare S50,S70,CPU

YW-411

ISO14443A

+3.3V

UART(TTL)

45*45

Mifare S50,S70

1 RFID模塊Wince API-基礎函數

1.1 DES加解密函數
方法:public static extern int DES(byte cModel, byte[] pkey, byte[] pInData, byte[] pOutData);
參數列表:


參數

類型

方向

說明

cModel

byte

IN

DES方式:
0x00->加密
0x01->解密

pkey

byte[]

IN

DES 密鑰(yào)(8 bytes)

pInData

byte[]

IN

原始數(shù)據(jù)(8 bytes)

pOutData

byte[]

OUT

加密後(hòu)的數據(jù)(8 bytes)

返回值:0x01->成功,<=0 失敗(bài)

1.2 3DES加解密函數
方法:public static extern int DES3(byte cModel, byte[] pKey, byte[] pInData, byte[] pOutData);
參數列表:

參數

類型

方向

說明

cModel

byte

IN

DES方式:
0x00->加密
0x01->解密

pkey

byte[]

IN

DES密鑰(yào)(16 bytes)

pInData

byte[]

IN

原始數(shù)據(jù)(8 bytes)

pOutData

byte[]

OUT

加密後(hòu)的數據(jù)(8 bytes)

返回值:0x01->成功,<=0 失敗(bài)

1.3 帶向量的3DES加解密函數
方法:public static extern int DES3_CBC(byte cModel, byte[] pKey,byte[] pInData, byte[] pOutData, byte[] pIV);
參數列表:

參數

類型

方向

說明

cModel

byte

IN

DES方式:
0x00->加密
0x01->解密

pkey

byte[]

IN

DES 密鑰(yào)(16 bytes)

pInData

byte[]

IN

原始數(shù)據(jù)(8 bytes)

pOutData

byte[]

OUT

加密後(hòu)的數據(jù)(8 bytes)

pIV

byte[]

IN

Vector(8 bytes)

返回值:0x01->成功,<=0 失敗(bài)

1.4 打開串口
方法:public static extern int YW_ComInitial(int PortIndex, int Baud);
參數列表:

參數

類型

方向

說明

PortIndex

int

IN

串口号

Baud

int

IN

波特率

返回值:0x01->成功 ,<=0 失敗(bài)

1.5 關串口
方法:public static extern int YW_ComFree()
參數列表:None

返回值:0x01->成功,<=0 失敗(bài)

1.6 修改模塊波特率
方法 :public static extern int YW_ComNewBaud(int NewBaudIndex);
參數列表:

參數

類型

方向

說明

NewBaudIndex

int

IN

0x00->9600
0x01->19200
0x02->38400
0x03->57600
0x04->115200

返回值:0x01->成功,<=0 失敗(bài)

1.7 開關模塊射頻天線
方法:public static extern int YW_AntennaStatus(bool AntOpen,bool AutoRequest)
參數列表:

參數

類型

方向

說明

AntOpen

bool

IN

True: 開天線
False: 關天線;

AutoRequest

bool

IN

是否自動(dòng)尋卡,wince系統請(qǐng)設置成false

返回值 :0x01->成功 ,<=0 失敗(bài)

1.8 尋卡類型設置
方法 :public static extern int YW_SearchCardMode(byte Mode);
參數列表:

參數

類型

方向

說明

Mode

byte

IN

0x41‐類型 A(0x41)
0x42‐類型B(0x42)
0x31 –ISO15693(0x31)
0x53‐SR512

返回值:0x01->成功,<=0 失敗(bài)

1.9 寫模塊内存
方法:public static extern int YW_WriteReaderMemory(int AddrBegin, int DataLen, byte[] Data)
參數列表:

參數

類型

方向

說明

AddrBegin

int

IN

起始地址

DataLen

int

IN

數據長度

Data

byte[]

IN

數據

返回值 :0x01->成功,<=0 失敗(bài)

1.10 讀模塊内存
方法:public static extern int YW_ReadReaderMemory(int AddrBegin, int DataLen, byte[] DataRead);
參數列表:

參數

類型

方向

說明

AddrBegin

int

IN

起始地址

DataLen

int

IN

數據長度

Data

byte[]

OUT

數據

返回值:0x01->成功,<=0 失敗(bài)

1.11 模塊休眠,任何指令可以激活
方法:public static extern int YW_ModuleSleep()
參數列表:None

返回值 :0x01->成功,<=0 失敗(bài)

1.12 獲取IIC地址
方法:public static extern int YW_ GetIICAddr ();
參數列表:None

<=0 失敗, >0 IIC 地址

1.13 設置IIC地址
方法:public static extern int YW_SetIICAddr(byte IICAddr);
參數列表:

參數

類型

方向

說明

IICAddr

byte

IN

新的IIC地址

返回值:0x01->成功,<=0 失敗(bài)

2 RFID模塊Wince API-ISO14443A函數

2.1 ISO14443A 尋卡
方法:public static extern int YW_RequestCard(byte CardMode, byte[] CardNo,byte[] OtherInfo);
參數列表:

參數

類型

方向

說明

CardMode

byte

IN

0x00: 所有卡
0x01: 激活的卡

CardNo

byte[]

OUT

卡号.

OtherInfo

byte[]

OUT

其他信息

<=0 失敗, else 返回值 value(>0) is the length of CardNo.

2.2 讀M1卡塊數據
方法:public static extern int YW_ReadaBlock(byte KeyAB,byte KeyMode,byte KeyIndx, byte[] Key, int BlockAddr, byte[] pData)
參數列表:

參數

類型

方向

說明

KeyAB

byte

IN

0x00: Key A
0x01: Key B

KeyMode

byte

IN

0x00: 命令密鑰
0x01: 系統密鑰

KeyIndx

byte

IN

如果採用系統密鑰 KeyIndx =0 to 31
如果採用命令密鑰KeyIndx=0

Key

byte[]

IN

命令密鑰(yào)6 bytes.

BlockAddr

int

IN

pData

byte[]

OUT

16 bytes 數據

返回值:0x01->成功,<=0 失敗(bài)

2.3 寫M1卡塊數據
方法:public static extern int YW_ WriteaBlock (byte KeyAB,byte KeyMode,byte KeyIndx, byte[] Key, int BlockAddr, byte[] pData);
參數列表:

參數

類型

方向

說明

KeyAB

byte

IN

0x00: Key A
0x01: Key B

KeyMode

byte

IN

0x00: 命令密鑰
0x01: 系統密鑰

KeyIndx

byte

IN

如果採用系統密鑰 KeyIndx =0 to 31
如果採用命令密鑰KeyIndx=0

Key

byte[]

IN

命令密鑰(yào)6 bytes.

BlockAddr

int

IN

pData

byte[]

IN

16 bytes 數據

返回值:0x01->成功,<=0 失敗(bài)

2.4 讀M1卡扇區數據
方法:public static extern int YW_ ReadSector (byte KeyAB,byte KeyMode,byte KeyIndx, byte[] Key, int SectorAddr, byte[] pData);
參數列表:

參數

類型

方向

說明

KeyAB

byte

IN

0x00: Key A
0x01: Key B

KeyMode

byte

IN

0x00: 命令密鑰
0x01: 系統密鑰

KeyIndx

byte

IN

如果採用系統密鑰 KeyIndx =0 to 31
如果採用命令密鑰KeyIndx=0

Key

byte[]

IN

命令密鑰(yào)6 bytes.

SectorAddr

int

IN

扇區号

pData

byte[]

OUT

64 bytes 數據

返回值:0x01->成功,<=0 失敗(bài)

2.5 M1卡初始化爲錢包(值)
方法:public static extern int YW_InitiaPurse(byte KeyAB,byte KeyMode,byte KeyIndx, byte[] Key,int BlockAddr, int IniMoney);
參數列表:

參數

類型

方向

說明

KeyAB

byte

IN

0x00: Key A
0x01: Key B

KeyMode

byte

IN

0x00: 命令密鑰
0x01: 系統密鑰

KeyIndx

byte

IN

如果採用系統密鑰 KeyIndx =0 to 31
如果採用命令密鑰KeyIndx=0

Key

byte[]

IN

命令密鑰(yào)6 bytes.

BlockAddr

int

IN

塊号

IniMoney

int

IN

初始值

返回值:0x01->成功,<=0 失敗(bài)

2.6 M1卡讀錢包(值)
方法:public static extern int YW_ ReadPurse (byte KeyAB,byte KeyMode,byte KeyIndx, byte[] Key,int BlockAddr, ref int Money);
參數列表:

參數

類型

方向

說明

KeyAB

byte

IN

0x00: Key A
0x01: Key B

KeyMode

byte

IN

0x00: 命令密鑰
0x01: 系統密鑰

KeyIndx

byte

IN

如果採用系統密鑰 KeyIndx =0 to 31
如果採用命令密鑰KeyIndx=0

Key

byte[]

IN

命令密鑰(yào)6 bytes.

BlockAddr

int

IN

塊号

Money

Ref int

OUT

返回值:0x01->成功,<=0 失敗(bài)

2.7 M1卡充值錢包(加值)
方法:public static extern int YW_IncPurse( (byte KeyAB,byte KeyMode,byte KeyIndx, byte[] Key,int BlockAddr, int Money);
參數列表:

參數

類型

方向

說明

KeyAB

byte

IN

0x00: Key A
0x01: Key B

KeyMode

byte

IN

0x00: 命令密鑰
0x01: 系統密鑰

KeyIndx

byte

IN

如果採用系統密鑰 KeyIndx =0 to 31
如果採用命令密鑰KeyIndx=0

Key

byte[]

IN

命令密鑰(yào)6 bytes.

BlockAddr

int

IN

塊号

Money

int

IN

返回值:0x01->成功,<=0 失敗(bài)

2.8 M1卡消費錢包(減值)
方法:public static extern int YW_DecPurse( (byte KeyAB,byte KeyMode,byte KeyIndx, byte[] Key,int BlockAddr, int Money);
參數列表:

參數

類型

方向

說明

KeyAB

byte

IN

0x00: Key A
0x01: Key B

KeyMode

byte

IN

0x00: 命令密鑰
0x01: 系統密鑰

KeyIndx

byte

IN

如果採用系統密鑰 KeyIndx =0 to 31
如果採用命令密鑰KeyIndx=0

Key

byte[]

IN

命令密鑰(yào)6 bytes.

BlockAddr

int

IN

塊号

Money

int

IN

返回值:0x01->成功,<=0 失敗(bài)

2.9 備份錢包(值)
方法:public static extern int YW_BakPurse(byte KeyAB,byte KeyMode,byte KeyIndx, byte[] Key,int SrcBlockAddr, int DesBlockAddr);
參數列表:

參數

類型

方向

說明

KeyAB

byte

IN

0x00: Key A
0x01: Key B

KeyMode

byte

IN

0x00: 命令密鑰
0x01: 系統密鑰

KeyIndx

byte

IN

如果採用系統密鑰 KeyIndx =0 to 31
如果採用命令密鑰KeyIndx=0

Key

byte[]

IN

命令密鑰(yào)6 bytes.

SrcBlockAddr

int

IN

原塊号

DesBlockAddr

int

IN

目的塊号
原塊号和目的塊号必須在同一個扇區

返回值:0x01->成功,<=0 失敗(bài)

2.10 卡Halt
方法:public static extern int YW_Halt_();
參數列表:None

返回值:0x01->成功,<=0 失敗(bài)

2.11 下載密鑰
方法:public static extern int YW_DownKey(int KeyIndex, byte[] Key);
參數列表:

參數

類型

方向

說明

KeyIndex

byte

IN

0 to 31,密鑰(yào)序号

Key

byte[]

IN

6 Bytes, 系統(tǒng)密鑰(yào)

返回值:0x01->成功,<=0 失敗(bài)

2.12 UltraLight讀數據
方法:public static extern int YW_M401UL_Read(byte Block, byte[] pData)
參數列表:

參數

類型

方向

說明

Block

 byte

IN

塊号

pData

byte[]

OUT

塊數據

返回值:0x01->成功,<=0 失敗(bài)

2.13 UltraLight寫數據
方法:public static extern int YW_M401UL_ Write (byte Block, byte[] pData);
參數列表:

參數

類型

方向

說明

Block

 byte

IN

塊号

pData

byte[]

IN

塊數據

返回值:0x01->成功,<=0 失敗(bài)

RFID讀寫器,SDK,IC卡讀卡器,開發包,二次開發,智能卡讀卡器,RFID讀卡器,CPU卡讀寫器,讀卡模塊
北京友我科技有限公司 版權所有 (C)2015-2015
客戶服務中心信箱:coodor#126.com(将#改爲@).客戶服務MSN: coodor#126.com(将#改爲@)
熱線直撥: 010-57049038 18910685939 QQ: 896163157,1403463073
京ICP備14016005号
友我科技


1
RFID讀寫器産品手冊下載
2
讀寫器開發SDK下載
3
WEB讀卡器開發指南
4
Windows讀卡器開發指南
5
Android讀卡器開發指南
6
Wince讀卡器開發指南
7
PLC讀卡器開發指南
8
Linux讀卡器開發指南
9
單片機讀卡器開發指南
10
PCSC讀卡器開發指南