com.sentilla.mote.clientservices
Class ClientServicesLib

java.lang.Object
  extended by com.sentilla.mote.clientservices.ClientServicesLib

public class ClientServicesLib
extends Object

ClientServices application is intended to be customized based on deployment requirements and sensors present on the motes for a given deployment.

Note: in this release, sensor deployments don't apply and therefore there is only one recommended way to instantiate ClientServices: via the default constructor.

The default implementation does the following:

Commands can be sent to client services via Command message objects. Supported commands include:

 cmd              param
 ping             seq_no
 reboot           n/a
 blink            0/1 (unset or set)
 setinterval(s)   0 to 3600s
 

When blink is enabled, the blue LED turns on for the duration of processing a command and the green LED turns on when sending the heartbeat.

In addition to using ClientServices as a standalone app, it can also be invoked from another program, e.g. using this approach:

    private static ClientServicesLib cs;

    public static void sendHeartbeat() throws InterruptedException {
        if (cs == null) {
            cs = new ClientServicesLib();
            // don't perform receive
            cs.receive = false;
            cs.init();
        }
        // send heartbeat once, then exit
        cs.loopCount = 1;
        cs.run();
    }
 


Field Summary
 short firmwareBuild
           
 int heartbeatInterval
          Interval to wait between heartbeat.
protected  Sensor<javax.measure.quantity.Dimensionless> humidity
           
protected  Sensor<javax.measure.quantity.Temperature> itemperature
           
 short loopCount
          Number of loop iterations.
 boolean receive
          Indicates that commands such as ping should not be received, only heartbeat will be sent.
 Sender sender
          Sender used for heartbeat and command/ping reply
protected  Sensor<javax.measure.quantity.Temperature> temperature
           
protected  Sensor<javax.measure.quantity.Illuminance> tsr
           
protected  Sensor<javax.measure.quantity.ElectricPotential> voltage
           
 
Constructor Summary
  ClientServicesLib()
          Default constructor.
  ClientServicesLib(boolean local)
          ClientServices with specification of protocol (single or multi-hop).
protected ClientServicesLib(int options)
          Ctor with options.
 
Method Summary
 void init()
           
 void run()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

firmwareBuild

public final short firmwareBuild
See Also:
Constant Field Values

heartbeatInterval

public int heartbeatInterval
Interval to wait between heartbeat. Desired interval (20s) minus correction (e.g. 2s) Correction accounts for delays due to sending etc.


temperature

protected Sensor<javax.measure.quantity.Temperature> temperature

itemperature

protected Sensor<javax.measure.quantity.Temperature> itemperature

humidity

protected Sensor<javax.measure.quantity.Dimensionless> humidity

voltage

protected Sensor<javax.measure.quantity.ElectricPotential> voltage

tsr

protected Sensor<javax.measure.quantity.Illuminance> tsr

loopCount

public short loopCount
Number of loop iterations. One loop sends one heartbeat, then if not done, wait for 'interval' duration.


receive

public boolean receive
Indicates that commands such as ping should not be received, only heartbeat will be sent.


sender

public Sender sender
Sender used for heartbeat and command/ping reply

Constructor Detail

ClientServicesLib

protected ClientServicesLib(int options)
Ctor with options. Only to be used internally by Sentilla. The use for shipping or sample applicationsis discouraged.

Parameters:
options -
See Also:
Heartbeat.options

ClientServicesLib

public ClientServicesLib()
Default constructor. Heartbeat sent will include memory, voltage. Heaerteat message sent will be in multi-hop mode (collect protocol).


ClientServicesLib

public ClientServicesLib(boolean local)
ClientServices with specification of protocol (single or multi-hop). Heartbeat sent will include memory, voltage.

Parameters:
local - use local protocol. If true, will use local protocol, otherwise will use collect/multi-hop protocol
Method Detail

init

public void init()

run

public void run()
         throws InterruptedException
Throws:
InterruptedException


Copyright © 2007 Sentilla Corporation. All Rights Reserved.