nfc 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,9 @@
1
+ === 2.0.1 / 2009-09-19
2
+
3
+ * 1 Bugfix
4
+
5
+ * Raising an exception when a reader cannot be found.
6
+
1
7
  === 2.0.0 / 2009-08-07
2
8
 
3
9
  * 2 major enhancements
@@ -43,11 +43,10 @@ lets you read RFID tags.
43
43
 
44
44
  == INSTALL:
45
45
 
46
- First install libnfc[http://libnfc.org/]
47
- I installed libnfc like this:
46
+ First install libnfc[http://libnfc.org/].
47
+ I installed libnfc via MacPorts[http://www.macports.org/] like this:
48
48
 
49
- $ ./configure --prefix=/usr/local
50
- $ make && make install
49
+ $ sudo port install libnfc
51
50
 
52
51
  The install the gem:
53
52
 
data/Rakefile CHANGED
@@ -5,6 +5,8 @@ require 'hoe'
5
5
  gem 'rake-compiler', '>= 0.4.1'
6
6
  require "rake/extensiontask"
7
7
 
8
+ Hoe.plugin :debugging
9
+
8
10
  HOE = Hoe.spec('nfc') do
9
11
  developer('Aaron Patterson', 'aaronp@rubyforge.org')
10
12
  self.readme_file = 'README.rdoc'
@@ -9,6 +9,9 @@
9
9
  static VALUE connect(VALUE klass)
10
10
  {
11
11
  dev_info * dev = nfc_connect();
12
+ if(!dev)
13
+ rb_raise(rb_eRuntimeError, "could not find NFC device");
14
+
12
15
  if(!nfc_initiator_init(dev))
13
16
  rb_raise(rb_eRuntimeError, "oh snap, could not init");
14
17
 
data/lib/nfc.rb CHANGED
@@ -9,7 +9,7 @@ require 'nfc/iso14443a'
9
9
  # library will read RFID tags from an RFID reader. You should start by reading
10
10
  # NFC#find
11
11
  class NFC
12
- VERSION = '2.0.0'
12
+ VERSION = '2.0.1'
13
13
 
14
14
  include Singleton
15
15
 
@@ -18,15 +18,19 @@ class NFC
18
18
  abtAtqa.unpack 'C*'
19
19
  end
20
20
 
21
+ ###
22
+ # Get the UID as a hex string
23
+ def to_s join_string = ''
24
+ sprintf((['%02x'] * uiUidLen).join(join_string), * uid).upcase
25
+ end
26
+
21
27
  ###
22
28
  # Inspect this tag
23
29
  def inspect
24
- uid = sprintf((['%02x'] * uiUidLen).join(' '), *self.uid)
25
-
26
30
  string_ary =
27
31
  [ "(NFC) ISO14443A Tag",
28
32
  " ATQA (SENS_RES): #{sprintf("%02x %02x", *atqa)}",
29
- " UID (NFCID1): #{uid}",
33
+ " UID (NFCID1): #{to_s ' '}",
30
34
  " SAK (SEL_RES): #{sprintf("%02x", btSak)}"
31
35
  ]
32
36
  if uiAtsLen > 0
@@ -32,8 +32,4 @@ class TestNFC < Test::Unit::TestCase
32
32
  @nfc.infinite_list_passive = true
33
33
  @nfc.infinite_list_passive = false
34
34
  end
35
-
36
- def test_poll_mifare
37
- thing = @nfc.poll_mifare
38
- end
39
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-07 00:00:00 -07:00
12
+ date: 2009-09-19 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.3.2
23
+ version: 2.3.3
24
24
  version:
25
25
  description: |-
26
26
  NFC is a ruby wrapper for the Near Field Communication library. The Near
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  requirements: []
81
81
 
82
82
  rubyforge_project: seattlerb
83
- rubygems_version: 1.3.4
83
+ rubygems_version: 1.3.5
84
84
  signing_key:
85
85
  specification_version: 3
86
86
  summary: NFC is a ruby wrapper for the Near Field Communication library