亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美人与禽zozo性伦| 懂色av一区二区在线播放| 亚洲色图视频网站| 国产精品美女久久久久久2018| 精品日韩在线观看| 精品免费国产二区三区 | 成人福利电影精品一区二区在线观看| 美女网站色91| 精品中文av资源站在线观看| 国产资源在线一区| 久久99精品国产.久久久久| 久久精品久久99精品久久| 麻豆精品国产传媒mv男同| 美腿丝袜在线亚洲一区| 久久99久久精品| 国产成人免费视频精品含羞草妖精 | 99精品视频在线观看| 99久久99久久精品国产片果冻| 色国产精品一区在线观看| 欧洲日韩一区二区三区| 欧美久久久影院| 欧美一区二区播放| 久久精品日韩一区二区三区| 国产人妖乱国产精品人妖| 国产精品国产精品国产专区不蜜| 亚洲欧美日本在线| 午夜欧美视频在线观看| 国产伦精品一区二区三区视频青涩| 精品一区二区三区在线播放视频 | 一本到高清视频免费精品| 欧美无砖专区一中文字| 精品国产1区二区| 中文字幕免费不卡在线| 亚洲图片欧美视频| 高清成人在线观看| 欧美制服丝袜第一页| 欧美mv和日韩mv的网站| 亚洲色图清纯唯美| 麻豆极品一区二区三区| 色婷婷av一区二区三区gif | 国产精品资源在线观看| 91福利国产精品| 久久综合九色欧美综合狠狠| 亚洲精品高清在线观看| 日韩成人精品在线观看| 不卡的av电影| 精品国产麻豆免费人成网站| 亚洲欧美日韩国产一区二区三区| 精品一区二区三区在线观看| 欧美色精品天天在线观看视频| 久久亚洲免费视频| 午夜精品免费在线观看| 成人天堂资源www在线| 欧美日韩国产色站一区二区三区| 久久精品无码一区二区三区| 日韩成人免费在线| 欧美日韩一区二区在线视频| 国产精品伦理一区二区| 精品一区在线看| 欧美一区二区免费视频| 亚洲欧洲制服丝袜| 国产成人午夜视频| 精品国产一区二区三区久久久蜜月 | 精品视频在线视频| 亚洲欧美视频在线观看视频| 岛国av在线一区| 久久久99精品久久| 久久不见久久见免费视频7 | 狠狠色狠狠色综合系列| 欧美色视频一区| 亚洲免费视频中文字幕| av中文字幕亚洲| 亚洲国产精品激情在线观看| 国产激情一区二区三区桃花岛亚洲| 欧美一区二区三区四区视频| 亚洲一区二区三区影院| 欧美丝袜丝交足nylons图片| 亚洲曰韩产成在线| 在线视频观看一区| 亚洲美女偷拍久久| 91视视频在线观看入口直接观看www | 1024成人网| 91在线免费播放| 亚洲欧美韩国综合色| 色悠悠久久综合| 亚洲综合偷拍欧美一区色| 色偷偷88欧美精品久久久| 亚洲丝袜精品丝袜在线| 欧美视频一区在线观看| 天堂久久一区二区三区| 日韩视频免费观看高清完整版| 日本少妇一区二区| 日韩久久久精品| 高清不卡一区二区| 综合久久久久综合| 欧美色图天堂网| 久久精品国产成人一区二区三区| 欧美mv和日韩mv的网站| 国产成人午夜精品5599| 亚洲黄色在线视频| 91精品国产综合久久福利| 国产麻豆欧美日韩一区| 亚洲色欲色欲www| 6080亚洲精品一区二区| 国产一区二区三区免费观看| 国产精品国产三级国产aⅴ中文| 欧美在线观看一二区| 久久草av在线| 亚洲综合在线五月| 日韩一区二区在线播放| 91在线观看污| 免播放器亚洲一区| 国产精品福利影院| 日韩小视频在线观看专区| 成人黄色免费短视频| 香蕉久久一区二区不卡无毒影院| 日韩女优视频免费观看| 色先锋资源久久综合| 美女视频一区二区三区| 一区二区三区在线观看网站| 日韩亚洲欧美在线观看| 欧美影视一区在线| 成人午夜电影网站| 日韩av电影免费观看高清完整版| 中文字幕av在线一区二区三区| 欧美日韩和欧美的一区二区| 成人动漫视频在线| 日韩黄色片在线观看| 国产精品大尺度| 久久婷婷成人综合色| 欧美日韩国产不卡| 色综合中文综合网| 日本欧美一区二区| 一区二区三区在线视频免费观看 | 99国产精品久久久久久久久久久 | 美女视频第一区二区三区免费观看网站| 国产精品免费av| 日韩欧美在线网站| 欧美精品自拍偷拍| 日本高清免费不卡视频| av电影一区二区| 懂色一区二区三区免费观看| 国产一区二区三区黄视频 | 欧美大片一区二区| 欧美美女直播网站| 在线免费不卡视频| 91麻豆6部合集magnet| 成人av午夜电影| 国产激情91久久精品导航| 日本人妖一区二区| 日本不卡高清视频| 日韩专区一卡二卡| 免费观看一级欧美片| 五月天中文字幕一区二区| 丝袜美腿亚洲综合| 免费观看在线综合色| 紧缚捆绑精品一区二区| 麻豆成人av在线| 国产精品影视网| 成人黄色一级视频| 色94色欧美sute亚洲线路二| 日本高清免费不卡视频| 欧美日韩在线综合| 欧美一区二区三区电影| 久久久久高清精品| 中文字幕一区二区三区精华液| 亚洲欧洲精品一区二区三区| 一区二区三区四区在线播放| 一区二区三区欧美视频| 日本aⅴ免费视频一区二区三区| 美国十次综合导航| 成人性生交大片免费看中文| 成人性生交大片免费看中文| 欧美中文字幕亚洲一区二区va在线 | 激情图片小说一区| 99精品视频一区| 91论坛在线播放| 日韩欧美成人午夜| 久久精品视频在线免费观看| 国产精品天美传媒| 亚洲国产欧美在线人成| 日韩不卡手机在线v区| 麻豆91小视频| 午夜精品在线看| 国产成人无遮挡在线视频| 成人免费看黄yyy456| 91最新地址在线播放| 欧美一区二区三区视频| 久久蜜臀中文字幕| 成人欧美一区二区三区| 久久91精品国产91久久小草| 国产成人亚洲精品狼色在线| 色综合久久久久久久久| 国产成人在线视频网站| 欧美日韩视频不卡| 久久综合成人精品亚洲另类欧美 | 69堂成人精品免费视频| 久久久亚洲高清| √…a在线天堂一区| 精品一区二区三区免费播放|