koalazak / dorita980

Unofficial iRobot Roomba and Braava (i7/i7+, 980, 960, 900, e5, 690, 675, m6, etc) node.js library (SDK) to control your robot
MIT License
945 stars 150 forks source link

discovery compatibility with node 4 - Buffer signature #7

Closed kavod closed 7 years ago

kavod commented 7 years ago

With Node v4.2.6, I got the following error using the discovery functionnality:

$ node discover.js 
Looking for robots...
/home/boris/node_modules/dorita980/lib/discovery.js:29
    const message = Buffer.from('irobotmcs');
                           ^

TypeError: this is not a typed array.
    at Function.from (native)
    at Socket.<anonymous> (/home/boris/node_modules/dorita980/lib/discovery.js:29:28)
    at Socket.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at Socket.emit (events.js:166:7)
    at startListening (dgram.js:121:10)
    at dgram.js:220:7
    at nextTickCallbackWith3Args (node.js:452:9)
    at process._tickCallback (node.js:358:17)
    at Function.Module.runMain (module.js:444:11)
    at startup (node.js:136:18)
    at node.js:966:3

The proposed hack fixes the issue.

koalazak commented 7 years ago

i just forgot to write unit tests for this method! haha. (if you can, please write some tests to test discovery feature :p)

thanks!

kavod commented 7 years ago

Thanks to you.

Actually, I am really newbie with NodeJS (more familiar with Python). After a quick look on your existing unit tests, I do not think be able to do it cleanly and quickly for moment.

For your information, I am building a plugin for the Open Source Home Automation system Jeedom based on your lib. I'll keep you informed about the progression.

Anyway: thanks for your work!