亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? btbrowsermidlet.java

?? BTBrowser,用JAVA API實現藍牙通信.
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package org.klings.j2me.BTBrowser;

import java.io.IOException;
import java.util.Vector;

import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.DataElement;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.ServiceRecord;
import javax.bluetooth.UUID;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.Ticker;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import org.klings.wireless.j2me.*;
import org.klings.wireless.BluetoothNumbers.*;

public class BTBrowserMIDlet extends MIDlet implements CommandListener,
		DiscoveryListener {

	/* Reference to the Display object to do anything useful with UI */
	private Display display = null;
	/* Reference to LocalDevice to do anything concerning Bluetooth */
	private LocalDevice local = null;
	/* Reference to a DiscoveryAgent to do inquiry or service searches */
	private DiscoveryAgent agent = null;
	/* Globally available Vectors for devices and services found */
	private Vector deviceVector = null;
	private Vector serviceVector = null;
	/* Global Ticker used for most screens in this application 滾動條 */
	private Ticker tic = null;
	/*
	 * Global UI list accessible to deviceDiscovered(...) so we can show devices
	 * and services as they are discovered, giving the user a feeling of
	 * progress in the program
	 */
	private List deviceList = null;
	private List serviceList = null;
	private String clientExecutableURL = null;
	private String documentationURL = null;

	private BluetoothServiceRecordCanvas rCanvas = null;

	/*
	 * Global list of interesting service attributes used when populating and
	 * showing service records
	 */
	int[] attrs = { BTServiceAttributeId.SDP_SERVICENAME,
			BTServiceAttributeId.SDP_SERVICEDESCRIPTION,
			BTServiceAttributeId.SDP_PROVIDERNAME,
			BTServiceAttributeId.SDP_SERVICEINFOTIMETOLIVE,
			BTServiceAttributeId.SDP_SERVICEAVAILABILITY,
			BTServiceAttributeId.SDP_BLUETOOTHPROFILEDESCRIPTORLIST,
			BTServiceAttributeId.SDP_DOCUMENTATIONURL,
			BTServiceAttributeId.SDP_CLIENTEEXECUTABLEURL,
			BTServiceAttributeId.SDP_ICONURL, };
	/* Globally available commands used for most menus */
	Command exitCommand = new Command("Exit", Command.EXIT, 2);
	Command searchCommand = new Command("New Search", Command.SCREEN, 1);
	Command backCommand = new Command("Back", Command.BACK, 1);
	Command cancelCommand = new Command("Cancel", Command.CANCEL, 1);
	Command openURL = new Command("Open URL", Command.CANCEL, 2);
	/* Integer to keep track of which menu is active */
	int currentMenu = 0;
	/* Boolean stating if an inquriy is in progress or not */
	boolean inquiring = false;
	/*
	 * Integer to keep track of service searches. Needed to cancel an ongoing
	 * service search
	 */
	int serviceSearch = 0;

	public BTBrowserMIDlet() {
		// TODO Auto-generated constructor stub
	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub
		notifyDestroyed();
	}

	protected void pauseApp() {
		// TODO Auto-generated method stub
		display = null;
		local = null;
		// attrs = null;
		tic = null;
	}

	protected void startApp() throws MIDletStateChangeException {
		// TODO Auto-generated method stub
		display = Display.getDisplay(this);
		Alert a = null;
		try {
			local = LocalDevice.getLocalDevice();
		} catch (BluetoothStateException bse) {
			a = new Alert("Bluetooth error",
					"Either Bluetooth must be turned on, or your "
							+ "device does not support JABWT", null,
					AlertType.ERROR);
			a.setTimeout(Alert.FOREVER);
			a.addCommand(exitCommand);
			a.setCommandListener(this);
		}
		tic = new Ticker("By Klings, www.klings.org/nowires");
		mainMenu(a);
	}

	/*
	 * mainMenu() will present the user a list of cached and preknown devices,
	 * and provide a menu to initiate device discovery (inquiry) in order to
	 * find nearby Bluetooth devices
	 */
	private void mainMenu(Alert a) {
		// TODO Auto-generated method stub
		List knownDevices = new List("Cached/known devices", List.IMPLICIT);
		if (deviceVector == null)
			deviceVector = new Vector();
		if (agent == null)
			agent = local.getDiscoveryAgent();

		/* Retrieve PREKNOWN devices and add them to our Vector */
		RemoteDevice[] devices = agent.retrieveDevices(DiscoveryAgent.PREKNOWN);
		String name = null;

		if (devices != null) {
			/*
			 * Synchronize on vector to obtain object lock before loop. Else,
			 * object lock will be obtained every iteration.
			 */
			synchronized (deviceVector) {
				for (int i = devices.length - 1; i >= 0; i--) {
					deviceVector.addElement(devices[i]);
					try {
						name = devices[i].getFriendlyName(false);
					} catch (IOException ioe) {
						name = devices[i].getBluetoothAddress();
					}
					if (name.equals(""))
						name = devices[i].getBluetoothAddress();
					knownDevices.insert(0, name, null);
				}
			} // End synchronized
		}

		/* Retrieve cached devices and add them to our Vector */
		devices = null;
		devices = agent.retrieveDevices(DiscoveryAgent.CACHED);
		if (devices != null) {
			synchronized (deviceVector) {
				for (int i = devices.length - 1; i >= 0; i--) {
					deviceVector.addElement(devices[i]);
					try {
						name = devices[i].getFriendlyName(false);
					} catch (IOException ioe) {
						name = devices[i].getBluetoothAddress();
					}
					if (name.equals(""))
						name = devices[i].getBluetoothAddress();
					knownDevices.insert(0, name, null);
				}
			}
		}

		/* Indicate to user if the Vector is empty */
		if (deviceVector.isEmpty()) {
			knownDevices.append("Empty", null);
		}
		knownDevices.setTicker(tic);
		knownDevices.addCommand(exitCommand);
		knownDevices.addCommand(searchCommand);
		knownDevices.setCommandListener(this);
		/* If we have an Alert, show it... */
		if (a == null)
			display.setCurrent(knownDevices);
		else
			display.setCurrent(a, knownDevices);
		currentMenu = 1;
	}

	/*
	 * deviceScreen() will show the user a list of devices found during device
	 * discovery (inquiry)
	 */
	private void deviceScreen(Alert a) {
		/*
		 * if currentmenu < 3 we are in screen with known/cached devices or
		 * screen with discovered devices and have issued a device search
		 * deviceList is then reinitialized by startInquiry(), hence we must add
		 * these commands again
		 */
		if (currentMenu < 3) {
			deviceList.setTicker(tic);
			if (inquiring) {
				deviceList.setTitle("Please wait...");
				deviceList.addCommand(cancelCommand);
			} else {
				deviceList.setTitle("Devices:");
				deviceList.removeCommand(cancelCommand);
				deviceList.addCommand(exitCommand);
				deviceList.addCommand(searchCommand);
				deviceList.addCommand(backCommand);
			}
			deviceList.setCommandListener(this);
		}
		/* Display Alert if any... */
		if (a == null)
			display.setCurrent(deviceList);
		else
			display.setCurrent(a, deviceList);
		currentMenu = 2;
	}

	/*
	 * startInquiry() will reinitialize the list of devices, and initiate a
	 * device discovery (inquiry) repopulating the list of devices
	 */
	private void startInquiry() {
		Alert a = new Alert("Inquiry status", null, null, AlertType.INFO);
		if (agent == null)
			agent = local.getDiscoveryAgent();
		/* Get rid of old search results in vector and deviceList */
		deviceVector.removeAllElements();
		deviceList = null;
		deviceList = new List("Devices", List.IMPLICIT);
		/* Start the actual inquiry */
		try {
			inquiring = agent.startInquiry(DiscoveryAgent.GIAC, this);
		} catch (BluetoothStateException bse) {
			a.setType(AlertType.ERROR);
			a.setString("Bluetooth error while starting inquiry");
			mainMenu(a);
			return;
		}
		if (inquiring) {
			a.setString("Inquiry started");
			deviceScreen(a);
		} else {
			a.setType(AlertType.ERROR);
			a.setString("Error starting inquiry");
			// With no Inquiry we have no need for this any more.
			deviceList = null;
			mainMenu(a);
		}
	}

	/*
	 * getFriendlyNames() will contact all devices in the deviceVector and
	 * retrieve their friendly names, if available
	 */
	private void getFriendlyNames() {
		String name = null;
		for (int i = deviceVector.size() - 1; i >= 0; i--) {
			try {
				name = ((RemoteDevice) deviceVector.elementAt(i))
						.getFriendlyName(false);
			} catch (IOException ioe) {
				/*
				 * An IOException may occur if the remote device can not be
				 * contacted or the remote device could not provide its name. In
				 * that case we leave the Bluetooth address in the list, and
				 * move on to the next device found.
				 */
				continue;
			}
			if (!name.equals("")) {
				deviceList.set(i, name, null);
			}
		}
	}

	/*
	 * startServiceSearch() will initiate a service search on the supplied
	 * remote device.
	 */
	private void startServiceSearch(RemoteDevice rDevice) {
		Alert a = null;
		// Prepare serviceVector
		if (serviceVector == null)
			serviceVector = new Vector();
		else
			serviceVector.removeAllElements();
		serviceList = null;
		serviceList = new List("", List.IMPLICIT);
		try {
			serviceList.setTitle(rDevice.getFriendlyName(false));
		} catch (IOException ioe) {
			serviceList.setTitle(rDevice.getBluetoothAddress());
		}
		/*
		 * Search for services containing the PublicBrowseRoot UUID (0x1002)
		 * Should give us all public browseable services
		 */
		UUID[] uuids = new UUID[1];
		uuids[0] = new UUID(0x1002);
		/*
		 * Start the actual service search, using the attrs array initialized
		 * earlier, the UUID array and the remote device we want to do a service
		 * search on
		 */
		try {
			serviceSearch = agent.searchServices(attrs, uuids, rDevice, this);
		} catch (BluetoothStateException bse) {
			a = new Alert("Bluetooth error", "Error starting service search",
					null, AlertType.ERROR);
			deviceScreen(a);
			return;
		}
		a = new Alert("Status", "Service search started. Please wait!", null,
				AlertType.INFO);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品1区2区| 在线精品视频免费播放| 亚洲成人黄色小说| 亚洲黄色免费网站| 夜夜夜精品看看| 亚洲人123区| 亚洲一二三级电影| 亚洲444eee在线观看| 日韩中文字幕1| 日本成人在线一区| 麻豆精品在线视频| 日韩av在线发布| 日韩电影一区二区三区四区| 日日骚欧美日韩| 日韩在线卡一卡二| 日韩高清不卡一区| 精东粉嫩av免费一区二区三区| 青草av.久久免费一区| 久久99精品国产.久久久久久| 精品一区二区日韩| 成人性生交大片免费看中文 | 午夜伦理一区二区| 午夜成人免费视频| 另类综合日韩欧美亚洲| 国产在线精品不卡| 97se亚洲国产综合自在线不卡| 91在线免费播放| 欧美日韩成人一区| 久久久精品国产99久久精品芒果| 久久久久久久久久久久久夜| 中文字幕五月欧美| 图片区小说区国产精品视频| 狠狠色狠狠色综合日日91app| 成人午夜激情在线| 欧美色大人视频| 久久品道一品道久久精品| 亚洲日本电影在线| 国内精品不卡在线| 91在线你懂得| 精品国产三级a在线观看| 国产精品久久久久一区| 欧美a一区二区| av电影天堂一区二区在线| 911国产精品| 国产精品人人做人人爽人人添| 午夜精品爽啪视频| 国产成人综合亚洲网站| 精品视频一区二区不卡| 国产欧美日韩不卡免费| 日韩精品亚洲一区| 一本色道久久综合亚洲精品按摩| 欧美一区二区黄色| 一区二区三区欧美在线观看| 国产精品一级二级三级| 欧美日韩电影一区| 亚洲视频免费观看| 国产成人精品一区二区三区四区| 欧美日韩大陆在线| 一区二区三区 在线观看视频| 国产成人精品aa毛片| 日韩免费一区二区| 午夜精品影院在线观看| 色偷偷一区二区三区| 国产欧美一区二区精品性色 | 国产精品久久久久桃色tv| 免费的成人av| 欧美理论在线播放| 亚洲麻豆国产自偷在线| 99免费精品视频| 国产午夜亚洲精品羞羞网站| 蜜臀a∨国产成人精品| 欧美日本一道本在线视频| 亚洲日本一区二区| 99精品视频中文字幕| 国产精品久久久久久久第一福利 | 91精品国产综合久久婷婷香蕉| 一区二区激情视频| 在线欧美日韩精品| 综合分类小说区另类春色亚洲小说欧美 | 国产成人在线影院| 久久精品在线观看| 国产一区二区三区久久悠悠色av | 国产成人在线视频播放| 国产日韩欧美激情| 国产伦理精品不卡| 久久久亚洲精华液精华液精华液| 久久国产夜色精品鲁鲁99| 亚洲精品在线三区| 国产精品一品二品| 国产欧美日韩麻豆91| 97se狠狠狠综合亚洲狠狠| 亚洲精品视频在线看| 欧美日韩在线免费视频| 秋霞av亚洲一区二区三| 久久这里只有精品6| 成人午夜视频在线观看| 亚洲乱码国产乱码精品精小说| 在线观看av一区| 婷婷国产在线综合| 精品久久久久久综合日本欧美 | 国产成人在线影院| 亚洲美女视频在线观看| 欧美一区二区在线观看| 国产在线视频精品一区| 中文字幕一区二区视频| 在线观看av不卡| 蜜臀91精品一区二区三区| 中文一区在线播放| 欧美丝袜第三区| 久久精品国产精品亚洲红杏| 国产亚洲精品福利| 欧美三级一区二区| 国产精品888| 亚洲一区在线观看免费 | 不卡电影免费在线播放一区| 亚洲一区二区三区免费视频| 日韩免费看的电影| av电影在线观看一区| 午夜欧美视频在线观看| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 制服丝袜亚洲播放| 国产精品资源在线观看| 亚洲一区二区五区| 国产亚洲人成网站| 欧美另类高清zo欧美| aaa国产一区| 久久精品国产亚洲高清剧情介绍| 国产精品夫妻自拍| 精品国产免费一区二区三区四区 | 中文字幕一区二区三区蜜月| 欧美精品1区2区| 色哟哟一区二区| 国产九九视频一区二区三区| 日韩有码一区二区三区| 亚洲美女区一区| 日本一区二区电影| 欧美成人a在线| 欧美日韩性生活| 色综合久久99| 国产宾馆实践打屁股91| 麻豆一区二区三| 日日摸夜夜添夜夜添国产精品| 最新欧美精品一区二区三区| 亚洲精品在线免费播放| 日韩欧美区一区二| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲欧美国产77777| 亚洲国产成人午夜在线一区 | 波多野结衣亚洲一区| 国产真实乱偷精品视频免| 日韩av不卡在线观看| 亚洲成人一二三| 亚洲国产精品久久不卡毛片 | 99免费精品在线观看| 成人免费高清视频在线观看| 狠狠色综合色综合网络| 老司机免费视频一区二区三区| 免费高清不卡av| 国产一区二区影院| 久久国产精品99精品国产| 免费人成在线不卡| 麻豆成人综合网| 国产在线播放一区三区四| 国产美女主播视频一区| 国内精品国产成人国产三级粉色 | 亚洲激情成人在线| 亚洲在线中文字幕| 丝瓜av网站精品一区二区| 亚洲成人午夜电影| 免费观看一级特黄欧美大片| 久久精品av麻豆的观看方式| 国产综合色视频| 国产99久久久国产精品潘金| 99久久综合99久久综合网站| 色综合一区二区| 欧美午夜精品理论片a级按摩| 欧美日韩久久一区二区| 欧美精品亚洲二区| 久久久蜜臀国产一区二区| 中文字幕乱码一区二区免费| 最新国产の精品合集bt伙计| 亚洲国产精品一区二区www在线 | 高清不卡一区二区| 91在线精品一区二区| 色美美综合视频| 制服丝袜中文字幕一区| 日韩午夜电影av| 国产精品少妇自拍| 偷窥少妇高潮呻吟av久久免费| 国产一区二区在线观看免费 | 亚洲国产成人porn| 狠狠色伊人亚洲综合成人| 成人激情免费电影网址| 欧美日韩日日骚| 国产欧美精品一区| 亚洲电影第三页| 成人h动漫精品| 3d动漫精品啪啪1区2区免费| 国产精品污污网站在线观看| 首页综合国产亚洲丝袜|