本文整理汇总了Java中sample.ble.sensortag.config.AppConfig类的典型用法代码示例。如果您正苦于以下问题:Java AppConfig类的具体用法?Java AppConfig怎么用?Java AppConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppConfig类属于sample.ble.sensortag.config包,在下文中一共展示了AppConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDataAvailable
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@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: onCreateOptionsMenu
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.gatt_scan, menu);
if (!AppConfig.DEBUG)
menu.findItem(R.id.menu_demo).setVisible(false);
if (scanner == null || !scanner.isScanning()) {
menu.findItem(R.id.menu_stop).setVisible(false);
menu.findItem(R.id.menu_scan).setVisible(true);
menu.findItem(R.id.menu_refresh).setActionView(null);
} else {
menu.findItem(R.id.menu_stop).setVisible(true);
menu.findItem(R.id.menu_scan).setVisible(false);
menu.findItem(R.id.menu_refresh).setActionView(
R.layout.ab_indeterminate_progress);
}
return true;
}
示例3: create
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Nullable
@Override
public DeviceDef create(String name, String address) {
if (TextUtils.isEmpty(name)) {
return new BaseDef<>((Void)null);
}
switch (name) {
case AppConfig.SENSOR_TAG_DEVICE_NAME:
return new TiSensorTagDef(address);
case AppConfig.SENSOR_TAG_V2_DEVICE_NAME:
return new TiSensorTagV2Def(address);
case AppConfig.METAWEAR_DEVICE_NAME:
return new MetawearDef(address);
default:
return new BaseDef<>((Void)null);
}
}
示例4: broadcastUpdate
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
private void broadcastUpdate(final String action) {
if (!AppConfig.REMOTE_BLE_SERVICE)
return;
final Intent intent = new Intent(action);
sendBroadcast(intent);
}
示例5: onStart
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
sensorManager.enable();
if (AppConfig.SENSOR_FUSION_USE_MAGNET_SENSOR)
sensorManager.registerSensor(ISensor.TYPE_MAGNETIC_FIELD);
sensorManager.registerSensor(ISensor.TYPE_ACCELEROMETER);
sensorManager.registerSensor(ISensor.TYPE_GYROSCOPE);
sensorFusion.start();
}
示例6: onCreateOptionsMenu
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
final String deviceName = getDeviceName();
if (deviceName != null) {
getMenuInflater().inflate(R.menu.gatt_services, menu);
// enable demo for SensorTag device only
menu.findItem(R.id.menu_demo).setEnabled(
deviceName.startsWith(AppConfig.BLE_DEVICE_NAME));
}
return true;
}
示例7: onReceive
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (!AppConfig.ENABLE_RECORD_SERVICE)
return;
final BluetoothAdapter adapter = BleUtils.getBluetoothAdapter(context);
final Intent gattServiceIntent = new Intent(context, BleSensorsRecordService.class);
if (adapter != null && adapter.isEnabled()) {
context.startService(gattServiceIntent);
} else {
context.stopService(gattServiceIntent);
}
}
示例8: onStart
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@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);
}
示例9: onStop
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Override
protected void onStop() {
super.onStop();
if (bleService != null)
bleService.getBleManager().disconnect();
if (AppConfig.REMOTE_BLE_SERVICE)
unregisterReceiver(bleActionsReceiver);
unbindService(this);
}
示例10: onServiceConnected
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@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);
}
示例11: onReceive
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (!AppConfig.ENABLE_RECORD_SERVICE) {
return;
}
final BluetoothAdapter adapter = BleUtils.getBluetoothAdapter(context);
final Intent gattServiceIntent = new Intent(context, BleSensorsRecordService.class);
if (adapter != null && adapter.isEnabled()) {
context.startService(gattServiceIntent);
} else {
context.stopService(gattServiceIntent);
}
}
示例12: getSensor
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public ISensor getSensor(int sensorType) {
if (sensors.get(sensorType) != null) {
return sensors.get(sensorType);
}
final BaseSensor<?> sensor = (BaseSensor<?>) App.DEVICE_DEF_COLLECTION
.get(AppConfig.SENSOR_TAG_DEVICE_NAME, deviceAddress)
.getSensor(BleSensor.getSensorUuid(sensorType));
if (sensor instanceof TiRangeSensors<?, ?>) {
return new BleSensor((TiRangeSensors<float[], Float>) sensor);
}
throw new IllegalStateException();
}
示例13: onCreateOptionsMenu
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.gatt_scan, menu);
//noinspection PointlessBooleanExpression
if (!AppConfig.LOCAL_SENSOR_FUSION) {
menu.findItem(R.id.menu_demo).setVisible(false);
}
return true;
}
示例14: onCreateOptionsMenu
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
final String deviceName = getDeviceName();
if (deviceName != null) {
getMenuInflater().inflate(R.menu.gatt_services, menu);
// enable demo for SensorTag device only
menu.findItem(R.id.menu_demo).setEnabled(
AppConfig.SENSOR_FUSION_DEVICES.contains(deviceName));
}
return true;
}
示例15: onMagDataUpdate
import sample.ble.sensortag.config.AppConfig; //导入依赖的package包/类
public void onMagDataUpdate(float[] magnet) {
if (AppConfig.SENSOR_FUSION_USE_MAGNET_SENSOR)
System.arraycopy(magnet, 0, this.magnet, 0, 3);
}