To run the compiled ClientlibExample application, we must include the following files in the classpath:
cricketlibexample.jar cricketdaemon.jar gnu.getopt.jar
The ClientlibExample application includes a script called launch.sh that shows how to include these files in the classpath and launch the application. Please modify the ROOT variable as instructed in the script file.
Before running ClientlibExample, you need to first run cricketd and CricketDaemon. Furthermore, at least 3 beacons must be placed according to the instructions in Section 3.3 and their coordinates must be configured.
Please refer to Section 2.2.1 for instructions to run cricketd. To launch CricketDaemon and configure beacon coordinates, please follow the instructions in Chapter 3.
Note: As explained in Section 4.2, applications that use processed location information of the same listener device should connect to the same CricketDaemon server. In our example, both BeaconConfigDemo and ClientlibExample connects to the same instance of CricketDaemon server.
Alternatively, you may hard code the beacon coordinates in a file and
launch-cricketdaemon.sh script to run CricketDaemon. Please modify the user-defined parameters in the script before running the script. Section 3.4 explains the function of the parameters in the script. The hard coded coordinate values are specified by the file indicated in the COORDINATE_FILE parameter. Please see bin/beacons.conf for a sample coordinate file.
To summarize, you may launch ClientlibExample (after running cricketd on the listener's host device and modifying the paramters in the launch*.sh scripts) by doing the following:
cd NMSDemo/2004/BeaconConfigDemo ./launchall.sh & cd src/app/clientexampleapp ./launch.sh
For the ``hard-coded coordinates'' approach, modify bin/beacons.conf and do:
cd src/app/clientexampleapp ./launch-cricketdaemon.sh & ./launch.sh
The following is a snippet of the output from executing the ClientlibExample application. The first three lines shows that the ServerBroker correctly established a connection with the CricketDaemon.
ServerBroker::connect() connecting to CricketDaemon at 127.0.0.1 CricketDaemon accepting new connection from /127.0.0.1:32864 ServerBroker::connect() connected ClientlibExample created space=C-32 pos=null space=C-32 pos=( 110.68068181818181 51.996363636363654 74.20246458136243 ) space=C-32 pos=( 105.02765151515152 49.79030303030304 70.9467680654887 ) space=A-32 pos=( 105.02765151515152 49.79030303030304 70.9467680654887 ) space=A-32 pos=( 99.99583333333334 47.826666666666675 67.46006180099782 ) space=A-32 pos=( 84.18386363636364 39.73272727272729 70.51112894364283 ) space=A-32 pos=( 71.51304924242424 49.99484848484849 77.07008845356134 )
Applications can expect some delay in receiving location updates due to the sliding window filter used in CricketDaemon. We can reduce this delay by specifying a small value for the FILTER_WINDOW_MS variable (see Section 3.4) in the launch-cricketdaemon.sh script. In addition, the application can use the setPositionAggressive method described in Section 4.4.1 to reduce the position estimation delay.