Appcelerator Titanium Bluetooth Module for Android
--Right now running as a background service is supported. To activate it, you should call novarumbluetooth.useService() and if data is received from bluetooth while the application is not running then application will be started again and you can get the data from the intent. Please check the example for details.
--New event (nb_onLowMemory) added for background service to be fired when the device is running low on memory.
Note: This is not an official bluetooth module nor 100% ready code for production. Please use it at your own risk.
Right now only connecting as a client is supported. Tested especially for connecting bluetooth modules such as JY-MCU
var novarumbluetooth = require("com.novarum.bluetooth");
The novarumbluetooth variable is a reference to the Module object.
Disconnects from the bluetooth and if service is used, destroys the service
Enables the background service to be used for bluetooth communication. If this function is called, even when the application is not running bluetooth connection will be kept alive and on receiving data main activity will be started with the data (as intent extra) Please check the example for the details
Enables bluetooth adapter
Disables bluetooth adapter
Searches for bluetooth devices
Retrieves already paired bluetooth devices. You can connect to them using connect method and providing mac address
connects to the device with the given mac address
if device is connected, it sends the given text data to the other end. To receive data, you must register nb_onReceiveData event
checks if the device is connected
starts server. Note that this functions are not fully implemented yet and may not work
stops server. Note that this functions are not fully implemented yet and may not work
sets the server name. Note that this functions are not fully implemented yet and may not work
sets the uuid will be used. Default is: 00001101-0000-1000-8000-00805F9B34FB
makes the device be discoverable for 300 seconds
If background service is used, this is fired when the phone is running low on memory. It's advised to clean up some code or the service can be destroyed by the system
Fired when a new bluetooth device is found. This event is fired after searchDevices function call
Fired when a new successfull connection is made
Fired when new data recevied
Fired when an error ocurred. Contains the details of the error
Fired when server is started successfully.
If you don't want to build it from the source code, please copy the module zip file provided to your project folder. Please refer to example app, it covers the main functionality.
Halil Kabaca [email protected]
The MIT License (MIT)
Stuff our legal folk make us say:
Appcelerator, Appcelerator Titanium and associated marks and logos are trademarks of Appcelerator, Inc.
Titanium is Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
Titanium is licensed under the Apache Public License (Version 2). Please see the LICENSE file for the full license.