nl.tbdev.IR
Class IrStation

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--nl.tbdev.IR.IrStation
All Implemented Interfaces:
java.lang.Runnable

public class IrStation
extends java.lang.Thread

IrStation is the main class to instantiate when creating an IR application. It initializes all the services required by the minimal IrDA specification.


Field Summary
private  ConnectionCallbackInterface callback
           
private  IasClient client
           
private  LmMux mux
           
private  byte newLsap
           
private  IasServer server
           
private  LmpStation station
           
private  IasStore store
           
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ
 
Constructor Summary
IrStation(Serial ser)
          Constructor for IrStation.
 
Method Summary
 void connectRequest(int address)
          Start a new LAP connection to the given address.
 void disconnectRequest()
          Disconnect current LAP connection All registered (MUX) clients will be notified
 boolean discoveryRequest(DiscoveryCallbackInterface dCb)
          Start a new discovery (if the IR stack is not busy at the moment)
 byte getLsap()
          Get a new lsap.
 void iasCreateClass(java.lang.String name)
          Create a new class in the information store.
 void IasQueryGetValueByClass(IasQueryCallbackInterface caller, java.lang.String className, java.lang.String attrName)
          Start an IAS Query for the given class and attribute.
 void iasRegisterAttr(java.lang.String cls, java.lang.String name, java.lang.Object attr)
          Register a new attribute in the information store.
 void muxRegister(byte lsap, LmpConnection conn)
          register service at MUX
 void registerService(byte lsap, ConnectionCallbackInterface service)
          Register a service
 void run()
          Start thread for IR stack.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mux

private LmMux mux

store

private IasStore store

server

private IasServer server

client

private IasClient client

station

private LmpStation station

newLsap

private byte newLsap

callback

private ConnectionCallbackInterface callback
Constructor Detail

IrStation

public IrStation(Serial ser)
Constructor for IrStation.
Parameters:
ser - Serial port object for communication with the physical IR adapter.
Method Detail

run

public void run()
Start thread for IR stack.
Overrides:
run in class java.lang.Thread

muxRegister

public void muxRegister(byte lsap,
                        LmpConnection conn)
register service at MUX
Parameters:
lsap - Lsap for new service
conn - Connection object

registerService

public void registerService(byte lsap,
                            ConnectionCallbackInterface service)
Register a service
Parameters:
lsap - Lsap for the new service
service - Class implementing the ConnectionCallbackInterface.

iasCreateClass

public void iasCreateClass(java.lang.String name)
Create a new class in the information store.
Parameters:
name - Name of the new class

iasRegisterAttr

public void iasRegisterAttr(java.lang.String cls,
                            java.lang.String name,
                            java.lang.Object attr)
Register a new attribute in the information store.
Parameters:
cls - Name of the class to store the attribute in
name - Name of the attribute
attr - The attribute value. The store can handle String, byte[] and Integer objects.

getLsap

public byte getLsap()
Get a new lsap. Do not ask for too many of them or the pool will be depleted.
Returns:
byte with new lsap.

discoveryRequest

public boolean discoveryRequest(DiscoveryCallbackInterface dCb)
Start a new discovery (if the IR stack is not busy at the moment)
Parameters:
dCb - Class implementing DiscoveryCallbackInterface to get the results when the discovery cycle has completed.
Returns:
true if the request has been queued successfully

connectRequest

public void connectRequest(int address)
Start a new LAP connection to the given address. All registered (MUX) clients will be notified upon completion. (disconnect notification if not successfull)
Parameters:
address - The address to connect to.

disconnectRequest

public void disconnectRequest()
Disconnect current LAP connection All registered (MUX) clients will be notified

IasQueryGetValueByClass

public void IasQueryGetValueByClass(IasQueryCallbackInterface caller,
                                    java.lang.String className,
                                    java.lang.String attrName)
Start an IAS Query for the given class and attribute.
Parameters:
caller - Class implementing IasQueryCallbackInterface for notification upon completion of the request
className - Name of the IAS class
attrName - Name of the attribute within the class.