HTTPS SSH

Mobile Bluetooth Adapters

This is a javascript interface built to give HTML5 mobile applciations the ability to interact with medical deivce peripherals.

This javascript interface is shared between the supported mobile platforms: Android and iOS.

Each of the supported mobile platforms has an identical implementation of the bluetooth adapter barring platform specific colloquialisms. These implementations handle the various use cases a user may expect when interacting with a medical device peripheral.

Usage

Initalization

    window.plugins.BluetoothService.initialize();

Attaching event handlers

    window.plugins.BluetoothService.on('initialize', function(e, payload){
        // I am the event handler method
        // e is always the first parameter and will be defined if there is an error
        // the parameter following e will be a payload of information if it is relevant
    });

Possible events

    .on(/*
        initialized
        enabled
        disabled
        connection
    */, function);

Callback payload structure

    // initialized
    payload = {
        status: true/false  // True if plugin initialization was successful
    }
    // enabled
    payload = {
        status: true/false  // True if enabling Bluetooth was successful
    }
    // disabled
    payload = {
        status: true/false  // True if disabled Bluetooth was successful
    }
    // connection
    payload = {
        // This is either the current device sending data or part of the discovery process
        type: 'weight/blood pressure/discovering/listening'

        // listening
        status: true/false  // True if plugin starts listening, False if plugin stops listening

        // discovering
        status: true/false, // True if the user allowed discovery during the popup
        time: 300           // Discovery uptime in seconds

        // weight
        time: 1360624026,   // Unix time of measurement in seconds
        system: 'lbs/kg',   // Measurement system
        weight: 100         // Weight as an integer
        serial: 5090250438  // Device serial number

        // blood pressure
        time: 1360624026    // Unix time of measurement in seconds
        systolic: 100,      // Systolic pressure as an integer
        diastolic: 100,     // Diastolic pressure as an integer
        pulse: 100,         // Pulse as an integer
        mean: 100           // Arterial mean as an integer
        serial: 5090651014  // Device serial number
    }

Other actions

    window.plugins.BluetoothService.
        enable();                           // Enables the Bluetooth interface
        disabled();                         // Disables the Bluetooth interface
        discoverable();                     // Starts the Bluetooth discovery process
        listen();                           // Begins the process of listening for Bluetooth client connections
        stopListen();                       // Stops the Bluetooth listening process and closes open connections
        isEnabled(callback(e, {             // Passes whether or not the Bluetooth interface is enabled into the callback
            status: true/false
        }));        
        isSupported(callback(e, {           // Passes whether or not the Bluetooth interface is supported into the callback
            status: true/false
        }));
        bonded(callback(e, {                // Passes the current bonded Bluetooth devices into the callback
            devices: [{
                name: 'name of device',
                address: 'address of device',
                isBonded: true/false
            }]
        }));
        getEvents(callback({                // Passes the supported list of events into the callback
            events: [
                'initialized',
                'enabled',
                'disabled',
                'connection'
            ]
        }));

Design Documentation

Docs Wiki - https://bitbucket.org/nexj/mobile-bluetooth-adapters/wiki/Home

Enabling Technology

Apache Cordova - https://cordova.apache.org/