當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalDevice類代碼示例

本文整理匯總了Java中it.gerdavax.easybluetooth.LocalDevice的典型用法代碼示例。如果您正苦於以下問題:Java LocalDevice類的具體用法?Java LocalDevice怎麽用?Java LocalDevice使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LocalDevice類屬於it.gerdavax.easybluetooth包,在下文中一共展示了LocalDevice類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onActivityResult

import it.gerdavax.easybluetooth.LocalDevice; //導入依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);
	switch(requestCode){
	case REQUEST_DISCOVERY:
		if (resultCode == RESULT_OK){
			String address = data.getStringExtra(DeviceDiscovery.ADDRESS_EXTRA);
			// add only if device is not already in the list
			if (!devices.deviceEntries.contains(new BTDevice(address))){
				db.open();
				db.createDevice(new BTDevice(LocalDevice.getInstance().getRemoteForAddr(address)));
				devices.deviceEntries = db.fetchAllDevices();
				db.close();
				devices.notifyDataSetChanged();
			}
			else {
				Logger.d(TAG, "Duplicate entry: device already added");
				Toast.makeText(this, "Selected device is already in your list", Toast.LENGTH_SHORT).show();
			}
		}
		break;
	}
}
 
開發者ID:abraxasson,項目名稱:amarino,代碼行數:24,代碼來源:MainScreen.java

示例2: connect

import it.gerdavax.easybluetooth.LocalDevice; //導入依賴的package包/類
protected void connect(final String address){
	if (address == null) return;
	localDevice = LocalDevice.getInstance();
	localDevice.init(this, new ReadyListener() {
		@Override
		public void ready() {
			RemoteDevice device = localDevice.getRemoteForAddr(address);
			localDevice.destroy();
			new ConnectThread(device).start();
		}
	});
	
}
 
開發者ID:abraxasson,項目名稱:amarino,代碼行數:14,代碼來源:AmarinoService.java

示例3: onCreate

import it.gerdavax.easybluetooth.LocalDevice; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setTitle("Discovered Devices");
	requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
	setContentView(R.layout.discovered_devices_list);

	adapter = new DeviceAdapter();
	setListAdapter(adapter);
	
	setProgressBarIndeterminateVisibility(true);
	localDevice = LocalDevice.getInstance();
}
 
開發者ID:abraxasson,項目名稱:amarino,代碼行數:14,代碼來源:DeviceDiscovery.java


注:本文中的it.gerdavax.easybluetooth.LocalDevice類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。