MifareUltralight官方文档翻译

原文地址:http://developer.android.com/reference/android/nfc/tech/MifareUltralight.html


1. MifareUltralight  Tag结构:
轻型Tag 共64字节,分为16个page,每个page 4字节,
前4页是存放制造商,和卡片相关信息的地方,有些是一次性写入的,有些是只读的,有些是可以写入的。
剩下的12 page 是用户存放数据的地方,是可读可写的。

 2.MIFARE Ultralight C Tag 结构:

一共192字节,分为48 page ,同样是每页4字节,前四页是存放 存放制造商,和卡片相关信息的地方,有些是一次性写入的,有些是只读的,有些是可以写入的。接下来的36页是用户数据区域,可读可写,接下来四页是存放验证信息的,只读,最后四页是用来证明身份的key,不可读。
在Android NFC设备上实现MifareUltralight是可选的,如果没有实现,当调用 getTechList()时就不会列举出来,如果列举出来,那么 all MifareUltralight I/O operations都会被支持。所有MifareUltralight Tag 都是 NfcA Tag。

常量:

PAGE_SIZE:每页的大写

TYPE_ULTRALIGHTA MIFARE Ultralight tag

TYPE_ULTRALIGHT_CA MIFARE Ultralight C tag

TYPE_UNKNOWN:一个MIFARE Ultralight兼容的但是未知类型的Tag


公有方法:

close()  关闭对Tag的读写,释放资源

connect()   连接Tag,成功连接之后就能进行I/O操作

static MifareUltralight get(Tag tag)  得到给出Tag的一个MifareUltralight类型的实例。

int  getMaxTransceiveLength()        返回能被 transceive(byte[])方法发送的最大的字节数

Tag getTag() 获得Tag对象

int  getTimeout()   获得当前的 transceive(byte[])超时毫秒数

int getType() 返回MIFARE Ultralight Tag的类型

boolean isConnected() 判断I/O操作是否可以进行。

byte[]   readPages(int pageOffset) 从指定的pageOffset处读取四页(16字节的内容)

void  setTimeout(int timeout)  设置 transceive(byte[])方法的超时时间

byte[]  transceive(byte[] data)  发送NFCA 类型的数据到Tag并等待回复。

void  writePage(int pageOffset, byte[] data)  写如Tag一页内容(4字节)


通过继承的到的方法:

Object clone()
Creates and returns a copy of this  Object.
boolean equals( Object o)
Compares this instance with the specified object and indicates if they are equal.
void finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
final  Class<?> getClass()
Returns the unique instance of  Class that represents this object's class.
int hashCode()
Returns an integer hash code for this object.
final void notify()
Causes a thread which is waiting on this object's monitor (by means of calling one of the  wait() methods) to be woken up.
final void notifyAll()
Causes all threads which are waiting on this object's monitor (by means of calling one of the  wait() methods) to be woken up.
String toString()
Returns a string containing a concise, human-readable description of this object.
final void wait()
Causes the calling thread to wait until another thread calls the  notify() or  notifyAll() method of this object.
final void wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the  notify() or  notifyAll() method of this object or until the specified timeout expires.
final void wait(long millis)
Causes the calling thread to wait until another thread calls the  notify() or  notifyAll() method of this object or until the specified timeout expires.

 From interface android.nfc.tech.TagTechnology

abstract void close()
Disable I/O operations to the tag from this  TagTechnology object, and release resources.
abstract void connect()
Enable I/O operations to the tag from this  TagTechnology object.
abstract  Tag getTag()
Get the  Tag object backing this  TagTechnology object.
abstract boolean isConnected()
Helper to indicate if I/O operations should be possible.

From interface java.io.Closeable

abstract void close()
Closes the object and release any system resources it holds.
From interface  java.lang.AutoCloseable
abstract void close()
Closes the object and release any system resources it holds.


 
     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值