1.0.11 • Published 6 years ago

rpi-obex-monitor v1.0.11

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

rpi-obex-monitor

A Raspberry Pi module for detecting when a file has been uploaded using Bluetooth (by OBEX).

Installation

$ npm install rpi-obex-monitor --save

Usage

var Monitor = require('rpi-obex-monitor');
var monitor = new Monitor();
var Path    = require('path');

monitor.on('upload', (fileName, content) => {

    // The file has already been deleted.
    // File contents is in the contents parameter.
    console.log('File name', fileName);
    console.log('Full path', Path.join(monitor.path, fileName));

    try {
        var json = JSON.parse(content);
        console.log('JSON content');
        console.log(JSON.stringify(json, null, '\t'));
    }
    catch(error) {
        console.log('File content');
        console.log(content);
    }
});

// Enable Bluetooth discovery for 30 minutes.
// Call disableBluetooth() to stop
monitor.enableBluetooth(30 * 60 * 1000);

// Start monitoring. Stop by calling stop()
monitor.start();

Set up Bluetooth

Make sure Bluetooth is up and running.

$ sudo bluetoothctl

Enter the following commands

power on
agent NoInputNoOutput
default-agent
pairable on
exit

Follow this link to set up Bluetooth file transfer. https://www.raspberrypi.org/forums/viewtopic.php?p=963751#p963751 It will make your Raspberry Pi accept files from your Mac or PC.

1.0.11

6 years ago

1.0.10

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago