当前位置: 首页>>代码示例>>Java>>正文


Java AppConfig类代码示例

本文整理汇总了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);
        }
    });
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:20,代码来源:BleService.java

示例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;
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:20,代码来源:DeviceScanActivity.java

示例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);
    }
}
 
开发者ID:StevenRudenko,项目名称:BleSensorTag,代码行数:18,代码来源:App.java

示例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);
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:8,代码来源:BleService.java

示例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();
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:12,代码来源:SensorFusionFragment.java

示例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;
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:14,代码来源:DeviceServicesActivity.java

示例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);
    }
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:14,代码来源:BluetoothStateReciever.java

示例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);
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:10,代码来源:BleServiceBindingActivity.java

示例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);
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:10,代码来源:BleServiceBindingActivity.java

示例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);
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:16,代码来源:BleServiceBindingActivity.java

示例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);
    }
}
 
开发者ID:StevenRudenko,项目名称:BleSensorTag,代码行数:15,代码来源:BluetoothStateReceiver.java

示例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();
}
 
开发者ID:StevenRudenko,项目名称:BleSensorTag,代码行数:16,代码来源:BleSensorManager.java

示例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;
}
 
开发者ID:StevenRudenko,项目名称:BleSensorTag,代码行数:10,代码来源:DeviceScanActivity.java

示例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;
}
 
开发者ID:StevenRudenko,项目名称:BleSensorTag,代码行数:12,代码来源:DeviceServicesActivity.java

示例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);
}
 
开发者ID:tzxl10000,项目名称:BLE_Fun,代码行数:5,代码来源:SensorFusionEngine.java


注:本文中的sample.ble.sensortag.config.AppConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。