LogicalLabs External Accessories Module

API Docs for: 1.0.0
Show:

Readme

This module makes the iOS External Accessory framework available to Titanium developers.

To access this module from JavaScript, you would do the following:

var EAModule = require("com.logicallabs.externalaccessories");

The EAModule variable is a reference to the Module object.

Usage

The following code segments are not complete; they only demonstrate the essentials of using the module. See the example app acompanying the module for a complete example.

Use the connectedAccessories property to get access to already connected accessories:

EAModule.connectedAccessories.forEach(function(accessory) {
    ...

Use the showPicker function to allow the user to connect a new accessory:

EAModule.showPicker({
        filterCallback: function(accessoryName) {
            ...

Use the openSession function to create a new communication session to an accessory:

session = accessory.openSession({
        protocol: '...'
    });

Use the write function to send data to the device:

session.write({
    data: buffer
});

Use the receivedData event to consume data received from the accessory:

session.addEventListener('receivedData', function(e) {
    // e.data is a TiBuffer object holding the received data
});

Issues and Limitations

None.

Change Log

Version 1.0.0

  • Initial release

Author

Zsombor Papp, Logical Labs

titanium@logicallabs.com

License

Logical Labs Commercial License

Copyright (c) 2014 by Logical Labs, LLC