Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Chechel committed Oct 2, 2014
1 parent b7867cb commit 871e468
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ readers = NFC::Reader.all
puts "Available readers: %s" % readers.to_s

# The order of tag types in poll arguments defines priority of tag types
readers[0].poll(IsoDep::Tag, Mifare::Classic::Tag, Mifare::Ultralight::Tag, NFC::Tag) do |tag|
readers[0].poll(IsoDep::Tag, Mifare::Classic::Tag, Mifare::Ultralight::Tag) do |tag|
begin
puts "Applied #{tag.class.name}: #{tag}"

case tag
when Mifare::Classic::Tag
case tag
when Mifare::Classic::Tag
tag.select do
# Perform authentication to block 0x04 with the Key A that equals
# to "\xFF\xFF\xFF\xFF\xFF\xFF" you can also use "FFFFFFFFFFFF"
Expand All @@ -84,19 +84,19 @@ readers[0].poll(IsoDep::Tag, Mifare::Classic::Tag, Mifare::Ultralight::Tag, NFC:
puts "Page 1: %s" % read(1).unpack('H*').pop
processed!
end
when IsoDep::Tag
aid = ["F75246544101"].pack('H*')
tag.select(aid) do
# sending APDU command to tag using send_apdu method
apdu = ['A00D010018B455CAF0F331AF703EFA2E2D744EC7E22AA64076CD19F6D0'].pack('H*')
puts send_apdu(apdu).unpack('H*').pop

# sending APDU command with "<<" operator which is alias to send_apdu
# response = tag << apdu
# puts response.unpack('H*').pop
processed!
end
when IsoDep::Tag
aid = ["F75246544101"].pack('H*')
tag.select(aid) do
# sending APDU command to tag using send_apdu method
apdu = ['A00D010018B455CAF0F331AF703EFA2E2D744EC7E22AA64076CD19F6D0'].pack('H*')
puts send_apdu(apdu).unpack('H*').pop

# sending APDU command with "<<" operator which is alias to send_apdu
# response = tag << apdu
# puts response.unpack('H*').pop
processed!
end
end
rescue Exception => e
puts e
end
Expand Down Expand Up @@ -127,7 +127,7 @@ Debugging

To see additional debug info from libnfc run your program as follows:
```
LIBNFC_LOG_LEVEL=3 ruby listen.rb
LIBNFC_LOG_LEVEL=3 ruby examples/listen.rb
```

License
Expand Down

0 comments on commit 871e468

Please sign in to comment.