Node.js wrapper for UART protocol for communication with ub_dongle. Provides transport over UART or MQTT via Gateways.
Basic examples for using the library are located in examples folder.
- Make sure driver installed, install the driver, if you have installed, please press windows logo, then r key and afterwards type
devmgmt.msc
and hit enter. You should see a window like this. You need remember the serial port number, in this case it'sCOM4
.
-
Open the command prompt and then clone this project
// make sure you have git windows installed git clone https://github.com/Ubudu/dongle-wrapper cd dongle-wrapper\examples
-
Install application mobile
nRF connect
and then insert the dongle -
Show dongle info
node device-info.js COM4
-
Test scan devices
node scanner COM4
-
Test read data from mobile
- Open nRF Connect application
- Start
node reader.js COM4
- Connect to device which appeared on the list
- Select
D9500001-...
service and on next screen press up arrow next toD9500002-...
characteristic - Type in some value to send, eg.
1234
(or0x31323334
as hex). - The data will be printed in node process as `received { connectionId: 1, payloadHex: '31323334', payload: '1234' }
-
Test send data to mobile
- Open nRF Connect application if not already open after previous example
- Connect to device which appeared on the list
- Select
D9500001-...
service and on next screen press down arrow next toD9500003-...
characteristic which will enable listening for incoming data - Start
node sender.com COM4 $connectionId $yourMessage
. Note connectionId from example "Test read data from mobile" - Observe the "Value" field nex th the characteristic
-
Test send data to all connections:
node sendToAllConnection.js COM4 yourMessage
-
ping-pong test
- Start
node pingpong.js COM4
- Go to nRF connect application, send
PING
to the dongle (or0x50494e47
as hex) - You will see
504f4e47
which is the hex of PONG on the application
- Start