UniversalLibrary 				for Android						Android DAQ Programming LibraryFeatures• Software API communicateswith select MCC DAQ devices
over the Android 3.1 platform(API level 12) and later• Provides similar high-level
DAQ functions as the Universal
Library for Windows®
• Develop and deploy toAndroid devices using
integrated development
environments (IDEs) such as
Eclipse or Android Studio• Ideal for developing apps foruse on Android-based tablets
and phones

Supported Operating Systems• Supports Android project
development on the following
platforms:−− Windows 10/8/7/Vista®/XP,
32/64-bit−− Linux®

Universal Library for Android is ideal for developing DAQ apps for Android-based devices
such as tablets, phones, and mini-PCs.

Overview
The Universal Library (UL) for Android is a data acquisition API for users to developand deploy applications to Android devices. UL for Android provides the samefunctions as the standard UL for Windows, but does not require InstaCal to installa supported MCC device.
A download version is also available for Linux and Mac users.

Easy-to-Learn for
Universal Library Users
The UL for Android provides similar high-level functions as the ULfor Windows for the common DAQ
device I/O operations – such as aIn(),aInScan(), dIn(), cIn(), and so on– so that experienced UL programmers
can adapt quickly to this API.

Measurement Computing

InstaCal™ Not Required
One significant difference found in theUL for Android is that it does not require
InstaCal to install a supported MCCdevice. UL for Android introduces theDaqDeviceManager class, which enables
users to programmatically detect paired or
attached DAQ devices and create a device
object through which they can access theI/O subsystems available on the device.

(508) 946-5100

1−− Mac®

Classes to Access andControl DAQ Devices andSubsystems
UL for Android includes classes thatallow users to access supported DAQ
devices and their functional subsystems.
The main device and subsystem classes
are explained below.
•DaqDeviceManager – Use this classto detect and create DAQ devices.

•

DaqDevice – Use this class to accessa DAQ device. This class contains
methods to access the device I/O
subsystems, identifying information,and configurations.

•AiDevice – Use this class to accessan analog input (AI) subsystem on aDAQ device. This class also contains analog input methods such asaIn() and aInScan(), along withmethods to access AI subsystem
information and configuration.

info@mccdaq.com

mccdaq.com

Universal Library for Android
General Information••••

AoDevice – Use this class to access an analog output (AO)
subsystem on a DAQ device. This class contains analog
output methods such as aOut() and aOutScan(), alongwith methods to access AO subsystem information andconfiguration.

Example Projects
The UL for Android also includes example projects that can beinstalled with the API. These examples can help users quickly getfamiliar with the library. Programmers can also use the sourcecode of these examples as starting points for their own custom
Android apps.

DioDevice – Use this class to access a digital I/O (DIO)
subsystem on a DAQ device. This class contains digital I/O
methods such as dIn() and dOut(), along with methods
to access DIO subsystem information and configuration.

Following is a partial list of the example projects and the operations they perform. Those examples that are also available asdemo apps for download from the Google Play™ store areindicated by .*CioDevice – Use this class to access a counter I/O (CIO)
subsystem on a DAQ Device. This class contains counter
I/O methods such as cIn() and cClear(), along withmethods to access CIO subsystem information and configuration.

Project Name

TmrDevice – Use this class to access a timer I/O subsystemon a DAQ Device. This class contains timer I/O methods
such as tmrOutStart() and tmrOutStop(), along withmethods to access timer subsystem information and configuration.

For example, the following code detects all of the DAQ devices
currently paired with or attached to an Android system, using
the getDaqDeviceInventory() method to return device descriptors (information about a device) for all detected devices. It thenconnects to the device, and reads data from AI channel 0.
DaqDeviceManager mDaqDeviceManager =new DaqDeviceManager(...);

AInAInScan

Scans a range of A/D input channels and stores thesample data in an array.

AIn_Log

Scans a range of A/D input channels and saves the sample
data in comma-separated values (.csv) file.

AInScan_Continuous

Scans a range of A/D input channels continuously inthe background and stores the data in an array.

AInScan_Events

Scans D/A channels, displays the latest sample acquired
every EventSize or more samples, and updates thelatest sample when scan completes/ends.

AInScan_ExtClockScans a range of A/D input channels and stores thesample data in an array at a sample rate specified by
an external clock.

AInScan_ExtTrigger

Selects the trigger source used to initiate the A/D
conversion using DaqDevice.aInScan() with the
AiScanOption.EXTTRIGGER option. Selects the trigger source, and displays the analog input on selectedchannels

AInScan_LoadQueuePrepares a channel gain queue and loads it to the DAQdevice. An analog input function demonstrates how thequeue values work.

AInScan_Plot

Scans a range of A/D input channels continuously inthe background, and plots the latest acquired samples.

// Find available DAQ devices
ArrayList<DaqDeviceDescriptor> daqDevInventory =mDaqDeviceManager.getDaqDeviceInventory();if(daqDevInventory.size() > 0)
DaqDevice mDaqDevice = mDaqDeviceManager.
createDaqDevice(daqDevInventory[0]);// Connect to DAQ deviceAOut

Writes a value to a specified D/A output channel.

AOutScanWrites values to a specified D/A output channel.

CInmDaqDevice.connect();// Read AI channel 0

Resets and reads the event counter.

DBitInReads the status of single digital input bit.

DBitOut

Sets the state of a single digital output bit.

DBitSetIn

Configures the selected port for input, if necessary, thenreads and displays the value on the port.

AiDaqDevice mAiDevice = mDaqDevice.getAiDev();
mAiDevice.aIn(0, ChannelMode.SINGLE_ENDED, Range.
BIP5VOLTS, AiUnit.VOLTS)

Description
Reads an A/D input channel.

DInReads a digital input port.

DInScanScans a digital port and stores the sample data in an array.

DOut

Writes a value to a specified digital output port.

DOutScanWrites values to a specified port.

TIn

Reads a temperature channel and displays the value.

TmrOutSends a frequency output to a specified timer.

* The Android robot is reproduced or modified from work created and shared byGoogle and used according to terms described in the Creative Commons 3.0
Attribution License.

Measurement Computing(508) 946-5100

2

info@mccdaq.com

mccdaq.com

Universal Library for Android
Ordering
Order Information
Part No.

Description

Universal Libraryfor Android

DAQ API for users to develop and deploy applications
to Android devices. Provides the same functions as
the standard UL for Windows.

The Universal Library for Android is included on theMCC DAQ Software installation CD. For a list of supported
devices or to download the software, visit www.mccdaq.com/
daq-software/universal-library-android.aspx.

When used with the BTH-1208LS, the UL for Android enables DAQ
programmers to develop apps that communicate wirelessly with
Android-based devices.

Measurement Computing
UL-Android(508) 946-5100

3

info@mccdaq.com

mccdaq.com
March 2017. Rev 6© Measurement Computing Corporation