https://blog.csdn.net/wangzhiqin365/category_10671283.html
https://blog.csdn.net/wangzhiqin365/article/details/112613570
NCI消息格式:
NCI 区分控制消息和数据消息
控制消息:
如下图所示, NCI控制消息分为三种,分别是Command, Response, Notification
数据消息:
Packet 格式:
控制 Packet 头格式:
MT:
- 001b : Control Packet - Command Message (命令 , 首字节通常为 20)
- 010b : Control Packet - Response Message (响应, 首字节通常为 40)
- 011b : Control Packet – Notification Message (通知, 首字节通常为 60)
PBF:
- 0b: 完整消息或者是分组消息的最后一个,无后续消息
- 1b: 有后续消息
控制 Packet 格式
控制Packet Header 3字节长度,主要包含MT、PBF、GID、OID、负载长度字节等组成;
GID: 命令组ID,NCI包含的分组如下:
- 0000b NCI Core
- 0001b RF Management
- 0010b NFCEE Management
- 0011b NFCC Management
- 0100b Test Management
OID:命令ID,太多了,请参考规范
Payload Length: 一个字节,因此最大负载长度为255字节
数据 Packet 格式
Conn ID: 连接ID, 表示数据属于哪个逻辑通道,创建逻辑通道的时候分配 Conn ID
CR: Credits, 取值为0~3,
Payload Length: 数据负载的长度,最大为255;
常用指令:
复位 CORE_RESET :
命令格式:
Configuration status: 0, RF配置保持, 1 RF配置 复位
NCI Version: 0x10, 1.0版本, 0x20: 2.0版本
举例:
--> 2000 01 00 -=(CORE_RESET_CMD)=- Keep Configuration
4000 01 00 (CORE_RESET_RSP) == 响应,状态00,表示执行OK
6000 0A 02 00 20 04 05 00A401105B (CORE_RESET_NTF)
初始化NFCC CORE_INIT :
举例:
--> 2001 02 0000 (CORE_INIT_CMD) , NCI2.0
4001 1E 00 1A3E0600 01 0604 FF FF 01 FF00 08 00000100020003008000820083008400 (CORE_INIT_RSP)1 Octet status: 00 ()
4 Octet NFCC Feature: 1A3E0600 ()
1 Octet Max Logical Connections: 01 (最大逻辑连接数 )
2 Octet Max Routing Table : 0604 (最大路由表大小)
1 Octet Max Control Packet Payload size : FF ( 255 字节)
1 Octet Max Data Packet Payload size of the Static HCI Connect : FF ( 255 字节)
1 Octet Number of credits of the Staitc HCI Connect : 01
2 Octet Max NFC-V RF Frame Size : FF00 (255 字节)
1 Octet Number of Supported RF Interface : 08
n Octet Supported RF Interfaces [1..n] : 0000(NFCEE Direct RF Interface) 0100(Frame RF Interface) 0200(ISO-DEP RF Interface) 0300(ISO-DEP RF Interface) 8000 8200 8300 8400 (私有接口)
获取配置 CORE_GET_CONFIG :
--> 2003 03 01A011 (CORE_GET_CONFIG_CMD)
4003 0C 0001A01107080A3201C8F6F6 (CORE_GET_CONFIG_RSP)
设置配置 CORE_SET_CONFIG_CMD :
--> 2002 21 08A0ED0101A0EC0100A0D40100A0070101A0150102A0180101A10F0101A1090100 (CORE_SET_CONFIG_CMD)
RF_DISCOVER_MAP_CMD :
--> 2100 07 02 040302 030201 (RF_DISCOVER_MAP_CMD)
1 Octet Mapping 配置个数: 02 (2个)
3 Octet Mapping 配置[1]: 040302 (IsoDep 协议, Poll&Listen , IsoDep 接口)
3 Octet Mapping 配置[1]: 030201 (T3T 协议,Listen, Frame 接口)<--- 41000100
NFCEE_DISCOVER_CMD
--> 220000 (NFCEE_DISCOVER_CMD)
4200 02 0001 1 NFCEE found (NFCEE_DISCOVER_RSP)
6200 08 C0 01 00 01 0301C001 (NFCEE_DISCOVER_NTF)1 Octet NFCEE ID: C0( 0x80-0xFE范围内为HCI-NFCEE IDs, NFCC分配)
1 Octet NFCEE status: 01( disable )
1 Octet Number of Protocol Information Entrie: 001 Octet Number of NFCEE Information TLVs: 01 (1 个TLV信息) , 0301C0
type :03 (Host ID in the HCI Network)
len: 01
value: C01 Octet, NFCEE Power Supply: 01 -- The NFCC has control of the NFCEE Power Supply
NFCEE_MODE_SET_CMD
--> 2201 02 C001 (NFCEE_MODE_SET_CMD) 使能NFCEE(ID = C0, status = NFCEE Initialization sequence started (01))
4201 01 00 (NFCEE_MODE_SET_RSP successful)
NFCEE_POWER_AND_LINK_CNTRL_CMD
--> 2203 02 C003 (NFCEE_POWER_AND_LINK_CNTRL_CMD) ID = C0, NFCEE Power and Link Configuration = 03 (NFCEE Power supply and NFCC to NFCEE communication link are always On.)
4203 01 00 (NFCEE_POWER_AND_LINK_CNTRL_RSP, successful)
RF_NFCEE_DISCOVERY_REQ_NTF
标签:00,01,NFC,CMD,Octet,NFCEE,NCI,RF,指令 From: https://www.cnblogs.com/bluestorm/p/17705366.html--> 610A 06 010003C08004 (RF_NFCEE_DISCOVERY_REQ_NTF)
1 Octet information entries 个数: 01 (1个)
3 Octet information entries[1]: 00 03 C08004type: 00
Len: 03
Value: C0(NFCEE ID ) 80(RF Technology and Mode, ) 04(RF Protocol , IsoDep)