Coder Social home page Coder Social logo

node-nfc's People

Contributors

camme avatar dave-snigier avatar jeroenvollenbrock avatar kmoe avatar mrose17 avatar shuangjj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-nfc's Issues

.on('read') returns after awhile

So, using 0.3.3, with acr122u. If I keep tapping the card it'll stay up, otherwise it times out after inactivity. Anyway to fix this?

Invalid pointer

When I run test.js on a raspberry pi, node just stops working and I get the following message:
*** Error in `node': free(): invalid pointer: 0x72a005a8 ***

Missing .stop() function

If I use the example from the readme to read tags, then exit the program (e.g. ctrl-c) and re-run the example, the second time it will fail to init. It seems like this is due to missing cleanup/shutdown.

error: call to 'New' is ambiguous

In file included from ../src/nfc.cc:6:
In file included from ../node_modules/nan/nan.h:190:
../node_modules/nan/nan_new.h:208:10: error: call to 'New' is ambiguous
  return imp::Factory<T>::New(arg0);
         ^~~~~~~~~~~~~~~~~~~~
../src/nfc.cc:83:78: note: in instantiation of function template specialization 'Nan::New<v8::Int32, unsigned long>'
      requested here
            if(offset) object->Set(Nan::New("offset").ToLocalChecked(), Nan::New<Int32>(offset));
                                                                             ^
../node_modules/nan/nan_new.h:113:26: note: candidate function
  static inline return_t New(int32_t value);
                         ^
../node_modules/nan/nan_new.h:114:26: note: candidate function
  static inline return_t New(uint32_t value);

It seem to work if I cast offset from Nan::New<Int32>(offset)) into Nan::New<Int32>((int)offset))

Unable to install

I got this error trying to installing the module with npm install nfc.

Error:

\
> [email protected] install /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
> node-gyp rebuild

  CXX(target) Release/obj.target/nfc/src/nfc.o
../src/nfc.cc:13:18: error: unknown type name 'uv_work_t'
    void NFCRead(uv_work_t* req);
                 ^
../src/nfc.cc:14:23: error: unknown type name 'uv_work_t'
    void AfterNFCRead(uv_work_t* req);
                      ^
../src/nfc.cc:16:17: error: expected class name
    struct NFC: ObjectWrap {
                ^
../src/nfc.cc:17:40: error: unknown type name 'Arguments'; did you mean
      'v8::internal::Arguments'?
        static Handle<Value> New(const Arguments& args);
                                       ^~~~~~~~~
                                       v8::internal::Arguments
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note:
      'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/nfc.cc:18:42: error: unknown type name 'Arguments'; did you mean
      'v8::internal::Arguments'?
        static Handle<Value> Start(const Arguments& args);
                                         ^~~~~~~~~
                                         v8::internal::Arguments
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note:
      'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/nfc.cc:21:34: error: unknown type name 'Arguments'; did you mean
      'v8::internal::Arguments'?
    Handle<Value> NFC::New(const Arguments& args) {
                                 ^~~~~~~~~
                                 v8::internal::Arguments
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note:
      'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/nfc.cc:22:21: error: calling a protected constructor of class
      'v8::HandleScope'
        HandleScope scope;
                    ^
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:816:13: note: declared
      protected here
  V8_INLINE HandleScope() {}
            ^
../src/nfc.cc:23:20: error: member access into incomplete type 'const
      v8::internal::Arguments'
        assert(args.IsConstructCall());
                   ^
/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE...
                        ^
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: forward
      declaration of 'v8::internal::Arguments'
class Arguments;
      ^
../src/nfc.cc:25:15: error: no member named 'Wrap' in '(anonymous
      namespace)::NFC'
        self->Wrap(args.This());
        ~~~~  ^
../src/nfc.cc:25:24: error: member access into incomplete type 'const
      v8::internal::Arguments'
        self->Wrap(args.This());
                       ^
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: forward
      declaration of 'v8::internal::Arguments'
class Arguments;
      ^
../src/nfc.cc:26:22: error: no member named 'Close' in 'v8::HandleScope'
        return scope.Close(args.This());
               ~~~~~ ^
../src/nfc.cc:26:32: error: member access into incomplete type 'const
      v8::internal::Arguments'
        return scope.Close(args.This());
                               ^
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: forward
      declaration of 'v8::internal::Arguments'
class Arguments;
      ^
../src/nfc.cc:37:36: error: unknown type name 'Arguments'; did you mean
      'v8::internal::Arguments'?
    Handle<Value> NFC::Start(const Arguments& args) {
                                   ^~~~~~~~~
                                   v8::internal::Arguments
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note:
      'v8::internal::Arguments' declared here
class Arguments;
      ^
../src/nfc.cc:39:21: error: calling a protected constructor of class
      'v8::HandleScope'
        HandleScope scope;
                    ^
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:816:13: note: declared
      protected here
  V8_INLINE HandleScope() {}
            ^
../src/nfc.cc:54:58: error: member access into incomplete type 'const
      v8::internal::Arguments'
        Handle<Function> cb = Handle<Function>::Cast(args.This());
                                                         ^
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:127:7: note: forward
      declaration of 'v8::internal::Arguments'
class Arguments;
      ^
../src/nfc.cc:56:49: error: 'New' is a private member of
      'v8::PersistentBase<v8::Function>'
        baton->callback = Persistent<Function>::New(cb);
                                                ^
/Users/magic890/.node-gyp/0.12.2/deps/v8/include/v8.h:572:23: note: declared
      private here
  V8_INLINE static T* New(Isolate* isolate, T* that);
                      ^
../src/nfc.cc:56:27: error: too few arguments to function call, expected 2, have
      1; did you mean '::NFC::New'?
        baton->callback = Persistent<Function>::New(cb);
                          ^~~~~~~~~~
                          ::NFC::New
../src/nfc.cc:21:24: note: '::NFC::New' declared here
    Handle<Value> NFC::New(const Arguments& args) {
                       ^
../src/nfc.cc:69:9: error: unknown type name 'uv_work_t'
        uv_work_t *req = new uv_work_t();
        ^
../src/nfc.cc:69:30: error: unknown type name 'uv_work_t'
        uv_work_t *req = new uv_work_t();
                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/nfc/src/nfc.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Darwin 14.4.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "nfc"
npm ERR! node v0.12.2
npm ERR! npm  v2.9.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the nfc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls nfc
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/magic890/Sites/test-rfid/node-nfc/npm-debug.log

npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'nfc' ]
2 info using [email protected]
3 info using [email protected]
4 verbose install initial load of /Users/magic890/Sites/test-rfid/node-nfc/package.json
5 verbose readDependencies loading dependencies from /Users/magic890/Sites/test-rfid/node-nfc/package.json
6 silly cache add args [ 'nfc', null ]
7 verbose cache add spec nfc
8 silly cache add parsed spec { raw: 'nfc',
8 silly cache add   scope: null,
8 silly cache add   name: 'nfc',
8 silly cache add   rawSpec: '',
8 silly cache add   spec: '*',
8 silly cache add   type: 'range' }
9 silly addNamed nfc@*
10 verbose addNamed "*" is a valid semver range for nfc
11 silly addNameRange { name: 'nfc', range: '*', hasData: false }
12 silly mapToRegistry name nfc
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/nfc
16 verbose addNameRange registry:https://registry.npmjs.org/nfc not in flight; fetching
17 verbose request uri https://registry.npmjs.org/nfc
18 verbose request no auth needed
19 info attempt registry request try #1 at 4:23:49 PM
20 verbose request id 0f9542d453f513e5
21 verbose etag "EK0NCH7U4O7PT9XZI0I9HA3YQ"
22 http request GET https://registry.npmjs.org/nfc
23 http 304 https://registry.npmjs.org/nfc
24 silly get cb [ 304,
24 silly get   { date: 'Mon, 15 Jun 2015 14:23:49 GMT',
24 silly get     via: '1.1 varnish',
24 silly get     'cache-control': 'max-age=60',
24 silly get     etag: '"EK0NCH7U4O7PT9XZI0I9HA3YQ"',
24 silly get     age: '0',
24 silly get     connection: 'keep-alive',
24 silly get     'x-served-by': 'cache-fra1231-FRA',
24 silly get     'x-cache': 'HIT',
24 silly get     'x-cache-hits': '1',
24 silly get     'x-timer': 'S1434378229.362440,VS0,VE99',
24 silly get     vary: 'Accept' } ]
25 verbose etag https://registry.npmjs.org/nfc from cache
26 verbose get saving nfc to /Users/magic890/.npm/registry.npmjs.org/nfc/.cache.json
27 silly addNameRange number 2 { name: 'nfc', range: '*', hasData: true }
28 silly addNameRange versions [ 'nfc', [ '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5' ] ]
29 silly addNamed [email protected]
30 verbose addNamed "0.0.5" is a plain semver version for nfc
31 silly cache afterAdd [email protected]
32 verbose afterAdd /Users/magic890/.npm/nfc/0.0.5/package/package.json not in flight; writing
33 verbose afterAdd /Users/magic890/.npm/nfc/0.0.5/package/package.json written
34 silly install resolved [ { name: 'nfc',
34 silly install resolved     version: '0.0.5',
34 silly install resolved     description: 'Node NFC functionallity through libnfc',
34 silly install resolved     main: 'index.js',
34 silly install resolved     scripts:
34 silly install resolved      { test: 'echo "Error: no test specified" && exit 1',
34 silly install resolved        install: 'node-gyp rebuild' },
34 silly install resolved     repository:
34 silly install resolved      { type: 'git',
34 silly install resolved        url: 'git+https://github.com/Camme/node-nfc.git' },
34 silly install resolved     keywords: [ 'nfc' ],
34 silly install resolved     author: { name: 'Camilo Tapia', email: '[email protected]' },
34 silly install resolved     license: 'MIT',
34 silly install resolved     gypfile: true,
34 silly install resolved     bugs: { url: 'https://github.com/Camme/node-nfc/issues' },
34 silly install resolved     homepage: 'https://github.com/Camme/node-nfc',
34 silly install resolved     _id: '[email protected]',
34 silly install resolved     dist:
34 silly install resolved      { shasum: '3167cc6b2e6e0b8679f7999f0ab9ba58b2240da0',
34 silly install resolved        tarball: 'http://registry.npmjs.org/nfc/-/nfc-0.0.5.tgz' },
34 silly install resolved     _from: 'nfc@*',
34 silly install resolved     _npmVersion: '1.4.3',
34 silly install resolved     _npmUser: { name: 'camilo.tapia', email: '[email protected]' },
34 silly install resolved     maintainers: [ [Object], [Object] ],
34 silly install resolved     directories: {},
34 silly install resolved     _shasum: '3167cc6b2e6e0b8679f7999f0ab9ba58b2240da0',
34 silly install resolved     _resolved: 'https://registry.npmjs.org/nfc/-/nfc-0.0.5.tgz',
34 silly install resolved     readme: 'ERROR: No README data found!' } ]
35 info install [email protected] into /Users/magic890/Sites/test-rfid/node-nfc
36 info installOne [email protected]
37 verbose installOne of nfc to /Users/magic890/Sites/test-rfid/node-nfc not in flight; installing
38 verbose lock using /Users/magic890/.npm/_locks/nfc-acf3b55abe2a0770.lock for /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
39 silly install write writing nfc 0.0.5 to /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
40 verbose unbuild node_modules/nfc
41 silly gentlyRm /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc is being purged from base /Users/magic890/Sites/test-rfid/node-nfc
42 verbose gentlyRm don't care about contents; nuking /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
43 verbose tar unpack /Users/magic890/.npm/nfc/0.0.5/package.tgz
44 verbose tar unpacking to /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
45 silly gentlyRm /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc is being purged
46 verbose gentlyRm don't care about contents; nuking /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
47 silly gunzTarPerm modes [ '755', '644' ]
48 silly gunzTarPerm extractEntry package.json
49 silly gunzTarPerm extractEntry .npmignore
50 silly gunzTarPerm extractEntry README.md
51 silly gunzTarPerm extractEntry index.js
52 silly gunzTarPerm extractEntry test.js
53 silly gunzTarPerm extractEntry binding.gyp
54 silly gunzTarPerm extractEntry src/nfc.cc
55 silly gunzTarPerm extractEntry temp.c
56 verbose write writing to /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc/package.json
57 info preinstall [email protected]
58 verbose readDependencies loading dependencies from /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc/package.json
59 verbose readDependencies loading dependencies from /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc/package.json
60 silly install resolved []
61 verbose about to build /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
62 info build /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
63 info linkStuff [email protected]
64 silly linkStuff [email protected] has /Users/magic890/Sites/test-rfid/node-nfc/node_modules as its parent node_modules
65 verbose linkBins [email protected]
66 verbose linkMans [email protected]
67 verbose rebuildBundles [email protected]
68 info install [email protected]
69 verbose unsafe-perm in lifecycle true
70 info [email protected] Failed to exec install script
71 verbose unlock done using /Users/magic890/.npm/_locks/nfc-acf3b55abe2a0770.lock for /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
72 verbose stack Error: [email protected] install: `node-gyp rebuild`
72 verbose stack Exit status 1
72 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
72 verbose stack     at EventEmitter.emit (events.js:110:17)
72 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
72 verbose stack     at ChildProcess.emit (events.js:110:17)
72 verbose stack     at maybeClose (child_process.js:1015:16)
72 verbose stack     at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
73 verbose pkgid [email protected]
74 verbose cwd /Users/magic890/Sites/test-rfid/node-nfc
75 error Darwin 14.4.0
76 error argv "node" "/usr/local/bin/npm" "install" "nfc"
77 error node v0.12.2
78 error npm  v2.9.1
79 error code ELIFECYCLE
80 error [email protected] install: `node-gyp rebuild`
80 error Exit status 1
81 error Failed at the [email protected] install script 'node-gyp rebuild'.
81 error This is most likely a problem with the nfc package,
81 error not with npm itself.
81 error Tell the author that this fails on your system:
81 error     node-gyp rebuild
81 error You can get their info via:
81 error     npm owner ls nfc
81 error There is likely additional logging output above.
82 verbose exit [ 1, true ]
83 verbose unbuild node_modules/nfc
84 info preuninstall [email protected]
85 info uninstall [email protected]
86 verbose unbuild rmStuff [email protected] from /Users/magic890/Sites/test-rfid/node-nfc/node_modules
87 info postuninstall [email protected]
88 silly gentlyRm /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc is being purged from base /Users/magic890/Sites/test-rfid/node-nfc
89 verbose gentlyRm don't care about contents; nuking /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
90 silly vacuum-fs purging /Users/magic890/Sites/test-rfid/node-nfc/node_modules/nfc
91 silly vacuum-fs removing /Users/magic890/Sites/test-rfid/node-nfc/node_modules
92 silly vacuum-fs finished vacuuming up to /Users/magic890/Sites/test-rfid/node-nfc

How can I solve this problem?

Update for newer Node.js v.6.x.x

Hi! 😃

How about to update node-nfc to newer version of Node.js?

I tested it on v.6.1.0 and v.6.2.2 - while building by node-gyp, it goes to errors, and that's because of using old (2.0.5) version of nan(current is 2.3.5).
After I manually updated nan and rebuilded node-nfc for Node v.6.1.0 - it's wroking, but I guess that we need to update native source of node-nfc to work with newer nan(2.3.5), because on builidng stage there is one error occurs:

../src/nfc.cc: In member function ‘virtual void {anonymous}::NFCReadWorker::HandleErrorCallback()’:
../src/nfc.cc:153:70: warning: array subscript is above array bounds [-Warray-bounds]
             argv[1] = Nan::Error(AsyncProgressWorker::ErrorMessage());

P.S> I gonna use node-nfc as native module for Atom Electron 1.2.5 (Node.js v6.1.0).
UPD: I updated node-nfc to Node.js v.6.1.0 and builded it for Electron 1.2.5 and it's working fine.

How to interpret card data?

Sorry, I am new to NFC, and I'm trying to use this library to identify cards.
However, not sure how to use the data that your code examples spit out.

When I press a simple plastic NFC card against the reader, I get the following output:

{ deviceID: 'pn532_uart:/dev/ttyS0',
  name: 'pn532_uart:/dev/ttyS0',
  uid: '19:bf:1e:28',
  type: 4,
  tag: 'mifare-classic' }

[ { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 255, len: 7, value: '8069ffffffffff' },
  { type: 255, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 1920 } ]

And for my phone:

{ deviceID: 'pn532_uart:/dev/ttyS0',
  name: 'pn532_uart:/dev/ttyS0',
  uid: '01:02:03:04',
  type: 4,
  tag: 'mifare-classic',
}

[ { type: 110, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 110, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 110, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 110, len: 0 },
  { type: 0, len: 0 },
  { type: 0, len: 0 },
  { type: 255, len: 7, value: '8069ffffffffff' },
  { type: 255,
    len: 110,
    value: '0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000' },
  { type: 0,
    len: 110,
    value: '0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000' },
  { type: 0,
    len: 110,
    value: '0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000' },
  { type: 0,
    len: 110,
    value: '0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffff' },
  { type: 255,
    len: 110,
    value: '0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000' },
  { type: 0,
    len: 110,
    value: '0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000' },
  { type: 0,
    len: 110,
    value: '0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000' },
  { type: 0,
    len: 110,
    value: '0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffffff6e0000000000000000000000000000006e0000000000000000000000000000006e0000000000000000000000000000006e0000000000ff078069ffffffffff' },
  { type: 255 } ]

As the value 8069ffffffffff appears in both of the data arrays, I don't think that's the one.

The uid might be what I need, but why does my phone report 01:02:03:04. That can't be correct either.

Any thoughts?

Could you clarify the readme as to what this data format represents and how it's structured?

Issue in Installing package in windows 8

While install in the package in windows I am facing the node-gyp issue.

..\src\nfc.cc(2): fatal error C1083: Cannot open include file: 'unistd.h': No s
uch file or directory [C:\Users\bhavesh.maheshwari\AppData\Roaming\npm\node_mod
ules\nfc\build\nfc.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe fail
ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules
npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:200:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodej
s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "clean" "configu
re" "rebuild"
gyp ERR! cwd C:\Users\bhavesh.maheshwari\AppData\Roaming\npm\node_modules\nfc
gyp ERR! node -v v4.5.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js" "install" "nfc" "-g"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp clean configure rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp clean configure rebuil
d'.
npm ERR! This is most likely a problem with the nfc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp clean configure rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs nfc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls nfc
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! E:\Projects\vasco_comp\sense_id\npm-debug.log.

Node version 4.5
npm version 2.15.9

Please resolve the issue.

Use Nan for later version compatibility

To keep things simple it's advised to use NAN which will abstract all the API changes between node versions. this will allow the module to be compatible with node 0.10 to 5.x.

I can work with you on this if you want to implement it.

cannot Load in Ubuntu

I was recently trying to load libraries but its giving me error like:
`/home/dotmark/Desktop/nfc2/node_modules/bindings/bindings.js:83
throw e
^

Error: libnfc.so.5: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (module.js:598:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at bindings (/home/dotmark/Desktop/nfc2/node_modules/bindings/bindings.js:76:44)
at Object. (/home/dotmark/Desktop/nfc2/node_modules/nfc/index.js:1:95)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
My codes for running in js file is :var nfc = require('nfc').nfc
, util = require('util')
;

console.log('nfc.version(): ' + util.inspect(nfc.version(), { depth: null }));
// { name: 'libfnc', version: '1.7.0' }

console.log('nfc.scan(): ' + util.inspect(nfc.scan(), { depth: null }));`

PN532_UART

Hey,

anyone get the PN532 UART/SPI to work with node nfc?
It works without porblems with nfc-eventd and nfc-poll.

Regards

Polling time

Thanks for making this node module, much appreciated!

I was wondering though, is there an option to set the polling time so that it will recognize my card sooner when writing this code:

device.on('read', function(tag) { 

});

Thanks in advance!

Support writing

I was really happy when I found your node module for NFC. Unfortunately I need to write to NFC tags in my application, so I'm asking for write support.

As far as I know, there isn't much difference between reading and writing. Therefore I wonder if implementing write support would be much effort.

I can try implementing it on my own if you don't want to add it. In this case I'd have to use libnfc anyway. Maybe you can give me a few hints where to start.

Failing to install – libnfc

I'm getting an error installing on OSX (after installing the dependencies through brew):

> node-gyp clean configure rebuild

  CXX(target) Release/obj.target/nfc/src/nfc.o
../src/nfc.cc:5:10: fatal error: 'nfc/nfc.h' file not found
#include <nfc/nfc.h>
         ^
1 error generated.
make: *** [Release/obj.target/nfc/src/nfc.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean" "configure" "rebuild"
gyp ERR! cwd /Users/Stefan/Projects/ribot/ripidrate-new/node_modules/nfc
gyp ERR! node -v v4.4.4
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.4
npm ERR! npm  v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp clean configure rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp clean configure rebuild'.
npm ERR! This is most likely a problem with the nfc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp clean configure rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs nfc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls nfc
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Stefan/Projects/ribot/ripidrate-new/npm-debug.log

I noticed you mentioned this was a known issue with libnfc not being installed correctly (in the readme), how does one fix this?

High CPU load

When running node-nfc, the cpu load can get very high

Error While installation

I have this error while i try install node nfc

make: Entering directory `/usr/local/lib/node_modules/nfc/build'
CXX(target) Release/obj.target/nfc/src/nfc.o
../src/nfc.cc:29:9: error: ‘nfc_device’ does not name a type
../src/nfc.cc:30:9: error: ‘nfc_target’ does not name a type
../src/nfc.cc:31:9: error: ‘nfc_context’ does not name a type
../src/nfc.cc: In static member function ‘static v8::Handlev8::Value {anonymous}::NFC::Start(const v8::Arguments&)’:
../src/nfc.cc:42:9: error: ‘nfc_device’ was not declared in this scope
../src/nfc.cc:42:21: error: ‘pnd’ was not declared in this scope
../src/nfc.cc:43:9: error: ‘nfc_target’ was not declared in this scope
../src/nfc.cc:43:20: error: expected ‘;’ before ‘nt’
../src/nfc.cc:44:9: error: ‘nfc_context’ was not declared in this scope
../src/nfc.cc:44:22: error: ‘context’ was not declared in this scope

do you know why happen that error?

Pointer being freed was not allocated

After compile the code, I try to run the test file. However, I got an error about pointer being freed was not allocated.

Here the full output.

version: { name: 'libnfc', version: '1.7.0' }
devices: { 'acr122_pcsc:ACS ACR122U':
   { name: 'ACS ACR122U / ACR122U214',
     info:
      { chip: 'PN532 v1.6',
        'initator mode modulations':
         { 'ISO/IEC 14443A': [ '106 kbps' ],
           FeliCa: [ '424 kbps', '212 kbps' ],
           'ISO/IEC 14443-4B': [ '106 kbps' ],
           'Innovision Jewel': [ '106 kbps' ],
           'D.E.P.': [ '424 kbps', '212 kbps', '106 kbps' ] },
        'target mode modulations':
         { 'ISO/IEC 14443A': [ '106 kbps' ],
           FeliCa: [ '424 kbps', '212 kbps' ],
           'D.E.P.': [ '424 kbps', '212 kbps', '106 kbps' ] } } } }

{ deviceID: 'acr122_pcsc:ACS ACR122U',
  name: 'ACS ACR122U / ACR122U214' }
{ deviceID: 'acr122_pcsc:ACS ACR122U',
  name: 'ACS ACR122U / ACR122U214',
  uid: '04:99:84:6a:43:2f:80',
  type: 68,
  tag: 'mifare-ultralight',
  data: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 84 01 01 00 00 00 50 5b 84 01 01 00 00 00 02 00 52 31 32 32 55 00 80 02 16 10 00 00 07 00 01 00 ... >,
  offset: 16 }
[]
stopped
node(28605,0x7fff790d2000) malloc: *** error for object 0x101600b20: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
[1]    28605 abort      node test.js

Reader: ACR122U
Tag: Mifare Ultralight
OS: OSX El Capitan
Node: 4.2.1

Build failed on Raspberry Pi

I got these errors while building on R-Pi:
../src/nfc.cc:73:68: error: invalid conversion from ‘void ()(uv_work_t) {aka void ()(uv_work_s)}’ to ‘uv_after_work_cb {aka void ()(uv_work_s, int)}’ [-fpermissive]
/home/pi/.node-gyp/0.10.12/deps/uv/include/uv.h:1432:15: error: initializing argument 4 of ‘int uv_queue_work(uv_loop_t_, uv_work_t_, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../src/nfc.cc: In function ‘void {anonymous}::Loop({anonymous}::Baton_)’:
../src/nfc.cc:85:68: error: invalid conversion from ‘void ()(uv_work_t) {aka void ()(uv_work_s)}’ to ‘uv_after_work_cb {aka void ()(uv_work_s, int)}’ [-fpermissive]
/home/pi/.node-gyp/0.10.12/deps/uv/include/uv.h:1432:15: error: initializing argument 4 of ‘int uv_queue_work(uv_loop_t_, uv_work_t_, uv_work_cb, uv_after_work_cb)’ [-fpermissive]
../src/nfc.cc: In function ‘void {anonymous}::NFCRead(uv_work_t_)’:
../src/nfc.cc:95:13: error: expected primary-expression before ‘.’ token
../src/nfc.cc:96:13: error: expected primary-expression before ‘.’ token
../src/nfc.cc: In function ‘void {anonymous}::AfterNFCRead(uv_work_t*)’:
../src/nfc.cc:129:59: error: ‘memcpy’ was not declared in this scope

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.