hardcodedbluetoothgpsspotter.java

来自「这是一款基于PlaceLab软件开发的导航系统中间件的客户端程序.」· Java 代码 · 共 47 行

JAVA
47
字号
/* * Created on Sep 17, 2004 * */package org.placelab.spotter;import javax.microedition.io.Connector;import javax.microedition.io.StreamConnection;public class HardcodedBluetoothGPSSpotter  extends BluetoothGPSSpotter {	protected String address;		public HardcodedBluetoothGPSSpotter(String address) {		this.address = address;	}		public void open() {		super.open();		findGPS();	}		protected void findGPS() {//		 fabricate the whole thing		String fabUrl = 			"btspp://" // this means bt serial port service 			+ address			+ ":1"  // bt gps uses 1 as the RFCOMM channel			+ ";authenticate=false"  // NOAUTHENTICATE_NOENCRYPT			+ ";encrypt=false";		try {			state = "Attempting to connect to " + address;			conn = (StreamConnection)Connector.open(fabUrl);			is = conn.openDataInputStream();		} catch (Exception e) {			state = "Failed connection attempt to " + address + " (" + e + ")";			serviceUrl = null;			return;			// this could be a problem		}		// if i get here, then the connection succeeded		serviceUrl = fabUrl;		state = "Connected " + address;	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?