头文件fmcos.h
#ifndef _FM_COS_H_
#define _FM_COS_H_
#define SW_OK (0x9000)
// FMCos命令集
namespace FMCos
{
// PCB初始化
void pcbInit();
// 擦除当前DF下所有文件(不包含Df目录本身)
int eraseCommand(quint8* cmd);
// 请求一个用于线路保护过程的随机数
int getChallengeCommand(quint8* cmd, quint8 len);
// 读取二进制文件内容
int readBinrayCommand(quint8* cmd, quint16 offset, quint8 len);
// 更新二进制文件内容
int writeBinaryCommand(quint8* cmd, quint16 offset, const quint8* data, quint8 len);
// 在密钥文件中增加密钥(密钥长度8字节)
int writeLineKeyCommand(quint8* cmd, quint8 keyId, const quint8* key);
int writeExternalKeyCommand(quint8* cmd, quint8 keyId, const quint8* key);
int writeKeyCommand(quint8* cmd, quint8 keyId, quint8 type, const quint8* key);
// 通过文件标识选择文件
int selectFileCommand(quint8* cmd, quint16 fileId);
// 建立文件系统,包含MF,DF和EF
int createMfFileCommand(quint8* cmd);
int createDfFileCommand(quint8* cmd, quint16 fileId, quint16 size, quint8 appId);
int createKeyFileCommand(quint8* cmd, quint16 fileId, quint16 size);
int createBinaryFileCommand(quint8* cmd, quint16 fileId, quint16 size);
int createEfFileCommand(quint8* cmd, quint16 fileId, quint8 type, quint16 size);
// 外部认证
int externalAuthenticateCommand(quint8* cmd, quint8 keyId, const quint8* data);
// 命令:CLA INS P1 P2 00,应答:SW1 SW2
int command(quint8* cmd, quint8 cla, quint8 ins, quint8 p1, quint8 p2);
// 命令:CLA INS P1 P2 Le,应答:Le 字节DATA SW1 SW2
int command(quint8* cmd, quint8 cla, quint8 ins, quint8 p1, quint8 p2, quint8 le);
// 命令:CLA INS P1 P2 Lc DATA,应答:SW1 SW2
int command(quint8* cmd, quint8 cla, quint8 ins, quint8 p1, quint8 p2, quint8 lc, const quint8* data);
// 命令:CLA INS P1 P2 Lc DATA Le,应答:Le 字节DATA SW1 SW2<