diff --git a/lib-doc/arduinoble_arduinoble.js.html b/lib-doc/arduinoble_arduinoble.js.html new file mode 100644 index 0000000..748d70f --- /dev/null +++ b/lib-doc/arduinoble_arduinoble.js.html @@ -0,0 +1,205 @@ + + + + + JSDoc: Source: arduinoble/arduinoble.js + + + + + + + + + + +
+ +

Source: arduinoble/arduinoble.js

+ + + + + + +
+
+
// File: arduinoble.js
+
+// Load library EasyBLE.
+evothings.loadScript('libs/evothings/easyble/easyble.js');
+
+/**
+ * @namespace
+ * @author Mikael Kindborg
+ * @description <p>Functions for communicating with an Arduino BLE shield.</p>
+ * <p>It is safe practise to call function {@link evothings.scriptsLoaded}
+ * to ensure dependent libraries are loaded before calling functions
+ * in this library.</p>
+ *
+ * @todo This is a very simple library that has only write capability,
+ * read and notification functions should be added.
+ *
+ * @todo Add function to set the write characteristic UUID to make
+ * the code more generic.
+ */
+evothings.arduinoble = {};
+
+;(function()
+{
+	// Internal functions.
+	var internal = {};
+
+	/**
+	 * Stop any ongoing scan and disconnect all devices.
+	 * @public
+	 */
+	evothings.arduinoble.close = function()
+	{
+		evothings.easyble.stopScan();
+		evothings.easyble.closeConnectedDevices();
+	};
+
+	/**
+	 * Called when you've connected to an Arduino BLE shield.
+	 * @callback evothings.arduinoble.connectsuccess
+	 * @param {evothings.arduinoble.ArduinoBLEDevice} device -
+	 * The connected BLE shield.
+	 */
+
+	/**
+	 * Connect to a BLE-shield.
+	 * @param deviceName BLE name if the shield.
+	 * @param {evothings.arduinoble.connectsuccess} success -
+	 * Success callback: success(device)
+	 * @param {function} fail - Error callback: fail(errorCode)
+	 * @example
+	 * evothings.arduinoble.connect(
+	 *   'arduinoble', // Name of BLE shield.
+	 *   function(device)
+	 *   {
+	 *     console.log('connected!');
+	 *     device.writeDataArray(new Uint8Array([1]));
+	 *     evothings.arduinoble.close();
+	 *   },
+	 *   function(errorCode)
+	 *   {
+	 *     console.log('Error: ' + errorCode);
+	 *   });
+	 * @public
+	 */
+	evothings.arduinoble.connect = function(deviceName, success, fail)
+	{
+		evothings.easyble.startScan(
+			function(device)
+			{
+				if (device.name == deviceName)
+				{
+					evothings.easyble.stopScan();
+					internal.connectToDevice(device, success, fail);
+				}
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Connect to the BLE shield.
+	 * @private
+	 */
+	internal.connectToDevice = function(device, success, fail)
+	{
+		device.connect(
+			function(device)
+			{
+				// Get services info.
+				internal.getServices(device, success, fail);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Read all services from the device.
+	 * @private
+	 */
+	internal.getServices = function(device, success, fail)
+	{
+		device.readServices(
+			null, // null means read info for all services
+			function(device)
+			{
+				internal.addMethodsToDeviceObject(device);
+				success(device);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Add instance methods to the device object.
+	 * @private
+	 */
+	internal.addMethodsToDeviceObject = function(device)
+	{
+		/**
+		 * Object that holds info about an Arduino BLE shield.
+		 * @namespace evothings.arduinoble.ArduinoBLEDevice
+		 */
+
+		/**
+		 * @function writeDataArray
+		 * @description Write data to an Arduino BLE shield.
+		 * @param {Uint8Array} uint8array - The data to be written.
+		 * @memberof evothings.arduinoble.ArduinoBLEDevice
+		 * @instance
+		 * @public
+		 */
+		device.writeDataArray = function(uint8array)
+		{
+			device.writeCharacteristic(
+				// TODO: Make this possible to set.
+				'713d0003-503e-4c75-ba94-3148f18d941e',
+				uint8array,
+				function()
+				{
+					console.log('writeCharacteristic success');
+				},
+				function(errorCode)
+				{
+					console.log('writeCharacteristic error: ' + errorCode);
+				});
+		};
+	};
+})();
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/lib-doc/arduinotcp_arduinotcp.js.html b/lib-doc/arduinotcp_arduinotcp.js.html new file mode 100644 index 0000000..f19dbac --- /dev/null +++ b/lib-doc/arduinotcp_arduinotcp.js.html @@ -0,0 +1,474 @@ + + + + + JSDoc: Source: arduinotcp/arduinotcp.js + + + + + + + + + + +
+ +

Source: arduinotcp/arduinotcp.js

+ + + + + + +
+
+
// File: arduinotcp.js
+// Author: Mikael Kindborg
+// Functions for scripting the Arduino board from JavaScript.
+
+/*
+ * Readable names for parameter values. (Having these as
+ * globals is a bit ugly but makes for shorter names in
+ * the application code.)
+ */
+
+/**
+ * Value for setting a pin to output.
+ * @todo Move into namespace
+ */
+var OUTPUT = 1
+
+/**
+ * Value for setting a pin to input.
+ * @todo Move into namespace
+ */
+var INPUT = 2
+
+/**
+ * Value for setting a pin to on.
+ * @todo Move into namespace
+ */
+var HIGH = true
+
+/**
+ * Value for setting a pin to off.
+ * @todo Move into namespace
+ */
+var LOW = false
+
+/**
+ * @namespace
+ * @description <p>Functions for communicating with an Arduino
+ * WiFi shield or Ethernet shield.</p>
+ */
+evothings.arduinotcp = {}
+
+;(function()
+{
+	/**
+	 * Holder of internal library functions.
+	 * @private
+	 */
+	var internal = {}
+
+	/**
+	 * Internal arrays for timeouts.
+	 * @private
+	 */
+	internal.timerTimeouts = []
+
+	/**
+	 * Internal arrays for timer intervals.
+	 * @private
+	 */
+	internal.timerIntervals = []
+
+	/**
+	 * Start timeout timer. This function makes it easier to
+	 * use timeouts in Arduino scripts.
+	 * @param fun Timer function, takes no parameters.
+	 * @param ms Timer delay in milliseconds.
+	 * @public
+	 */
+	evothings.arduinotcp.setTimeout = function(fun, ms)
+	{
+		internal.timerTimeouts.push(
+			setTimeout(fun, ms))
+	}
+
+	/**
+	 * Start interval timer. This function makes it easier to
+	 * use timer intervals in Arduino scripts.
+	 * @param fun Timer function, takes no parameters.
+	 * @param ms Timer interval in milliseconds.
+	 * @public
+	 */
+	evothings.arduinotcp.setInterval = function(fun, ms)
+	{
+		internal.timerIntervals.push(
+			setInterval(fun, ms))
+	}
+
+	/**
+	 * Clear all timers.
+	 */
+	evothings.arduinotcp.clearAllTimers = function()
+	{
+		for (var i = 0; i < internal.timerTimeouts.length; ++i)
+		{
+			clearTimeout(internal.timerTimeouts[i])
+		}
+		for (var i = 0; i < internal.timerIntervals.length; ++i)
+		{
+			clearInterval(internal.timerIntervals[i])
+		}
+		internal.timerTimeouts = []
+		internal.timerIntervals = []
+	}
+
+	/**
+	 * The IP address of the Arduino board.
+	 * @public
+	 */
+	evothings.arduinotcp.ipAddress = ''
+
+	/**
+	 * The port number used by the Arduino server.
+	 * @public
+	 */
+	evothings.arduinotcp.port = 0
+
+	/**
+	 * Returns the current IP address value.
+	 * @return {string} IP address.
+	 * @public
+	 */
+	evothings.arduinotcp.getIpAddress = function()
+	{
+		return evothings.arduinotcp.ipAddress
+	}
+
+	/**
+	 * Write a digital output value.
+	 * @param {number} pinNumber - pin number to read
+	 * @param {number} value - HIGH or LOW
+	 * @public
+	 */
+	evothings.arduinotcp.digitalWrite = function(pinNumber, value)
+	{
+		if (value == HIGH)
+		{
+			internal.sendRequest('H' + pinNumber, internal.callbackFun)
+		}
+		else if (value == LOW)
+		{
+			internal.sendRequest('L' + pinNumber, internal.callbackFun)
+		}
+	}
+
+	/**
+	 * Set pin to output or input.
+	 * @param {number} pinNumber - pin number to read
+	 * @param {number} mode - OUTPUT or INPUT
+	 * @public
+	 */
+	evothings.arduinotcp.pinMode = function(pinNumber, mode)
+	{
+		if (mode == OUTPUT)
+		{
+			internal.sendRequest('O' + pinNumber, internal.callbackFun)
+		}
+		else if (mode == INPUT)
+		{
+			internal.sendRequest('I' + pinNumber, internal.callbackFun)
+		}
+	}
+
+	/**
+	 * Read a digital input value, callback is called with the value
+	 * 'H' or 'L' corresponding to the result of the Arduino function
+	 * digitalRead().
+	 * @param {number} pinNumber - pin number to read
+	 * @param {function} callback - Function called with value of pin.
+	 * Format: callback(value) where value is 'H' or 'L',
+	 * or null on error.
+	 * @public
+	 */
+	evothings.arduinotcp.digitalRead = function(pinNumber, callback)
+	{
+		internal.sendRequest(
+			'R' + pinNumber,
+			function(result)
+			{
+				if (result)
+				{
+					internal.readServerResult(function(data)
+					{
+						callback(data)
+					})
+				}
+				else
+				{
+					callback(null)
+				}
+			}
+		)
+	}
+
+	/**
+	 * Read an analog input value. The callback function is called
+	 * with the value of the Arduino function analogRead().
+	 * @param {number} pinNumber - pin number to read.
+	 * @param {function} callback - Function called with analog value of pin.
+	 * Format: callback(value) where is a number, or null on error.
+	 * @public
+	 */
+	evothings.arduinotcp.analogRead = function(pinNumber, callback)
+	{
+		internal.sendRequest(
+			'A' + pinNumber,
+			function(result)
+			{
+				if (result)
+				{
+					internal.readServerResult(function(data)
+					{
+						callback(data)
+					})
+				}
+				else
+				{
+					callback(null)
+				}
+			}
+		)
+	}
+
+	/**
+	 * Connect to a server running on the Arduino.
+	 * @param {string} hostname
+	 * @param {number} port
+	 * @param {number} callback Function called when connect
+	 * operation has completed. Format: callback(successFlag)
+	 * where successFlag is true on success and false on error.
+	 * @public
+	 */
+	evothings.arduinotcp.connect = function(hostname, port, callback)
+	{
+		evothings.arduinotcp.disconnect()
+
+		chrome.socket.create('tcp', {}, function(createInfo)
+		{
+			internal.socketId = createInfo.socketId
+			chrome.socket.connect(
+				createInfo.socketId,
+				hostname,
+				port,
+				function(resultCode)
+				{
+					internal.connected = (0 === resultCode)
+					callback(internal.connected)
+				}
+			)
+		})
+	}
+
+	/**
+	 * Disconnect from the Arduino.
+	 * @public
+	 */
+	evothings.arduinotcp.disconnect = function()
+	{
+		if (internal.connected)
+		{
+			chrome.socket.disconnect(internal.socketId)
+			internal.connected = false
+		}
+	}
+
+	/**
+	 * Internal connected flag.
+	 * @private
+	 */
+	internal.connected = false
+
+	/**
+	 * Send a request to the Arduino.
+	 * @param command - the command string
+	 * @callback - function on the format: callback(successFlag)
+	 * @private
+	 */
+	internal.sendRequest = function(command, callback)
+	{
+		if (internal.connected)
+		{
+			internal.write(
+				internal.socketId,
+				command + '\n', // Here a newline is added to the end of the request.
+				function(bytesWritten)
+				{
+					// Command length is +1 due to the added newline.
+					callback(bytesWritten === command.length + 1)
+				}
+			)
+		}
+	}
+
+	/**
+	 * Write data.
+	 * Format: callback(bytesWritten)
+	 * @private
+	 */
+	internal.write = function(socketId, string, callback)
+	{
+		chrome.socket.write(
+			socketId,
+			internal.stringToBuffer(string),
+			function(writeInfo)
+			{
+				callback(writeInfo.bytesWritten)
+			}
+		)
+	}
+
+	/**
+	 * Array for the callback queue.
+	 * @private
+	 */
+	internal.resultCallbackQueue = []
+
+	/**
+	 * Data being read from the server.
+	 * @private
+	 */
+	internal.resultData = ''
+
+	/**
+	 * Read result from server, calling the callback function
+	 * with the result.
+	 * Format: callback(data) where data is a string
+	 * @private
+	 */
+	internal.readServerResult = function(callback)
+	{
+		// Add callback to queue.
+		internal.resultCallbackQueue.push(callback)
+
+		// If this is the only callback there is no read operation
+		// in progress, so start reading.
+		if (internal.resultCallbackQueue.length == 1)
+		{
+			internal.resultData = ''
+			internal.readNext()
+		}
+	}
+
+	/**
+	 * Read data from server, when a result is read (reading up to next
+	 * newline char) the first function in the callback queue is called.
+	 * @private
+	 */
+	internal.readNext = function()
+	{
+		console.log('internal.readNext: ' + internal.resultData)
+		chrome.socket.read(
+			internal.socketId,
+			1,
+			function(readInfo)
+			{
+				if (1 == readInfo.resultCode)
+				{
+					var data = internal.bufferToString(readInfo.data)
+					if (data == '\n')
+					{
+						console.log('  end of data: ' + data)
+						// We have read all data, call next result callback with result.
+						var callback = internal.resultCallbackQueue.shift()
+						callback(internal.resultData)
+
+						// If there are callbacks waiting, continue reading
+						// the next result.
+						if (internal.resultCallbackQueue.length > 0)
+						{
+							internal.resultData = ''
+							internal.readNext()
+						}
+					}
+					else
+					{
+						console.log('  got data: ' + data)
+						// We got more data, continue to read.
+						internal.resultData += data
+						internal.readNext()
+					}
+				}
+				else
+				{
+					console.log('  no data')
+					// We did not get any data, read again.
+					internal.readNext()
+				}
+			}
+		)
+	}
+
+	/**
+	 * @private
+	 */
+	internal.callbackFun = function(result)
+	{
+		if (result == false)
+		{
+			alert('Failed to send the command to the Arduino.')
+		}
+	}
+
+	/**
+	 * @private
+	 */
+	internal.bufferToString = function(buffer)
+	{
+		return String.fromCharCode.apply(null, new Uint8Array(buffer))
+	}
+
+	/**
+	 * @private
+	 */
+	internal.stringToBuffer = function(string)
+	{
+		var buffer = new ArrayBuffer(string.length)
+		var bufferView = new Uint8Array(buffer);
+		for (var i = 0; i < string.length; ++i)
+		{
+			bufferView[i] = string.charCodeAt(i) //string[i]
+		}
+		return buffer
+	}
+})()
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/lib-doc/easyble_easyble.js.html b/lib-doc/easyble_easyble.js.html new file mode 100644 index 0000000..4b014f5 --- /dev/null +++ b/lib-doc/easyble_easyble.js.html @@ -0,0 +1,1365 @@ + + + + + JSDoc: Source: easyble/easyble.js + + + + + + + + + + +
+ +

Source: easyble/easyble.js

+ + + + + + +
+
+
// File: easyble.js
+
+;(function()
+{
+	// Load script used by this file.
+	evothings.loadScript('libs/evothings/util/util.js');
+
+	/**
+	 * @namespace
+	 * @description <p>Library for making BLE programming easier.</p>
+	 * <p>It is safe practise to call function {@link evothings.scriptsLoaded}
+	 * to ensure dependent libraries are loaded before calling functions
+	 * in this library.</p>
+	 */
+	evothings.easyble = {};
+
+	/**
+	 * @namespace
+	 * @description Error string.
+	 */
+	evothings.easyble.error = {};
+
+	/**
+	 * @description BLE device was disconnected.
+	 */
+	evothings.easyble.error.DISCONNECTED = 'EASYBLE_ERROR_DISCONNECTED';
+
+	/**
+	 * @description BLE service was not found.
+	 */
+	evothings.easyble.error.SERVICE_NOT_FOUND = 'EASYBLE_ERROR_SERVICE_NOT_FOUND';
+
+	/**
+	 * @description BLE characteristic was not found.
+	 */
+	evothings.easyble.error.CHARACTERISTIC_NOT_FOUND = 'EASYBLE_ERROR_CHARACTERISTIC_NOT_FOUND';
+
+	/**
+	 * @description BLE descriptor was not found.
+	 */
+	evothings.easyble.error.DESCRIPTOR_NOT_FOUND = 'EASYBLE_ERROR_DESCRIPTOR_NOT_FOUND';
+
+	/**
+	 * @private
+	 */
+	var base64 = cordova.require('cordova/base64');
+
+	/**
+	 * Set to true to report found devices only once,
+	 * set to false to report continuously.
+	 * @private
+	 */
+	var reportDeviceOnce = false;
+
+	/**
+	 * @private
+	 */
+	var serviceFilter = false;
+
+	/**
+	 * Internal properties and functions.
+	 * @private
+	 */
+	var internal = {};
+
+	/**
+	 * Internal variable used to track reading of service data.
+	 * @private
+	 */
+	var readCounter = 0;
+
+	/**
+	 * Table of discovered devices.
+	 * @private
+	 */
+	internal.knownDevices = {};
+
+	/**
+	 * Table of connected devices.
+	 * @private
+	 */
+	internal.connectedDevices = {};
+
+	/**
+	 * Set whether to report devices once or continuously during scan.
+	 * The default is to report continously.
+	 * @param {boolean} reportOnce - Set to true to report found devices only once.
+	 * Set to false to report continuously.
+	 * @public
+	 */
+	evothings.easyble.reportDeviceOnce = function(reportOnce)
+	{
+		reportDeviceOnce = reportOnce;
+	};
+
+	/**
+	 * Set to an Array of UUID strings to enable filtering of devices
+	 * found by startScan().
+	 * @param services - Array of UUID strings. Set to false to disable filtering.
+	 * The default is no filtering. An empty array will cause no devices to be reported.
+	 * @public
+	 */
+	evothings.easyble.filterDevicesByService = function(services)
+	{
+		serviceFilter = services;
+	};
+
+	/**
+	 * @description Called during scanning when a BLE device is found.
+	 * @callback evothings.easyble.scanCallback
+	 * @param {evothings.easyble.EasyBLEDevice} device - EasyBLE device object
+	 * found during scanning.
+	 */
+
+	/**
+	 * @description This callback indicates that an operation was successful,
+	 * without specifying and additional information.
+	 * @callback evothings.easyble.emptyCallback - Callback that takes no parameters.
+	 */
+
+	/**
+	 * @description This function is called when an operation fails.
+	 * @callback evothings.easyble.failCallback
+	 * @param {string} errorString - A human-readable string that
+	 * describes the error that occurred.
+	 */
+
+	/**
+	 * @description Called when successfully connected to a device.
+	 * @callback evothings.easyble.connectCallback
+	 * @param {evothings.easyble.EasyBLEDevice} device - EasyBLE devices object.
+	 */
+
+	/**
+	 * @description Called when services are successfully read.
+	 * @callback evothings.easyble.servicesCallback
+	 * @param {evothings.easyble.EasyBLEDevice} device - EasyBLE devices object.
+	 */
+
+	/**
+	 * @description Function when data is available.
+	 * @callback evothings.easyble.dataCallback
+	 * @param {ArrayBuffer} data - The data is an array buffer.
+	 * Use an ArrayBufferView to access the data.
+	 */
+
+	/**
+	 * @description Called with RSSI value.
+	 * @callback evothings.easyble.rssiCallback
+	 * @param {number} rssi - A negative integer, the signal strength in decibels.
+	 * This value may be 127 which indicates an unknown value.
+	 */
+
+	/**
+	 * Start scanning for devices.
+	 * @param {evothings.easyble.scanCallback} - Success function called when a device is found.
+	 * Format: success({@link evothings.easyble.EasyBLEDevice}).
+	 * @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+	 * @public
+	 * @example
+	 *   evothings.easyble.startScan(
+	 *     function(device)
+	 *     {
+	 *       console.log('BLE Found device: ' + device.name);
+	 *     },
+	 *     function(error)
+	 *     {
+	 *       console.log('BLE Scan error: ' + error);
+	 *     });
+	 */
+	evothings.easyble.startScan = function(success, fail)
+	{
+		evothings.easyble.stopScan();
+		internal.knownDevices = {};
+		evothings.ble.startScan(function(device)
+		{
+			// Ensure we have advertisementData.
+			internal.ensureAdvertisementData(device);
+
+			// Check if the device matches the filter, if we have a filter.
+			if(!internal.deviceMatchesServiceFilter(device)) {
+				return;
+			}
+
+			// Check if we already have got the device.
+			var existingDevice = internal.knownDevices[device.address]
+			if (existingDevice)
+			{
+				// Do not report device again if flag is set.
+				if (reportDeviceOnce) { return; }
+
+				// Flag not set, report device again.
+				existingDevice.rssi = device.rssi;
+				existingDevice.name = device.name;
+				existingDevice.scanRecord = device.scanRecord;
+				existingDevice.advertisementData = device.advertisementData;
+				success(existingDevice);
+				return;
+			}
+
+			// New device, add to known devices.
+			internal.knownDevices[device.address] = device;
+
+			// Add methods to the device info object.
+			internal.addMethodsToDeviceObject(device);
+
+			// Call callback function with device info.
+			success(device);
+		},
+		function(errorCode)
+		{
+			fail(errorCode);
+		});
+	};
+
+	/**
+	 * Stop scanning for devices.
+	 * @example
+	 *   evothings.easyble.stopScan();
+	 */
+	evothings.easyble.stopScan = function()
+	{
+		evothings.ble.stopScan();
+	};
+
+	/**
+	 * Disconnect and close all connected BLE devices.
+	 * @example
+	 *   evothings.easyble.closeConnectedDevices();
+	 */
+	evothings.easyble.closeConnectedDevices = function()
+	{
+		for (var key in internal.connectedDevices)
+		{
+			var device = internal.connectedDevices[key];
+			device && device.close();
+			internal.connectedDevices[key] = null;
+		}
+	};
+
+	/**
+	 * If device already has advertisementData, does nothing.
+	 * If device instead has scanRecord, creates advertisementData.
+	 * See ble.js for AdvertisementData reference.
+	 * @param device - Device object.
+	 * @private
+	 */
+	internal.ensureAdvertisementData = function(device)
+	{
+		// If device object already has advertisementData we
+		// do not need to parse the scanRecord.
+		if (device.advertisementData) { return; }
+
+		// Must have scanRecord yo continue.
+		if (!device.scanRecord) { return; }
+
+		// Here we parse BLE/GAP Scan Response Data.
+		// See the Bluetooth Specification, v4.0, Volume 3, Part C, Section 11,
+		// for details.
+
+		var byteArray = evothings.util.base64DecToArr(device.scanRecord);
+		var pos = 0;
+		var advertisementData = {};
+		var serviceUUIDs;
+		var serviceData;
+
+		// The scan record is a list of structures.
+		// Each structure has a length byte, a type byte, and (length-1) data bytes.
+		// The format of the data bytes depends on the type.
+		// Malformed scanRecords will likely cause an exception in this function.
+		while (pos < byteArray.length)
+		{
+			var length = byteArray[pos++];
+			if (length == 0)
+			{
+				break;
+			}
+			length -= 1;
+			var type = byteArray[pos++];
+
+			// Parse types we know and care about.
+			// Skip other types.
+
+			var BLUETOOTH_BASE_UUID = '-0000-1000-8000-00805f9b34fb'
+
+			// Convert 16-byte Uint8Array to RFC-4122-formatted UUID.
+			function arrayToUUID(array, offset)
+			{
+				var k=0;
+				var string = '';
+				var UUID_format = [4, 2, 2, 2, 6];
+				for (var l=0; l<UUID_format.length; l++)
+				{
+					if (l != 0)
+					{
+						string += '-';
+					}
+					for (var j=0; j<UUID_format[l]; j++, k++)
+					{
+						string += evothings.util.toHexString(array[offset+k], 1);
+					}
+				}
+				return string;
+			}
+
+			if (type == 0x02 || type == 0x03) // 16-bit Service Class UUIDs.
+			{
+				serviceUUIDs = serviceUUIDs ? serviceUUIDs : [];
+				for(var i=0; i<length; i+=2)
+				{
+					serviceUUIDs.push(
+						'0000' +
+						evothings.util.toHexString(
+							evothings.util.littleEndianToUint16(byteArray, pos + i),
+							2) +
+						BLUETOOTH_BASE_UUID);
+				}
+			}
+			if (type == 0x04 || type == 0x05) // 32-bit Service Class UUIDs.
+			{
+				serviceUUIDs = serviceUUIDs ? serviceUUIDs : [];
+				for (var i=0; i<length; i+=4)
+				{
+					serviceUUIDs.push(
+						evothings.util.toHexString(
+							evothings.util.littleEndianToUint32(byteArray, pos + i),
+							4) +
+						BLUETOOTH_BASE_UUID);
+				}
+			}
+			if (type == 0x06 || type == 0x07) // 128-bit Service Class UUIDs.
+			{
+				serviceUUIDs = serviceUUIDs ? serviceUUIDs : [];
+				for (var i=0; i<length; i+=16)
+				{
+					serviceUUIDs.push(arrayToUUID(byteArray, pos + i));
+				}
+			}
+			if (type == 0x08 || type == 0x09) // Local Name.
+			{
+				advertisementData.kCBAdvDataLocalName = evothings.ble.fromUtf8(
+					new Uint8Array(byteArray.buffer, pos, length));
+			}
+			if (type == 0x0a) // TX Power Level.
+			{
+				advertisementData.kCBAdvDataTxPowerLevel =
+					evothings.util.littleEndianToInt8(byteArray, pos);
+			}
+			if (type == 0x16) // Service Data, 16-bit UUID.
+			{
+				serviceData = serviceData ? serviceData : {};
+				var uuid =
+					'0000' +
+					evothings.util.toHexString(
+						evothings.util.littleEndianToUint16(byteArray, pos),
+						2) +
+					BLUETOOTH_BASE_UUID;
+				var data = new Uint8Array(byteArray.buffer, pos+2, length-2);
+				serviceData[uuid] = base64.fromArrayBuffer(data);
+			}
+			if (type == 0x20) // Service Data, 32-bit UUID.
+			{
+				serviceData = serviceData ? serviceData : {};
+				var uuid =
+					evothings.util.toHexString(
+						evothings.util.littleEndianToUint32(byteArray, pos),
+						4) +
+					BLUETOOTH_BASE_UUID;
+				var data = new Uint8Array(byteArray.buffer, pos+4, length-4);
+				serviceData[uuid] = base64.fromArrayBuffer(data);
+			}
+			if (type == 0x21) // Service Data, 128-bit UUID.
+			{
+				serviceData = serviceData ? serviceData : {};
+				var uuid = arrayToUUID(byteArray, pos);
+				var data = new Uint8Array(byteArray.buffer, pos+16, length-16);
+				serviceData[uuid] = base64.fromArrayBuffer(data);
+			}
+			if (type == 0xff) // Manufacturer-specific Data.
+			{
+				// Annoying to have to transform base64 back and forth,
+				// but it has to be done in order to maintain the API.
+				advertisementData.kCBAdvDataManufacturerData =
+					base64.fromArrayBuffer(new Uint8Array(byteArray.buffer, pos, length));
+			}
+
+			pos += length;
+		}
+		advertisementData.kCBAdvDataServiceUUIDs = serviceUUIDs;
+		advertisementData.kCBAdvDataServiceData = serviceData;
+		device.advertisementData = advertisementData;
+
+		/*
+		// Log raw data for debugging purposes.
+
+		console.log("scanRecord: "+evothings.util.typedArrayToHexString(byteArray));
+
+		console.log(JSON.stringify(advertisementData));
+		*/
+	}
+
+	/**
+	 * Returns true if the device matches the serviceFilter, or if there is no filter.
+	 * Returns false otherwise.
+	 * @private
+	 */
+	internal.deviceMatchesServiceFilter = function(device)
+	{
+		if (!serviceFilter) { return true; }
+
+		var advertisementData = device.advertisementData;
+		if (advertisementData)
+		{
+			if (advertisementData.kCBAdvDataServiceUUIDs)
+			{
+				for (var i in advertisementData)
+				{
+					for (var j in serviceFilter)
+					{
+						if (advertisementData[i].toLowerCase() ==
+							serviceFilter[j].toLowerCase())
+						{
+							return true;
+						}
+					}
+				}
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Add functions to the device object to allow calling them
+	 * in an object-oriented style.
+	 * @private
+	 */
+	internal.addMethodsToDeviceObject = function(deviceObject)
+	{
+		/**
+		 * This is the BLE DeviceInfo object obtained by calling
+		 * evothings.ble.startScan, with additional properties and
+		 * functions added. Internal properties are prefixed with two
+		 * underscores. Properties are also added to the Characteristic
+		 * and Descriptor objects.
+		 * @namespace
+		 * @alias evothings.easyble.EasyBLEDevice
+		 */
+		var device = deviceObject;
+
+		/**
+		 * Match device name.
+		 * @param name The name to match.
+		 * @return true if device has the given name, false if not.
+		 * @example
+		 *   device.hasName('MyBLEDevice');
+		 */
+		device.hasName = function(name)
+		{
+			var deviceName = device.advertisementData ?
+				device.advertisementData.kCBAdvDataLocalName : null;
+			if (!deviceName) { return false }
+			return 0 == deviceName.indexOf(name);
+		};
+
+		/**
+		 * Connect to the device.
+		 * @param {evothings.easyble.connectCallback} success -
+		 * Called when connected: success(device).
+		 * @param {evothings.easyble.failCallback} fail -
+		 * Called on error and if a disconnect happens.
+		 * Format: error(errorMessage)
+		 * @public
+		 * @instance
+		 * @example
+		 *   device.connect(
+		 *     function(device)
+		 *     {
+		 *       console.log('BLE device connected.');
+		 *       // TODO: Read services here.
+		 *     },
+		 *     function(errorCode)
+		 *     {
+		 *       console.log('BLE connect error: ' + errorCode);
+		 *     });
+		 */
+		device.connect = function(success, fail)
+		{
+			internal.connectToDevice(device, success, fail);
+		};
+
+		/**
+		 * Close the device. This disconnects from the BLE device.
+		 * @public
+		 * @instance
+		 * @example
+		 * device.close();
+		 */
+		device.close = function()
+		{
+			device.deviceHandle && evothings.ble.close(device.deviceHandle);
+		};
+
+		/**
+		 * Read devices RSSI. Device must be connected.
+		 * @param {evothings.easyble.rssiCallback} success - Called with RSSI value: success(rssi).
+		 * @param {evothings.easyble.failCallback} fail - Called on error: fail(error).
+		 * @public
+		 * @instance
+		 */
+		device.readRSSI = function(success, fail)
+		{
+			evothings.ble.rssi(device.deviceHandle, success, fail);
+		};
+
+		/**
+		 * Read services, characteristics and descriptors for the
+		 * specified service UUIDs.
+		 * <strong>Services must be read be able to access characteristics and
+		 * descriptors</strong>. Call this function before reading and writing
+		 * characteristics/descriptors.
+		 * @param serviceUUIDs - array of UUID strings, if null all
+		 * services are read (this can be time-consuming compared to
+		 * reading selected services).
+		 * @param {evothings.easyble.servicesCallback} success -
+		 * Called when services are read: success(device).
+		 * @param {evothings.easyble.failCallback} fail - error callback: error(errorMessage)
+		 * @public
+		 * @instance
+		 * @example
+		 *   device.readServices(
+		 *     null, // Read all services
+		 *     function(device)
+		 *     {
+		 *       console.log('BLE Services available.');
+		 *       // TODO: Read/write/enable notifications here.
+		 *     },
+		 *     function(errorCode)
+		 *     {
+		 *       console.log('BLE readServices error: ' + errorCode);
+		 *     });
+		 */
+		device.readServices = function(serviceUUIDs, success, fail)
+		{
+			internal.readServices(device, serviceUUIDs, success, fail);
+		};
+
+		/**
+		 * Read value of characteristic.
+		 * @param {string} characteristicUUID - UUID of characteristic to read.
+		 * @param {evothings.easyble.dataCallback} success - Success callback: success(data).
+		 * @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		 * @public
+		 * @instance
+		 * @example
+		 *   device.readCharacteristic(
+		 *     characteristicUUID,
+		 *     function(data)
+		 *     {
+		 *       console.log('BLE characteristic data: ' + evothings.ble.fromUtf8(data));
+		 *     },
+		 *     function(errorCode)
+		 *     {
+		 *       console.log('BLE readCharacteristic error: ' + errorCode);
+		 *     });
+		 */
+		device.readCharacteristic = function(characteristicUUID, success, fail)
+		{
+			internal.readCharacteristic(device, characteristicUUID, success, fail);
+		};
+
+		/**
+		* Read value of a specific characteristic.
+		* @param {string} serviceUUID - UUID of service in which the characteristic is found.
+		* @param {string} characteristicUUID - UUID of characteristic to read.
+		* @param {evothings.easyble.dataCallback} success - Success callback: success(data).
+		* @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		* @public
+		* @instance
+		* @example
+		*   device.readServiceCharacteristic(
+		*     serviceUUID,
+		*     characteristicUUID,
+		*     function(data)
+		*     {
+		*       console.log('BLE characteristic data: ' + evothings.ble.fromUtf8(data));
+		*     },
+		*     function(errorCode)
+		*     {
+		*       console.log('BLE readServiceCharacteristic error: ' + errorCode);
+		*     });
+		*/
+		device.readServiceCharacteristic = function(serviceUUID, characteristicUUID, success, fail)
+		{
+			internal.readServiceCharacteristic(device, serviceUUID, characteristicUUID, success, fail);
+		};
+
+		/**
+		 * Read value of descriptor.
+		 * @param {string} characteristicUUID - UUID of characteristic for descriptor.
+		 * @param {string} descriptorUUID - UUID of descriptor to read.
+		 * @param {evothings.easyble.dataCallback} success - Success callback: success(data).
+		 * @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		 * @public
+		 * @instance
+		 * @example
+		 *   device.readDescriptor(
+		 *     characteristicUUID,
+		 *     descriptorUUID,
+		 *     function(data)
+		 *     {
+		 *       console.log('BLE descriptor data: ' + evothings.ble.fromUtf8(data));
+		 *     },
+		 *     function(errorCode)
+		 *     {
+		 *       console.log('BLE readDescriptor error: ' + errorCode);
+		 *     });
+		 */
+		device.readDescriptor = function(characteristicUUID, descriptorUUID, success, fail)
+		{
+			internal.readDescriptor(device, characteristicUUID, descriptorUUID, success, fail);
+		};
+
+		/**
+		* Read value of a specific descriptor.
+		* @param {string} serviceUUID - UUID of service in which the characteristic is found.
+		* @param {string} characteristicUUID - UUID of characteristic for descriptor.
+		* @param {string} descriptorUUID - UUID of descriptor to read.
+		* @param {evothings.easyble.dataCallback} success - Success callback: success(data).
+		* @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		* @public
+		* @instance
+		* @example
+		*   device.readServiceDescriptor(
+		*     serviceUUID,
+		*     characteristicUUID,
+		*     descriptorUUID,
+		*     function(data)
+		*     {
+		*       console.log('BLE descriptor data: ' + evothings.ble.fromUtf8(data));
+		*     },
+		*     function(errorCode)
+		*     {
+		*       console.log('BLE readServiceDescriptor error: ' + errorCode);
+		*     });
+		*/
+		device.readServiceDescriptor = function(serviceUUID, characteristicUUID, descriptorUUID, success, fail)
+		{
+			internal.readServiceDescriptor(device, serviceUUID, characteristicUUID, descriptorUUID, success, fail);
+		};
+
+		/**
+		 * Write value of characteristic.
+		 * @param {string} characteristicUUID - UUID of characteristic to write to.
+		 * @param {ArrayBufferView} value - Value to write.
+		 * @param {evothings.easyble.emptyCallback} success - Success callback: success().
+		 * @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		 * @public
+		 * @instance
+		 * @example
+		 *   device.writeCharacteristic(
+		 *     characteristicUUID,
+		 *     new Uint8Array([1]), // Write byte with value 1.
+		 *     function()
+		 *     {
+		 *       console.log('BLE characteristic written.');
+		 *     },
+		 *     function(errorCode)
+		 *     {
+		 *       console.log('BLE writeCharacteristic error: ' + errorCode);
+		 *     });
+		 */
+		device.writeCharacteristic = function(characteristicUUID, value, success, fail)
+		{
+			internal.writeCharacteristic(device, characteristicUUID, value, success, fail);
+		};
+
+		/**
+		* Write value of a specific characteristic.
+		* @param {string} serviceUUID - UUID of service in which the characteristic is found.
+		* @param {string} characteristicUUID - UUID of characteristic to write to.
+		* @param {ArrayBufferView} value - Value to write.
+		* @param {evothings.easyble.emptyCallback} success - Success callback: success().
+		* @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		* @public
+		* @instance
+		* @example
+		*   device.writeServiceCharacteristic(
+		*     serviceUUID,
+		*     characteristicUUID,
+		*     new Uint8Array([1]), // Write byte with value 1.
+		*     function()
+		*     {
+		*       console.log('BLE characteristic written.');
+		*     },
+		*     function(errorCode)
+		*     {
+		*       console.log('BLE writeServiceCharacteristic error: ' + errorCode);
+		*     });
+		*/
+		device.writeServiceCharacteristic = function(serviceUUID, characteristicUUID, value, success, fail)
+		{
+			internal.writeServiceCharacteristic(device, serviceUUID, characteristicUUID, value, success, fail);
+		};
+
+		/**
+		 * Write value of descriptor.
+		 * @param {string} characteristicUUID - UUID of characteristic for descriptor.
+		 * @param {string} descriptorUUID - UUID of descriptor to write to.
+		 * @param {ArrayBufferView} value - Value to write.
+		 * @param {evothings.easyble.emptyCallback} success - Success callback: success().
+		 * @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		 * @public
+		 * @instance
+		 * @example
+		 *   device.writeDescriptor(
+		 *     characteristicUUID,
+		 *     descriptorUUID,
+		 *     new Uint8Array([1]), // Write byte with value 1.
+		 *     function()
+		 *     {
+		 *       console.log('BLE descriptor written.');
+		 *     },
+		 *     function(errorCode)
+		 *     {
+		 *       console.log('BLE writeDescriptor error: ' + errorCode);
+		 *     });
+		 */
+		device.writeDescriptor = function(characteristicUUID, descriptorUUID, value, success, fail)
+		{
+			internal.writeDescriptor(device, characteristicUUID, descriptorUUID, value, success, fail);
+		};
+
+		/**
+		* Write value of a specific descriptor.
+		* @param {string} serviceUUID - UUID of service in which the characteristic is found.
+		* @param {string} characteristicUUID - UUID of characteristic for descriptor.
+		* @param {string} descriptorUUID - UUID of descriptor to write to.
+		* @param {ArrayBufferView} value - Value to write.
+		* @param {evothings.easyble.emptyCallback} success - Success callback: success().
+		* @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		* @public
+		* @instance
+		* @example
+		*   device.writeServiceDescriptor(
+		*     serviceUUID,
+		*     characteristicUUID,
+		*     descriptorUUID,
+		*     new Uint8Array([1]), // Write byte with value 1.
+		*     function()
+		*     {
+		*       console.log('BLE descriptor written.');
+		*     },
+		*     function(errorCode)
+		*     {
+		*       console.log('BLE writeServiceDescriptor error: ' + errorCode);
+		*     });
+		*/
+		device.writeServiceDescriptor = function(serviceUUID, characteristicUUID, descriptorUUID, value, success, fail)
+		{
+			internal.writeServiceDescriptor(device, serviceUUID, characteristicUUID, descriptorUUID, value, success, fail);
+		};
+
+		/**
+		 * Subscribe to characteristic value updates. The success function
+		 * will be called repeatedly whenever there is new data available.
+		 * @param {string} characteristicUUID - UUID of characteristic to subscribe to.
+		 * @param {evothings.easyble.dataCallback} success - Success callback: success(data).
+		 * @param {evothings.easyble.failCallback} fail - Error callback: fail(error).
+		 * @public
+		 * @instance
+		 * @example
+		 * device.enableNotification(
+		 *   characteristicUUID,
+		 *   function(data)
+		 *   {
+		 *     console.log('BLE characteristic data: ' + evothings.ble.fromUtf8(data));
+		 *   },
+		 *   function(errorCode)
+		 *   {
+		 *     console.log('BLE enableNotification error: ' + errorCode);
+		 *   });
+		 */
+		device.enableNotification = function(characteristicUUID, success, fail)
+		{
+			internal.enableNotification(device, characteristicUUID, success, fail);
+		};
+
+		device.enableServiceNotification = function(serviceUUID, characteristicUUID, success, fail)
+		{
+			internal.enableServiceNotification(device, serviceUUID, characteristicUUID, success, fail);
+		};
+
+		/**
+		 * Unsubscribe from characteristic updates to stop notifications.
+		 * @param characteristicUUID - UUID of characteristic to unsubscribe from
+		 * @param {evothings.easyble.emptyCallback} success - Success callback: success()
+		 * @param {evothings.easyble.failCallback} fail - Error callback: fail(error)
+		 * @public
+		 * @instance
+		 * @example
+		 *  device.disableNotification(
+		 *    characteristicUUID,
+		 *    function()
+		 *    {
+		 *      console.log('BLE characteristic notification disabled');
+		 *    },
+		 *    function(errorCode)
+		 *    {
+		 *      console.log('BLE disableNotification error: ' + errorCode);
+		 *    });
+		 */
+		device.disableNotification = function(characteristicUUID, success, fail)
+		{
+			internal.disableNotification(device, characteristicUUID, success, fail);
+		};
+
+		device.disableServiceNotification = function(serviceUUID, characteristicUUID, success, fail)
+		{
+			internal.disableServiceNotification(device, serviceUUID, characteristicUUID, success, fail);
+		};
+	};
+
+	/**
+	 * Connect to a device.
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.connectToDevice = function(device, success, fail)
+	{
+		evothings.ble.connect(device.address, function(connectInfo)
+		{
+			if (connectInfo.state == 2) // connected
+			{
+				device.deviceHandle = connectInfo.deviceHandle;
+				device.__uuidMap = {};
+				device.__serviceMap = {};
+				internal.connectedDevices[device.address] = device;
+
+				success(device);
+			}
+			else if (connectInfo.state == 0) // disconnected
+			{
+				internal.connectedDevices[device.address] = null;
+
+				// TODO: Perhaps this should be redesigned, as disconnect is
+				// more of a status change than an error? What do you think?
+				fail && fail(evothings.easyble.error.DISCONNECTED);
+			}
+		},
+		function(errorCode)
+		{
+			fail(errorCode);
+		});
+	};
+
+	/**
+	 * Obtain device services, them read characteristics and descriptors
+	 * for the services with the given uuid(s).
+	 * If serviceUUIDs is null, info is read for all services.
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.readServices = function(device, serviceUUIDs, success, fail)
+	{
+		// Read services.
+		evothings.ble.services(
+			device.deviceHandle,
+			function(services)
+			{
+				// Array that stores services.
+				device.__services = [];
+
+				for (var i = 0; i < services.length; ++i)
+				{
+					var service = services[i];
+					service.uuid = service.uuid.toLowerCase();
+					device.__services.push(service);
+					device.__uuidMap[service.uuid] = service;
+				}
+
+				internal.readCharacteristicsForServices(
+					device, serviceUUIDs, success, fail);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Read characteristics and descriptors for the services with the given uuid(s).
+	 * If serviceUUIDs is null, info for all services are read.
+	 * Internal function.
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.readCharacteristicsForServices = function(device, serviceUUIDs, success, fail)
+	{
+		var characteristicsCallbackFun = function(service)
+		{
+			// Array with characteristics for service.
+			service.__characteristics = [];
+
+			return function(characteristics)
+			{
+				--readCounter; // Decrements the count added by services.
+				readCounter += characteristics.length;
+				for (var i = 0; i < characteristics.length; ++i)
+				{
+					var characteristic = characteristics[i];
+					characteristic.uuid = characteristic.uuid.toLowerCase();
+					service.__characteristics.push(characteristic);
+					device.__uuidMap[characteristic.uuid] = characteristic;
+					device.__serviceMap[service.uuid + ':' + characteristic.uuid] = characteristic;
+
+					// Read descriptors for characteristic.
+					evothings.ble.descriptors(
+						device.deviceHandle,
+						characteristic.handle,
+						descriptorsCallbackFun(service, characteristic),
+						function(errorCode)
+						{
+							fail(errorCode);
+						});
+				}
+			};
+		};
+
+ 		/**
+	 	 * @private
+	 	 */
+		var descriptorsCallbackFun = function(service, characteristic)
+		{
+			// Array with descriptors for characteristic.
+			characteristic.__descriptors = [];
+
+			return function(descriptors)
+			{
+				--readCounter; // Decrements the count added by characteristics.
+				for (var i = 0; i < descriptors.length; ++i)
+				{
+					var descriptor = descriptors[i];
+					descriptor.uuid = descriptor.uuid.toLowerCase();
+					characteristic.__descriptors.push(descriptor);
+					device.__uuidMap[characteristic.uuid + ':' + descriptor.uuid] = descriptor;
+					device.__serviceMap[service.uuid + ':' + characteristic.uuid + ':' + descriptor.uuid] = descriptor;
+				}
+				if (0 == readCounter)
+				{
+					// Everything is read.
+					success(device);
+				}
+			};
+		};
+
+		// Initialize read counter.
+		readCounter = 0;
+
+		if (null != serviceUUIDs)
+		{
+			// Read info for service UUIDs.
+			readCounter = serviceUUIDs.length;
+			for (var i = 0; i < serviceUUIDs.length; ++i)
+			{
+				var uuid = serviceUUIDs[i].toLowerCase();
+				var service = device.__uuidMap[uuid];
+				if (!service)
+				{
+					fail(evothings.easyble.error.SERVICE_NOT_FOUND + ' ' + uuid);
+					return;
+				}
+
+				// Read characteristics for service. Will also read descriptors.
+				evothings.ble.characteristics(
+					device.deviceHandle,
+					service.handle,
+					characteristicsCallbackFun(service),
+					function(errorCode)
+					{
+						fail(errorCode);
+					});
+			}
+		}
+		else
+		{
+			// Read info for all services.
+			readCounter = device.__services.length;
+			for (var i = 0; i < device.__services.length; ++i)
+			{
+				// Read characteristics for service. Will also read descriptors.
+				var service = device.__services[i];
+				evothings.ble.characteristics(
+					device.deviceHandle,
+					service.handle,
+					characteristicsCallbackFun(service),
+					function(errorCode)
+					{
+						fail(errorCode);
+					});
+			}
+		}
+	};
+
+ 	/**
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.readCharacteristic = function(device, characteristicUUID, success, fail)
+	{
+		characteristicUUID = characteristicUUID.toLowerCase();
+
+		var characteristic = device.__uuidMap[characteristicUUID];
+		if (!characteristic)
+		{
+			fail(evothings.easyble.error.CHARACTERISTIC_NOT_FOUND + ' ' +
+				characteristicUUID);
+			return;
+		}
+
+		evothings.ble.readCharacteristic(
+			device.deviceHandle,
+			characteristic.handle,
+			success,
+			fail);
+	};
+
+	/**
+	* Called from evothings.easyble.EasyBLEDevice.
+	* @private
+	*/
+	internal.readServiceCharacteristic = function(device, serviceUUID, characteristicUUID, success, fail)
+	{
+		var key = serviceUUID.toLowerCase() + ':' + characteristicUUID.toLowerCase();
+
+		var characteristic = device.__serviceMap[key];
+		if (!characteristic)
+		{
+			fail(evothings.easyble.error.CHARACTERISTIC_NOT_FOUND + ' ' + key);
+			return;
+		}
+
+		evothings.ble.readCharacteristic(
+			device.deviceHandle,
+			characteristic.handle,
+			success,
+			fail);
+	};
+
+ 	/**
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.readDescriptor = function(device, characteristicUUID, descriptorUUID, success, fail)
+	{
+		characteristicUUID = characteristicUUID.toLowerCase();
+		descriptorUUID = descriptorUUID.toLowerCase();
+
+		var descriptor = device.__uuidMap[characteristicUUID + ':' + descriptorUUID];
+		if (!descriptor)
+		{
+			fail(evothings.easyble.error.DESCRIPTOR_NOT_FOUND + ' ' + descriptorUUID);
+			return;
+		}
+
+		evothings.ble.readDescriptor(
+			device.deviceHandle,
+			descriptor.handle,
+			value,
+			function()
+			{
+				success();
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	* Called from evothings.easyble.EasyBLEDevice.
+	* @private
+	*/
+	internal.readServiceDescriptor = function(device, serviceUUID, characteristicUUID, descriptorUUID, success, fail)
+	{
+		var key = serviceUUID.toLowerCase() + ':' + characteristicUUID.toLowerCase() + ':' + descriptorUUID.toLowerCase();
+
+		var descriptor = device.__serviceMap[key];
+		if (!descriptor)
+		{
+			fail(evothings.easyble.error.DESCRIPTOR_NOT_FOUND + ' ' + key);
+			return;
+		}
+
+		evothings.ble.readDescriptor(
+			device.deviceHandle,
+			descriptor.handle,
+			success,
+			fail);
+	};
+
+ 	/**
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.writeCharacteristic = function(device, characteristicUUID, value, success, fail)
+	{
+		characteristicUUID = characteristicUUID.toLowerCase();
+
+		var characteristic = device.__uuidMap[characteristicUUID];
+		if (!characteristic)
+		{
+			fail(evothings.easyble.error.CHARACTERISTIC_NOT_FOUND + ' ' +
+				characteristicUUID);
+			return;
+		}
+
+		evothings.ble.writeCharacteristic(
+			device.deviceHandle,
+			characteristic.handle,
+			value,
+			function()
+			{
+				success();
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	* Called from evothings.easyble.EasyBLEDevice.
+	* @private
+	*/
+	internal.writeServiceCharacteristic = function(device, serviceUUID, characteristicUUID, value, success, fail)
+	{
+		var key = serviceUUID.toLowerCase() + ':' + characteristicUUID.toLowerCase();
+
+		var characteristic = device.__serviceMap[key];
+		if (!characteristic)
+		{
+			fail(evothings.easyble.error.CHARACTERISTIC_NOT_FOUND + ' ' + key);
+			return;
+		}
+
+		evothings.ble.writeCharacteristic(
+			device.deviceHandle,
+			characteristic.handle,
+			value,
+			success,
+			fail);
+	};
+
+ 	/**
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.writeDescriptor = function(
+		device, characteristicUUID, descriptorUUID, value, success, fail)
+	{
+		characteristicUUID = characteristicUUID.toLowerCase();
+		descriptorUUID = descriptorUUID.toLowerCase();
+
+		var descriptor = device.__uuidMap[characteristicUUID + ':' + descriptorUUID];
+		if (!descriptor)
+		{
+			fail(evothings.easyble.error.DESCRIPTOR_NOT_FOUND + ' ' + descriptorUUID);
+			return;
+		}
+
+		evothings.ble.writeDescriptor(
+			device.deviceHandle,
+			descriptor.handle,
+			value,
+			function()
+			{
+				success();
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	* Called from evothings.easyble.EasyBLEDevice.
+	* @private
+	*/
+	internal.writeServiceDescriptor = function(device, serviceUUID, characteristicUUID, descriptorUUID, value, success, fail)
+	{
+		var key = serviceUUID.toLowerCase() + ':' + characteristicUUID.toLowerCase() + ':' + descriptorUUID.toLowerCase();
+
+		var descriptor = device.__serviceMap[key];
+		if (!descriptor)
+		{
+			fail(evothings.easyble.error.DESCRIPTOR_NOT_FOUND + ' ' + key);
+			return;
+		}
+
+		evothings.ble.writeDescriptor(
+			device.deviceHandle,
+			descriptor.handle,
+			value,
+			success,
+			fail);
+	};
+
+ 	/**
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.enableNotification = function(device, characteristicUUID, success, fail)
+	{
+		characteristicUUID = characteristicUUID.toLowerCase();
+
+		var characteristic = device.__uuidMap[characteristicUUID];
+		if (!characteristic)
+		{
+			fail(evothings.easyble.error.CHARACTERISTIC_NOT_FOUND + ' ' +
+				characteristicUUID);
+			return;
+		}
+
+		evothings.ble.enableNotification(
+			device.deviceHandle,
+			characteristic.handle,
+			success,
+			fail);
+	};
+
+	/**
+	* Called from evothings.easyble.EasyBLEDevice.
+	* @private
+	*/
+	internal.enableServiceNotification = function(device, serviceUUID, characteristicUUID, success, fail)
+	{
+		var key = serviceUUID.toLowerCase() + ':' + characteristicUUID.toLowerCase();
+
+		var characteristic = device.__serviceMap[key];
+		if (!characteristic)
+		{
+			fail(evothings.easyble.error.CHARACTERISTIC_NOT_FOUND + ' ' + key);
+			return;
+		}
+
+		evothings.ble.enableNotification(
+			device.deviceHandle,
+			characteristic.handle,
+			success,
+			fail);
+	};
+
+ 	/**
+ 	 * Called from evothings.easyble.EasyBLEDevice.
+	 * @private
+	 */
+	internal.disableNotification = function(device, characteristicUUID, success, fail)
+	{
+		characteristicUUID = characteristicUUID.toLowerCase();
+
+		var characteristic = device.__uuidMap[characteristicUUID];
+		if (!characteristic)
+		{
+			fail(evothings.easyble.error.CHARACTERISTIC_NOT_FOUND + ' ' +
+				characteristicUUID);
+			return;
+		}
+
+		evothings.ble.disableNotification(
+			device.deviceHandle,
+			characteristic.handle,
+			success,
+			fail);
+	};
+
+	/**
+	* Called from evothings.easyble.EasyBLEDevice.
+	* @private
+	*/
+	internal.disableServiceNotification = function(device, serviceUUID, characteristicUUID, success, fail)
+	{
+		var key = serviceUUID.toLowerCase() + ':' + characteristicUUID.toLowerCase();
+
+		var characteristic = device.__serviceMap[key];
+		if (!characteristic)
+		{
+			fail(evothings.easyble.error.CHARACTERISTIC_NOT_FOUND + ' ' + key);
+			return;
+		}
+
+		evothings.ble.disableNotification(
+			device.deviceHandle,
+			characteristic.handle,
+			success,
+			fail);
+	};
+
+	/**
+	 * Prints and object for debugging purposes.
+	 * @deprecated. Defined here for backwards compatibility.
+	 * Use evothings.printObject().
+	 * @public
+	 */
+	evothings.easyble.printObject = evothings.printObject;
+
+ 	/**
+ 	 * Reset the BLE hardware. Can be time consuming.
+	 * @public
+	 */
+	evothings.easyble.reset = function()
+	{
+		evothings.ble.reset();
+	};
+})();
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/lib-doc/eddystone_eddystone.js.html b/lib-doc/eddystone_eddystone.js.html new file mode 100644 index 0000000..c1158df --- /dev/null +++ b/lib-doc/eddystone_eddystone.js.html @@ -0,0 +1,236 @@ + + + + + JSDoc: Source: eddystone/eddystone.js + + + + + + + + + + +
+ +

Source: eddystone/eddystone.js

+ + + + + + +
+
+
// This library scans for Eddystone beacons and translates their
+// advertisements into user-friendly variables.
+// The protocol specification is available at:
+// https://github.com/google/eddystone
+
+// prerequisites
+evothings.loadScripts([
+	'libs/evothings/easyble/easyble.js',
+])
+
+evothings.eddystone = {};
+
+(function() {
+// constants
+var BLUETOOTH_BASE_UUID = '-0000-1000-8000-00805f9b34fb';
+
+// false when scanning is off. true when on.
+var isScanning = false;
+
+/** Starts scanning for Eddystone devices.
+* <p>Found devices and errors will be reported to the supplied callbacks.</p>
+* <p>Will keep scanning indefinitely until you call stopScan().</p>
+* To conserve energy, call stopScan() as soon as you've found the device you're looking for.
+* <p>Calling this function while scanning is in progress will fail.</p>
+*
+* @param {scanCallback} win
+* @param {failCallback} fail
+*/
+evothings.eddystone.startScan = function(win, fail) {
+	// If scanning is already in progress, fail.
+	if(isScanning) {
+		fail("Scanning already in progress!");
+		return;
+	}
+
+	isScanning = true;
+
+	// The device object given in this callback is reused by easyble.
+	// Therefore we can store data in it and expect to have the data still be there
+	// on the next callback with the same device.
+	evothings.easyble.startScan(function(device) {
+		// A device might be an Eddystone if it has advertisementData...
+		var ad = device.advertisementData;
+		if(!ad) return;
+		// With serviceData...
+		var sd = ad.kCBAdvDataServiceData;
+		if(!sd) return;
+		// And the 0xFEAA service.
+		var base64data = sd['0000feaa'+BLUETOOTH_BASE_UUID];
+		if(!base64data) return;
+		var byteArray = evothings.util.base64DecToArr(base64data);
+
+		// If the data matches one of the Eddystone frame formats,
+		// we can forward it to the user.
+		if(parseFrameUID(device, byteArray, win, fail)) return;
+		if(parseFrameURL(device, byteArray, win, fail)) return;
+		if(parseFrameTLM(device, byteArray, win, fail)) return;
+
+	}, function(error) {
+		fail(error);
+	});
+}
+
+/** This function is a parameter to startScan() and is called when a new device is discovered.
+* @callback scanCallback
+* @param {EddystoneDevice} device
+*/
+
+/** Object representing a BLE device. Inherits from evothings.easyble.EasyBLEDevice.
+* All uninherited properties are optional; they may be missing.
+* @typedef {Object} EddystoneDevice
+* @property {string} url - An Internet URL.
+* @property {number} txPower - A signed integer, the signal strength in decibels, factory-measured at a range of 0 meters.
+* @property {Uint8Array} nid - 10-byte namespace ID.
+* @property {Uint8Array} bid - 6-byte beacon ID.
+* @property {number} voltage - Device's battery voltage, in millivolts, or 0 (zero) if device is not battery-powered.
+* @property {number} temperature - Device's ambient temperature in 256:ths of degrees Celcius, or 0x8000 if device has no thermometer.
+* @property {number} adv_cnt - Count of advertisement frames sent since device's startup.
+* @property {number} dsec_cnt - Time since device's startup, in deci-seconds (10 units equals 1 second).
+*/
+
+/** Stop scanning for Eddystone devices.
+*/
+evothings.eddystone.stopScan = function() {
+	evothings.easyble.stopScan();
+	isScanning = false;
+}
+
+// Return true on frame type recognition, false otherwise.
+function parseFrameUID(device, data, win, fail) {
+	if(data[0] != 0x00) return false;
+	// The UID frame has 18 bytes + 2 bytes reserved for future use
+	// https://github.com/google/eddystone/tree/master/eddystone-uid
+	// Check that we got at least 18 bytes.
+	if(data.byteLength < 18) {
+		fail("UID frame: invalid byteLength: "+data.byteLength);
+		return true;
+	}
+	device.txPower = evothings.util.littleEndianToInt8(data, 1);
+	device.nid = data.subarray(2, 12);  // Namespace ID.
+	device.bid = data.subarray(12, 18); // Beacon ID.
+	win(device);
+	return true;
+}
+
+function parseFrameURL(device, data, win, fail) {
+	if(data[0] != 0x10) return false;
+	if(data.byteLength < 4) {
+		fail("URL frame: invalid byteLength: "+data.byteLength);
+		return true;
+	}
+	device.txPower = evothings.util.littleEndianToInt8(data, 1);
+	var url;
+	// URL scheme prefix
+	switch(data[2]) {
+		case 0: url = 'http://www.'; break;
+		case 1: url = 'https://www.'; break;
+		case 2: url = 'http://'; break;
+		case 3: url = 'https://'; break;
+		default: fail("URL frame: invalid prefix: "+data[2]); return true;
+	}
+	// Process each byte in sequence.
+	var i = 3;
+	while(i < data.byteLength) {
+		var c = data[i];
+		// A byte is either a top-domain shortcut, or a printable ascii character.
+		if(c < 14) {
+			switch(c) {
+				case 0: url += '.com/'; break;
+				case 1: url += '.org/'; break;
+				case 2: url += '.edu/'; break;
+				case 3: url += '.net/'; break;
+				case 4: url += '.info/'; break;
+				case 5: url += '.biz/'; break;
+				case 6: url += '.gov/'; break;
+				case 7: url += '.com'; break;
+				case 8: url += '.org'; break;
+				case 9: url += '.edu'; break;
+				case 10: url += '.net'; break;
+				case 11: url += '.info'; break;
+				case 12: url += '.biz'; break;
+				case 13: url += '.gov'; break;
+			}
+		} else if(c < 32 || c >= 127) {
+			// Unprintables are not allowed.
+			fail("URL frame: invalid character: "+data[2]);
+			return true;
+		} else {
+			url += String.fromCharCode(c);
+		}
+
+		i += 1;
+	}
+	device.url = url;
+	win(device);
+	return true;
+}
+
+function parseFrameTLM(device, data, win, fail) {
+	if(data[0] != 0x20) return false;
+	if(data[1] != 0x00) {
+		fail("TLM frame: unknown version: "+data[1]);
+		return true;
+	}
+	if(data.byteLength != 14) {
+		fail("TLM frame: invalid byteLength: "+data.byteLength);
+		return true;
+	}
+
+	device.voltage = evothings.util.bigEndianToUint16(data, 2);
+
+	var temp = evothings.util.bigEndianToUint16(data, 4);
+	if(temp == 0x8000)
+		device.temperature = 0x8000;
+	else
+		device.temperature = evothings.util.bigEndianToInt16(data, 4) / 256.0;
+
+	device.adv_cnt = evothings.util.bigEndianToUint32(data, 6);
+	device.dsec_cnt = evothings.util.bigEndianToUint32(data, 10);
+
+	win(device);
+	return true;
+}
+
+})();
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/lib-doc/evothings.arduinoble.ArduinoBLEDevice.html b/lib-doc/evothings.arduinoble.ArduinoBLEDevice.html new file mode 100644 index 0000000..e51ef0d --- /dev/null +++ b/lib-doc/evothings.arduinoble.ArduinoBLEDevice.html @@ -0,0 +1,269 @@ + + + + + JSDoc: Namespace: ArduinoBLEDevice + + + + + + + + + + +
+ +

Namespace: ArduinoBLEDevice

+ + + + + + +
+ +
+ +

+ evothings.arduinoble. + + ArduinoBLEDevice +

+ + +
+ +
+
+ + +
Object that holds info about an Arduino BLE shield.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

writeDataArray(uint8array)

+ + + + + +
+ Write data to an Arduino BLE shield. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uint8array + + +Uint8Array + + + + The data to be written.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.arduinoble.html b/lib-doc/evothings.arduinoble.html new file mode 100644 index 0000000..e51eaf3 --- /dev/null +++ b/lib-doc/evothings.arduinoble.html @@ -0,0 +1,571 @@ + + + + + JSDoc: Namespace: arduinoble + + + + + + + + + + +
+ +

Namespace: arduinoble

+ + + + + + +
+ +
+ +

+ evothings. + + arduinoble +

+ + +
+ +
+
+ + +

Functions for communicating with an Arduino BLE shield.

+

It is safe practise to call function evothings.scriptsLoaded +to ensure dependent libraries are loaded before calling functions +in this library.

+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Mikael Kindborg
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
To Do:
+
+
    +
  • This is a very simple library that has only write capability, +read and notification functions should be added.
  • + +
  • Add function to set the write characteristic UUID to make +the code more generic.
  • +
+
+ +
+ + + + +
+ + + + + + + + + + +

Namespaces

+ +
+
ArduinoBLEDevice
+
+
+ + + + + +

Methods

+ + + + + + +

(static) close()

+ + + + + +
+ Stop any ongoing scan and disconnect all devices. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) connect(deviceName, success, fail)

+ + + + + +
+ Connect to a BLE-shield. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
deviceName + + BLE name if the shield.
success + + +evothings.arduinoble.connectsuccess + + + + Success callback: success(device)
fail + + +function + + + + Error callback: fail(errorCode)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
evothings.arduinoble.connect(
+  'arduinoble', // Name of BLE shield.
+  function(device)
+  {
+    console.log('connected!');
+    device.writeDataArray(new Uint8Array([1]));
+    evothings.arduinoble.close();
+  },
+  function(errorCode)
+  {
+    console.log('Error: ' + errorCode);
+  });
+ + + + + + + +

Type Definitions

+ + + + + + +

connectsuccess(device)

+ + + + + +
+ Called when you've connected to an Arduino BLE shield. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +evothings.arduinoble.ArduinoBLEDevice + + + + The connected BLE shield.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.arduinotcp.html b/lib-doc/evothings.arduinotcp.html new file mode 100644 index 0000000..eeb661a --- /dev/null +++ b/lib-doc/evothings.arduinotcp.html @@ -0,0 +1,1626 @@ + + + + + JSDoc: Namespace: arduinotcp + + + + + + + + + + +
+ +

Namespace: arduinotcp

+ + + + + + +
+ +
+ +

+ evothings. + + arduinotcp +

+ + +
+ +
+
+ + +

Functions for communicating with an Arduino +WiFi shield or Ethernet shield.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static) ipAddress

+ + + + +
+ The IP address of the Arduino board. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) port

+ + + + +
+ The port number used by the Arduino server. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) analogRead(pinNumber, callback)

+ + + + + +
+ Read an analog input value. The callback function is called +with the value of the Arduino function analogRead(). +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pinNumber + + +number + + + + pin number to read.
callback + + +function + + + + Function called with analog value of pin. +Format: callback(value) where is a number, or null on error.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) clearAllTimers()

+ + + + + +
+ Clear all timers. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) connect(hostname, port, callback)

+ + + + + +
+ Connect to a server running on the Arduino. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
hostname + + +string + + + +
port + + +number + + + +
callback + + +number + + + + Function called when connect +operation has completed. Format: callback(successFlag) +where successFlag is true on success and false on error.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) digitalRead(pinNumber, callback)

+ + + + + +
+ Read a digital input value, callback is called with the value +'H' or 'L' corresponding to the result of the Arduino function +digitalRead(). +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pinNumber + + +number + + + + pin number to read
callback + + +function + + + + Function called with value of pin. +Format: callback(value) where value is 'H' or 'L', +or null on error.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) digitalWrite(pinNumber, value)

+ + + + + +
+ Write a digital output value. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pinNumber + + +number + + + + pin number to read
value + + +number + + + + HIGH or LOW
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) disconnect()

+ + + + + +
+ Disconnect from the Arduino. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) getIpAddress() → {string}

+ + + + + +
+ Returns the current IP address value. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ IP address. +
+ + + +
+
+ Type +
+
+ +string + + +
+
+ + + + + + + + + + +

(static) pinMode(pinNumber, mode)

+ + + + + +
+ Set pin to output or input. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pinNumber + + +number + + + + pin number to read
mode + + +number + + + + OUTPUT or INPUT
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) setInterval(fun, ms)

+ + + + + +
+ Start interval timer. This function makes it easier to +use timer intervals in Arduino scripts. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + Timer function, takes no parameters.
ms + + Timer interval in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) setTimeout(fun, ms)

+ + + + + +
+ Start timeout timer. This function makes it easier to +use timeouts in Arduino scripts. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + Timer function, takes no parameters.
ms + + Timer delay in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.easyble.EasyBLEDevice.html b/lib-doc/evothings.easyble.EasyBLEDevice.html new file mode 100644 index 0000000..7a51032 --- /dev/null +++ b/lib-doc/evothings.easyble.EasyBLEDevice.html @@ -0,0 +1,3080 @@ + + + + + JSDoc: Namespace: EasyBLEDevice + + + + + + + + + + +
+ +

Namespace: EasyBLEDevice

+ + + + + + +
+ +
+ +

+ evothings.easyble. + + EasyBLEDevice +

+ + +
+ +
+
+ + +
This is the BLE DeviceInfo object obtained by calling +evothings.ble.startScan, with additional properties and +functions added. Internal properties are prefixed with two +underscores. Properties are also added to the Characteristic +and Descriptor objects.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) hasName(name)

+ + + + + +
+ Match device name. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + The name to match.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ true if device has the given name, false if not. +
+ + + + + + +
Example
+ +
device.hasName('MyBLEDevice');
+ + + + + + + + +

close()

+ + + + + +
+ Close the device. This disconnects from the BLE device. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.close();
+ + + + + + + + +

connect(success, fail)

+ + + + + +
+ Connect to the device. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +evothings.easyble.connectCallback + + + + Called when connected: success(device).
fail + + +evothings.easyble.failCallback + + + + Called on error and if a disconnect happens. +Format: error(errorMessage)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.connect(
+    function(device)
+    {
+      console.log('BLE device connected.');
+      // TODO: Read services here.
+    },
+    function(errorCode)
+    {
+      console.log('BLE connect error: ' + errorCode);
+    });
+ + + + + + + + +

disableNotification(characteristicUUID, success, fail)

+ + + + + +
+ Unsubscribe from characteristic updates to stop notifications. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
characteristicUUID + + UUID of characteristic to unsubscribe from
success + + +evothings.easyble.emptyCallback + + + + Success callback: success()
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.disableNotification(
+   characteristicUUID,
+   function()
+   {
+     console.log('BLE characteristic notification disabled');
+   },
+   function(errorCode)
+   {
+     console.log('BLE disableNotification error: ' + errorCode);
+   });
+ + + + + + + + +

enableNotification(characteristicUUID, success, fail)

+ + + + + +
+ Subscribe to characteristic value updates. The success function +will be called repeatedly whenever there is new data available. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
characteristicUUID + + +string + + + + UUID of characteristic to subscribe to.
success + + +evothings.easyble.dataCallback + + + + Success callback: success(data).
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.enableNotification(
+  characteristicUUID,
+  function(data)
+  {
+    console.log('BLE characteristic data: ' + evothings.ble.fromUtf8(data));
+  },
+  function(errorCode)
+  {
+    console.log('BLE enableNotification error: ' + errorCode);
+  });
+ + + + + + + + +

readCharacteristic(characteristicUUID, success, fail)

+ + + + + +
+ Read value of characteristic. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
characteristicUUID + + +string + + + + UUID of characteristic to read.
success + + +evothings.easyble.dataCallback + + + + Success callback: success(data).
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.readCharacteristic(
+    characteristicUUID,
+    function(data)
+    {
+      console.log('BLE characteristic data: ' + evothings.ble.fromUtf8(data));
+    },
+    function(errorCode)
+    {
+      console.log('BLE readCharacteristic error: ' + errorCode);
+    });
+ + + + + + + + +

readDescriptor(characteristicUUID, descriptorUUID, success, fail)

+ + + + + +
+ Read value of descriptor. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
characteristicUUID + + +string + + + + UUID of characteristic for descriptor.
descriptorUUID + + +string + + + + UUID of descriptor to read.
success + + +evothings.easyble.dataCallback + + + + Success callback: success(data).
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.readDescriptor(
+    characteristicUUID,
+    descriptorUUID,
+    function(data)
+    {
+      console.log('BLE descriptor data: ' + evothings.ble.fromUtf8(data));
+    },
+    function(errorCode)
+    {
+      console.log('BLE readDescriptor error: ' + errorCode);
+    });
+ + + + + + + + +

readRSSI(success, fail)

+ + + + + +
+ Read devices RSSI. Device must be connected. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +evothings.easyble.rssiCallback + + + + Called with RSSI value: success(rssi).
fail + + +evothings.easyble.failCallback + + + + Called on error: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

readServiceCharacteristic(serviceUUID, characteristicUUID, success, fail)

+ + + + + +
+ Read value of a specific characteristic. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceUUID + + +string + + + + UUID of service in which the characteristic is found.
characteristicUUID + + +string + + + + UUID of characteristic to read.
success + + +evothings.easyble.dataCallback + + + + Success callback: success(data).
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.readServiceCharacteristic(
+    serviceUUID,
+    characteristicUUID,
+    function(data)
+    {
+      console.log('BLE characteristic data: ' + evothings.ble.fromUtf8(data));
+    },
+    function(errorCode)
+    {
+      console.log('BLE readServiceCharacteristic error: ' + errorCode);
+    });
+ + + + + + + + +

readServiceDescriptor(serviceUUID, characteristicUUID, descriptorUUID, success, fail)

+ + + + + +
+ Read value of a specific descriptor. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceUUID + + +string + + + + UUID of service in which the characteristic is found.
characteristicUUID + + +string + + + + UUID of characteristic for descriptor.
descriptorUUID + + +string + + + + UUID of descriptor to read.
success + + +evothings.easyble.dataCallback + + + + Success callback: success(data).
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.readServiceDescriptor(
+    serviceUUID,
+    characteristicUUID,
+    descriptorUUID,
+    function(data)
+    {
+      console.log('BLE descriptor data: ' + evothings.ble.fromUtf8(data));
+    },
+    function(errorCode)
+    {
+      console.log('BLE readServiceDescriptor error: ' + errorCode);
+    });
+ + + + + + + + +

readServices(serviceUUIDs, success, fail)

+ + + + + +
+ Read services, characteristics and descriptors for the +specified service UUIDs. +Services must be read be able to access characteristics and +descriptors. Call this function before reading and writing +characteristics/descriptors. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceUUIDs + + array of UUID strings, if null all +services are read (this can be time-consuming compared to +reading selected services).
success + + +evothings.easyble.servicesCallback + + + + Called when services are read: success(device).
fail + + +evothings.easyble.failCallback + + + + error callback: error(errorMessage)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.readServices(
+    null, // Read all services
+    function(device)
+    {
+      console.log('BLE Services available.');
+      // TODO: Read/write/enable notifications here.
+    },
+    function(errorCode)
+    {
+      console.log('BLE readServices error: ' + errorCode);
+    });
+ + + + + + + + +

writeCharacteristic(characteristicUUID, value, success, fail)

+ + + + + +
+ Write value of characteristic. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
characteristicUUID + + +string + + + + UUID of characteristic to write to.
value + + +ArrayBufferView + + + + Value to write.
success + + +evothings.easyble.emptyCallback + + + + Success callback: success().
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.writeCharacteristic(
+    characteristicUUID,
+    new Uint8Array([1]), // Write byte with value 1.
+    function()
+    {
+      console.log('BLE characteristic written.');
+    },
+    function(errorCode)
+    {
+      console.log('BLE writeCharacteristic error: ' + errorCode);
+    });
+ + + + + + + + +

writeDescriptor(characteristicUUID, descriptorUUID, value, success, fail)

+ + + + + +
+ Write value of descriptor. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
characteristicUUID + + +string + + + + UUID of characteristic for descriptor.
descriptorUUID + + +string + + + + UUID of descriptor to write to.
value + + +ArrayBufferView + + + + Value to write.
success + + +evothings.easyble.emptyCallback + + + + Success callback: success().
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.writeDescriptor(
+    characteristicUUID,
+    descriptorUUID,
+    new Uint8Array([1]), // Write byte with value 1.
+    function()
+    {
+      console.log('BLE descriptor written.');
+    },
+    function(errorCode)
+    {
+      console.log('BLE writeDescriptor error: ' + errorCode);
+    });
+ + + + + + + + +

writeServiceCharacteristic(serviceUUID, characteristicUUID, value, success, fail)

+ + + + + +
+ Write value of a specific characteristic. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceUUID + + +string + + + + UUID of service in which the characteristic is found.
characteristicUUID + + +string + + + + UUID of characteristic to write to.
value + + +ArrayBufferView + + + + Value to write.
success + + +evothings.easyble.emptyCallback + + + + Success callback: success().
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.writeServiceCharacteristic(
+    serviceUUID,
+    characteristicUUID,
+    new Uint8Array([1]), // Write byte with value 1.
+    function()
+    {
+      console.log('BLE characteristic written.');
+    },
+    function(errorCode)
+    {
+      console.log('BLE writeServiceCharacteristic error: ' + errorCode);
+    });
+ + + + + + + + +

writeServiceDescriptor(serviceUUID, characteristicUUID, descriptorUUID, value, success, fail)

+ + + + + +
+ Write value of a specific descriptor. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
serviceUUID + + +string + + + + UUID of service in which the characteristic is found.
characteristicUUID + + +string + + + + UUID of characteristic for descriptor.
descriptorUUID + + +string + + + + UUID of descriptor to write to.
value + + +ArrayBufferView + + + + Value to write.
success + + +evothings.easyble.emptyCallback + + + + Success callback: success().
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
device.writeServiceDescriptor(
+    serviceUUID,
+    characteristicUUID,
+    descriptorUUID,
+    new Uint8Array([1]), // Write byte with value 1.
+    function()
+    {
+      console.log('BLE descriptor written.');
+    },
+    function(errorCode)
+    {
+      console.log('BLE writeServiceDescriptor error: ' + errorCode);
+    });
+ + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.easyble.error.html b/lib-doc/evothings.easyble.error.html new file mode 100644 index 0000000..161cf78 --- /dev/null +++ b/lib-doc/evothings.easyble.error.html @@ -0,0 +1,386 @@ + + + + + JSDoc: Namespace: error + + + + + + + + + + +
+ +

Namespace: error

+ + + + + + +
+ +
+ +

+ evothings.easyble. + + error +

+ + +
+ +
+
+ + +
Error string.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static) CHARACTERISTIC_NOT_FOUND

+ + + + +
+ BLE characteristic was not found. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) DESCRIPTOR_NOT_FOUND

+ + + + +
+ BLE descriptor was not found. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) DISCONNECTED

+ + + + +
+ BLE device was disconnected. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) SERVICE_NOT_FOUND

+ + + + +
+ BLE service was not found. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.easyble.html b/lib-doc/evothings.easyble.html new file mode 100644 index 0000000..1f478fe --- /dev/null +++ b/lib-doc/evothings.easyble.html @@ -0,0 +1,1779 @@ + + + + + JSDoc: Namespace: easyble + + + + + + + + + + +
+ +

Namespace: easyble

+ + + + + + +
+ +
+ +

+ evothings. + + easyble +

+ + +
+ +
+
+ + +

Library for making BLE programming easier.

+

It is safe practise to call function evothings.scriptsLoaded +to ensure dependent libraries are loaded before calling functions +in this library.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + +

Namespaces

+ +
+
EasyBLEDevice
+
+ +
error
+
+
+ + + +

Members

+ + + +

(static) printObject

+ + + + +
+ Prints and object for debugging purposes. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) closeConnectedDevices()

+ + + + + +
+ Disconnect and close all connected BLE devices. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
evothings.easyble.closeConnectedDevices();
+ + + + + + + + +

(static) filterDevicesByService(services)

+ + + + + +
+ Set to an Array of UUID strings to enable filtering of devices +found by startScan(). +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
services + + Array of UUID strings. Set to false to disable filtering. +The default is no filtering. An empty array will cause no devices to be reported.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) reportDeviceOnce(reportOnce)

+ + + + + +
+ Set whether to report devices once or continuously during scan. +The default is to report continously. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
reportOnce + + +boolean + + + + Set to true to report found devices only once. +Set to false to report continuously.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) reset()

+ + + + + +
+ Reset the BLE hardware. Can be time consuming. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) startScan(success, fail)

+ + + + + +
+ Start scanning for devices. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +evothings.easyble.scanCallback + + + + Success function called when a device is found. +Format: success(evothings.easyble.EasyBLEDevice).
fail + + +evothings.easyble.failCallback + + + + Error callback: fail(error).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
evothings.easyble.startScan(
+    function(device)
+    {
+      console.log('BLE Found device: ' + device.name);
+    },
+    function(error)
+    {
+      console.log('BLE Scan error: ' + error);
+    });
+ + + + + + + + +

(static) stopScan()

+ + + + + +
+ Stop scanning for devices. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
evothings.easyble.stopScan();
+ + + + + + + +

Type Definitions

+ + + + + + +

connectCallback(device)

+ + + + + +
+ Called when successfully connected to a device. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +evothings.easyble.EasyBLEDevice + + + + EasyBLE devices object.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

dataCallback(data)

+ + + + + +
+ Function when data is available. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + The data is an array buffer. +Use an ArrayBufferView to access the data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

emptyCallback()

+ + + + + +
+ This callback indicates that an operation was successful, +without specifying and additional information. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

failCallback(errorString)

+ + + + + +
+ This function is called when an operation fails. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
errorString + + +string + + + + A human-readable string that +describes the error that occurred.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

rssiCallback(rssi)

+ + + + + +
+ Called with RSSI value. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
rssi + + +number + + + + A negative integer, the signal strength in decibels. +This value may be 127 which indicates an unknown value.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

scanCallback(device)

+ + + + + +
+ Called during scanning when a BLE device is found. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +evothings.easyble.EasyBLEDevice + + + + EasyBLE device object +found during scanning.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

servicesCallback(device)

+ + + + + +
+ Called when services are successfully read. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +evothings.easyble.EasyBLEDevice + + + + EasyBLE devices object.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.html b/lib-doc/evothings.html new file mode 100644 index 0000000..10fc973 --- /dev/null +++ b/lib-doc/evothings.html @@ -0,0 +1,1327 @@ + + + + + JSDoc: Namespace: evothings + + + + + + + + + + +
+ +

Namespace: evothings

+ + + + + + +
+ +
+ +

+ evothings +

+ + +
+ +
+
+ + +

Functions for loading scripts asynchronously, +detecting platform, and other common application functionality.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + +

Namespaces

+ +
+
arduinoble
+
+ +
arduinotcp
+
+ +
easyble
+
+ +
nordicble
+
+ +
nRF51_ble
+
+ +
os
+
+ +
rfduinoble
+
+ +
tisensortag
+
+ +
util
+
+
+ + + + + +

Methods

+ + + + + + +

(static) loadScript(url, callback)

+ + + + + +
+ Load a script. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + URL or path to the script. Relative paths are +relative to the HTML file that initiated script loading.
callback + + +function + + + + Optional parameterless function that will +be called when the script has loaded.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) loadScripts(array, loadedCallback)

+ + + + + +
+ Load array of scripts. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
array + + +array + + + + Array of URL or path name stringa. +Relative paths are relative to the HTML file that initiated +script loading.
loadedCallback + + +function + + + + Optional parameterless +function called when all scripts in the array has loaded.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) markScriptAsLoaded(pathOrURL)

+ + + + + +
+ Experimental. +Mark a script as loaded. This is useful if a script is designed +to be included both in HTML and in JavaScript. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pathOrURL + + +string + + + + URL or path to the script. Relative paths are +relative to the HTML file that initiated script loading.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) os.isAndroid() → {boolean}

+ + + + + +
+ Returns true if current platform is Android, false if not. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ true if platform is Android, false if not. +
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) os.isIOS() → {boolean}

+ + + + + +
+ Returns true if current platform is iOS, false if not. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ true if platform is iOS, false if not. +
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) os.isIOS7() → {boolean}

+ + + + + +
+ Returns true if current platform is iOS 7, false if not. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ true if platform is iOS 7, false if not. +
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) os.isWP() → {boolean}

+ + + + + +
+ Returns true if current platform is Windows Phone, false if not. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ true if platform is Windows Phone, false if not. +
+ + + +
+
+ Type +
+
+ +boolean + + +
+
+ + + + + + + + + + +

(static) printObject(obj, printFun)

+ + + + + +
+ Print a JavaScript object (dictionary). For debugging. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
obj + + +Object + + + + Object to print.
printFun + + +function + + + + print function (optional - defaults to +console.log if not given).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
var obj = { company: 'Evothings', field: 'IoT' };
+evothings.printObject(obj);
+evothings.printObject(obj, console.log);
+ + + + + + + + +

(static) scriptsLoaded(callback)

+ + + + + +
+

Add a callback that will be called when all scripts are loaded.

+

It is good practise to always use this function when +loading script asynchronously or using a library that does so.

+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
callback + + +function + + + + Parameterless function that will +be called when all scripts have finished loading.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.js.html b/lib-doc/evothings.js.html new file mode 100644 index 0000000..da1f708 --- /dev/null +++ b/lib-doc/evothings.js.html @@ -0,0 +1,293 @@ + + + + + JSDoc: Source: evothings.js + + + + + + + + + + +
+ +

Source: evothings.js

+ + + + + + +
+
+
;(function()
+{
+	/**
+	 * @namespace
+	 * @description <p>Functions for loading scripts asynchronously,
+	 * detecting platform, and other common application functionality.</p>
+	 * @alias evothings
+	 * @public
+	 */
+	var evothings = window.evothings || {};
+	window.evothings = evothings;
+
+	/* ------------------ Script loading ------------------ */
+
+	var scriptLoadingCounter = 0;
+	var loadedScripts = {};
+	var scriptsLoadedCallbacks = [];
+
+	/* Make sure to catch any DOMContentLoaded events occurring before
+	 * asynchronous loading of scripts. Those scripts, like ui.js, should check
+	 * this variable before listening for the event. */
+	evothings.gotDOMContentLoaded = false
+
+	window.addEventListener('DOMContentLoaded', function(e)
+	{
+		evothings.gotDOMContentLoaded = true
+	})
+
+	/**
+	 * Load a script.
+	 * @param {string} url - URL or path to the script. Relative paths are
+	 * relative to the HTML file that initiated script loading.
+	 * @param {function} callback - Optional parameterless function that will
+	 * be called when the script has loaded.
+	 * @public
+	 */
+	evothings.loadScript = function(url, callback)
+	{
+		// If script is already loaded call callback directly and return.
+		if (loadedScripts[url])
+		{
+			callback && callback();
+			return;
+		}
+
+		// Add script to dictionary of loaded scripts.
+		loadedScripts[url] = 'loadingstarted';
+		++scriptLoadingCounter;
+
+		// Create script tag.
+		var script = document.createElement('script');
+		script.type = 'text/javascript';
+		script.src = url;
+
+		// Bind the onload event.
+		script.onload = function()
+		{
+			// Mark as loaded.
+			loadedScripts[url] = 'loadingcomplete';
+			--scriptLoadingCounter;
+
+			// Call callback if given.
+			callback && callback();
+
+			// Call scripts loaded callbacks if this was the last script loaded.
+			if (0 == scriptLoadingCounter)
+			{
+				for (var i = 0; i < scriptsLoadedCallbacks.length; ++i)
+				{
+					var loadedCallback = scriptsLoadedCallbacks[i];
+					loadedCallback && loadedCallback();
+				}
+
+				// Clear callbacks - should we do this???
+				scriptsLoadedCallbacks = [];
+			}
+		};
+
+		// onerror fires for things like malformed URLs and 404's.
+		// If this function is called, the matching onload will not be called and
+		// scriptsLoaded will not fire.
+		script.onerror = function()
+		{
+			throw "Could not load script '" + url + "'";
+		};
+
+		// Attaching the script tag to the document starts loading the script.
+		document.head.appendChild(script);
+	};
+
+	/**
+	 * Load array of scripts.
+	 * @param {array} array - Array of URL or path name stringa.
+	 * Relative paths are relative to the HTML file that initiated
+	 * script loading.
+	 * @param {function} loadedCallback - Optional parameterless
+	 * function called when all scripts in the array has loaded.
+	 * @public
+	 */
+	evothings.loadScripts = function(array, loadedCallback)
+	{
+		var lib = array.shift();
+		if (!lib)
+		{
+			// Array is empty and all scripts are loaded.
+			loadedCallback && loadedCallback();
+		}
+		else
+		{
+			// Load next script.
+			evothings.loadScript(lib, function() {
+				evothings.loadScripts(array, loadedCallback);
+			});
+		}
+	};
+
+	/**
+	 * Experimental.
+	 * Mark a script as loaded. This is useful if a script is designed
+	 * to be included both in HTML and in JavaScript.
+	 * @param {string} pathOrURL - URL or path to the script. Relative paths are
+	 * relative to the HTML file that initiated script loading.
+	 * @public
+	 */
+	evothings.markScriptAsLoaded = function(pathOrURL)
+	{
+		loadedScripts[url] = 'loadingcomplete';
+	};
+
+	/**
+	 * <p>Add a callback that will be called when all scripts are loaded.</p>
+	 * <p><strong>It is good practise to always use this function when
+	 * loading script asynchronously or using a library that does so.</strong></p>
+	 * @param  {function} callback - Parameterless function that will
+	 * be called when all scripts have finished loading.
+	 * @public
+	 */
+	evothings.scriptsLoaded = function(callback)
+	{
+		// If scripts are already loaded call the callback directly,
+		// else add the callback to the callbacks array.
+		if (0 != Object.keys(loadedScripts).length &&
+			0 == scriptLoadingCounter)
+		{
+			callback && callback();
+		}
+		else
+		{
+			scriptsLoadedCallbacks.push(callback);
+		}
+	};
+
+	/* ------------------ Debugging ------------------ */
+
+	/**
+	 * Print a JavaScript object (dictionary). For debugging.
+	 *
+	 * @param {Object} obj - Object to print.
+	 * @param {function} printFun - print function (optional - defaults to
+	 * console.log if not given).
+	 *
+	 * @example
+	 * var obj = { company: 'Evothings', field: 'IoT' };
+	 * evothings.printObject(obj);
+	 * evothings.printObject(obj, console.log);
+	 *
+	 * @public
+	 */
+	evothings.printObject = function(obj, printFun)
+	{
+		printFun = printFun || console.log;
+		function print(obj, level)
+		{
+			var indent = new Array(level + 1).join('  ');
+			for (var prop in obj)
+			{
+				if (obj.hasOwnProperty(prop))
+				{
+					var value = obj[prop];
+					if (typeof value == 'object')
+					{
+						printFun(indent + prop + ':');
+						print(value, level + 1);
+					}
+					else
+					{
+						printFun(indent + prop + ': ' + value);
+					}
+				}
+			}
+		}
+		print(obj, 0);
+	};
+
+	/* ------------------ Platform check ------------------ */
+
+	/**
+	 * @namespace
+	 * @description Namespace for platform check functions.
+	 */
+	evothings.os = {};
+
+	/**
+	 * Returns true if current platform is iOS, false if not.
+	 * @return {boolean} true if platform is iOS, false if not.
+	 * @public
+	 */
+	evothings.os.isIOS = function()
+	{
+		return /iP(hone|ad|od)/.test(navigator.userAgent);
+	};
+
+	/**
+	 * Returns true if current platform is iOS 7, false if not.
+	 * @return {boolean} true if platform is iOS 7, false if not.
+	 * @public
+	 */
+	evothings.os.isIOS7 = function()
+	{
+		return /iP(hone|ad|od).*OS 7/.test(navigator.userAgent);
+	};
+
+	/**
+	 * Returns true if current platform is Android, false if not.
+	 * @return {boolean} true if platform is Android, false if not.
+	 * @public
+	 */
+	evothings.os.isAndroid = function()
+	{
+		return /Android|android/.test(navigator.userAgent);
+	};
+
+	/**
+	 * Returns true if current platform is Windows Phone, false if not.
+	 * @return {boolean} true if platform is Windows Phone, false if not.
+	 * @public
+	 */
+	evothings.os.isWP = function()
+	{
+		return /Windows Phone/.test(navigator.userAgent);
+	};
+})();
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/lib-doc/evothings.nRF51_ble.html b/lib-doc/evothings.nRF51_ble.html new file mode 100644 index 0000000..c5641a5 --- /dev/null +++ b/lib-doc/evothings.nRF51_ble.html @@ -0,0 +1,387 @@ + + + + + JSDoc: Namespace: nRF51_ble + + + + + + + + + + +
+ +

Namespace: nRF51_ble

+ + + + + + +
+ +
+ +

+ evothings. + + nRF51_ble +

+ + +
+ +
+
+ + +
Functions for communicating with a Nordic BLE device.
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Aaron Ardiri
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + +

Example

+ +
evothings.nRF51_ble.connect(
+	'nRF51-DK', // BLE name
+	function(device)
+	{
+		console.log('connected!');
+		device.writeDataArray(new Uint8Array([1]));
+		evothings.nRF51_ble.close();
+	},
+	function(errorCode)
+	{
+		console.log('Error: ' + errorCode);
+	});
+ + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) close()

+ + + + + +
+ Stops any ongoing scan and disconnects all devices. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) connect(win, fail)

+ + + + + +
+ Connect to a BLE-shield. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
win + + Success callback: win(device)
fail + + Error callback: fail(errorCode)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.nordicble.NordicBLEDevice.html b/lib-doc/evothings.nordicble.NordicBLEDevice.html new file mode 100644 index 0000000..d02d118 --- /dev/null +++ b/lib-doc/evothings.nordicble.NordicBLEDevice.html @@ -0,0 +1,400 @@ + + + + + JSDoc: Namespace: NordicBLEDevice + + + + + + + + + + +
+ +

Namespace: NordicBLEDevice

+ + + + + + +
+ +
+ +

+ evothings.nordicble. + + NordicBLEDevice +

+ + +
+ +
+
+ + +
Object that holds info about a Nordic device.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

setNotification(uint8array)

+ + + + + +
+ Set a notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uint8array + + +Uint8Array + + + + The data to be written.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

writeDataArray(uint8array)

+ + + + + +
+ Write data to a Nordic board. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uint8array + + +Uint8Array + + + + The data to be written.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.nordicble.html b/lib-doc/evothings.nordicble.html new file mode 100644 index 0000000..415696b --- /dev/null +++ b/lib-doc/evothings.nordicble.html @@ -0,0 +1,521 @@ + + + + + JSDoc: Namespace: nordicble + + + + + + + + + + +
+ +

Namespace: nordicble

+ + + + + + +
+ +
+ +

+ evothings. + + nordicble +

+ + +
+ +
+
+ + +

Functions for communicating with a Nordic BLE device.

It is safe practise to call function evothings.scriptsLoaded to ensure dependent libraries are loaded before calling functions in this library.

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + +

Namespaces

+ +
+
NordicBLEDevice
+
+
+ + + + + +

Methods

+ + + + + + +

(static) close()

+ + + + + +
+ Stops any ongoing scan and disconnects any connected devices. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) connect(success, fail)

+ + + + + +
+ Connect to the Nordic board. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +evothings.nordicble.connectsuccess + + + + Success callback: success(device)
fail + + +function + + + + Error callback: fail(errorCode)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + +
Example
+ +
evothings.nordicble.connect(
  'LedButtonDemo', // BLE name
  function(device)
  {
    console.log('connected!');
    device.writeDataArray(new Uint8Array([1]));
    evothings.nordicble.close();
  },
  function(errorCode)
  {
    console.log('Error: ' + errorCode);
  });
+ + + + + + + +

Type Definitions

+ + + + + + +

connectsuccess(device)

+ + + + + +
+ Called when you have connected to a Nordic board. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +evothings.nordicble.ArduinoBLEDevice + + + + The connected BLE shield.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.os.html b/lib-doc/evothings.os.html new file mode 100644 index 0000000..189ea27 --- /dev/null +++ b/lib-doc/evothings.os.html @@ -0,0 +1,134 @@ + + + + + JSDoc: Namespace: os + + + + + + + + + + +
+ +

Namespace: os

+ + + + + + +
+ +
+ +

+ evothings. + + os +

+ + +
+ +
+
+ + +
Namespace for platform check functions.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.rfduinoble.RFduinoBLEDevice.html b/lib-doc/evothings.rfduinoble.RFduinoBLEDevice.html new file mode 100644 index 0000000..4520cb4 --- /dev/null +++ b/lib-doc/evothings.rfduinoble.RFduinoBLEDevice.html @@ -0,0 +1,269 @@ + + + + + JSDoc: Namespace: RFduinoBLEDevice + + + + + + + + + + +
+ +

Namespace: RFduinoBLEDevice

+ + + + + + +
+ +
+ +

+ evothings.rfduinoble. + + RFduinoBLEDevice +

+ + +
+ +
+
+ + +
Object that holds info about an RFduino device.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

writeDataArray(uint8array)

+ + + + + +
+ Write data to an RFduino. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uint8array + + +Uint8Array + + + + The data to be written.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.rfduinoble.html b/lib-doc/evothings.rfduinoble.html new file mode 100644 index 0000000..5be3dc6 --- /dev/null +++ b/lib-doc/evothings.rfduinoble.html @@ -0,0 +1,526 @@ + + + + + JSDoc: Namespace: rfduinoble + + + + + + + + + + +
+ +

Namespace: rfduinoble

+ + + + + + +
+ +
+ +

+ evothings. + + rfduinoble +

+ + +
+ +
+
+ + +

Functions for communicating with an RFduino board.

+

It is safe practise to call function evothings.scriptsLoaded +to ensure dependent libraries are loaded before calling functions +in this library.

+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Patrik D.
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + +

Namespaces

+ +
+
RFduinoBLEDevice
+
+
+ + + + + +

Methods

+ + + + + + +

(static) close()

+ + + + + +
+ Stops any ongoing scan and disconnects any connected devices. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) connect(success, fail)

+ + + + + +
+ Connect to an RFduino board. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
success + + +evothings.rfduinoble.connectsuccess + + + + Success callback: success(device)
fail + + +function + + + + Error callback: fail(errorCode)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +

Type Definitions

+ + + + + + +

connectsuccess(device)

+ + + + + +
+ Called when you have connected to the board. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +evothings.rfduinoble.RFduinoBLEDevice + + + + The connected BLE shield.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.SensorTagInstance.html b/lib-doc/evothings.tisensortag.SensorTagInstance.html new file mode 100644 index 0000000..92b143a --- /dev/null +++ b/lib-doc/evothings.tisensortag.SensorTagInstance.html @@ -0,0 +1,4063 @@ + + + + + JSDoc: Namespace: SensorTagInstance + + + + + + + + + + +
+ +

Namespace: SensorTagInstance

+ + + + + + +
+ +
+ +

+ evothings.tisensortag. + + SensorTagInstance +

+ + +
+ +
+
+ + +
Abstract SensorTag instance object that defines a common interface.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) celsiusToFahrenheit(celsius)

+ + + + + +
+ Convert Celsius to Fahrenheit. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
celsius + + Temperature in Celsius.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Temperature converted to Fahrenheit. +
+ + + + + + + + + + + + +

(static) luxometerCallback(fun, interval)

+ + + + + +
+ Public. Set the luxometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + luxometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) luxometerOff()

+ + + + + +
+ Public. Turn off luxometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) luxometerOn()

+ + + + + +
+ Public. Turn on luxometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

accelerometerCallback(fun, interval)

+ + + + + +
+ Public. Set the accelerometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + accelerometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

accelerometerOff()

+ + + + + +
+ Public. Turn off accelerometer notification (SensorTag 1). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

accelerometerOn()

+ + + + + +
+ Public. Turn on accelerometer notification (SensorTag 1). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

barometerCallback(fun, interval)

+ + + + + +
+ Public. Set the barometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + barometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

barometerOff()

+ + + + + +
+ Public. Turn off barometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

barometerOn()

+ + + + + +
+ Public. Turn on barometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

callErrorCallback()

+ + + + + +
+ Public. Call the error handler function. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

callStatusCallback()

+ + + + + +
+ Public. Call the status handler function. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

errorCallback(fun)

+ + + + + +
+ Public. Set the error handler function. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + error callback: fun(error)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getDeviceModel()

+ + + + + +
+ Public. Get device model number. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getFirmwareString()

+ + + + + +
+ Public. Get firmware string. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

gyroscopeCallback(fun, interval, axes)

+ + + + + +
+ Public. Set the gyroscope notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + gyroscope rate in milliseconds.
axes + + (optional) the axes to enable ((z << 2) | (y << 1) | x) +Only available on SensorTag CC2541. +Axis parameter values are: +1 = X only, 2 = Y only, +3 = X and Y, 4 = Z only, +5 = X and Z, 6 = Y and Z, +7 = X, Y and Z.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

gyroscopeOff()

+ + + + + +
+ Public. Turn off gyroscope notification (SensorTag 1). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

gyroscopeOn()

+ + + + + +
+ Public. Turn on gyroscope notification (SensorTag 1). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

humidityCallback(fun, interval)

+ + + + + +
+ Public. Set the humidity notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + humidity rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

humidityOff()

+ + + + + +
+ Public. Turn off humidity notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

humidityOn()

+ + + + + +
+ Public. Turn on humidity notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isAccelerometerAvailable()

+ + + + + +
+ Public. Checks if the accelerometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isBarometerAvailable()

+ + + + + +
+ Public. Checks if the barometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isGyroscopeAvailable()

+ + + + + +
+ Public. Checks if the gyroscope sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isHumidityAvailable()

+ + + + + +
+ Public. Checks if the humidity sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isKeypressAvailable()

+ + + + + +
+ Public. Checks if the keypress sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isLuxometerAvailable()

+ + + + + +
+ Public. Checks if the luxometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isMagnetometerAvailable()

+ + + + + +
+ Public. Checks if the magnetometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isMovementAvailable()

+ + + + + +
+ Public. Checks if movement sensor is available that +combines accelerometer, gyroscope, and magnetometer. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isTemperatureAvailable()

+ + + + + +
+ Public. Checks if the Temperature sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

keypressCallback(fun)

+ + + + + +
+ Public. Set the keypress notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called when a key is pressed: fun(data)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

keypressOff()

+ + + + + +
+ Public. Turn off keypress notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

keypressOn()

+ + + + + +
+ Public. Turn on keypress notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

magnetometerCallback(fun, interval)

+ + + + + +
+ Public. Set the magnetometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + magnetometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

magnetometerOff()

+ + + + + +
+ Public. Turn off magnetometer notification (SensorTag 1). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

magnetometerOn()

+ + + + + +
+ Public. Turn on magnetometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

statusCallback(fun)

+ + + + + +
+ Public. Set the status handler function. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + callback: fun(status)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

temperatureCallback(fun, interval)

+ + + + + +
+ Public. Set the IR temperature notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + update rate in milliseconds (min 300ms)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

temperatureOff()

+ + + + + +
+ Public. Turn off temperature notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

temperatureOn()

+ + + + + +
+ Public. Turn on temperature notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.SensorTagInstanceBLE.html b/lib-doc/evothings.tisensortag.SensorTagInstanceBLE.html new file mode 100644 index 0000000..226b31d --- /dev/null +++ b/lib-doc/evothings.tisensortag.SensorTagInstanceBLE.html @@ -0,0 +1,2390 @@ + + + + + JSDoc: Namespace: SensorTagInstanceBLE + + + + + + + + + + +
+ +

Namespace: SensorTagInstanceBLE

+ + + + + + +
+ +
+ +

+ evothings.tisensortag. + + SensorTagInstanceBLE +

+ + +
+ +
+
+ + +
Abstract SensorTag instance object. +This object specifies the interface common to Bluetooth Smart +SensorTags.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

barometerCallback(fun, interval)

+ + + + + +
+ Both CC2541 and CC2650. +Public. Set the barometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + barometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

barometerOff()

+ + + + + +
+ Both CC2541 and CC2650. +Public. Turn off barometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

barometerOn()

+ + + + + +
+ Public. Turn on barometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

connectToClosestDevice()

+ + + + + +
+ Public. Connect to the nearest physical SensorTag device. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • Use evothings.tiseonsortag.ble.connectToNearestDevice
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

connectToDevice(device)

+ + + + + +
+ Connect to a SensorTag BLE device. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + A Bluetooth Low Energy device object.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

connectToNearestDevice(scanTimeMilliseconds)

+ + + + + +
+ Public. Connect to the nearest physical SensorTag device. +For this to work reliably SensorTags should be at least a +couple of meters apart. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
scanTimeMilliseconds + + The time to scan for nearby +SensorTags (optional, defaults to 3 seconds).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

deviceIsSensorTag()

+ + + + + +
+ Determine if a BLE device is a SensorTag. +This version checks the general case using +the advertised name. +Specific versions for CC2541 and CC2650 uses +advertisement data to determine tag type. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

disconnectDevice()

+ + + + + +
+ Public. Disconnect from the physical device. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getHumidityValues(data)

+ + + + + +
+ Calculate humidity values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: humidityTemperature, relativeHumidity. +
+ + + + + + + + + + + + +

humidityCallback(fun, interval)

+ + + + + +
+ Both CC2541 and CC2650. +Public. Set the humidity notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + humidity rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

humidityOff()

+ + + + + +
+ Both CC2541 and CC2650. +Public. Turn off humidity notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

humidityOn()

+ + + + + +
+ Both CC2541 and CC2650. +Public. Turn on humidity notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

keypressCallback(fun)

+ + + + + +
+ Both CC2541 and CC2650. +Public. Set the keypress notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called when a key is pressed: fun(data)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

keypressOff()

+ + + + + +
+ Both CC2541 and CC2650. +Public. Turn off keypress notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

keypressOn()

+ + + + + +
+ Both CC2541 and CC2650. +Public. Turn on keypress notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

sensorOff()

+ + + + + +
+ Helper function for turning off sensor notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

sensorOn()

+ + + + + +
+ Public. Used internally as a helper function for turning on +sensor notification. You can call this function from the +application to enable sensors using custom parameters. +For advanced use. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

startScanningForDevices(foundCallback)

+ + + + + +
+ Start scanning for physical devices. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
foundCallback + + Function called when a SensorTag +is found. It has the form foundCallback(device) where +is a an object representing a BLE device object. You can +inspect the device fields to determine properties such as +RSSI, name etc. You can call deviceIsSensorTag(device) to +determine if this is a SensorTag of the same type as the +instance object. +To connect to a SensorTag call connectToDevice(device).
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

stopScanningForDevices()

+ + + + + +
+ Stop scanning for physical devices. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

temperatureCallback(fun, interval)

+ + + + + +
+ Both CC2541 and CC2650. +Public. Set the humidity temperature callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + humidity rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

temperatureOff()

+ + + + + +
+ Both CC2541 and CC2650. +Public. Turn off IR temperature notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

temperatureOn()

+ + + + + +
+ Both CC2541 and CC2650. +Public. Turn on IR temperature notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.SensorTagInstanceBLE_CC2541.html b/lib-doc/evothings.tisensortag.SensorTagInstanceBLE_CC2541.html new file mode 100644 index 0000000..3282740 --- /dev/null +++ b/lib-doc/evothings.tisensortag.SensorTagInstanceBLE_CC2541.html @@ -0,0 +1,2524 @@ + + + + + JSDoc: Namespace: SensorTagInstanceBLE_CC2541 + + + + + + + + + + +
+ +

Namespace: SensorTagInstanceBLE_CC2541

+ + + + + + +
+ +
+ +

+ evothings.tisensortag. + + SensorTagInstanceBLE_CC2541 +

+ + +
+ +
+
+ + +
SensorTag CC2541 instance object.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

deviceModel

+ + + + +
+ The device model. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

accelerometerCallback(fun, interval)

+ + + + + +
+ Public. Set the accelerometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + accelerometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

accelerometerOff()

+ + + + + +
+ SensorTag CC2541. +Public. Turn off accelerometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

accelerometerOn()

+ + + + + +
+ SensorTag CC2541. +Public. Turn on accelerometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

barometerOn()

+ + + + + +
+ SensorTag CC2541. +Public. Turn on barometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

deviceIsSensorTag()

+ + + + + +
+ Determine if a BLE device is a SensorTag CC2541. +Checks for the CC2541 using the advertised name. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getAccelerometerValues(data)

+ + + + + +
+ SensorTag CC2541. +Calculate accelerometer values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: x, y, z. +
+ + + + + + + + + + + + +

getBarometerValues()

+ + + + + +
+ SensorTag CC2541. +Calculate barometer values from raw data. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getGyroscopeValues(data)

+ + + + + +
+ SensorTag CC2541. +Calculate gyroscope values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: x, y, z. +
+ + + + + + + + + + + + +

getMagnetometerValues(data)

+ + + + + +
+ SensorTag CC2541. +Calculate magnetometer values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: x, y, z. +
+ + + + + + + + + + + + +

getTemperatureValues(data)

+ + + + + +
+ Calculate temperature values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: ambientTemperature, targetTemperature. +
+ + + + + + + + + + + + +

gyroscopeCallback(fun, interval, axes)

+ + + + + +
+ Public. Set the gyroscope notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + gyroscope rate in milliseconds.
axes + + the axes to enable ((z << 2) | (y << 1) | x) +Axis parameter values are: +1 = X only, 2 = Y only, +3 = X and Y, 4 = Z only, +5 = X and Z, 6 = Y and Z, +7 = X, Y and Z.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

gyroscopeOff()

+ + + + + +
+ Public. Turn off gyroscope notification (SensorTag CC2541). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

gyroscopeOn()

+ + + + + +
+ SensorTag CC2541. +Public. Turn on gyroscope notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isAccelerometerAvailable()

+ + + + + +
+ Public. Checks if the accelerometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isBarometerAvailable()

+ + + + + +
+ Public. Checks if the barometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isGyroscopeAvailable()

+ + + + + +
+ Public. Checks if the gyroscope sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isHumidityAvailable()

+ + + + + +
+ Public. Checks if the humidity sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isKeypressAvailable()

+ + + + + +
+ Public. Checks if the keypress sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isMagnetometerAvailable()

+ + + + + +
+ Public. Checks if the magnetometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isTemperatureAvailable()

+ + + + + +
+ Public. Checks if the Temperature sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

magnetometerCallback(fun, interval)

+ + + + + +
+ Public. Set the magnetometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + magnetometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

magnetometerOff()

+ + + + + +
+ Public. Turn off magnetometer notification (SensorTag CC2541). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

magnetometerOn()

+ + + + + +
+ Public. Turn on magnetometer notification (SensorTag CC2541). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.SensorTagInstanceBLE_CC2650.html b/lib-doc/evothings.tisensortag.SensorTagInstanceBLE_CC2650.html new file mode 100644 index 0000000..4904a28 --- /dev/null +++ b/lib-doc/evothings.tisensortag.SensorTagInstanceBLE_CC2650.html @@ -0,0 +1,2956 @@ + + + + + JSDoc: Namespace: SensorTagInstanceBLE_CC2650 + + + + + + + + + + +
+ +

Namespace: SensorTagInstanceBLE_CC2650

+ + + + + + +
+ +
+ +

+ evothings.tisensortag. + + SensorTagInstanceBLE_CC2650 +

+ + +
+ +
+
+ + +
SensorTag CC2650 instance object.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

deviceModel

+ + + + +
+ The device model. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

accelerometerCallback(fun, interval)

+ + + + + +
+ Public. Set the accelerometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + accelerometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

barometerOn()

+ + + + + +
+ SensorTag CC2650. +Public. Turn on barometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

deviceIsSensorTag()

+ + + + + +
+ Determine if a BLE device is a SensorTag CC2650. +Checks for the CC2650 using the advertised name. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getAccelerometerValues(data)

+ + + + + +
+ SensorTag CC2650. +Calculate accelerometer values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: x, y, z. +
+ + + + + + + + + + + + +

getBarometerValues()

+ + + + + +
+ SensorTag CC2650. +Calculate barometer values from raw data. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getGyroscopeValues(data)

+ + + + + +
+ SensorTag CC2650. +Calculate gyroscope values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: x, y, z. +
+ + + + + + + + + + + + +

getLuxometerValue(data)

+ + + + + +
+ SensorTag CC2650. +Calculate luxometer values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Light level in lux units. +
+ + + + + + + + + + + + +

getMagnetometerValues(data)

+ + + + + +
+ SensorTag CC2650. +Calculate magnetometer values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: x, y, z. +
+ + + + + + + + + + + + +

getTemperatureValues(data)

+ + + + + +
+ SensorTag CC2650. +Calculate temperature values from raw data. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + an Uint8Array.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Object with fields: ambientTemperature, targetTemperature. +
+ + + + + + + + + + + + +

gyroscopeCallback(fun, interval)

+ + + + + +
+ Public. Set the gyroscope notification callback. +Enables all axes. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + gyroscope rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isAccelerometerAvailable()

+ + + + + +
+ Public. Checks if the accelerometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isBarometerAvailable()

+ + + + + +
+ Public. Checks if the barometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isGyroscopeAvailable()

+ + + + + +
+ Public. Checks if the gyroscope sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isHumidityAvailable()

+ + + + + +
+ Public. Checks if the humidity sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isKeypressAvailable()

+ + + + + +
+ Public. Checks if the keypress sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isLuxometerAvailable()

+ + + + + +
+ Public. Checks if the luxometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isMagnetometerAvailable()

+ + + + + +
+ Public. Checks if the magnetometer sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isMovementAvailable()

+ + + + + +
+ Public. Checks if movement sensor is available that +combines accelerometer, gyroscope, and magnetometer. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

isTemperatureAvailable()

+ + + + + +
+ Public. Checks if the Temperature sensor is available. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

luxometerOff()

+ + + + + +
+ SensorTag CC2650. +Public. Turn off luxometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

luxometerOn()

+ + + + + +
+ SensorTag CC2650. +Public. Turn on luxometer notification. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

magnetometerCallback(fun, interval)

+ + + + + +
+ Public. Set the magnetometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + magnetometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

movementCallback(fun, interval, sensors)

+ + + + + +
+ SensorTag CC2650. +Public. Set the movement notification callback. +Movement callbacks are routed back to accelerometer, +gyroscope, and magnetometer callbacks. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + Success callback called repeatedly: fun(data)
interval + + Sensor rate in milliseconds.
sensors + + Set the config that turns on the needed sensors:
+Magnetometer on: 64 (1000000) (seems to not work in ST2 FW 0.89)
+3-axis acc. on: 56 (0111000)
+3-axis gyro on: 7 (0000111)
+3-axis acc. + 3-axis gyro on: 63 (0111111)
+3-axis acc. + 3-axis gyro + magnetometer on: 127 (1111111)
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

movementOff()

+ + + + + +
+ SensorTag CC2650. +Public. Turn off movement notification (SensorTag 2). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

movementOn()

+ + + + + +
+ SensorTag CC2650. +Public. Turn on movement notification (SensorTag 2). +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) luxometerCallback(fun, interval)

+ + + + + +
+ Public. Set the luxometer notification callback. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fun + + success callback called repeatedly: fun(data)
interval + + luxometer rate in milliseconds.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.ble.CC2541.html b/lib-doc/evothings.tisensortag.ble.CC2541.html new file mode 100644 index 0000000..0bcc5c3 --- /dev/null +++ b/lib-doc/evothings.tisensortag.ble.CC2541.html @@ -0,0 +1,134 @@ + + + + + JSDoc: Namespace: CC2541 + + + + + + + + + + +
+ +

Namespace: CC2541

+ + + + + + +
+ +
+ +

+ evothings.tisensortag.ble. + + CC2541 +

+ + +
+ +
+
+ + +
Internal implementation of JavaScript library for the TI SensorTag CC2541.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.ble.CC2650.html b/lib-doc/evothings.tisensortag.ble.CC2650.html new file mode 100644 index 0000000..621498e --- /dev/null +++ b/lib-doc/evothings.tisensortag.ble.CC2650.html @@ -0,0 +1,134 @@ + + + + + JSDoc: Namespace: CC2650 + + + + + + + + + + +
+ +

Namespace: CC2650

+ + + + + + +
+ +
+ +

+ evothings.tisensortag.ble. + + CC2650 +

+ + +
+ +
+
+ + +
Internal implementation of JavaScript library for the TI SensorTag CC2650.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.ble.error.html b/lib-doc/evothings.tisensortag.ble.error.html new file mode 100644 index 0000000..2f1b37c --- /dev/null +++ b/lib-doc/evothings.tisensortag.ble.error.html @@ -0,0 +1,202 @@ + + + + + JSDoc: Namespace: error + + + + + + + + + + +
+ +

Namespace: error

+ + + + + + +
+ +
+ +

+ evothings.tisensortag.ble. + + error +

+ + +
+ +
+
+ + +
Error constants. There are additional +error strings reported by the cordova-ble plugin +and the easyble.js library.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static) SCAN_FAILED

+ + + + +
+ Scan failed. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.ble.html b/lib-doc/evothings.tisensortag.ble.html new file mode 100644 index 0000000..0ede318 --- /dev/null +++ b/lib-doc/evothings.tisensortag.ble.html @@ -0,0 +1,150 @@ + + + + + JSDoc: Namespace: ble + + + + + + + + + + +
+ +

Namespace: ble

+ + + + + + +
+ +
+ +

+ evothings.tisensortag. + + ble +

+ + +
+ +
+
+ + +
JavaScript library for the TI SensorTag.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + +

Namespaces

+ +
+
CC2541
+
+ +
CC2650
+
+ +
error
+
+ +
status
+
+
+ + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.ble.status.html b/lib-doc/evothings.tisensortag.ble.status.html new file mode 100644 index 0000000..63e7376 --- /dev/null +++ b/lib-doc/evothings.tisensortag.ble.status.html @@ -0,0 +1,696 @@ + + + + + JSDoc: Namespace: status + + + + + + + + + + +
+ +

Namespace: status

+ + + + + + +
+ +
+ +

+ evothings.tisensortag.ble. + + status +

+ + +
+ +
+
+ + +
Status constants.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

(static) CONNECTED

+ + + + +
+ Connected to physical device. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) CONNECTING

+ + + + +
+ Connecting to physical device. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) DEVICE_INFO_AVAILABLE

+ + + + +
+ Info about the device is available. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) READING_DEVICE_INFO

+ + + + +
+ Reading info about the device. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) READING_SERVICES

+ + + + +
+ Reading services of the device. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) SCANNING

+ + + + +
+ Scanning is ongoing. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) SENSORTAG_FOUND

+ + + + +
+ Found SensorTag device. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) SENSORTAG_NOT_FOUND

+ + + + +
+ Scanning timed out, no device found. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) SENSORTAG_ONLINE

+ + + + +
+ SensorTag device is connected and sensors are avaliable. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.tisensortag.html b/lib-doc/evothings.tisensortag.html new file mode 100644 index 0000000..c1eb419 --- /dev/null +++ b/lib-doc/evothings.tisensortag.html @@ -0,0 +1,512 @@ + + + + + JSDoc: Namespace: tisensortag + + + + + + + + + + +
+ +

Namespace: tisensortag

+ + + + + + +
+ +
+ +

+ evothings. + + tisensortag +

+ + +
+ +
+
+ + +
Top-level object that holds generic functions and sub-modules.
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + +

Namespaces

+ +
+
ble
+
+ +
SensorTagInstance
+
+ +
SensorTagInstanceBLE
+
+ +
SensorTagInstanceBLE_CC2541
+
+ +
SensorTagInstanceBLE_CC2650
+
+
+ + + +

Members

+ + + +

(static) CC2541_BLUETOOTH_SMART

+ + + + +
+ Constant identifying the CC2541 Bluetooth Smart SensorTag. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(static) CC2650_BLUETOOTH_SMART

+ + + + +
+ Constant identifying the CC2650 Bluetooth Smart SensorTag. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) createGenericInstance()

+ + + + + +
+ Create an object with functions common to all SensorTag models. +This object specifies the public interface for SensorTag instances. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) createInstance(type)

+ + + + + +
+ Public. Create a SensorTag instance. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + +string + + + + String with type of tag. Use constants +evothings.tisensortag.CC2650_BLUETOOTH_SMART and +evothings.tisensortag.CC2541_BLUETOOTH_SMART.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ evothings.tisensortag.SensorTagInstance or null +if an object of the requested type cannot be created. +
+ + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/evothings.util.html b/lib-doc/evothings.util.html new file mode 100644 index 0000000..e1d398a --- /dev/null +++ b/lib-doc/evothings.util.html @@ -0,0 +1,1923 @@ + + + + + JSDoc: Namespace: util + + + + + + + + + + +
+ +

Namespace: util

+ + + + + + +
+ +
+ +

+ evothings. + + util +

+ + +
+ +
+
+ + +
Utilities for byte arrays.
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Aaron Ardiri
  • + +
  • Fredrik Eldh
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) base64DecToArr(sBase64, nBlocksSize) → {Uint8Array}

+ + + + + +
+ Decodes a Base64 string. Returns a Uint8Array. +nBlocksSize is optional. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sBase64 + + +String + + + +
nBlocksSize + + +int + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Uint8Array + + +
+
+ + + + + + + + + + +

(static) bigEndianToInt16(data, offset)

+ + + + + +
+ Interpret byte buffer as signed big endian 16 bit integer. +Returns converted number. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + Input buffer.
offset + + +number + + + + Start of data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Converted number. +
+ + + + + + + + + + + + +

(static) bigEndianToUint16(data, offset)

+ + + + + +
+ Interpret byte buffer as unsigned big endian 16 bit integer. +Returns converted number. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + Input buffer.
offset + + +number + + + + Start of data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Converted number. +
+ + + + + + + + + + + + +

(static) bigEndianToUint32(data, offset)

+ + + + + +
+ Interpret byte buffer as unsigned big endian 32 bit integer. +Returns converted number. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + Input buffer.
offset + + +number + + + + Start of data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Converted number. +
+ + + + + + + + + + + + +

(static) littleEndianToInt8(data, offset)

+ + + + + +
+ Interpret byte buffer as little endian 8 bit integer. +Returns converted number. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + Input buffer.
offset + + +number + + + + Start of data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Converted number. +
+ + + + + + + + + + + + +

(static) littleEndianToInt16(data, offset)

+ + + + + +
+ Interpret byte buffer as little endian 16 bit integer. +Returns converted number. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + Input buffer.
offset + + +number + + + + Start of data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Converted number. +
+ + + + + + + + + + + + +

(static) littleEndianToUint8(data, offset)

+ + + + + +
+ Interpret byte buffer as unsigned little endian 8 bit integer. +Returns converted number. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + Input buffer.
offset + + +number + + + + Start of data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Converted number. +
+ + + + + + + + + + + + +

(static) littleEndianToUint16(data, offset)

+ + + + + +
+ Interpret byte buffer as unsigned little endian 16 bit integer. +Returns converted number. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + Input buffer.
offset + + +number + + + + Start of data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Converted number. +
+ + + + + + + + + + + + +

(static) littleEndianToUint32(data, offset)

+ + + + + +
+ Interpret byte buffer as unsigned little endian 32 bit integer. +Returns converted number. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +ArrayBuffer + + + + Input buffer.
offset + + +number + + + + Start of data.
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Converted number. +
+ + + + + + + + + + + + +

(static) toHexString(i, byteCount)

+ + + + + +
+ Returns the integer i in hexadecimal string form, +with leading zeroes, such that +the resulting string is at least byteCount*2 characters long. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
i + + +int + + + +
byteCount + + +int + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) typedArrayToHexString(data)

+ + + + + +
+ Takes a ArrayBuffer or TypedArray and returns its hexadecimal representation. +No spaces or linebreaks. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/fonts/OpenSans-Bold-webfont.eot b/lib-doc/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 0000000..5d20d91 Binary files /dev/null and b/lib-doc/fonts/OpenSans-Bold-webfont.eot differ diff --git a/lib-doc/fonts/OpenSans-Bold-webfont.svg b/lib-doc/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 0000000..3ed7be4 --- /dev/null +++ b/lib-doc/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib-doc/fonts/OpenSans-Bold-webfont.woff b/lib-doc/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 0000000..1205787 Binary files /dev/null and b/lib-doc/fonts/OpenSans-Bold-webfont.woff differ diff --git a/lib-doc/fonts/OpenSans-BoldItalic-webfont.eot b/lib-doc/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 0000000..1f639a1 Binary files /dev/null and b/lib-doc/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/lib-doc/fonts/OpenSans-BoldItalic-webfont.svg b/lib-doc/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 0000000..6a2607b --- /dev/null +++ b/lib-doc/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib-doc/fonts/OpenSans-BoldItalic-webfont.woff b/lib-doc/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 0000000..ed760c0 Binary files /dev/null and b/lib-doc/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/lib-doc/fonts/OpenSans-Italic-webfont.eot b/lib-doc/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 0000000..0c8a0ae Binary files /dev/null and b/lib-doc/fonts/OpenSans-Italic-webfont.eot differ diff --git a/lib-doc/fonts/OpenSans-Italic-webfont.svg b/lib-doc/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 0000000..e1075dc --- /dev/null +++ b/lib-doc/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib-doc/fonts/OpenSans-Italic-webfont.woff b/lib-doc/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 0000000..ff652e6 Binary files /dev/null and b/lib-doc/fonts/OpenSans-Italic-webfont.woff differ diff --git a/lib-doc/fonts/OpenSans-Light-webfont.eot b/lib-doc/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 0000000..1486840 Binary files /dev/null and b/lib-doc/fonts/OpenSans-Light-webfont.eot differ diff --git a/lib-doc/fonts/OpenSans-Light-webfont.svg b/lib-doc/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 0000000..11a472c --- /dev/null +++ b/lib-doc/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib-doc/fonts/OpenSans-Light-webfont.woff b/lib-doc/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 0000000..e786074 Binary files /dev/null and b/lib-doc/fonts/OpenSans-Light-webfont.woff differ diff --git a/lib-doc/fonts/OpenSans-LightItalic-webfont.eot b/lib-doc/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 0000000..8f44592 Binary files /dev/null and b/lib-doc/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/lib-doc/fonts/OpenSans-LightItalic-webfont.svg b/lib-doc/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 0000000..431d7e3 --- /dev/null +++ b/lib-doc/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib-doc/fonts/OpenSans-LightItalic-webfont.woff b/lib-doc/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 0000000..43e8b9e Binary files /dev/null and b/lib-doc/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/lib-doc/fonts/OpenSans-Regular-webfont.eot b/lib-doc/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 0000000..6bbc3cf Binary files /dev/null and b/lib-doc/fonts/OpenSans-Regular-webfont.eot differ diff --git a/lib-doc/fonts/OpenSans-Regular-webfont.svg b/lib-doc/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 0000000..25a3952 --- /dev/null +++ b/lib-doc/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib-doc/fonts/OpenSans-Regular-webfont.woff b/lib-doc/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 0000000..e231183 Binary files /dev/null and b/lib-doc/fonts/OpenSans-Regular-webfont.woff differ diff --git a/lib-doc/global.html b/lib-doc/global.html new file mode 100644 index 0000000..ac5de32 --- /dev/null +++ b/lib-doc/global.html @@ -0,0 +1,826 @@ + + + + + JSDoc: Global + + + + + + + + + + +
+ +

Global

+ + + + + + +
+ +
+ +

+ +

+ + +
+ +
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

HIGH

+ + + + +
+ Value for setting a pin to on. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
To Do:
+
+
    +
  • Move into namespace
  • +
+
+ +
+ + + + + + + + +

INPUT

+ + + + +
+ Value for setting a pin to input. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
To Do:
+
+
    +
  • Move into namespace
  • +
+
+ +
+ + + + + + + + +

LOW

+ + + + +
+ Value for setting a pin to off. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
To Do:
+
+
    +
  • Move into namespace
  • +
+
+ +
+ + + + + + + + +

OUTPUT

+ + + + +
+ Value for setting a pin to output. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
To Do:
+
+
    +
  • Move into namespace
  • +
+
+ +
+ + + + + + + + + + + + +

Type Definitions

+ + + +

EddystoneDevice

+ + + + +
+ Object representing a BLE device. Inherits from evothings.easyble.EasyBLEDevice. +All uninherited properties are optional; they may be missing. +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + An Internet URL.
txPower + + +number + + + + A signed integer, the signal strength in decibels, factory-measured at a range of 0 meters.
nid + + +Uint8Array + + + + 10-byte namespace ID.
bid + + +Uint8Array + + + + 6-byte beacon ID.
voltage + + +number + + + + Device's battery voltage, in millivolts, or 0 (zero) if device is not battery-powered.
temperature + + +number + + + + Device's ambient temperature in 256:ths of degrees Celcius, or 0x8000 if device has no thermometer.
adv_cnt + + +number + + + + Count of advertisement frames sent since device's startup.
dsec_cnt + + +number + + + + Time since device's startup, in deci-seconds (10 units equals 1 second).
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + +

scanCallback(device)

+ + + + + +
+ This function is a parameter to startScan() and is called when a new device is discovered. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
device + + +EddystoneDevice + + + +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/index.html b/lib-doc/index.html new file mode 100644 index 0000000..7c136d8 --- /dev/null +++ b/lib-doc/index.html @@ -0,0 +1,65 @@ + + + + + JSDoc: Home + + + + + + + + + + +
+ +

Home

+ + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/lib-doc/nordic-nRF51-ble_nordic-nRF51-ble.js.html b/lib-doc/nordic-nRF51-ble_nordic-nRF51-ble.js.html new file mode 100644 index 0000000..479ee69 --- /dev/null +++ b/lib-doc/nordic-nRF51-ble_nordic-nRF51-ble.js.html @@ -0,0 +1,183 @@ + + + + + JSDoc: Source: nordic-nRF51-ble/nordic-nRF51-ble.js + + + + + + + + + + +
+ +

Source: nordic-nRF51-ble/nordic-nRF51-ble.js

+ + + + + + +
+
+
// File: nordic-nRF51-ble.js
+
+evothings.loadScript('libs/evothings/easyble/easyble.js')
+
+/**
+ * @namespace
+ * @author Aaron Ardiri
+ * @description Functions for communicating with a Nordic BLE device.
+ *
+ * @example
+evothings.nRF51_ble.connect(
+	'nRF51-DK', // BLE name
+	function(device)
+	{
+		console.log('connected!');
+		device.writeDataArray(new Uint8Array([1]));
+		evothings.nRF51_ble.close();
+	},
+	function(errorCode)
+	{
+		console.log('Error: ' + errorCode);
+	});
+*/
+
+// Object that exposes the nRF51-DK BLE API.
+evothings.nRF51_ble = {};
+(function()
+{
+	// Internal functions.
+	var internal = {};
+
+	/** Stops any ongoing scan and disconnects all devices. */
+	evothings.nRF51_ble.close = function()
+	{
+		evothings.easyble.stopScan();
+		evothings.easyble.closeConnectedDevices();
+	};
+
+	/** Connect to a BLE-shield.
+	* @param win - Success callback: win(device)
+	* @param fail - Error callback: fail(errorCode)
+	*/
+	evothings.nRF51_ble.connect = function(deviceName, win, fail)
+	{
+		evothings.easyble.startScan(
+			function(device)
+			{
+				console.log('found device: ' + device.name);
+				if (device.hasName(deviceName))
+				{
+					evothings.easyble.stopScan();
+					internal.connectToDevice(device, win, fail);
+				}
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	internal.connectToDevice = function(device, win, fail)
+	{
+		device.connect(
+			function(device)
+			{
+				console.log('connected!');
+				// Get services info.
+				internal.getServices(device, win, fail);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	internal.getServices = function(device, win, fail)
+	{
+		device.readServices(
+			null, // null means read info for all services
+			function(device)
+			{
+				internal.addMethodsToDeviceObject(device);
+				win(device);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	internal.addMethodsToDeviceObject = function(device)
+	{
+		device.writeDataArray = function(uint8array)
+		{
+			device.writeCharacteristic(
+				'6e524635-312d-444b-206c-656420202020',
+				uint8array,
+				function()
+				{
+					console.log('writeCharacteristic success');
+				},
+				function(errorCode)
+				{
+					console.log('writeCharacteristic error: ' + errorCode);
+				});
+		};
+
+		device.setNotification = function(callback)
+		{
+			console.log('setNotification');
+
+			// Enable notification support (required on Android)
+			device.writeDescriptor(
+				'6e524635-312d-444b-2062-7574746f6e20',
+				'00002902-0000-1000-8000-00805f9b34fb',
+				new Uint8Array([1,0]),
+				function() {
+					console.log('writeDescriptor success');
+				}, function(errorCode) {
+					console.log('writeDescriptor error: ' + errorCode);
+				});
+
+			device.enableNotification(
+				'6e524635-312d-444b-2062-7574746f6e20',
+				callback,
+				function(errorCode)
+				{
+					console.log('enableNotification error: ' + errorCode);
+			});
+		};
+	};
+})();
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/lib-doc/nordic-nRF51822-ble_nordic-nRF51822-ble.js.html b/lib-doc/nordic-nRF51822-ble_nordic-nRF51822-ble.js.html new file mode 100644 index 0000000..b6c9b97 --- /dev/null +++ b/lib-doc/nordic-nRF51822-ble_nordic-nRF51822-ble.js.html @@ -0,0 +1,231 @@ + + + + + JSDoc: Source: nordic-nRF51822-ble/nordic-nRF51822-ble.js + + + + + + + + + + +
+ +

Source: nordic-nRF51822-ble/nordic-nRF51822-ble.js

+ + + + + + +
+
+
// File: nordic-ble.js
+
+// Load dependent library EasyBLE.
+evothings.loadScript('libs/evothings/easyble/easyble.js');
+
+/**
+ * @namespace
+ * @description <p>Functions for communicating with a Nordic BLE device.</p>
+ * <p>It is safe practise to call function {@link evothings.scriptsLoaded}
+ * to ensure dependent libraries are loaded before calling functions
+ * in this library.</p>
+ */
+evothings.nordicble = {};
+
+;(function()
+{
+	// Internal functions.
+	var internal = {};
+
+	/**
+	 * Stops any ongoing scan and disconnects any connected devices.
+	 * @public
+	 */
+	evothings.nordicble.close = function()
+	{
+		evothings.easyble.stopScan();
+		evothings.easyble.closeConnectedDevices();
+	};
+
+	/**
+	 * Called when you have connected to a Nordic board.
+	 * @callback evothings.nordicble.connectsuccess
+	 * @param {evothings.nordicble.ArduinoBLEDevice} device -
+	 * The connected BLE shield.
+	 */
+
+	/**
+	 * Connect to the Nordic board.
+	 * @param {evothings.nordicble.connectsuccess} success -
+	 * Success callback: success(device)
+	 * @param {function} fail - Error callback: fail(errorCode)
+	 * @example
+	 * evothings.nordicble.connect(
+	 *   'LedButtonDemo', // BLE name
+	 *   function(device)
+	 *   {
+	 *     console.log('connected!');
+	 *     device.writeDataArray(new Uint8Array([1]));
+	 *     evothings.nordicble.close();
+	 *   },
+	 *   function(errorCode)
+	 *   {
+	 *     console.log('Error: ' + errorCode);
+	 *   });
+	 * @public
+	 */
+	evothings.nordicble.connect = function(deviceName, success, fail)
+	{
+		evothings.easyble.startScan(
+			function(device)
+			{
+				console.log('found device: ' + device.name);
+				if (device.name == deviceName)
+				{
+					evothings.easyble.stopScan();
+					internal.connectToDevice(device, success, fail);
+				}
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Connect to the device.
+	 * @private
+	 */
+	internal.connectToDevice = function(device, success, fail)
+	{
+		device.connect(
+			function(device)
+			{
+				console.log('connected!');
+				// Get services info.
+				internal.getServices(device, success, fail);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Read all services from the device.
+	 * @private
+	 */
+	internal.getServices = function(device, success, fail)
+	{
+		device.readServices(
+			null, // null means read info for all services
+			function(device)
+			{
+				internal.addMethodsToDeviceObject(device);
+				success(device);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Add instance methods to the device object.
+	 * @private
+	 */
+	internal.addMethodsToDeviceObject = function(device)
+	{
+		/**
+		 * Object that holds info about a Nordic device.
+		 * @namespace evothings.nordicble.NordicBLEDevice
+		 */
+
+		/**
+		 * @function writeDataArray
+		 * @description Write data to a Nordic board.
+		 * @param {Uint8Array} uint8array - The data to be written.
+		 * @memberof evothings.nordicble.NordicBLEDevice
+		 * @instance
+		 * @public
+		 */
+		device.writeDataArray = function(uint8array)
+		{
+			device.writeCharacteristic(
+				'00001525-1212-efde-1523-785feabcd123',
+				uint8array,
+				function()
+				{
+					console.log('writeCharacteristic success');
+				},
+				function(errorCode)
+				{
+					console.log('writeCharacteristic error: ' + errorCode);
+				});
+		};
+
+		/**
+		 * @function setNotification
+		 * @description Set a notification callback.
+		 * @param {Uint8Array} uint8array - The data to be written.
+		 * @memberof evothings.nordicble.NordicBLEDevice
+		 * @instance
+		 * @public
+		 */
+		device.setNotification = function(callback)
+		{
+			// Debug logging.
+			//console.log('setNotification');
+
+			// Must write this descriptor value to enable enableNotification().
+			// Yes, it's weird.
+			// Without it, enableNotification() fails silently;
+			// we never get the data we should be getting.
+			device.writeDescriptor('00001524-1212-efde-1523-785feabcd123',
+				'00002902-0000-1000-8000-00805f9b34fb',
+				new Uint8Array([1,0]),
+				function() {
+					console.log('writeDescriptor success');
+				}, function(errorCode) {
+					console.log('writeDescriptor error: ' + errorCode);
+				});
+
+			device.enableNotification('00001524-1212-efde-1523-785feabcd123',
+				callback,
+				function(errorCode) {
+					console.log('enableNotification error: ' + errorCode);
+				});
+		};
+	};
+})();
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/lib-doc/rfduinoble_rfduinoble.js.html b/lib-doc/rfduinoble_rfduinoble.js.html new file mode 100644 index 0000000..9cbb6d6 --- /dev/null +++ b/lib-doc/rfduinoble_rfduinoble.js.html @@ -0,0 +1,186 @@ + + + + + JSDoc: Source: rfduinoble/rfduinoble.js + + + + + + + + + + +
+ +

Source: rfduinoble/rfduinoble.js

+ + + + + + +
+
+
// File: rfduinoble.js
+
+// Load dependent library EasyBLE.
+evothings.loadScript('libs/evothings/easyble/easyble.js')
+
+/**
+ * @namespace
+ * @author Patrik D.
+ * @description <p>Functions for communicating with an RFduino board.</p>
+ * <p>It is safe practise to call function {@link evothings.scriptsLoaded}
+ * to ensure dependent libraries are loaded before calling functions
+ * in this library.</p>
+ */
+evothings.rfduinoble = {};
+
+;(function()
+{
+	// Internal functions.
+	var internal = {};
+
+	/**
+	 * Stops any ongoing scan and disconnects any connected devices.
+	 * @public
+	 */
+	evothings.rfduinoble.close = function()
+	{
+		evothings.easyble.stopScan();
+		evothings.easyble.closeConnectedDevices();
+	};
+
+	/**
+	 * Called when you have connected to the board.
+	 * @callback evothings.rfduinoble.connectsuccess
+	 * @param {evothings.rfduinoble.RFduinoBLEDevice} device -
+	 * The connected BLE shield.
+	 */
+
+	/**
+	 * Connect to an RFduino board.
+	 * @param {evothings.rfduinoble.connectsuccess} success -
+	 * Success callback: success(device)
+	 * @param {function} fail - Error callback: fail(errorCode)
+	 * @public
+	 */
+	evothings.rfduinoble.connect = function(deviceName, success, fail)
+	{
+		evothings.easyble.startScan(
+			function(device)
+			{
+				console.log('found device: ' + device.name);
+				if (device.name == deviceName)
+				{
+					evothings.easyble.stopScan();
+					console.log('connectToDevice');
+					internal.connectToDevice(device, success, fail);
+				}
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Connect to the device.
+	 * @private
+	 */
+	internal.connectToDevice = function(device, success, fail)
+	{
+		device.connect(
+			function(device)
+			{
+				// Get services info.
+				internal.getServices(device, success, fail);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Read all services from the device.
+	 * @private
+	 */
+	internal.getServices = function(device, success, fail)
+	{
+		device.readServices(
+			null, // null means read info for all services
+			function(device)
+			{
+				internal.addMethodsToDeviceObject(device);
+				success(device);
+			},
+			function(errorCode)
+			{
+				fail(errorCode);
+			});
+	};
+
+	/**
+	 * Add instance methods to the device object.
+	 * @private
+	 */
+	internal.addMethodsToDeviceObject = function(device)
+	{
+		/**
+		 * Object that holds info about an RFduino device.
+		 * @namespace evothings.rfduinoble.RFduinoBLEDevice
+		 */
+
+		/**
+		 * @function writeDataArray
+		 * @description Write data to an RFduino.
+		 * @param {Uint8Array} uint8array - The data to be written.
+		 * @memberof evothings.rfduinoble.RFduinoBLEDevice
+		 * @instance
+		 * @public
+		 */
+		device.writeDataArray = function(uint8array)
+		{
+			device.writeCharacteristic(
+				'00002222-0000-1000-8000-00805f9b34fb',
+				uint8array,
+				function()
+				{
+					console.log('writeCharacteristic success');
+				},
+				function(errorCode)
+				{
+					console.log('writeCharacteristic error: ' + errorCode);
+				});
+		};
+	};
+})();
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/lib-doc/scripts/linenumber.js b/lib-doc/scripts/linenumber.js new file mode 100644 index 0000000..8d52f7e --- /dev/null +++ b/lib-doc/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(function() { + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + var lineId; + var lines; + var totalLines; + var anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/lib-doc/scripts/prettify/Apache-License-2.0.txt b/lib-doc/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/lib-doc/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/lib-doc/scripts/prettify/lang-css.js b/lib-doc/scripts/prettify/lang-css.js new file mode 100644 index 0000000..041e1f5 --- /dev/null +++ b/lib-doc/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/lib-doc/scripts/prettify/prettify.js b/lib-doc/scripts/prettify/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/lib-doc/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p p:first-child, +.props td.description > p:first-child +{ + margin-top: 0; + padding-top: 0; +} + +.params td.description > p:last-child, +.props td.description > p:last-child +{ + margin-bottom: 0; + padding-bottom: 0; +} + +.disabled { + color: #454545; +} diff --git a/lib-doc/styles/prettify-jsdoc.css b/lib-doc/styles/prettify-jsdoc.css new file mode 100644 index 0000000..5a2526e --- /dev/null +++ b/lib-doc/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/lib-doc/styles/prettify-tomorrow.css b/lib-doc/styles/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/lib-doc/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/lib-doc/tisensortag_tisensortag-ble-cc2541.js.html b/lib-doc/tisensortag_tisensortag-ble-cc2541.js.html new file mode 100644 index 0000000..db0b8fe --- /dev/null +++ b/lib-doc/tisensortag_tisensortag-ble-cc2541.js.html @@ -0,0 +1,537 @@ + + + + + JSDoc: Source: tisensortag/tisensortag-ble-cc2541.js + + + + + + + + + + +
+ +

Source: tisensortag/tisensortag-ble-cc2541.js

+ + + + + + +
+
+
// Documentation for TI SensorTag CC2541:
+// http://processors.wiki.ti.com/index.php/SensorTag_User_Guide
+// http://processors.wiki.ti.com/index.php/File:BLE_SensorTag_GATT_Server.pdf
+
+;(function()
+{
+	evothings.tisensortag.ble.CC2541 = {}
+
+	/**
+	 * @namespace
+	 * @description Internal implementation of JavaScript library for the TI SensorTag CC2541.
+	 * @alias evothings.tisensortag.ble.CC2541
+	 */
+	var sensortag = {}
+
+	evothings.tisensortag.ble.CC2541 = sensortag
+
+	/**
+	 * Create a SensorTag CC2541 instance.
+	 * @returns {@link evothings.tisensortag.SensorTagInstance}
+	 * @private
+	 */
+	sensortag.addInstanceMethods = function(anInstance)
+	{
+		/**
+		 * @namespace
+		 * @alias evothings.tisensortag.SensorTagInstanceBLE_CC2541
+		 * @description SensorTag CC2541 instance object.
+		 * @public
+		 */
+		var instance = anInstance
+
+		// Add generic BLE instance methods.
+		evothings.tisensortag.ble.addInstanceMethods(instance)
+
+		/**
+		 * The device model.
+		 * @instance
+		 * @public
+		 */
+		instance.deviceModel = 'CC2541'
+
+		/**
+		 * Determine if a BLE device is a SensorTag CC2541.
+		 * Checks for the CC2541 using the advertised name.
+		 * @instance
+		 * @public
+		 */
+		instance.deviceIsSensorTag = function(device)
+		{
+			return (device != null) &&
+				(device.advertisementData != null) &&
+				(device.advertisementData.kCBAdvDataLocalName ==
+					'SensorTag')
+		}
+
+		/**
+		 * Public. Set the accelerometer notification callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - accelerometer rate in milliseconds.
+		 * @instance
+		 * @public
+		 */
+		instance.accelerometerCallback = function(fun, interval)
+		{
+			instance.accelerometerFun = fun
+			instance.accelerometerConfig = [1] // on
+			instance.accelerometerInterval = interval
+			instance.requiredServices.push(instance.ACCELEROMETER.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * Public. Set the gyroscope notification callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - gyroscope rate in milliseconds.
+		 * @param axes - the axes to enable ((z << 2) | (y << 1) | x)
+		 * Axis parameter values are:
+		 * 1 = X only, 2 = Y only,
+		 * 3 = X and Y, 4 = Z only,
+		 * 5 = X and Z, 6 = Y and Z,
+		 * 7 = X, Y and Z.
+		 * @instance
+		 * @public
+		 */
+		instance.gyroscopeCallback = function(fun, interval, axes)
+		{
+			if ('undefined' == typeof axes)
+			{
+				axes = 7 // 7 = enable all axes
+			}
+			instance.gyroscopeFun = fun
+			instance.gyroscopeConfig = [axes]
+			instance.gyroscopeInterval = Math.max(100, interval)
+			instance.requiredServices.push(instance.GYROSCOPE.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * Public. Set the magnetometer notification callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - magnetometer rate in milliseconds.
+		 * @instance
+		 * @public
+		 */
+		instance.magnetometerCallback = function(fun, interval)
+		{
+			instance.magnetometerFun = fun
+			instance.magnetometerConfig = [1] // on
+			instance.magnetometerInterval = interval
+			instance.requiredServices.push(instance.MAGNETOMETER.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * Internal.
+		 * @instance
+		 * @private
+		 */
+		instance.activateSensorsImpl = function()
+		{
+			// Debug logging.
+			//console.log('-------------------- SERVICES --------------------')
+			//sensortag.logServices(instance.device)
+			//console.log('---------------------- END -----------------------')
+
+			instance.temperatureOn()
+			instance.humidityOn()
+			instance.barometerOn()
+			instance.accelerometerOn()
+			instance.magnetometerOn()
+			instance.gyroscopeOn()
+			instance.keypressOn()
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Public. Turn on accelerometer notification.
+		 * @instance
+		 * @public
+		 */
+		instance.accelerometerOn = function()
+		{
+			instance.sensorOn(
+				instance.ACCELEROMETER,
+				instance.accelerometerConfig,
+				instance.accelerometerInterval,
+				instance.accelerometerFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Public. Turn off accelerometer notification.
+		 * @instance
+		 * @public
+		 */
+		instance.accelerometerOff = function()
+		{
+			instance.sensorOff(instance.ACCELEROMETER)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Public. Turn on gyroscope notification.
+		 * @instance
+		 * @public
+		 */
+		instance.gyroscopeOn = function()
+		{
+			instance.sensorOn(
+				instance.GYROSCOPE,
+				instance.gyroscopeConfig,
+				instance.gyroscopeInterval,
+				instance.gyroscopeFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * Public. Turn off gyroscope notification (SensorTag CC2541).
+		 * @instance
+		 * @public
+		 */
+		instance.gyroscopeOff = function()
+		{
+			instance.sensorOff(instance.GYROSCOPE)
+
+			return instance
+		}
+
+		/**
+		 * Public. Turn on magnetometer notification (SensorTag CC2541).
+		 * @instance
+		 * @public
+		 */
+		instance.magnetometerOn = function()
+		{
+			instance.sensorOn(
+				instance.MAGNETOMETER,
+				instance.magnetometerConfig,
+				instance.magnetometerInterval,
+				instance.magnetometerFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * Public. Turn off magnetometer notification (SensorTag CC2541).
+		 * @instance
+		 * @public
+		 */
+		instance.magnetometerOff = function()
+		{
+			instance.sensorOff(instance.MAGNETOMETER)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Public. Turn on barometer notification.
+		 * @instance
+		 * @public
+		 */
+		instance.barometerOn = function()
+		{
+			// First fetch barometer calibration data,
+			// then enable the barometer.
+			instance.barometerCalibrate(function()
+			{
+				instance.sensorOn(
+					instance.BAROMETER,
+					instance.barometerConfig,
+					instance.barometerInterval,
+					instance.barometerFun
+				)
+			})
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Private. Enable barometer calibration mode.
+		 * @instance
+		 * @private
+		 */
+		instance.barometerCalibrate = function(callback)
+		{
+			instance.device.writeCharacteristic(
+				instance.BAROMETER.CONFIG,
+				new Uint8Array([2]),
+				function()
+				{
+					instance.device.readCharacteristic(
+						instance.BAROMETER.CALIBRATION,
+						function(data)
+						{
+							data = new Uint8Array(data)
+							instance.barometerCalibrationData =
+							[
+								evothings.util.littleEndianToUint16(data, 0),
+								evothings.util.littleEndianToUint16(data, 2),
+								evothings.util.littleEndianToUint16(data, 4),
+								evothings.util.littleEndianToUint16(data, 6),
+								evothings.util.littleEndianToInt16(data, 8),
+								evothings.util.littleEndianToInt16(data, 10),
+								evothings.util.littleEndianToInt16(data, 12),
+								evothings.util.littleEndianToInt16(data, 14)
+							]
+							callback()
+						},
+						function(error)
+						{
+							console.log('CC2541 Barometer calibration failed: ' + error)
+						})
+				},
+				instance.errorFun)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Calculate accelerometer values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: x, y, z.
+		 * @instance
+		 * @public
+		 */
+		instance.getAccelerometerValues = function(data)
+		{
+			// Set divisor based on firmware version.
+			var divisors = {x: 16.0, y: -16.0, z: 16.0}
+
+			// Calculate accelerometer values.
+			var ax = evothings.util.littleEndianToInt8(data, 0) / divisors.x
+			var ay = evothings.util.littleEndianToInt8(data, 1) / divisors.y
+			var az = evothings.util.littleEndianToInt8(data, 2) / divisors.z
+
+			// Return result.
+			return { x: ax, y: ay, z: az }
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Calculate gyroscope values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: x, y, z.
+		 * @instance
+		 * @public
+		 */
+		instance.getGyroscopeValues = function(data)
+		{
+			// Calculate gyroscope values. NB: x,y,z has a weird order.
+			var gy = -evothings.util.littleEndianToInt16(data, 0) * 500.0 / 65536.0
+			var gx =  evothings.util.littleEndianToInt16(data, 2) * 500.0 / 65536.0
+			var gz =  evothings.util.littleEndianToInt16(data, 4) * 500.0 / 65536.0
+
+			// Return result.
+			return { x: gx, y: gy, z: gz }
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Calculate magnetometer values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: x, y, z.
+		 * @instance
+		 * @public
+		 */
+		instance.getMagnetometerValues = function(data)
+		{
+			// Magnetometer values (Micro Tesla).
+			var mx = evothings.util.littleEndianToInt16(data, 0) * (2000.0 / 65536.0) * -1
+			var my = evothings.util.littleEndianToInt16(data, 2) * (2000.0 / 65536.0) * -1
+			var mz = evothings.util.littleEndianToInt16(data, 4) * (2000.0 / 65536.0)
+
+			// Return result.
+			return { x: mx, y: my, z: mz }
+		}
+
+		/**
+		 * SensorTag CC2541.
+		 * Calculate barometer values from raw data.
+		 * @instance
+		 * @public
+		 */
+		instance.getBarometerValues = function(data)
+		{
+			var t = evothings.util.littleEndianToInt16(data, 0)
+			var p = evothings.util.littleEndianToUint16(data, 2)
+			var c = instance.barometerCalibrationData
+
+			var S = c[2] + ((c[3] * t) / 131072) + ((c[4] * (t * t)) / 17179869184.0)
+			var O = (c[5] * 16384.0) + (((c[6] * t) / 8)) + ((c[7] * (t * t)) / 524288.0)
+			var Pa = (((S * p) + O) / 16384.0)
+			var pInterpreted = Pa / 100.0
+
+			return { pressure: pInterpreted }
+		}
+
+		/**
+		 * Calculate temperature values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: ambientTemperature, targetTemperature.
+		 * @instance
+		 * @public
+		 */
+		instance.getTemperatureValues = function(data)
+		{
+			// Calculate ambient temperature (Celsius).
+			var ac = evothings.util.littleEndianToUint16(data, 2) / 128.0
+
+			// Calculate target temperature (Celsius, based on ambient).
+			var Vobj2 = evothings.util.littleEndianToInt16(data, 0) * 0.00000015625
+			var Tdie = ac + 273.15
+			var S0 =  6.4E-14	// calibration factor
+			var a1 =  1.750E-3
+			var a2 = -1.678E-5
+			var b0 = -2.940E-5
+			var b1 = -5.700E-7
+			var b2 =  4.630E-9
+			var c2 = 13.4
+			var Tref = 298.15
+			var S = S0 * (1 + a1 * (Tdie - Tref) + a2 * Math.pow((Tdie - Tref), 2))
+			var Vos = b0 + b1 * (Tdie - Tref) + b2 * Math.pow((Tdie - Tref), 2)
+			var fObj = (Vobj2 - Vos) + c2 * Math.pow((Vobj2 - Vos), 2)
+			var tObj = Math.pow(Math.pow(Tdie, 4 ) + (fObj / S), 0.25)
+			var tc = tObj - 273.15
+
+			// Return result.
+			return { ambientTemperature: ac, targetTemperature: tc }
+		}
+
+		/**
+		 * Public. Checks if the Temperature sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isTemperatureAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the accelerometer sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isAccelerometerAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the humidity sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isHumidityAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the magnetometer sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isMagnetometerAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the barometer sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isBarometerAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the gyroscope sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isGyroscopeAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the keypress sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isKeypressAvailable = function()
+		{
+			return true
+		}
+
+		// Finally, return the SensorTag instance object.
+		return instance
+	}
+})()
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Tue Oct 27 2015 14:39:06 GMT+0100 (CET) +
+ + + + + diff --git a/lib-doc/tisensortag_tisensortag-ble-cc2650.js.html b/lib-doc/tisensortag_tisensortag-ble-cc2650.js.html new file mode 100644 index 0000000..28d10c2 --- /dev/null +++ b/lib-doc/tisensortag_tisensortag-ble-cc2650.js.html @@ -0,0 +1,573 @@ + + + + + JSDoc: Source: tisensortag/tisensortag-ble-cc2650.js + + + + + + + + + + +
+ +

Source: tisensortag/tisensortag-ble-cc2650.js

+ + + + + + +
+
+

+;(function()
+{
+	evothings.tisensortag.ble.CC2650 = {}
+
+	/**
+	 * @namespace
+	 * @description Internal implementation of JavaScript library for the TI SensorTag CC2650.
+	 * @alias evothings.tisensortag.ble.CC2650
+	 */
+	var sensortag = {}
+
+	evothings.tisensortag.ble.CC2650 = sensortag
+
+	/**
+	 * Create a SensorTag CC2650 instance.
+	 * @returns {@link evothings.tisensortag.SensorTagInstanceBLE_CC2650}
+	 * @private
+	 */
+	sensortag.addInstanceMethods = function(anInstance)
+	{
+		/**
+		 * @namespace
+		 * @alias evothings.tisensortag.SensorTagInstanceBLE_CC2650
+		 * @description SensorTag CC2650 instance object.
+		 * @public
+		 */
+		var instance = anInstance
+
+		// Add generic BLE instance methods.
+		evothings.tisensortag.ble.addInstanceMethods(instance)
+
+		/**
+		 * The device model.
+		 * @instance
+		 * @public
+		 */
+		instance.deviceModel = 'CC2650'
+
+		/**
+		 * Determine if a BLE device is a SensorTag CC2650.
+		 * Checks for the CC2650 using the advertised name.
+		 * @instance
+		 * @public
+		 */
+		instance.deviceIsSensorTag = function(device)
+		{
+			return (device != null) &&
+				(device.advertisementData != null) &&
+				(device.advertisementData.kCBAdvDataLocalName ==
+					'CC2650 SensorTag')
+		}
+
+		/**
+		 * Public. Set the accelerometer notification callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - accelerometer rate in milliseconds.
+		 * @instance
+		 * @public
+		 */
+		instance.accelerometerCallback = function(fun, interval)
+		{
+			instance.accelerometerFun = fun
+
+			// Enable movement callback.
+			instance.setupCatchAllMovementCallback(interval)
+
+			return instance
+		}
+
+		/**
+		 * Public. Set the gyroscope notification callback.
+		 * Enables all axes.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - gyroscope rate in milliseconds.
+		 * @instance
+		 * @public
+		 */
+		instance.gyroscopeCallback = function(fun, interval)
+		{
+			instance.gyroscopeFun = fun
+
+			// Enable movement callback.
+			instance.setupCatchAllMovementCallback(interval)
+
+			return instance
+		}
+
+		/**
+		 * Public. Set the magnetometer notification callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - magnetometer rate in milliseconds.
+		 * @instance
+		 * @public
+		 */
+		instance.magnetometerCallback = function(fun, interval)
+		{
+			instance.magnetometerFun = fun
+
+			// Enable movement callback.
+			instance.setupCatchAllMovementCallback(interval)
+
+			return instance
+		}
+
+		/**
+		 * Private. Setup the movement sensor to call accelerometer,
+		 * gyroscope and magnetometer callbacks.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - magnetometer rate in milliseconds.
+		 * @instance
+		 * @private
+		 */
+		instance.setupCatchAllMovementCallback = function(interval)
+		{
+			// Only do this once.
+			if (instance.catchAllMovementCallbackEnabled) { return }
+			instance.catchAllMovementCallbackEnabled = true
+
+			// Call all of the movement service's callbacks
+			// (accelerometer, gyroscope, magnetometer)
+
+ 			// Set the config that turns on the needed sensors.
+			// magnetometer on: 64 (1000000) (seems to not work in ST2 FW 0.89)
+			// 3-axis acc. on: 56 (0111000)
+			// 3-axis gyro on: 7 (0000111)
+			// 3-axis acc. + 3-axis gyro on: 63 (0111111)
+			// 3-axis acc. + 3-axis gyro + magnetometer on: 127 (1111111)
+			instance.movementCallback(
+				function(data)
+				{
+					instance.accelerometerFun && instance.accelerometerFun(data)
+					instance.magnetometerFun && instance.magnetometerFun(data)
+					instance.gyroscopeFun && instance.gyroscopeFun(data)
+				},
+				interval,
+				127)
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Public. Set the movement notification callback.
+		 * Movement callbacks are routed back to accelerometer,
+		 * gyroscope, and magnetometer callbacks.
+		 * @param fun - Success callback called repeatedly: fun(data)
+		 * @param interval - Sensor rate in milliseconds.
+		 * @param sensors - Set the config that turns on the needed sensors:<br/>
+		 * Magnetometer on: 64 (1000000) (seems to not work in ST2 FW 0.89)<br/>
+		 * 3-axis acc. on: 56 (0111000)<br/>
+		 * 3-axis gyro on: 7 (0000111)<br/>
+		 * 3-axis acc. + 3-axis gyro on: 63 (0111111)<br/>
+		 * 3-axis acc. + 3-axis gyro + magnetometer on: 127 (1111111)<br/>
+		 * @instance
+		 * @public
+		 */
+		instance.movementCallback = function(fun, interval, sensors)
+		{
+			// Callback for all movement sensors (accelerometer, gyroscope, magnetometer).
+			instance.movementFun = fun
+
+ 			// Set the config that turns on the needed sensors.
+			instance.movementConfig = [sensors, 0]
+			instance.movementInterval = interval
+			instance.requiredServices.push(instance.MOVEMENT.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * Public. Set the luxometer notification callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - luxometer rate in milliseconds.
+		 */
+		instance.luxometerCallback = function(fun, interval)
+		{
+			instance.luxometerFun = fun
+			instance.luxometerConfig = [1] // on
+			instance.luxometerInterval = Math.max(1000, interval)
+			instance.requiredServices.push(instance.LUXOMETER.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Internal.
+		 * @instance
+		 * @private
+		 */
+		instance.activateSensorsImpl = function()
+		{
+			// Debug logging.
+			//console.log('-------------------- SERVICES --------------------')
+			//sensortag.logServices(instance.device)
+			//console.log('---------------------- END -----------------------')
+
+			instance.temperatureOn()
+			instance.humidityOn()
+			instance.barometerOn()
+			instance.luxometerOn()
+			instance.movementOn()
+			instance.keypressOn()
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Public. Turn on barometer notification.
+		 * @instance
+		 * @public
+		 */
+		instance.barometerOn = function()
+		{
+			instance.sensorOn(
+				instance.BAROMETER,
+				instance.barometerConfig,
+				instance.barometerInterval,
+				instance.barometerFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Public. Turn on movement notification (SensorTag 2).
+		 * @instance
+		 * @public
+		 */
+		instance.movementOn = function()
+		{
+			instance.sensorOn(
+				instance.MOVEMENT,
+				instance.movementConfig,
+				instance.movementInterval,
+				instance.movementFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Public. Turn off movement notification (SensorTag 2).
+		 * @instance
+		 * @public
+		 */
+		instance.movementOff = function()
+		{
+			instance.sensorOff(instance.MOVEMENT)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Public. Turn on luxometer notification.
+		 * @instance
+		 * @public
+		 */
+		instance.luxometerOn = function()
+		{
+			instance.sensorOn(
+				instance.LUXOMETER,
+				instance.luxometerConfig,
+				instance.luxometerInterval,
+				instance.luxometerFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Public. Turn off luxometer notification.
+		 * @instance
+		 * @public
+		 */
+		instance.luxometerOff = function()
+		{
+			instance.sensorOff(instance.LUXOMETER)
+
+			return instance
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Calculate temperature values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: ambientTemperature, targetTemperature.
+		 * @instance
+		 * @public
+		 */
+		instance.getTemperatureValues = function(data)
+		{
+			// Calculate ambient temperature (Celsius).
+			var ac = evothings.util.littleEndianToUint16(data, 2) / 128.0
+
+			// Calculate target temperature (Celsius).
+			var tc = evothings.util.littleEndianToInt16(data, 0)
+			tc = (tc >> 2) * 0.03125
+
+			// Return result.
+			return { ambientTemperature: ac, targetTemperature: tc }
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Calculate accelerometer values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: x, y, z.
+		 * @instance
+		 * @public
+		 */
+		instance.getAccelerometerValues = function(data)
+		{
+			var divisors = {x: -16384.0, y: 16384.0, z: -16384.0}
+
+			// Calculate accelerometer values.
+			var ax = evothings.util.littleEndianToInt16(data, 6) / divisors.x
+			var ay = evothings.util.littleEndianToInt16(data, 8) / divisors.y
+			var az = evothings.util.littleEndianToInt16(data, 10) / divisors.z
+
+			// Return result.
+			return { x: ax, y: ay, z: az }
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Calculate gyroscope values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: x, y, z.
+		 * @instance
+		 * @public
+		 */
+		instance.getGyroscopeValues = function(data)
+		{
+			// Calculate gyroscope values.
+			var gx = evothings.util.littleEndianToInt16(data, 0) * 255.0 / 32768.0
+			var gy = evothings.util.littleEndianToInt16(data, 2) * 255.0 / 32768.0
+			var gz =  evothings.util.littleEndianToInt16(data, 4) * 255.0 / 32768.0
+
+			// Return result.
+			return { x: gx, y: gy, z: gz }
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Calculate barometer values from raw data.
+		 * @instance
+		 * @public
+		 */
+		instance.getBarometerValues = function(data)
+		{
+			var p = evothings.util.littleEndianToUint16(data, 2)
+
+			// Extraction of pressure value, based on sfloatExp2ToDouble from
+			// BLEUtility.m in Texas Instruments TI BLE SensorTag iOS app
+			// source code.
+			// TODO: Move to util.js
+			var mantissa = p & 0x0FFF
+			var exponent = p >> 12
+
+			magnitude = Math.pow(2, exponent)
+			output = (mantissa * magnitude)
+
+			var pInterpreted = output / 10000.0
+
+			return { pressure: pInterpreted }
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Calculate magnetometer values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: x, y, z.
+		 * @instance
+		 * @public
+		 */
+		instance.getMagnetometerValues = function(data)
+		{
+			// Magnetometer values (Micro Tesla).
+			var mx = evothings.util.littleEndianToInt16(data, 12) * (4912.0 / 32768.0)
+			var my = evothings.util.littleEndianToInt16(data, 14) * (4912.0 / 32768.0)
+			var mz = evothings.util.littleEndianToInt16(data, 16) * (4912.0 / 32768.0)
+
+			// Return result.
+			return { x: mx, y: my, z: mz }
+		}
+
+		/**
+		 * SensorTag CC2650.
+		 * Calculate luxometer values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Light level in lux units.
+		 * @instance
+		 * @public
+		 */
+		instance.getLuxometerValue = function(data)
+		{
+			// Calculate the light level.
+			var value = evothings.util.littleEndianToUint16(data, 0)
+
+			// Extraction of luxometer value, based on sfloatExp2ToDouble
+			// from BLEUtility.m in Texas Instruments TI BLE SensorTag
+			// iOS app source code.
+			// TODO: move to util.js
+			var mantissa = value & 0x0FFF
+			var exponent = value >> 12
+
+			magnitude = Math.pow(2, exponent)
+			output = (mantissa * magnitude)
+
+			var lux = output / 100.0
+
+			// Return result.
+			return lux
+		}
+
+		/**
+		 * Public. Checks if the Temperature sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isTemperatureAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the accelerometer sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isAccelerometerAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the humidity sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isHumidityAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the magnetometer sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isMagnetometerAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the barometer sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isBarometerAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the gyroscope sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isGyroscopeAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if movement sensor is available that
+		 * combines accelerometer, gyroscope, and magnetometer.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isMovementAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the luxometer sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isLuxometerAvailable = function()
+		{
+			return true
+		}
+
+		/**
+		 * Public. Checks if the keypress sensor is available.
+		 * @preturn true if available, false if not.
+		 * @instance
+		 * @public
+		 */
+		instance.isKeypressAvailable = function()
+		{
+			return true
+		}
+
+		// Finally, return the SensorTag instance object.
+		return instance
+	}
+})()
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Tue Oct 27 2015 14:39:06 GMT+0100 (CET) +
+ + + + + diff --git a/lib-doc/tisensortag_tisensortag-ble.js.html b/lib-doc/tisensortag_tisensortag-ble.js.html new file mode 100644 index 0000000..0f7e9f8 --- /dev/null +++ b/lib-doc/tisensortag_tisensortag-ble.js.html @@ -0,0 +1,935 @@ + + + + + JSDoc: Source: tisensortag/tisensortag-ble.js + + + + + + + + + + +
+ +

Source: tisensortag/tisensortag-ble.js

+ + + + + + +
+
+
// Shared functions for BLE TI SensorTags.
+
+;(function()
+{
+	/**
+	 * @namespace
+	 * @description JavaScript library for the TI SensorTag.
+	 * @alias evothings.tisensortag.ble
+	 * @public
+	 */
+	var sensortag = {}
+
+	// Add object to namespace.
+	evothings.tisensortag.ble = sensortag
+
+	/**
+	 * @namespace
+	 * @description Status constants.
+	 * @alias evothings.tisensortag.ble.status
+	 * @public
+	 */
+	var status = {}
+
+	// Add to namespace. This trick is needed for JSDoc,
+	// cannot use sensortag.status below, docs do not
+	// generate properly in this case.
+	sensortag.status = status
+
+	/**
+	 * @description Scanning is ongoing.
+	 * @public
+	 */
+	status.SCANNING = 'SCANNING'
+
+	/**
+	 * @description Found SensorTag device.
+	 * @public
+	 */
+	status.SENSORTAG_FOUND = 'SENSORTAG_FOUND'
+
+	/**
+	 * @description Scanning timed out, no device found.
+	 * @public
+	 */
+	status.SENSORTAG_NOT_FOUND = 'SENSORTAG_NOT_FOUND'
+
+	/**
+	 * @description Connecting to physical device.
+	 * @public
+	 */
+	status.CONNECTING = 'CONNECTING'
+
+	/**
+	 * @description Connected to physical device.
+	 * @public
+	 */
+	status.CONNECTED = 'CONNECTED'
+
+	/**
+	 * @description Reading info about the device.
+	 * @public
+	 */
+	status.READING_DEVICE_INFO = 'READING_DEVICE_INFO'
+
+	/**
+	 * @description Info about the device is available.
+	 * @public
+	 */
+	status.DEVICE_INFO_AVAILABLE = 'DEVICE_INFO_AVAILABLE'
+
+	/**
+	 * @description Reading services of the device.
+	 * @public
+	 */
+	status.READING_SERVICES = 'READING_SERVICES'
+
+	/**
+	 * @description SensorTag device is connected and sensors are avaliable.
+	 * @public
+	 */
+	status.SENSORTAG_ONLINE = 'SENSORTAG_ONLINE'
+
+	/**
+	 * @namespace
+	 * @description Error constants. There are additional
+	 * error strings reported by the cordova-ble plugin
+	 * and the easyble.js library.
+	 * @alias evothings.tisensortag.ble.error
+	 * @public
+	 */
+	var error = {}
+
+	// Add to namespace. This trick is needed for JSDoc,
+	// cannot use sensortag.error below, docs do not
+	// generate properly in this case.
+	sensortag.error = error
+
+	/**
+	 * @description Scan failed.
+	 * @public
+	 */
+	error.SCAN_FAILED = 'SCAN_FAILED'
+
+	/**
+	 * Public. Create a SensorTag instance.
+	 * @returns {@link evothings.tisensortag.SensorTagInstanceBLE}
+	 * @private
+	 */
+	sensortag.addInstanceMethods = function(anInstance)
+	{
+		/**
+		 * @namespace
+		 * @alias evothings.tisensortag.SensorTagInstanceBLE
+		 * @description Abstract SensorTag instance object.
+		 * This object specifies the interface common to Bluetooth Smart
+		 * SensorTags.
+		 * @public
+		 */
+		var instance = anInstance
+
+		// UUIDs for services, characteristics, and descriptors.
+		instance.NOTIFICATION_DESCRIPTOR = '00002902-0000-1000-8000-00805f9b34fb'
+
+		instance.DEVICEINFO_SERVICE = '0000180a-0000-1000-8000-00805f9b34fb'
+		instance.FIRMWARE_DATA = '00002a26-0000-1000-8000-00805f9b34fb'
+		instance.MODELNUMBER_DATA = '00002a24-0000-1000-8000-00805f9b34fb'
+
+		instance.TEMPERATURE = {
+			SERVICE: 'f000aa00-0451-4000-b000-000000000000',
+			DATA: 'f000aa01-0451-4000-b000-000000000000',
+			CONFIG: 'f000aa02-0451-4000-b000-000000000000',
+			// Missing in HW rev. 1.2 (FW rev. 1.5)
+			PERIOD: 'f000aa03-0451-4000-b000-000000000000',
+		}
+
+		instance.HUMIDITY = {
+			SERVICE: 'f000aa20-0451-4000-b000-000000000000',
+			DATA: 'f000aa21-0451-4000-b000-000000000000',
+			CONFIG: 'f000aa22-0451-4000-b000-000000000000',
+			PERIOD: 'f000aa23-0451-4000-b000-000000000000',
+		}
+
+		instance.BAROMETER = {
+			SERVICE: 'f000aa40-0451-4000-b000-000000000000',
+			DATA: 'f000aa41-0451-4000-b000-000000000000',
+			CONFIG: 'f000aa42-0451-4000-b000-000000000000',
+			CALIBRATION: 'f000aa43-0451-4000-b000-000000000000',
+			PERIOD: 'f000aa44-0451-4000-b000-000000000000',
+		}
+
+		// Only in SensorTag CC2541.
+		instance.ACCELEROMETER = {
+			SERVICE: 'f000aa10-0451-4000-b000-000000000000',
+			DATA: 'f000aa11-0451-4000-b000-000000000000',
+			CONFIG: 'f000aa12-0451-4000-b000-000000000000',
+			PERIOD: 'f000aa13-0451-4000-b000-000000000000',
+		}
+
+		// Only in SensorTag CC2541.
+		instance.MAGNETOMETER = {
+			SERVICE: 'f000aa30-0451-4000-b000-000000000000',
+			DATA: 'f000aa31-0451-4000-b000-000000000000',
+			CONFIG: 'f000aa32-0451-4000-b000-000000000000',
+			PERIOD: 'f000aa33-0451-4000-b000-000000000000',
+		}
+
+		// Only in SensorTag CC2541.
+		instance.GYROSCOPE = {
+			SERVICE: 'f000aa50-0451-4000-b000-000000000000',
+			DATA: 'f000aa51-0451-4000-b000-000000000000',
+			CONFIG: 'f000aa52-0451-4000-b000-000000000000',
+			PERIOD: 'f000aa53-0451-4000-b000-000000000000',
+		}
+
+		// Only in SensorTag CC2650.
+		instance.LUXOMETER = {
+			SERVICE: 'f000aa70-0451-4000-b000-000000000000',
+			DATA: 'f000aa71-0451-4000-b000-000000000000',
+			CONFIG: 'f000aa72-0451-4000-b000-000000000000',
+			PERIOD: 'f000aa73-0451-4000-b000-000000000000',
+		}
+
+		// Only in SensorTag CC2650.
+		instance.MOVEMENT = {
+			SERVICE: 'f000aa80-0451-4000-b000-000000000000',
+			DATA: 'f000aa81-0451-4000-b000-000000000000',
+			CONFIG: 'f000aa82-0451-4000-b000-000000000000',
+			PERIOD: 'f000aa83-0451-4000-b000-000000000000',
+		}
+
+		instance.KEYPRESS = {
+			SERVICE: '0000ffe0-0000-1000-8000-00805f9b34fb',
+			DATA: '0000ffe1-0000-1000-8000-00805f9b34fb',
+		}
+
+		/**
+		 * Internal. Services used by the application.
+		 * @instance
+		 * @private
+		 */
+		instance.requiredServices = []
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Set the humidity temperature callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - humidity rate in milliseconds.
+		 * @instance
+		 * @public
+		 */
+		instance.temperatureCallback = function(fun, interval)
+		{
+			instance.temperatureFun = fun
+			instance.temperatureConfig = [1] // on
+			instance.temperatureInterval = Math.max(300, interval)
+			instance.requiredServices.push(instance.TEMPERATURE.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Set the humidity notification callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - humidity rate in milliseconds.
+		 * @instance
+		 * @public
+		 */
+		instance.humidityCallback = function(fun, interval)
+		{
+			instance.humidityFun = fun
+			instance.humidityConfig = [1] // on
+			instance.humidityInterval = Math.max(100, interval)
+			instance.requiredServices.push(instance.HUMIDITY.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Set the barometer notification callback.
+		 * @param fun - success callback called repeatedly: fun(data)
+		 * @param interval - barometer rate in milliseconds.
+		 * @instance
+		 * @public
+		 */
+		instance.barometerCallback = function(fun, interval)
+		{
+			instance.barometerFun = fun
+			instance.barometerConfig = [1] // on
+			instance.barometerInterval = Math.max(100, interval)
+			instance.requiredServices.push(instance.BAROMETER.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Set the keypress notification callback.
+		 * @param fun - success callback called when a key is pressed: fun(data)
+		 * @instance
+		 * @public
+		 */
+		instance.keypressCallback = function(fun)
+		{
+			instance.keypressFun = fun
+			instance.requiredServices.push(instance.KEYPRESS.SERVICE)
+
+			return instance
+		}
+
+		/**
+		 * Determine if a BLE device is a SensorTag.
+		 * This version checks the general case using
+		 * the advertised name.
+		 * Specific versions for CC2541 and CC2650 uses
+		 * advertisement data to determine tag type.
+		 * @instance
+		 * @public
+		 */
+		instance.deviceIsSensorTag = function(device)
+		{
+			return (device != null) &&
+				(device.name != null) &&
+				(device.name.indexOf('Sensor Tag') > -1 ||
+					device.name.indexOf('SensorTag') > -1)
+		}
+
+		/**
+		 * Public. Connect to the nearest physical SensorTag device.
+		 * @instance
+		 * @public
+		 * @deprecated Use evothings.tiseonsortag.ble.connectToNearestDevice
+		 */
+		instance.connectToClosestDevice = function()
+		{
+			return instance.connectToNearestDevice()
+		}
+
+		/**
+		 * Public. Connect to the nearest physical SensorTag device.
+		 * For this to work reliably SensorTags should be at least a
+		 * couple of meters apart.
+		 * @param scanTimeMilliseconds The time to scan for nearby
+		 * SensorTags (optional, defaults to 3 seconds).
+		 * @instance
+		 * @public
+		 */
+		instance.connectToNearestDevice = function(scanTimeMilliseconds)
+		{
+			instance.callStatusCallback(sensortag.status.SCANNING)
+			instance.disconnectDevice()
+			evothings.easyble.stopScan()
+			evothings.easyble.reportDeviceOnce(false)
+
+			var nearestDevice = null
+			var strongestRSSI = -1000
+			var scanTimeoutStarted = false
+			var noTagFoundTimer = null
+
+			// Timer that connects to the nearest SensorTag efter the
+			// specified timeout.
+			function startConnectTimer()
+			{
+				// Set timeout period.
+				scanTimeMilliseconds = (('undefined' == typeof scanTimeMilliseconds)
+					? 1000 // Default scan time is 3 seconds
+					: scanTimeMilliseconds) // Use user-set value
+
+				// Start timer.
+				setTimeout(
+					function() {
+						if (nearestDevice)
+						{
+							evothings.easyble.stopScan()
+							instance.callStatusCallback(
+								sensortag.status.SENSORTAG_FOUND)
+							instance.connectToDevice(nearestDevice)
+						}
+					},
+					scanTimeMilliseconds)
+			}
+
+			// Timer that times out if no tag at all is found.
+			// Period is set to 10 seconds.
+			function startNoTagFoundTimer(device)
+			{
+				// Set scan timeout period.
+				var timeOut = 10000
+
+				// Start timer.
+				noTagFoundTimer = setTimeout(
+					function() {
+						if (!nearestDevice)
+						{
+							evothings.easyble.stopScan()
+							instance.callStatusCallback(
+								sensortag.status.SENSORTAG_NOT_FOUND)
+						}
+					},
+					timeOut)
+			}
+
+			function stopNoTagFoundTimer()
+			{
+				clearTimeout(noTagFoundTimer)
+			}
+
+			// Called when a device is found during scanning.
+			function deviceFound(device)
+			{
+				// Update the device if it is nearest so far
+				// and the RRSI value is valid. 127 is an invalid
+				// (unknown) RSSI value reported occasionally.
+				// deviceIsSensorTag is implemented in CC2541 and
+				// CC2650 object code.
+				if (device.rssi != 127 && instance.deviceIsSensorTag(device))
+				{
+					//console.log('deviceFound: ' + device.name)
+
+					if (device.rssi > strongestRSSI)
+					{
+						// If this is the first SensorTag found,
+						// start the timer that makes the connection.
+						if (!nearestDevice)
+						{
+							stopNoTagFoundTimer()
+							startConnectTimer()
+						}
+
+						nearestDevice = device
+						strongestRSSI = device.rssi
+					}
+				}
+			}
+
+			function scanError(errorCode)
+			{
+				instance.callErrorCallback(sensortag.error.SCAN_FAILED)
+			}
+
+			// Start timer that reports if no tag at all was found.
+			startNoTagFoundTimer()
+
+			// Start scanning.
+			evothings.easyble.startScan(deviceFound, scanError)
+
+			return instance
+		}
+
+		/**
+		 * Start scanning for physical devices.
+		 * @param foundCallback Function called when a SensorTag
+		 * is found. It has the form foundCallback(device) where
+		 * is a an object representing a BLE device object. You can
+		 * inspect the device fields to determine properties such as
+		 * RSSI, name etc. You can call deviceIsSensorTag(device) to
+		 * determine if this is a  SensorTag of the same type as the
+		 * instance object.
+		 * To connect to a SensorTag call connectToDevice(device).
+		 * @instance
+		 * @public
+		 */
+		instance.startScanningForDevices = function(foundCallback)
+		{
+			instance.callStatusCallback(sensortag.status.SCANNING)
+			instance.disconnectDevice()
+			evothings.easyble.stopScan()
+			evothings.easyble.reportDeviceOnce(false)
+
+			// Called when a device is found during scanning.
+			function deviceFound(device)
+			{
+				// 127 is an invalid (unknown) RSSI value reported occasionally.
+				if (device.rssi != 127)
+				{
+					foundCallback(device)
+				}
+			}
+
+			function scanError(errorCode)
+			{
+				instance.callErrorCallback(sensortag.error.SCAN_FAILED)
+			}
+
+			// Start scanning.
+			evothings.easyble.startScan(deviceFound, scanError)
+
+			return instance
+		}
+
+		/**
+		 * Stop scanning for physical devices.
+		 * @instance
+		 * @public
+		 */
+		instance.stopScanningForDevices = function()
+		{
+			instance.callStatusCallback(sensortag.status.SENSORTAG_NOT_FOUND)
+
+			evothings.easyble.stopScan()
+
+			return instance
+		}
+
+		/**
+		 * Connect to a SensorTag BLE device.
+		 * @param device A Bluetooth Low Energy device object.
+		 * @instance
+		 * @public
+		 */
+		instance.connectToDevice = function(device)
+		{
+			instance.device = device
+			instance.callStatusCallback(sensortag.status.CONNECTING)
+			instance.device.connect(
+				function(device)
+				{
+					instance.callStatusCallback(sensortag.status.CONNECTED)
+					instance.readDeviceInfo()
+				},
+				instance.errorFun)
+		}
+
+		/**
+		 * Public. Disconnect from the physical device.
+		 * @instance
+		 * @public
+		 */
+		instance.disconnectDevice = function()
+		{
+			if (instance.device)
+			{
+				instance.device.close()
+				instance.device = null
+			}
+
+			return instance
+		}
+
+		/**
+		 * Internal. When connected we read device info and services.
+		 * @instance
+		 * @private
+		 */
+		instance.readDeviceInfo = function()
+		{
+			function readDeviceInfoService()
+			{
+				// Notify that status is reading device info.
+				instance.callStatusCallback(sensortag.status.READING_DEVICE_INFO)
+
+				// Read device information service.
+				instance.device.readServices(
+					[instance.DEVICEINFO_SERVICE],
+					gotDeviceInfoService,
+					instance.errorFun)
+			}
+
+			function gotDeviceInfoService(device)
+			{
+				// Reading of model is disabled. See comment below.
+				//readModelNumber()
+				readFirmwareVersion()
+			}
+
+			/*
+			Commented out unused code.
+
+			The value we get from the MODELNUMBER_DATA charaterictic
+			does not seem to be consistent.
+
+			We instead set model number in tisensortag-ble-cc2541.js
+			and tisensortag-ble-cc2650.js
+
+			function readModelNumber()
+			{
+				// Read model number.
+				instance.device.readCharacteristic(
+					instance.MODELNUMBER_DATA,
+					gotModelNumber,
+					instance.errorFun)
+			}
+
+			function gotModelNumber(data)
+			{
+				// Set model number.
+				var modelNumber = evothings.ble.fromUtf8(data)
+				console.log('devicemodel: ' + modelNumber)
+				if (-1 !== modelNumber.indexOf('CC2650'))
+				{
+					instance.deviceModel = 'CC2650'
+				}
+				else
+				{
+					instance.deviceModel = 'CC2541'
+				}
+
+				// Next read firmware version.
+				readFirmwareVersion()
+			}
+			*/
+
+			function readFirmwareVersion()
+			{
+				instance.device.readServiceCharacteristic(
+					instance.DEVICEINFO_SERVICE,
+					instance.FIRMWARE_DATA,
+					gotFirmwareVersion,
+					instance.errorFun)
+			}
+
+			function gotFirmwareVersion(data)
+			{
+				// Set firmware string.
+				var fw = evothings.ble.fromUtf8(data)
+				instance.firmwareString = fw.match(/\d+\.\d+\S?\b/g)[0] || ''
+
+				// Notify that device info is available.
+				instance.callStatusCallback(sensortag.status.DEVICE_INFO_AVAILABLE)
+
+				// Read services requested by the application.
+				readRequestedServices()
+			}
+
+			function readRequestedServices()
+			{
+				// Notify that status is reading services.
+				instance.callStatusCallback(sensortag.status.READING_SERVICES)
+
+				// Read services requested by the application.
+				instance.device.readServices(
+					instance.requiredServices,
+					instance.activateSensors,
+					instance.errorFun)
+			}
+
+			// Start by reading model number. Then read other
+			// data successively.
+			readDeviceInfoService()
+		}
+
+		/**
+		 * Internal.
+		 * @instance
+		 * @private
+		 */
+		instance.activateSensors = function()
+		{
+			// Debug logging.
+			//console.log('-------------------- SERVICES --------------------')
+			//sensortag.logServices(instance.device)
+			//console.log('---------------------- END -----------------------')
+
+			// Call implementation method in sub module.
+			instance.activateSensorsImpl()
+
+			instance.callStatusCallback(sensortag.status.SENSORTAG_ONLINE)
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Turn on IR temperature notification.
+		 * @instance
+		 * @public
+		 */
+		instance.temperatureOn = function()
+		{
+			instance.sensorOn(
+				instance.TEMPERATURE,
+				instance.temperatureConfig,
+				instance.temperatureInterval,
+				instance.temperatureFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Turn off IR temperature notification.
+		 * @instance
+		 * @public
+		 */
+		instance.temperatureOff = function()
+		{
+			instance.sensorOff(instance.TEMPERATURE)
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Turn on humidity notification.
+		 * @instance
+		 * @public
+		 */
+		instance.humidityOn = function()
+		{
+			instance.sensorOn(
+				instance.HUMIDITY,
+				instance.humidityConfig,
+				instance.humidityInterval,
+				instance.humidityFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Turn off humidity notification.
+		 * @instance
+		 * @public
+		 */
+		instance.humidityOff = function()
+		{
+			instance.sensorOff(instance.HUMIDITY)
+
+			return instance
+		}
+
+		/**
+		 * Public. Turn on barometer notification.
+		 * @instance
+		 * @public
+		 */
+		instance.barometerOn = function()
+		{
+			// Implemented in sub modules.
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Turn off barometer notification.
+		 * @instance
+		 * @public
+		 */
+		instance.barometerOff = function()
+		{
+			instance.sensorOff(instance.BAROMETER)
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Turn on keypress notification.
+		 * @instance
+		 * @public
+		 */
+		instance.keypressOn = function()
+		{
+			instance.sensorOn(
+				instance.KEYPRESS,
+				null, // Not used.
+				null, // Not used.
+				instance.keypressFun
+			)
+
+			return instance
+		}
+
+		/**
+		 * Both CC2541 and CC2650.
+		 * Public. Turn off keypress notification.
+		 * @instance
+		 * @public
+		 */
+		instance.keypressOff = function()
+		{
+			instance.sensorOff(instance.KEYPRESS)
+
+			return instance
+		}
+
+		/**
+		 * Public. Used internally as a helper function for turning on
+		 * sensor notification. You can call this function from the
+		 * application to enable sensors using custom parameters.
+		 * For advanced use.
+		 * @instance
+		 * @public
+		 */
+		instance.sensorOn = function(
+			service,
+			configValue,
+			periodValue,
+			notificationFunction)
+		{
+			// Only start sensor if a notification function has been set.
+			if (!notificationFunction) { return }
+
+			// Set sensor configuration to ON.
+			// If configValue is provided, service.CONFIG must be set.
+			configValue && instance.device.writeServiceCharacteristic(
+				service.SERVICE,
+				service.CONFIG,
+				new Uint8Array(configValue),
+				function() {},
+				instance.errorFun)
+
+			// Set sensor update period.
+			periodValue && instance.device.writeServiceCharacteristic(
+				service.SERVICE,
+				service.PERIOD,
+				new Uint8Array([periodValue / 10]),
+				function() {},
+				instance.errorFun)
+
+			// Set sensor notification to ON.
+			service.DATA && instance.device.writeServiceDescriptor(
+				service.SERVICE,
+				service.DATA,
+				instance.NOTIFICATION_DESCRIPTOR,
+				new Uint8Array([1,0]),
+				function() {
+					// Make sure value got written correctly.
+					// Also test readServiceDescriptor().
+					instance.device.readServiceDescriptor(service.SERVICE, service.DATA, instance.NOTIFICATION_DESCRIPTOR, function(data) {
+						//console.log('BLE descriptor data: ' + instance.dataToString(data))
+					}, function(errorCode)
+					{
+						console.log('BLE readServiceDescriptor error: ' + errorCode)
+					})
+				},
+				instance.errorFun)
+
+			// Start sensor notification.
+			service.DATA && instance.device.enableServiceNotification(
+				service.SERVICE,
+				service.DATA,
+				function(data) { notificationFunction(new Uint8Array(data)) },
+				instance.errorFun)
+
+			return instance
+		}
+
+		instance.dataToString = function(data)
+		{
+			var str = '['
+			data = new Uint8Array(data)
+			for(var i=0; i<data.length; i++) {
+				if(i > 0)
+					str += ','
+				str += data[i]
+			}
+			str += ']'
+			return str
+		}
+
+		/**
+		 * Helper function for turning off sensor notification.
+		 * @instance
+		 * @public
+		 */
+		instance.sensorOff = function(service)
+		{
+			// TODO: Check that sensor notification function is set.
+
+			// Set sensor configuration to OFF
+			service.CONFIG && instance.device.writeServiceCharacteristic(
+				service.SERVICE,
+				service.CONFIG,
+				new Uint8Array([0]),
+				function() {},
+				instance.errorFun)
+
+			// Set sensor notification to OFF.
+			service.DATA && instance.device.writeServiceDescriptor(
+				service.SERVICE,
+				service.DATA,
+				instance.NOTIFICATION_DESCRIPTOR,
+				new Uint8Array([0,0]),
+				function() {
+					// Make sure value got written correctly.
+					// Also test readServiceDescriptor().
+					instance.device.readServiceDescriptor(service.SERVICE, service.DATA, instance.NOTIFICATION_DESCRIPTOR, function(data) {
+						//console.log('BLE descriptor data: ' + instance.dataToString(data))
+					}, function(errorCode)
+					{
+						console.log('BLE readServiceDescriptor error: ' + errorCode)
+					})
+				},
+				instance.errorFun)
+
+			service.DATA && instance.device.disableServiceNotification(
+				service.SERVICE,
+				service.DATA,
+				function() {
+					//console.log("disableServiceNotification success")
+				},
+				instance.errorFun)
+
+			return instance
+		}
+
+		/**
+		 * Calculate humidity values from raw data.
+		 * @param data - an Uint8Array.
+		 * @return Object with fields: humidityTemperature, relativeHumidity.
+		 * @instance
+		 * @public
+		 */
+		instance.getHumidityValues = function(data)
+		{
+			// Calculate the humidity temperature (Celsius).
+			var tData = evothings.util.littleEndianToInt16(data, 0)
+			var tc = -46.85 + 175.72 / 65536.0 * tData
+
+			// Calculate the relative humidity.
+			var hData = (evothings.util.littleEndianToInt16(data, 2) & ~0x03)
+			var h = -6.0 + 125.00 / 65536.0 * hData
+
+			// Return result.
+			return { humidityTemperature: tc, relativeHumidity: h }
+		}
+
+		// Finally, return the SensorTag instance object.
+		return instance
+	}
+})()
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Tue Oct 27 2015 14:39:06 GMT+0100 (CET) +
+ + + + + diff --git a/lib-doc/tisensortag_tisensortag.js.html b/lib-doc/tisensortag_tisensortag.js.html new file mode 100644 index 0000000..13369d2 --- /dev/null +++ b/lib-doc/tisensortag_tisensortag.js.html @@ -0,0 +1,586 @@ + + + + + JSDoc: Source: tisensortag/tisensortag.js + + + + + + + + + + +
+ +

Source: tisensortag/tisensortag.js

+ + + + + + +
+
+
// File: tisensortag.js
+
+/**
+ * @namespace
+ * @description Top-level object that holds generic functions and sub-modules.
+ * @public
+ */
+evothings.tisensortag = {}
+
+/**
+ * Constant identifying the CC2650 Bluetooth Smart SensorTag.
+ * @public
+ */
+evothings.tisensortag.CC2650_BLUETOOTH_SMART = 'CC2650 Bluetooth Smart'
+
+/**
+ * Constant identifying the CC2541 Bluetooth Smart SensorTag.
+ * @public
+ */
+evothings.tisensortag.CC2541_BLUETOOTH_SMART = 'CC2541 Bluetooth Smart'
+
+/**
+ * Public. Create a SensorTag instance.
+ * @param {string} type String with type of tag. Use constants
+ * evothings.tisensortag.CC2650_BLUETOOTH_SMART and
+ * evothings.tisensortag.CC2541_BLUETOOTH_SMART.
+ * @returns {@link evothings.tisensortag.SensorTagInstance} or null
+ * if an object of the requested type cannot be created.
+ * @public
+ */
+evothings.tisensortag.createInstance = function(type)
+{
+	// TODO: Update this function as new models are added.
+
+	// Get a factory object that will add in specific methods.
+	if (evothings.tisensortag.CC2541_BLUETOOTH_SMART == type)
+	{
+		var factory = evothings.tisensortag.ble.CC2541
+	}
+	else if (evothings.tisensortag.CC2650_BLUETOOTH_SMART == type)
+	{
+		var factory = evothings.tisensortag.ble.CC2650
+	}
+	else
+	{
+		return null
+	}
+
+	// Create abstract instance.
+	var instance = evothings.tisensortag.createGenericInstance()
+
+	// Add specific implementation.
+	return factory.addInstanceMethods(instance)
+}
+
+/**
+ * Create an object with functions common to all SensorTag models.
+ * This object specifies the public interface for SensorTag instances.
+ * @public
+ */
+evothings.tisensortag.createGenericInstance = function()
+{
+	/**
+	 * @namespace
+	 * @alias evothings.tisensortag.SensorTagInstance
+	 * @description Abstract SensorTag instance object that defines a common interface.
+	 * @public
+	 */
+	var instance = {}
+
+	/**
+	 * Internal. Default error handler function.
+	 * @instance
+	 * @private
+	 */
+	instance.errorFun = function(error)
+	{
+		console.log('SensorTag error: ' + error)
+	}
+
+	/**
+	 * Internal. Default status handler function.
+	 * @instance
+	 * @private
+	 */
+	instance.statusFun = function(status)
+	{
+		console.log('SensorTag status: ' + status)
+	}
+
+	/**
+	 * Public. Set the IR temperature notification callback.
+	 * @param fun - success callback called repeatedly: fun(data)
+	 * @param interval - update rate in milliseconds (min 300ms)
+	 * @instance
+	 * @public
+	 */
+	instance.temperatureCallback = function(fun, interval)
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Set the accelerometer notification callback.
+	 * @param fun - success callback called repeatedly: fun(data)
+	 * @param interval - accelerometer rate in milliseconds.
+	 * @instance
+	 * @public
+	 */
+	instance.accelerometerCallback = function(fun, interval)
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Set the humidity notification callback.
+	 * @param fun - success callback called repeatedly: fun(data)
+	 * @param interval - humidity rate in milliseconds.
+	 * @instance
+	 * @public
+	 */
+	instance.humidityCallback = function(fun, interval)
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Set the magnetometer notification callback.
+	 * @param fun - success callback called repeatedly: fun(data)
+	 * @param interval - magnetometer rate in milliseconds.
+	 * @instance
+	 * @public
+	 */
+	instance.magnetometerCallback = function(fun, interval)
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Set the barometer notification callback.
+	 * @param fun - success callback called repeatedly: fun(data)
+	 * @param interval - barometer rate in milliseconds.
+	 * @instance
+	 * @public
+	 */
+	instance.barometerCallback = function(fun, interval)
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Set the gyroscope notification callback.
+	 * @param fun - success callback called repeatedly: fun(data)
+	 * @param interval - gyroscope rate in milliseconds.
+	 * @param axes - (optional) the axes to enable ((z << 2) | (y << 1) | x)
+	 * Only available on SensorTag CC2541.
+	 * Axis parameter values are:
+	 * 1 = X only, 2 = Y only,
+	 * 3 = X and Y, 4 = Z only,
+	 * 5 = X and Z, 6 = Y and Z,
+	 * 7 = X, Y and Z.
+	 * @instance
+	 * @public
+	 */
+	instance.gyroscopeCallback = function(fun, interval, axes)
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Set the luxometer notification callback.
+	 * @param fun - success callback called repeatedly: fun(data)
+	 * @param interval - luxometer rate in milliseconds.
+	 */
+	instance.luxometerCallback = function(fun, interval)
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Set the keypress notification callback.
+	 * @param fun - success callback called when a key is pressed: fun(data)
+	 * @instance
+	 * @public
+	 */
+	instance.keypressCallback = function(fun)
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Set the error handler function.
+	 * @param fun - error callback: fun(error)
+	 * @instance
+	 * @public
+	 */
+	instance.errorCallback = function(fun)
+	{
+		instance.errorFun = fun
+
+		return instance
+	}
+
+	/**
+	 * Public. Set the status handler function.
+	 * @param fun - callback: fun(status)
+	 * @instance
+	 * @public
+	 */
+	instance.statusCallback = function(fun)
+	{
+		instance.statusFun = fun
+
+		return instance
+	}
+
+	/**
+	 * Public. Call the error handler function.
+	 * @instance
+	 * @public
+	 */
+	instance.callErrorCallback = function(error)
+	{
+		instance.errorFun && instance.errorFun(error)
+	}
+
+	/**
+	 * Public. Call the status handler function.
+	 * @instance
+	 * @public
+	 */
+	instance.callStatusCallback = function(status)
+	{
+		instance.statusFun && instance.statusFun(status)
+	}
+
+	/**
+	 * Public. Get device model number.
+	 * @instance
+	 * @public
+	 */
+	instance.getDeviceModel = function()
+	{
+		return instance.deviceModel
+	}
+
+	/**
+	 * Public. Get firmware string.
+	 * @instance
+	 * @public
+	 */
+	instance.getFirmwareString = function()
+	{
+		return instance.firmwareString
+	}
+
+	/**
+	 * Public. Checks if the Temperature sensor is available.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isTemperatureAvailable = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Checks if the accelerometer sensor is available.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isAccelerometerAvailable = function()
+	{
+		return false
+	}
+
+	/**
+	 * Public. Checks if the humidity sensor is available.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isHumidityAvailable = function()
+	{
+		return false
+	}
+
+	/**
+	 * Public. Checks if the magnetometer sensor is available.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isMagnetometerAvailable = function()
+	{
+		return false
+	}
+
+	/**
+	 * Public. Checks if the barometer sensor is available.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isBarometerAvailable = function()
+	{
+		return false
+	}
+
+	/**
+	 * Public. Checks if the gyroscope sensor is available.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isGyroscopeAvailable = function()
+	{
+		return false
+	}
+
+	/**
+	 * Public. Checks if movement sensor is available that
+	 * combines accelerometer, gyroscope, and magnetometer.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isMovementAvailable = function()
+	{
+		return false
+	}
+
+	/**
+	 * Public. Checks if the luxometer sensor is available.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isLuxometerAvailable = function()
+	{
+		return false
+	}
+
+	/**
+	 * Public. Checks if the keypress sensor is available.
+	 * @preturn true if available, false if not.
+	 * @instance
+	 * @public
+	 */
+	instance.isKeypressAvailable = function()
+	{
+		return false
+	}
+
+	/**
+	 * Public. Turn on temperature notification.
+	 * @instance
+	 * @public
+	 */
+	instance.temperatureOn = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn off temperature notification.
+	 * @instance
+	 * @public
+	 */
+	instance.temperatureOff = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn on accelerometer notification (SensorTag 1).
+	 * @instance
+	 * @public
+	 */
+	instance.accelerometerOn = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn off accelerometer notification (SensorTag 1).
+	 * @instance
+	 * @public
+	 */
+	instance.accelerometerOff = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn on humidity notification.
+	 * @instance
+	 * @public
+	 */
+	instance.humidityOn = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn off humidity notification.
+	 * @instance
+	 * @public
+	 */
+	instance.humidityOff = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn on magnetometer notification.
+	 * @instance
+	 * @public
+	 */
+	instance.magnetometerOn = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn off magnetometer notification (SensorTag 1).
+	 * @instance
+	 * @public
+	 */
+	instance.magnetometerOff = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn on barometer notification.
+	 * @instance
+	 * @public
+	 */
+	instance.barometerOn = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn off barometer notification.
+	 * @instance
+	 * @public
+	 */
+	instance.barometerOff = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn on gyroscope notification (SensorTag 1).
+	 * @instance
+	 * @public
+	 */
+	instance.gyroscopeOn = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn off gyroscope notification (SensorTag 1).
+	 * @instance
+	 * @public
+	 */
+	instance.gyroscopeOff = function()
+	{
+		return instance
+	}
+
+
+	/**
+	 * Public. Turn on luxometer notification.
+	 */
+	instance.luxometerOn = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn off luxometer notification.
+	 */
+	instance.luxometerOff = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn on keypress notification.
+	 * @instance
+	 * @public
+	 */
+	instance.keypressOn = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Public. Turn off keypress notification.
+	 * @instance
+	 * @public
+	 */
+	instance.keypressOff = function()
+	{
+		return instance
+	}
+
+	/**
+	 * Convert Celsius to Fahrenheit.
+	 * @param celsius Temperature in Celsius.
+	 * @returns Temperature converted to Fahrenheit.
+	 * @public
+	 */
+	instance.celsiusToFahrenheit = function(celsius)
+	{
+		return (celsius * 9 / 5) + 32
+	}
+
+	return instance
+}
+
+// Load TI SensorTag library components.
+evothings.loadScripts(
+[
+	'libs/evothings/easyble/easyble.js',
+	'libs/evothings/tisensortag/tisensortag-ble.js',    // Abstract object for BLE tags
+	'libs/evothings/tisensortag/tisensortag-ble-cc2541.js', // Specific object for CC2541
+	'libs/evothings/tisensortag/tisensortag-ble-cc2650.js'  // Specific object for CC2650
+])
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Tue Oct 27 2015 14:39:06 GMT+0100 (CET) +
+ + + + + diff --git a/lib-doc/ui_fastclick.js.html b/lib-doc/ui_fastclick.js.html new file mode 100644 index 0000000..54f0afc --- /dev/null +++ b/lib-doc/ui_fastclick.js.html @@ -0,0 +1,892 @@ + + + + + JSDoc: Source: ui/fastclick.js + + + + + + + + + + +
+ +

Source: ui/fastclick.js

+ + + + + + +
+
+
;(function () {
+	'use strict';
+
+	/**
+	 * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
+	 *
+	 * @codingstandard ftlabs-jsv2
+	 * @copyright The Financial Times Limited [All Rights Reserved]
+	 * @license MIT License (see LICENSE.txt)
+	 */
+
+	/*jslint browser:true, node:true*/
+	/*global define, Event, Node*/
+
+
+	/**
+	 * Instantiate fast-clicking listeners on the specified layer.
+	 *
+	 * @constructor
+	 * @param {Element} layer The layer to listen on
+	 * @param {Object} [options={}] The options to override the defaults
+	 */
+	function FastClick(layer, options) {
+		var oldOnClick;
+
+		options = options || {};
+
+		/**
+		 * Whether a click is currently being tracked.
+		 *
+		 * @type boolean
+		 */
+		this.trackingClick = false;
+
+
+		/**
+		 * Timestamp for when click tracking started.
+		 *
+		 * @type number
+		 */
+		this.trackingClickStart = 0;
+
+
+		/**
+		 * The element being tracked for a click.
+		 *
+		 * @type EventTarget
+		 */
+		this.targetElement = null;
+
+
+		/**
+		 * X-coordinate of touch start event.
+		 *
+		 * @type number
+		 */
+		this.touchStartX = 0;
+
+
+		/**
+		 * Y-coordinate of touch start event.
+		 *
+		 * @type number
+		 */
+		this.touchStartY = 0;
+
+
+		/**
+		 * ID of the last touch, retrieved from Touch.identifier.
+		 *
+		 * @type number
+		 */
+		this.lastTouchIdentifier = 0;
+
+
+		/**
+		 * Touchmove boundary, beyond which a click will be cancelled.
+		 *
+		 * @type number
+		 */
+		this.touchBoundary = options.touchBoundary || 10;
+
+
+		/**
+		 * The FastClick layer.
+		 *
+		 * @type Element
+		 */
+		this.layer = layer;
+
+		/**
+		 * The minimum time between tap(touchstart and touchend) events
+		 *
+		 * @type number
+		 */
+		this.tapDelay = options.tapDelay || 200;
+
+		/**
+		 * The maximum time for a tap
+		 *
+		 * @type number
+		 */
+		this.tapTimeout = options.tapTimeout || 700;
+
+		if (FastClick.notNeeded(layer)) {
+			return;
+		}
+
+		// Some old versions of Android don't have Function.prototype.bind
+		function bind(method, context) {
+			return function() { return method.apply(context, arguments); };
+		}
+
+
+		var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];
+		var context = this;
+		for (var i = 0, l = methods.length; i < l; i++) {
+			context[methods[i]] = bind(context[methods[i]], context);
+		}
+
+		// Set up event handlers as required
+		if (deviceIsAndroid) {
+			layer.addEventListener('mouseover', this.onMouse, true);
+			layer.addEventListener('mousedown', this.onMouse, true);
+			layer.addEventListener('mouseup', this.onMouse, true);
+		}
+
+		layer.addEventListener('click', this.onClick, true);
+		layer.addEventListener('touchstart', this.onTouchStart, false);
+		layer.addEventListener('touchmove', this.onTouchMove, false);
+		layer.addEventListener('touchend', this.onTouchEnd, false);
+		layer.addEventListener('touchcancel', this.onTouchCancel, false);
+
+		// Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
+		// which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
+		// layer when they are cancelled.
+		if (!Event.prototype.stopImmediatePropagation) {
+			layer.removeEventListener = function(type, callback, capture) {
+				var rmv = Node.prototype.removeEventListener;
+				if (type === 'click') {
+					rmv.call(layer, type, callback.hijacked || callback, capture);
+				} else {
+					rmv.call(layer, type, callback, capture);
+				}
+			};
+
+			layer.addEventListener = function(type, callback, capture) {
+				var adv = Node.prototype.addEventListener;
+				if (type === 'click') {
+					adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
+						if (!event.propagationStopped) {
+							callback(event);
+						}
+					}), capture);
+				} else {
+					adv.call(layer, type, callback, capture);
+				}
+			};
+		}
+
+		// If a handler is already declared in the element's onclick attribute, it will be fired before
+		// FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
+		// adding it as listener.
+		if (typeof layer.onclick === 'function') {
+
+			// Android browser on at least 3.2 requires a new reference to the function in layer.onclick
+			// - the old one won't work if passed to addEventListener directly.
+			oldOnClick = layer.onclick;
+			layer.addEventListener('click', function(event) {
+				oldOnClick(event);
+			}, false);
+			layer.onclick = null;
+		}
+	}
+
+	/**
+	* Windows Phone 8.1 fakes user agent string to look like Android and iPhone.
+	*
+	* @type boolean
+	*/
+	var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0;
+
+	/**
+	 * Android requires exceptions.
+	 *
+	 * @type boolean
+	 */
+	var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone;
+
+
+	/**
+	 * iOS requires exceptions.
+	 *
+	 * @type boolean
+	 */
+	var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;
+
+
+	/**
+	 * iOS 4 requires an exception for select elements.
+	 *
+	 * @type boolean
+	 */
+	var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
+
+
+	/**
+	 * iOS 6.0-7.* requires the target element to be manually derived
+	 *
+	 * @type boolean
+	 */
+	var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent);
+
+	/**
+	 * BlackBerry requires exceptions.
+	 *
+	 * @type boolean
+	 */
+	var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;
+
+	/**
+	 * Determine whether a given element requires a native click.
+	 *
+	 * @param {EventTarget|Element} target Target DOM element
+	 * @returns {boolean} Returns true if the element needs a native click
+	 */
+	FastClick.prototype.needsClick = function(target) {
+		switch (target.nodeName.toLowerCase()) {
+
+		// Don't send a synthetic click to disabled inputs (issue #62)
+		case 'button':
+		case 'select':
+		case 'textarea':
+			if (target.disabled) {
+				return true;
+			}
+
+			break;
+		case 'input':
+
+			// File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
+			if ((deviceIsIOS && target.type === 'file') || target.disabled) {
+				return true;
+			}
+
+			break;
+		case 'label':
+		case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames
+		case 'video':
+			return true;
+		}
+
+		return (/\bneedsclick\b/).test(target.className);
+	};
+
+
+	/**
+	 * Determine whether a given element requires a call to focus to simulate click into element.
+	 *
+	 * @param {EventTarget|Element} target Target DOM element
+	 * @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
+	 */
+	FastClick.prototype.needsFocus = function(target) {
+		switch (target.nodeName.toLowerCase()) {
+		case 'textarea':
+			return true;
+		case 'select':
+			return !deviceIsAndroid;
+		case 'input':
+			switch (target.type) {
+			case 'button':
+			case 'checkbox':
+			case 'file':
+			case 'image':
+			case 'radio':
+			case 'submit':
+				return false;
+			}
+
+			// No point in attempting to focus disabled inputs
+			return !target.disabled && !target.readOnly;
+		default:
+			return (/\bneedsfocus\b/).test(target.className);
+		}
+	};
+
+
+	/**
+	 * Send a click event to the specified element.
+	 *
+	 * @param {EventTarget|Element} targetElement
+	 * @param {Event} event
+	 */
+	FastClick.prototype.sendClick = function(targetElement, event) {
+		var clickEvent, touch;
+
+		// On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
+		if (document.activeElement && document.activeElement !== targetElement) {
+			document.activeElement.blur();
+		}
+
+		touch = event.changedTouches[0];
+
+		// Synthesise a click event, with an extra attribute so it can be tracked
+		clickEvent = document.createEvent('MouseEvents');
+		clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
+		clickEvent.forwardedTouchEvent = true;
+		targetElement.dispatchEvent(clickEvent);
+	};
+
+	FastClick.prototype.determineEventType = function(targetElement) {
+
+		//Issue #159: Android Chrome Select Box does not open with a synthetic click event
+		if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
+			return 'mousedown';
+		}
+
+		return 'click';
+	};
+
+
+	/**
+	 * @param {EventTarget|Element} targetElement
+	 */
+	FastClick.prototype.focus = function(targetElement) {
+		var length;
+
+		// Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
+		if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
+			length = targetElement.value.length;
+			targetElement.setSelectionRange(length, length);
+		} else {
+			targetElement.focus();
+		}
+	};
+
+
+	/**
+	 * Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
+	 *
+	 * @param {EventTarget|Element} targetElement
+	 */
+	FastClick.prototype.updateScrollParent = function(targetElement) {
+		var scrollParent, parentElement;
+
+		scrollParent = targetElement.fastClickScrollParent;
+
+		// Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
+		// target element was moved to another parent.
+		if (!scrollParent || !scrollParent.contains(targetElement)) {
+			parentElement = targetElement;
+			do {
+				if (parentElement.scrollHeight > parentElement.offsetHeight) {
+					scrollParent = parentElement;
+					targetElement.fastClickScrollParent = parentElement;
+					break;
+				}
+
+				parentElement = parentElement.parentElement;
+			} while (parentElement);
+		}
+
+		// Always update the scroll top tracker if possible.
+		if (scrollParent) {
+			scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;
+		}
+	};
+
+
+	/**
+	 * @param {EventTarget} targetElement
+	 * @returns {Element|EventTarget}
+	 */
+	FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
+
+		// On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
+		if (eventTarget.nodeType === Node.TEXT_NODE) {
+			return eventTarget.parentNode;
+		}
+
+		return eventTarget;
+	};
+
+
+	/**
+	 * On touch start, record the position and scroll offset.
+	 *
+	 * @param {Event} event
+	 * @returns {boolean}
+	 */
+	FastClick.prototype.onTouchStart = function(event) {
+		var targetElement, touch, selection;
+
+		// Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
+		if (event.targetTouches.length > 1) {
+			return true;
+		}
+
+		targetElement = this.getTargetElementFromEventTarget(event.target);
+		touch = event.targetTouches[0];
+
+		if (deviceIsIOS) {
+
+			// Only trusted events will deselect text on iOS (issue #49)
+			selection = window.getSelection();
+			if (selection.rangeCount && !selection.isCollapsed) {
+				return true;
+			}
+
+			if (!deviceIsIOS4) {
+
+				// Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
+				// when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
+				// with the same identifier as the touch event that previously triggered the click that triggered the alert.
+				// Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
+				// immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
+				// Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,
+				// which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,
+				// random integers, it's safe to to continue if the identifier is 0 here.
+				if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {
+					event.preventDefault();
+					return false;
+				}
+
+				this.lastTouchIdentifier = touch.identifier;
+
+				// If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
+				// 1) the user does a fling scroll on the scrollable layer
+				// 2) the user stops the fling scroll with another tap
+				// then the event.target of the last 'touchend' event will be the element that was under the user's finger
+				// when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
+				// is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
+				this.updateScrollParent(targetElement);
+			}
+		}
+
+		this.trackingClick = true;
+		this.trackingClickStart = event.timeStamp;
+		this.targetElement = targetElement;
+
+		this.touchStartX = touch.pageX;
+		this.touchStartY = touch.pageY;
+
+		// Prevent phantom clicks on fast double-tap (issue #36)
+		if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
+			event.preventDefault();
+		}
+
+		return true;
+	};
+
+
+	/**
+	 * Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
+	 *
+	 * @param {Event} event
+	 * @returns {boolean}
+	 */
+	FastClick.prototype.touchHasMoved = function(event) {
+		var touch = event.changedTouches[0], boundary = this.touchBoundary;
+
+		if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
+			return true;
+		}
+
+		return false;
+	};
+
+
+	/**
+	 * Update the last position.
+	 *
+	 * @param {Event} event
+	 * @returns {boolean}
+	 */
+	FastClick.prototype.onTouchMove = function(event) {
+		if (!this.trackingClick) {
+			return true;
+		}
+
+		// If the touch has moved, cancel the click tracking
+		if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
+			this.trackingClick = false;
+			this.targetElement = null;
+		}
+
+		return true;
+	};
+
+
+	/**
+	 * Attempt to find the labelled control for the given label element.
+	 *
+	 * @param {EventTarget|HTMLLabelElement} labelElement
+	 * @returns {Element|null}
+	 */
+	FastClick.prototype.findControl = function(labelElement) {
+
+		// Fast path for newer browsers supporting the HTML5 control attribute
+		if (labelElement.control !== undefined) {
+			return labelElement.control;
+		}
+
+		// All browsers under test that support touch events also support the HTML5 htmlFor attribute
+		if (labelElement.htmlFor) {
+			return document.getElementById(labelElement.htmlFor);
+		}
+
+		// If no for attribute exists, attempt to retrieve the first labellable descendant element
+		// the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
+		return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');
+	};
+
+
+	/**
+	 * On touch end, determine whether to send a click event at once.
+	 *
+	 * @param {Event} event
+	 * @returns {boolean}
+	 */
+	FastClick.prototype.onTouchEnd = function(event) {
+		var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
+
+		if (!this.trackingClick) {
+			return true;
+		}
+
+		// Prevent phantom clicks on fast double-tap (issue #36)
+		if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
+			this.cancelNextClick = true;
+			return true;
+		}
+
+		if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
+			return true;
+		}
+
+		// Reset to prevent wrong click cancel on input (issue #156).
+		this.cancelNextClick = false;
+
+		this.lastClickTime = event.timeStamp;
+
+		trackingClickStart = this.trackingClickStart;
+		this.trackingClick = false;
+		this.trackingClickStart = 0;
+
+		// On some iOS devices, the targetElement supplied with the event is invalid if the layer
+		// is performing a transition or scroll, and has to be re-detected manually. Note that
+		// for this to function correctly, it must be called *after* the event target is checked!
+		// See issue #57; also filed as rdar://13048589 .
+		if (deviceIsIOSWithBadTarget) {
+			touch = event.changedTouches[0];
+
+			// In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
+			targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;
+			targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;
+		}
+
+		targetTagName = targetElement.tagName.toLowerCase();
+		if (targetTagName === 'label') {
+			forElement = this.findControl(targetElement);
+			if (forElement) {
+				this.focus(targetElement);
+				if (deviceIsAndroid) {
+					return false;
+				}
+
+				targetElement = forElement;
+			}
+		} else if (this.needsFocus(targetElement)) {
+
+			// Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
+			// Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
+			if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
+				this.targetElement = null;
+				return false;
+			}
+
+			this.focus(targetElement);
+			this.sendClick(targetElement, event);
+
+			// Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
+			// Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
+			if (!deviceIsIOS || targetTagName !== 'select') {
+				this.targetElement = null;
+				event.preventDefault();
+			}
+
+			return false;
+		}
+
+		if (deviceIsIOS && !deviceIsIOS4) {
+
+			// Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
+			// and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
+			scrollParent = targetElement.fastClickScrollParent;
+			if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
+				return true;
+			}
+		}
+
+		// Prevent the actual click from going though - unless the target node is marked as requiring
+		// real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.
+		if (!this.needsClick(targetElement)) {
+			event.preventDefault();
+			this.sendClick(targetElement, event);
+		}
+
+		return false;
+	};
+
+
+	/**
+	 * On touch cancel, stop tracking the click.
+	 *
+	 * @returns {void}
+	 */
+	FastClick.prototype.onTouchCancel = function() {
+		this.trackingClick = false;
+		this.targetElement = null;
+	};
+
+
+	/**
+	 * Determine mouse events which should be permitted.
+	 *
+	 * @param {Event} event
+	 * @returns {boolean}
+	 */
+	FastClick.prototype.onMouse = function(event) {
+
+		// If a target element was never set (because a touch event was never fired) allow the event
+		if (!this.targetElement) {
+			return true;
+		}
+
+		if (event.forwardedTouchEvent) {
+			return true;
+		}
+
+		// Programmatically generated events targeting a specific element should be permitted
+		if (!event.cancelable) {
+			return true;
+		}
+
+		// Derive and check the target element to see whether the mouse event needs to be permitted;
+		// unless explicitly enabled, prevent non-touch click events from triggering actions,
+		// to prevent ghost/doubleclicks.
+		if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
+
+			// Prevent any user-added listeners declared on FastClick element from being fired.
+			if (event.stopImmediatePropagation) {
+				event.stopImmediatePropagation();
+			} else {
+
+				// Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
+				event.propagationStopped = true;
+			}
+
+			// Cancel the event
+			event.stopPropagation();
+			event.preventDefault();
+
+			return false;
+		}
+
+		// If the mouse event is permitted, return true for the action to go through.
+		return true;
+	};
+
+
+	/**
+	 * On actual clicks, determine whether this is a touch-generated click, a click action occurring
+	 * naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
+	 * an actual click which should be permitted.
+	 *
+	 * @param {Event} event
+	 * @returns {boolean}
+	 */
+	FastClick.prototype.onClick = function(event) {
+		var permitted;
+
+		// It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
+		if (this.trackingClick) {
+			this.targetElement = null;
+			this.trackingClick = false;
+			return true;
+		}
+
+		// Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
+		if (event.target.type === 'submit' && event.detail === 0) {
+			return true;
+		}
+
+		permitted = this.onMouse(event);
+
+		// Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
+		if (!permitted) {
+			this.targetElement = null;
+		}
+
+		// If clicks are permitted, return true for the action to go through.
+		return permitted;
+	};
+
+
+	/**
+	 * Remove all FastClick's event listeners.
+	 *
+	 * @returns {void}
+	 */
+	FastClick.prototype.destroy = function() {
+		var layer = this.layer;
+
+		if (deviceIsAndroid) {
+			layer.removeEventListener('mouseover', this.onMouse, true);
+			layer.removeEventListener('mousedown', this.onMouse, true);
+			layer.removeEventListener('mouseup', this.onMouse, true);
+		}
+
+		layer.removeEventListener('click', this.onClick, true);
+		layer.removeEventListener('touchstart', this.onTouchStart, false);
+		layer.removeEventListener('touchmove', this.onTouchMove, false);
+		layer.removeEventListener('touchend', this.onTouchEnd, false);
+		layer.removeEventListener('touchcancel', this.onTouchCancel, false);
+	};
+
+
+	/**
+	 * Check whether FastClick is needed.
+	 *
+	 * @param {Element} layer The layer to listen on
+	 */
+	FastClick.notNeeded = function(layer) {
+		var metaViewport;
+		var chromeVersion;
+		var blackberryVersion;
+		var firefoxVersion;
+
+		// Devices that don't support touch don't need FastClick
+		if (typeof window.ontouchstart === 'undefined') {
+			return true;
+		}
+
+		// Chrome version - zero for other browsers
+		chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
+
+		if (chromeVersion) {
+
+			if (deviceIsAndroid) {
+				metaViewport = document.querySelector('meta[name=viewport]');
+
+				if (metaViewport) {
+					// Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
+					if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
+						return true;
+					}
+					// Chrome 32 and above with width=device-width or less don't need FastClick
+					if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
+						return true;
+					}
+				}
+
+			// Chrome desktop doesn't need FastClick (issue #15)
+			} else {
+				return true;
+			}
+		}
+
+		if (deviceIsBlackBerry10) {
+			blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);
+
+			// BlackBerry 10.3+ does not require Fastclick library.
+			// https://github.com/ftlabs/fastclick/issues/251
+			if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {
+				metaViewport = document.querySelector('meta[name=viewport]');
+
+				if (metaViewport) {
+					// user-scalable=no eliminates click delay.
+					if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
+						return true;
+					}
+					// width=device-width (or less than device-width) eliminates click delay.
+					if (document.documentElement.scrollWidth <= window.outerWidth) {
+						return true;
+					}
+				}
+			}
+		}
+
+		// IE10 with -ms-touch-action: none or manipulation, which disables double-tap-to-zoom (issue #97)
+		if (layer.style.msTouchAction === 'none' || layer.style.touchAction === 'manipulation') {
+			return true;
+		}
+
+		// Firefox version - zero for other browsers
+		firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
+
+		if (firefoxVersion >= 27) {
+			// Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896
+
+			metaViewport = document.querySelector('meta[name=viewport]');
+			if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) {
+				return true;
+			}
+		}
+
+		// IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version
+		// http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx
+		if (layer.style.touchAction === 'none' || layer.style.touchAction === 'manipulation') {
+			return true;
+		}
+
+		return false;
+	};
+
+
+	/**
+	 * Factory method for creating a FastClick object
+	 *
+	 * @param {Element} layer The layer to listen on
+	 * @param {Object} [options={}] The options to override the defaults
+	 */
+	FastClick.attach = function(layer, options) {
+		return new FastClick(layer, options);
+	};
+
+
+	if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
+
+		// AMD. Register as an anonymous module.
+		define(function() {
+			return FastClick;
+		});
+	} else if (typeof module !== 'undefined' && module.exports) {
+		module.exports = FastClick.attach;
+		module.exports.FastClick = FastClick;
+	} else {
+		window.FastClick = FastClick;
+	}
+}());
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Tue Oct 27 2015 14:39:06 GMT+0100 (CET) +
+ + + + + diff --git a/lib-doc/util_util.js.html b/lib-doc/util_util.js.html new file mode 100644 index 0000000..03c8dca --- /dev/null +++ b/lib-doc/util_util.js.html @@ -0,0 +1,270 @@ + + + + + JSDoc: Source: util/util.js + + + + + + + + + + +
+ +

Source: util/util.js

+ + + + + + +
+
+
// File: util.js
+
+evothings = window.evothings || {};
+
+/**
+ * @namespace
+ * @author Aaron Ardiri
+ * @author Fredrik Eldh
+ * @description Utilities for byte arrays.
+ */
+evothings.util = {};
+
+;(function()
+{
+	/**
+	 * Interpret byte buffer as little endian 8 bit integer.
+	 * Returns converted number.
+	 * @param {ArrayBuffer} data - Input buffer.
+	 * @param {number} offset - Start of data.
+	 * @return Converted number.
+	 * @public
+	 */
+	evothings.util.littleEndianToInt8 = function(data, offset)
+	{
+		var x = evothings.util.littleEndianToUint8(data, offset)
+		if (x & 0x80) x = x - 256
+		return x
+	}
+
+	/**
+	 * Interpret byte buffer as unsigned little endian 8 bit integer.
+	 * Returns converted number.
+	 * @param {ArrayBuffer} data - Input buffer.
+	 * @param {number} offset - Start of data.
+	 * @return Converted number.
+	 * @public
+	 */
+	evothings.util.littleEndianToUint8 = function(data, offset)
+	{
+		return data[offset]
+	}
+
+	/**
+	 * Interpret byte buffer as little endian 16 bit integer.
+	 * Returns converted number.
+	 * @param {ArrayBuffer} data - Input buffer.
+	 * @param {number} offset - Start of data.
+	 * @return Converted number.
+	 * @public
+	 */
+	evothings.util.littleEndianToInt16 = function(data, offset)
+	{
+		return (evothings.util.littleEndianToInt8(data, offset + 1) << 8) +
+			evothings.util.littleEndianToUint8(data, offset)
+	}
+
+	/**
+	 * Interpret byte buffer as unsigned little endian 16 bit integer.
+	 * Returns converted number.
+	 * @param {ArrayBuffer} data - Input buffer.
+	 * @param {number} offset - Start of data.
+	 * @return Converted number.
+	 * @public
+	 */
+	evothings.util.littleEndianToUint16 = function(data, offset)
+	{
+		return (evothings.util.littleEndianToUint8(data, offset + 1) << 8) +
+			evothings.util.littleEndianToUint8(data, offset)
+	}
+
+	/**
+	 * Interpret byte buffer as unsigned little endian 32 bit integer.
+	 * Returns converted number.
+	 * @param {ArrayBuffer} data - Input buffer.
+	 * @param {number} offset - Start of data.
+	 * @return Converted number.
+	 * @public
+	 */
+	evothings.util.littleEndianToUint32 = function(data, offset)
+	{
+		return (evothings.util.littleEndianToUint8(data, offset + 3) << 24) +
+			(evothings.util.littleEndianToUint8(data, offset + 2) << 16) +
+			(evothings.util.littleEndianToUint8(data, offset + 1) << 8) +
+			evothings.util.littleEndianToUint8(data, offset)
+	}
+
+
+	/**
+	 * Interpret byte buffer as signed big endian 16 bit integer.
+	 * Returns converted number.
+	 * @param {ArrayBuffer} data - Input buffer.
+	 * @param {number} offset - Start of data.
+	 * @return Converted number.
+	 * @public
+	 */
+	evothings.util.bigEndianToInt16 = function(data, offset)
+	{
+		return (evothings.util.littleEndianToInt8(data, offset) << 8) +
+			evothings.util.littleEndianToUint8(data, offset + 1)
+	}
+
+	/**
+	 * Interpret byte buffer as unsigned big endian 16 bit integer.
+	 * Returns converted number.
+	 * @param {ArrayBuffer} data - Input buffer.
+	 * @param {number} offset - Start of data.
+	 * @return Converted number.
+	 * @public
+	 */
+	evothings.util.bigEndianToUint16 = function(data, offset)
+	{
+		return (evothings.util.littleEndianToUint8(data, offset) << 8) +
+			evothings.util.littleEndianToUint8(data, offset + 1)
+	}
+
+	/**
+	 * Interpret byte buffer as unsigned big endian 32 bit integer.
+	 * Returns converted number.
+	 * @param {ArrayBuffer} data - Input buffer.
+	 * @param {number} offset - Start of data.
+	 * @return Converted number.
+	 * @public
+	 */
+	evothings.util.bigEndianToUint32 = function(data, offset)
+	{
+		return (evothings.util.littleEndianToUint8(data, offset) << 24) +
+			(evothings.util.littleEndianToUint8(data, offset + 1) << 16) +
+			(evothings.util.littleEndianToUint8(data, offset + 2) << 8) +
+			evothings.util.littleEndianToUint8(data, offset + 3)
+	}
+
+	/**
+	 * Converts a single Base64 character to a 6-bit integer.
+	 * @private
+	 */
+	function b64ToUint6(nChr) {
+		return nChr > 64 && nChr < 91 ?
+				nChr - 65
+			: nChr > 96 && nChr < 123 ?
+				nChr - 71
+			: nChr > 47 && nChr < 58 ?
+				nChr + 4
+			: nChr === 43 ?
+				62
+			: nChr === 47 ?
+				63
+			:
+				0;
+	}
+
+	/**
+	 * Decodes a Base64 string. Returns a Uint8Array.
+	 * nBlocksSize is optional.
+	 * @param {String} sBase64
+	 * @param {int} nBlocksSize
+	 * @return {Uint8Array}
+	 * @public
+	 */
+	evothings.util.base64DecToArr = function(sBase64, nBlocksSize) {
+		var sB64Enc = sBase64.replace(/[^A-Za-z0-9\+\/]/g, "");
+		var nInLen = sB64Enc.length;
+		var nOutLen = nBlocksSize ?
+			Math.ceil((nInLen * 3 + 1 >> 2) / nBlocksSize) * nBlocksSize
+			: nInLen * 3 + 1 >> 2;
+		var taBytes = new Uint8Array(nOutLen);
+
+		for (var nMod3, nMod4, nUint24 = 0, nOutIdx = 0, nInIdx = 0; nInIdx < nInLen; nInIdx++) {
+			nMod4 = nInIdx & 3;
+			nUint24 |= b64ToUint6(sB64Enc.charCodeAt(nInIdx)) << 18 - 6 * nMod4;
+			if (nMod4 === 3 || nInLen - nInIdx === 1) {
+				for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) {
+					taBytes[nOutIdx] = nUint24 >>> (16 >>> nMod3 & 24) & 255;
+				}
+				nUint24 = 0;
+			}
+		}
+
+		return taBytes;
+	}
+
+	/**
+	 * Returns the integer i in hexadecimal string form,
+	 * with leading zeroes, such that
+	 * the resulting string is at least byteCount*2 characters long.
+	 * @param {int} i
+	 * @param {int} byteCount
+	 * @public
+	 */
+	evothings.util.toHexString = function(i, byteCount) {
+		var string = (new Number(i)).toString(16);
+		while(string.length < byteCount*2) {
+			string = '0'+string;
+		}
+		return string;
+	}
+
+	/**
+	 * Takes a ArrayBuffer or TypedArray and returns its hexadecimal representation.
+	 * No spaces or linebreaks.
+	 * @param data
+	 * @public
+	 */
+	evothings.util.typedArrayToHexString = function(data) {
+		// view data as a Uint8Array, unless it already is one.
+		if(data.buffer) {
+			if(!(data instanceof Uint8Array))
+				data = new Uint8Array(data.buffer);
+		} else if(data instanceof ArrayBuffer) {
+			data = new Uint8Array(data);
+		} else {
+			throw "not an ArrayBuffer or TypedArray.";
+		}
+		var str = '';
+		for(var i=0; i<data.length; i++) {
+			str += evothings.util.toHexString(data[i], 1);
+		}
+		return str;
+	}
+})();
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.3.3 on Tue Oct 27 2015 14:39:06 GMT+0100 (CET) +
+ + + + +