Hardware Reference
In-Depth Information
Figure 8-6. The Android /src directory
BleWrapper is the main part of the Application Accelerator library issued by the Blue‐
tooth SIG. It's a simplified wrapper into the Android Bluetooth Low Energy library that
makes accessing and using the library much simpler, because it handles a lot of the
complicated processing.
This takes care of the prep work for the project. Now that you've created the project,
configured the manifest, installed the class libraries, you're ready to get into the meat
of the Android code.
Initializing the BLE Library
Now it's time to get into the actual implementation of things. The first time through (to
emphasize the BLE aspect of the programming without getting too far into the GUI side
of things), the example will mainly print out information received over Bluetooth Low
Energy. After that, you'll add some GUI features incorporate the BLE data into the
presentation side of things.
Before you begin, you'll need to create an instance of the BleWrapper library you im‐
ported. This is the file from the Bluetooth Application Accelerator library from the
Bluetooth SIG:
public class MainActivity extends Activity {
// add this line to instantiate the BLE wrapper
private BleWrapper mBleWrapper = null ;
@Override
protected void onCreate ( Bundle savedInstanceState ) {
super . onCreate ( savedInstanceState );
setContentView ( R . layout . activity_main );
}
 
Search WWH ::




Custom Search