|
kobu.rfid.ConnectorListenerインターフェースを実装するクラスを作成して、ID ConnectorにIDが届いた瞬間に通知を受けることもできます。
そのIDでまもなくクライアントがあなたのアプリケーションに接続してくるので、その準備のためIDを退避しておけます。
リスナーは必要であれば短い文字列を返して、その文字列をID KickerのログウィンドウのそのIDの横に表示できます。
ログウィンドウに表示するものがない場合はnullを返してください。
package kobu.rfid;
public interface ConnectorListener
{
String cardSwiped(javax.servlet.ServletContext cnt, String id, long swipeTime);
// Web application can do anything with the id and swipeTime passed through the listener.
// If the listener returns a short string, it will be displayed on the log display of ID Kicker.
}
リスナーを作成して、そのインスタンスをID Connectorに渡すには、ConnectorUtilの次のメソッドを使います。
package kobu.rfid;
public class ConnectorUtil
{
public static void addConnectorListener(ServletContext cnt, ConnectorListener listener)
{
...
この方法でIDが有効か無効かを調べているDemo #2をご覧ください。Demo #2はデモアプリのユーザがタイプしたカードの名前をID Kickerに渡し、それがKickerウィンドウのカード履歴に表示されます。
|