當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。