本文整理汇总了Java中sample.ble.sensortag.config.AppConfig.REMOTE_BLE_SERVICE属性的典型用法代码示例。如果您正苦于以下问题:Java AppConfig.REMOTE_BLE_SERVICE属性的具体用法?Java AppConfig.REMOTE_BLE_SERVICE怎么用?Java AppConfig.REMOTE_BLE_SERVICE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sample.ble.sensortag.config.AppConfig
的用法示例。
在下文中一共展示了AppConfig.REMOTE_BLE_SERVICE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDataAvailable
@Override
public void onDataAvailable(final String serviceUuid, final String characteristicUuid,
final String text, final byte[] data) {
final Intent intent = new Intent(ACTION_DATA_AVAILABLE);
intent.putExtra(EXTRA_SERVICE_UUID, serviceUuid);
intent.putExtra(EXTRA_CHARACTERISTIC_UUID, characteristicUuid);
intent.putExtra(EXTRA_TEXT, text);
intent.putExtra(EXTRA_DATA, data);
if (AppConfig.REMOTE_BLE_SERVICE)
sendBroadcast(intent);
uiThreadHandler.post(new Runnable() {
@Override
public void run() {
if (serviceListener != null)
serviceListener.onDataAvailable(serviceUuid, characteristicUuid, text, data);
}
});
}
示例2: broadcastUpdate
private void broadcastUpdate(final String action) {
if (!AppConfig.REMOTE_BLE_SERVICE)
return;
final Intent intent = new Intent(action);
sendBroadcast(intent);
}
示例3: onStart
@Override
protected void onStart() {
super.onStart();
if (AppConfig.REMOTE_BLE_SERVICE)
registerReceiver(bleActionsReceiver, BleActionsReceiver.createIntentFilter());
final Intent gattServiceIntent = new Intent(this, BleService.class);
bindService(gattServiceIntent, this, BIND_AUTO_CREATE);
}
示例4: onStop
@Override
protected void onStop() {
super.onStop();
if (bleService != null)
bleService.getBleManager().disconnect();
if (AppConfig.REMOTE_BLE_SERVICE)
unregisterReceiver(bleActionsReceiver);
unbindService(this);
}
示例5: onServiceConnected
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
bleService = ((BleService.LocalBinder) service).getService();
//noinspection PointlessBooleanExpression,ConstantConditions
if (!AppConfig.REMOTE_BLE_SERVICE)
bleService.setServiceListener(this);
if (!bleService.getBleManager().initialize(getBaseContext())) {
Log.e(TAG, "Unable to initialize Bluetooth");
finish();
return;
}
// Automatically connects to the device upon successful start-up initialization.
bleService.getBleManager().connect(getBaseContext(), deviceAddress);
}