jacklund / btle.js

Node.js Bluetooth LE module
MIT License
32 stars 6 forks source link

Uncaught TypeError: Cannot call method 'readUInt16LE' of undefined #12

Closed edy555 closed 11 years ago

edy555 commented 11 years ago

I found this great project yesterday and tried it immediately. But unfortunately, it might caused from my environment, failed to run. As pushing SensorTag side button, btle.js gives me an error "Uncaught TypeError: Cannot call method 'readUInt16LE' of undefined" as follows.

$ node test-btle.js test-btle.js:750: Uncaught TypeError: Cannot call method 'readUInt16LE' of undefined test-btle.js:750: Uncaught TypeError: Cannot call method 'readUInt16LE' of undefined ...

test-btle.js is as described on README.md and changed bdaddr as my device. It seems this error occurs on service.js line 28. I think version of node.js might be wrong.

$ uname -a Linux ubuntu 3.8.0-31-generic #46-Ubuntu SMP Tue Sep 10 20:03:44 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux $ node -v v0.10.20

Could you give me any advise?

BR TT @edy555

jacklund commented 11 years ago

Unfortunately, I'm in the middle of making a bunch of changes to it, and am probably breaking things left and right. My apologies. :-}

I just updated the code with some changes, so if you could pull the code and try it again, and let me know if it still breaks. If it does, could you also send me your test program, so I can try it?

Again, my apologies, it's still a work in progress, but I'm hoping to stabilize it now that I've made most of the API changes I wanted to. I'll also update the README with the changes as soon as I can.

Thanks for your patience.

-Jack

jacklund commented 11 years ago

Just FYI, I found the error and fixed it in the latest commit. I've also added a regression test to help keep errors from creeping back in. Feel free to pull the latest codebase and let me know if your issue is still there.

-Jack

edy555 commented 11 years ago

Hi Jack, Thank you for updating project. I have pulled the source and succeed to build project with a little changes as #13.

Unfortunately test-btle.js (usage code described in README.md) still failed in the same error. But I found that test.js is working completely without any problem, so I got to be able to enjoy this project now.

Please let me say to you thanks again.

TT @edy555

jacklund commented 11 years ago

I'm going to go ahead and reopen this, and when I get a chance, I'll see if I can replicate the problem from the README code.

-Jack

jacklund commented 11 years ago

Ah, I found the problem - there was an error in the code in the README. I've fixed it now, so that code should now work.

Thanks!