智能卡读卡器I / O - 如何阅读 [英] Smart card reader I/O - how to read

查看:118
本文介绍了智能卡读卡器I / O - 如何阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个需要使用智能卡读卡器的项目。智能卡上的数据以类型长度值格式编码,其中类型定义数据的性质, length表示数据的长度,值是数据本身,而这又是另一个编码数据。



简言之,智能卡将包含电表指令( S)。当卡放置在仪表上时,仪表应读取卡内容,查找请求并执行它们,并写下执行这些请求的结果。将写在卡上的数据结构将包括所谓的元数据,其中将有一条数据,一个指针,指示响应存在的起始地址。



我需要读取总是写在卡片开头的元数据,直到我到达响应指针,然后寻找那个位置开始读取响应的过程,解码它们,提取值部分并将它们存储在列表中,并将它们传递给另一个解码器。



老实说我不知道​​如何编写解决方案,我需要建议。



我尝试过:



我正在尝试阅读有关Stream和I / O的信息。我已经为类型,长度和值格式实现了编码和解码算法。

I'm working on a project that requires the use of smart card reader. The data on the smart card is encoded in type, length, and value format, in which the type defines the nature of the data, the length tells the length of the data, and the value is the data itself which in turn another encoded data.

Briefly, the smart card will contain an electricity meter instruction(s). When the card is placed on the meter the meter should reads the card content, finds the requests and executes them, and writes down the results of executing these requests. The structure of the data that will be written on the card will include what is so-called metadata in which there will be a piece of data, a pointer, indicates the start address where the responses exist.

I need to read that metadata, which is always written at the beginning of the card, until I reach the response pointer, then seek to that location to start the process of reading the responses, decoding them, extract the value part and stores them on a list ,and pass them to another decoder.

Honestly I do not know how to program that solution and I need advises.

What I have tried:

I am trying to read about Stream(s) and I/O. I already implemented the encode and decode algorithm for the type, length, and value format.

推荐答案

查阅您正在使用的API的文档。如果您没有任何文档,请联系设备供应商或API上的任何支持文档。



没有通用的一种方法适用于所有设备要做到这一点。
Consult the documentation on the API you're using. If you don't have any documentation, contact the vendor of the device for it or any supporting documentation on the API.

There is no generic "one method works with all devices" to do this.


我通过创建一个接受文件并处理它的解码算法完成了工作,并给了我所需的信息。
I finished the work by creating a decode algorithm that accepts the file and process it and gives me back the information I need.


这篇关于智能卡读卡器I / O - 如何阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆