lsongdev / node-bluetooth

:large_blue_diamond:😬Bluetooth serial port communication for Node.js
https://npmjs.org/node-bluetooth
Other
197 stars 56 forks source link

Receiving Connections #25

Closed AndrewLester closed 5 years ago

AndrewLester commented 5 years ago

I know there's a way to receive data from a device that I'm already connected to, but I haven't be able to find a way to get a connection object for a received connection. Is there some event that I'm missing in the device object, or is this feature simply not out yet? I may just be missing some obvious portion of the docs, but I would appreciate some information.

Thanks

lsongdev commented 5 years ago

The “connection object” just same “device”

bluetooth.connect will callback two objects, the first one is error object if contains an error, second is “connection” you can receive data from that and send something to peer device.

AndrewLester commented 5 years ago

@song940 I understand your answer here, but I was wondering how one would receive data from a connection without specifically using the bluetooth.connect function. Let's say one doesn't know the address of the computer connected to them and they want to receive data from this connection. How would this task be accomplished?

Thanks