locationstub.java

来自「gps 源码.GPS工作原理,对开发GPS软件有帮助」· Java 代码 · 共 50 行

JAVA
50
字号
import hp.chaiserver.*;
import java.io.*;

public final class LocationStub extends Worker implements IWorker {

	private final String DISCOVERPROPS = new String("__DISCOVERPROPS");
	public final String WORKER_VERSION = "ChaiServer.3.0.0.0";
	private final static String locationRetrieve	= new String("locationRetrieve");
	// Helper methods for worker	protected Object createObject() {
		return (Object) new LocationImpl();
	}

	protected String getObjectClassName() {
		return new String("LocationImpl");
	}

	protected boolean invokeMethod(Object obj, String method, String format)
		throws Exception {
		LocationImpl cs_obj = (LocationImpl) obj;

		if(method.equalsIgnoreCase(DISCOVERPROPS)) {
			webProtocol.sendToClient("HTTP/1.1 200 OK\r\n");
			webProtocol.sendToClient("MIME-Version: 1.0\r\n");
			webProtocol.sendToClient("Server: HP/ChaiServer 3.0\r\n");
			webProtocol.sendToClient("Content-type: text/plain\r\n\n");
			webProtocol.sendToClient("locationRetrieve");
			return true;
		}
		if (method.equalsIgnoreCase(locationRetrieve))
			cs_obj.locationRetrieve(format, args, reqEnv);
		else
			return false;

		return true;
	}

	protected boolean isObjectInstance(Object obj) {
		return (obj instanceof LocationImpl);
	}

	// Methods callable outside of worker
	public String getVersion() {
		return WORKER_VERSION;
	}

}

⌨️ 快捷键说明

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