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


Java Logger.newSession方法代码示例

本文整理汇总了Java中no.nordicsemi.android.log.Logger.newSession方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.newSession方法的具体用法?Java Logger.newSession怎么用?Java Logger.newSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在no.nordicsemi.android.log.Logger的用法示例。


在下文中一共展示了Logger.newSession方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(final BluetoothDevice device, final String name) {
	final int titleId = getLoggerProfileTitle();
	if (titleId > 0) {
		mLogSession = Logger.newSession(getApplicationContext(), getString(titleId), device.getAddress(), name);
		// If nRF Logger is not installed we may want to use local logger
		if (mLogSession == null && getLocalAuthorityLogger() != null) {
			mLogSession = LocalLogSession.newSession(getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name);
		}
	}
	mDeviceName = name;
	mBleManager.setLogger(mLogSession);
	mDeviceNameView.setText(name != null ? name : getString(R.string.not_available));
	mConnectButton.setText(R.string.action_disconnect);
	mBleManager.connect(device);
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:17,代码来源:BleProfileExpandableListActivity.java

示例2: onCreate

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mLogSession = Logger.newSession(this, "Hello", "BleUARTPeripheral");

    setContentView(R.layout.activity_main);

    ListView list = new ListView(this);
    setContentView(list);

    mConnectedDevices = new ArrayList<BluetoothDevice>();
    mConnectedDevicesAdapter = new ArrayAdapter<BluetoothDevice>(this,
            android.R.layout.simple_list_item_1, mConnectedDevices);
    list.setAdapter(mConnectedDevicesAdapter);

    mBluetoothManager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
    mBluetoothAdapter = mBluetoothManager.getAdapter();
    Logger.log(mLogSession, LogContract.Log.Level.DEBUG, "In on create");

}
 
开发者ID:thejeshgn,项目名称:BleUARTPeripheral,代码行数:21,代码来源:MainActivity.java

示例3: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(final BluetoothDevice device, final String name) {
	final int titleId = getLoggerProfileTitle();
	if (titleId > 0) {
		mLogSession = Logger.newSession(getApplicationContext(), getString(titleId), device.getAddress(), name);
		// If nRF Logger is not installed we may want to use local logger
		if (mLogSession == null && getLocalAuthorityLogger() != null) {
			mLogSession = LocalLogSession.newSession(getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name);
		}
	}
	mDeviceName = name;
	mDeviceNameView.setText(name != null ? name : getString(R.string.not_available));
	mConnectButton.setText(R.string.action_disconnect);

	// The device may not be in the range but the service will try to connect to it if it reach it
	Logger.d(mLogSession, "Creating service...");
	final Intent service = new Intent(this, getServiceClass());
	service.putExtra(BleProfileService.EXTRA_DEVICE_ADDRESS, device.getAddress());
	if (mLogSession != null)
		service.putExtra(BleProfileService.EXTRA_LOG_URI, mLogSession.getSessionUri());
	startService(service);
	Logger.d(mLogSession, "Binding to the service...");
	bindService(service, mServiceConnection, 0);
}
 
开发者ID:elibo,项目名称:ScribaNotesApp,代码行数:25,代码来源:BleProfileServiceReadyActivity.java

示例4: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(final BluetoothDevice device, final String name) {
	final int titleId = getLoggerProfileTitle();
	if (titleId > 0) {
		mLogSession = Logger.newSession(getApplicationContext(), getString(titleId), device.getAddress(), name);
		// If nRF Logger is not installed we may want to use local logger
		if (mLogSession == null && getLocalAuthorityLogger() != null) {
			mLogSession = LocalLogSession.newSession(getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name);
		}
	}
	mBluetoothDevice = device;
	mDeviceName = name;

	// The device may not be in the range but the service will try to connect to it if it reach it
	Logger.d(mLogSession, "Creating service...");
	final Intent service = new Intent(this, getServiceClass());
	service.putExtra(BleProfileService.EXTRA_DEVICE_ADDRESS, device.getAddress());
	service.putExtra(BleProfileService.EXTRA_DEVICE_NAME, name);
	if (mLogSession != null)
		service.putExtra(BleProfileService.EXTRA_LOG_URI, mLogSession.getSessionUri());
	startService(service);
	Logger.d(mLogSession, "Binding to the service...");
	bindService(service, mServiceConnection, 0);
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:25,代码来源:BleProfileServiceReadyActivity.java

示例5: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(BluetoothDevice device, String name) {
    final int titleId = getLoggerProfileTitle();
    if (titleId > 0) {
        mLogSession = Logger.newSession(getActivity().getApplicationContext(), getString(titleId), device.getAddress(), name);
        // If nRF Logger is not installed we may want to use local logger
        if (mLogSession == null && getLocalAuthorityLogger() != null) {
            mLogSession = LocalLogSession.newSession(getActivity().getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name);
        }
    }

    // The device may not be in the range but the service will try to connect to it if it reach it
    Logger.d(mLogSession, "Creating service...");
    final Intent service = new Intent(getActivity(), getServiceClass());
    service.putExtra(BleProfileService.EXTRA_DEVICE_ADDRESS, device.getAddress());
    if (mLogSession != null)
        service.putExtra(BleProfileService.EXTRA_LOG_URI, mLogSession.getSessionUri());
    getActivity().startService(service);
    Logger.d(mLogSession, "Binding to the service...");
    getActivity().bindService(service, mServiceConnection, 0);
}
 
开发者ID:linkezhi,项目名称:Android-nRF-Toolbox-master,代码行数:22,代码来源:BleProfileServiceReadyFragment.java

示例6: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(final BluetoothDevice device, final String name) {
	final int titleId = getLoggerProfileTitle();
	if (titleId > 0) {
		mLogSession = Logger.newSession(getApplicationContext(), getString(titleId), device.getAddress(), name);
		// If nRF Logger is not installed we may want to use local logger
		if (mLogSession == null && getLocalAuthorityLogger() != null) {
			mLogSession = LocalLogSession.newSession(getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name);
		}
	}
	mDeviceNameView.setText(mDeviceName = name);
	mConnectButton.setText(R.string.action_disconnect);

	// The device may not be in the range but the service will try to connect to it if it reach it
	Logger.d(mLogSession, "Creating service...");
	final Intent service = new Intent(this, getServiceClass());
	service.putExtra(BleProfileService.EXTRA_DEVICE_ADDRESS, device.getAddress());
	if (mLogSession != null)
		service.putExtra(BleProfileService.EXTRA_LOG_URI, mLogSession.getSessionUri());
	startService(service);
	Logger.d(mLogSession, "Binding to the service...");
	bindService(service, mServiceConnection, 0);
}
 
开发者ID:frostmournex,项目名称:nRFToolbox,代码行数:24,代码来源:BleProfileServiceReadyActivity.java

示例7: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(final BluetoothDevice device, final String name) {
	final int titleId = getLoggerProfileTitle();
	ILogSession logSession = null;
	if (titleId > 0) {
		logSession = Logger.newSession(getApplicationContext(), getString(titleId), device.getAddress(), name);
		// If nRF Logger is not installed we may want to use local logger
		if (logSession == null && getLocalAuthorityLogger() != null) {
			logSession = LocalLogSession.newSession(getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name);
		}
	}

	mService.connect(device, logSession);
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:15,代码来源:BleMulticonnectProfileServiceReadyActivity.java

示例8: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(final BluetoothDevice device, final String name) {
	final int titleId = getLoggerProfileTitle();
	if (titleId > 0) {
		mLogSession = Logger.newSession(getApplicationContext(), getString(titleId), device.getAddress(), name);
		// If nRF Logger is not installed we may want to use local logger
		if (mLogSession == null && getLocalAuthorityLogger() != null) {
			mLogSession = LocalLogSession.newSession(getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name);
		}
	}
	mDeviceName = name;
	mBleManager.setLogger(mLogSession);
	mBleManager.connect(device);
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:15,代码来源:BleProfileExpandableListActivity.java

示例9: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(BluetoothDevice device, String name) {
    final int titleId = R.string.hrs_feature_title;
    if (titleId > 0) {
        mLogSession = Logger.newSession(BleApplication.getInstance(), getString(titleId), device.getAddress(), name);
        // If nRF Logger is not installed we may want to use local logger
    }
    mBleManager.setLogger(mLogSession);
    mBleManager.connect(device);
}
 
开发者ID:linkezhi,项目名称:Android-nRF-Toolbox-master,代码行数:11,代码来源:HrsFragment.java

示例10: onDeviceSelected

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
@Override
public void onDeviceSelected(final BluetoothDevice device, final String name) {
	final int titleId = getLoggerProfileTitle();
	if (titleId > 0) {
		mLogSession = Logger.newSession(getApplicationContext(), getString(titleId), device.getAddress(), name);
		// If nRF Logger is not installed we may want to use local logger
		if (mLogSession == null && getLocalAuthorityLogger() != null) {
			mLogSession = LocalLogSession.newSession(getApplicationContext(), getLocalAuthorityLogger(), device.getAddress(), name);
		}
	}
	mBleManager.setLogger(mLogSession);
	mDeviceNameView.setText(mDeviceName = name);
	mConnectButton.setText(R.string.action_disconnect);
	mBleManager.connect(device);
}
 
开发者ID:frostmournex,项目名称:nRFToolbox,代码行数:16,代码来源:BleProfileExpandableListActivity.java

示例11: connect

import no.nordicsemi.android.log.Logger; //导入方法依赖的package包/类
/**
 * Connect to peripheral
 */
public void connect(final ExtendedBluetoothDevice device) {
	final LogSession logSession = Logger.newSession(getApplication(), null, device.getAddress(), device.getName());
	mBlinkyManager.setLogger(logSession);
	mBlinkyManager.connect(device.getDevice());
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Blinky,代码行数:9,代码来源:BlinkyViewModel.java


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