📄 readeraccessclient.java
字号:
/* * ReaderAccessClient.java * * Created on July 13, 2005, 5:35 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package com.mycompany;import javax.xml.rpc.Stub;/** * * @author yuchen */public class ReaderAccessClient { /** Creates a new instance of ReaderAccessClient */ public ReaderAccessClient() { } private static Stub createProxy() { return (Stub) (new ReaderAccess_Impl().getReaderAccessSEIPort()); } public static void main(String[] args){ String readerName = "PMLReader"; String groupStr = "ALL"; String locatorStr = null; String UrlString = "http://localhost:8080/readeraccess/ReaderAccess"; System.out.println("UrlString = " + UrlString); try { Stub stub = createProxy(); stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, UrlString); ReaderAccessSEI myproxy = (ReaderAccessSEI) stub; DeviceFinder rs = new DeviceFinder(readerName,groupStr, null ); System.out.println("this reader is: " + readerName); /** * test its status **/ System.out.println("Status= " + myproxy.getStatus(rs)); /** * test its handle **/ System.out.println("Handle= " + myproxy.getHandle(rs)); /** * test its EPC * not all readers have this set, so be prepared to handle null **/ System.out.println("ReaderEPC= " + myproxy.getEPC(rs)); /** * is autoread set? */ boolean autoRead = myproxy.isAutoRead(rs); System.out.println("autoread currently set to: " + autoRead); /** * toggle autoread */ myproxy.setAutoRead(rs, !autoRead); System.out.println("autoread changed to: " + !autoRead); /** * Sleep a few seconds to see the effects of autoread toggling. * If running a tagviewer, the tags should either appear or dissapear * depending on the previous setting */ try { Thread.sleep(10000); } catch (InterruptedException ignored) {} /** * Reset autoread to original value */ myproxy.setAutoRead(rs, autoRead); System.out.println("autoread changed back to: " + autoRead); /** * finally close this connection **/ myproxy.disconnect(rs); }catch(Exception ex) { // TODO handle remote exception ex.printStackTrace(); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -