Skip to content

Commit

Permalink
updating to_s and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Sep 20, 2009
1 parent c29d8a3 commit 23cdfc3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rdoc
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,9 @@
=== 2.0.1 / 2009-09-19

* 1 Bugfix

* Raising an exception when a reader cannot be found.

=== 2.0.0 / 2009-08-07 === 2.0.0 / 2009-08-07


* 2 major enhancements * 2 major enhancements
Expand Down
2 changes: 1 addition & 1 deletion lib/nfc.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# library will read RFID tags from an RFID reader. You should start by reading # library will read RFID tags from an RFID reader. You should start by reading
# NFC#find # NFC#find
class NFC class NFC
VERSION = '2.0.0' VERSION = '2.0.1'


include Singleton include Singleton


Expand Down
10 changes: 7 additions & 3 deletions lib/nfc/iso14443a.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ def atqa
abtAtqa.unpack 'C*' abtAtqa.unpack 'C*'
end end


###
# Get the UID as a hex string
def to_s join_string = ''
sprintf((['%02x'] * uiUidLen).join(join_string), * uid).upcase
end

### ###
# Inspect this tag # Inspect this tag
def inspect def inspect
uid = sprintf((['%02x'] * uiUidLen).join(' '), *self.uid)

string_ary = string_ary =
[ "(NFC) ISO14443A Tag", [ "(NFC) ISO14443A Tag",
" ATQA (SENS_RES): #{sprintf("%02x %02x", *atqa)}", " ATQA (SENS_RES): #{sprintf("%02x %02x", *atqa)}",
" UID (NFCID1): #{uid}", " UID (NFCID1): #{to_s ' '}",
" SAK (SEL_RES): #{sprintf("%02x", btSak)}" " SAK (SEL_RES): #{sprintf("%02x", btSak)}"
] ]
if uiAtsLen > 0 if uiAtsLen > 0
Expand Down
4 changes: 0 additions & 4 deletions test/test_nfc.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,8 +32,4 @@ def test_infinite_list_passive=
@nfc.infinite_list_passive = true @nfc.infinite_list_passive = true
@nfc.infinite_list_passive = false @nfc.infinite_list_passive = false
end end

def test_poll_mifare
thing = @nfc.poll_mifare
end
end end

0 comments on commit 23cdfc3

Please sign in to comment.