MOVERIO Pro Developer's Guide (Rev.1.4)
169
8.9.3.
Registering scan start and callback
To start the Beacon function, register the callback function using setGapCallback() to receive
Advertise from the Beacon device, and start scanning using startScan().
import android.widget.Toast;
public class MainActivity extends Activity {
private BluetoothLeAdapterManager mManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
//Instance acquisition for the BLE manager class
mManager = BluetoothLeAdapterManager.getInstance();
//Register a callback for the GAP function provided
mManager.setGapCallback(mLeGapCallback);
}
private void scanLe(final boolean enable) {
if ( enable ) {
//Start scanning
mManager.starScan();
} else {
//Stop scanning
mManager.stopScan();
}
}
Receive scan results using the following callback, and output the received signal strength to a
log.
private BluetoothLeGapCallback mLeGapCallback = new BluetoothLeGapCallback(){
@Override
public void onScanResult(AddrType addrType, String addr, int rssi
, byte[] adv_data) {
Log.i(“DEBUG”, “rssi=” + rssi);
}
};
}
Содержание Moverio Pro BT-2000
Страница 7: ...MOVERIO Pro Developer s Guide Rev 1 4 1 1 Introduction ...
Страница 12: ...MOVERIO Pro Developer s Guide Rev 1 4 6 2 Developing Apps ...
Страница 30: ...MOVERIO Pro Developer s Guide Rev 1 4 24 3 Display control ...
Страница 39: ...MOVERIO Pro Developer s Guide Rev 1 4 33 4 UI control ...
Страница 47: ...MOVERIO Pro Developer s Guide Rev 1 4 41 5 Voice commands ...
Страница 70: ...MOVERIO Pro Developer s Guide Rev 1 4 64 6 Camera control ...
Страница 119: ...MOVERIO Pro Developer s Guide Rev 1 4 113 7 Sensor control ...
Страница 127: ...MOVERIO Pro Developer s Guide Rev 1 4 121 8 Bluetooth BLE ...
Страница 184: ...MOVERIO Pro Developer s Guide Rev 1 4 178 9 Power control ...
Страница 187: ...MOVERIO Pro Developer s Guide Rev 1 4 181 10 Self diagnostic function ...
Страница 191: ...MOVERIO Pro Developer s Guide Rev 1 4 185 11 GPS Assist ...
Страница 202: ...MOVERIO Pro Developer s Guide Rev 1 4 196 Memo ...