Allows exploration of the 1-Wire network attached to the device.
This servlet allows you to drill down from the adapters, through
the devices, and into the internal memory of each device.
This servlet can be configured to provide alternative information
for each family code by specifying an "include" servlet in the list
of initialization parameters. For example, here is a possible
snippet for the servlets.props file:
[Very important NOTE: The property loading code
does not support continuation lines with the '\' character. Thus,
make sure you put the initParams on one line. The
use of this in the following example is just for illustration.]
#
# Useful servlet that can explore all aspects of a 1-Wire system
#
OneWireServlet.mapping=/servlet/OneWireServlet
OneWireServlet.class=com.qindesign.servlet.example.OneWireServlet
OneWireServlet.initParams=familyCode10=TemperatureInclude,\
familyCode21=TemperatureInclude,\
familyCode12=SwitchInclude,\
familyCode20=FamilyCode20Include,\
familyCode2c=PotentiometerInclude
#
# Family code includes for use by OneWireServlet
#
TemperatureInclude.mapping=
TemperatureInclude.class=com.qindesign.servlet.example.TemperatureInclude
SwitchInclude.mapping=
SwitchInclude.class=com.qindesign.servlet.example.SwitchInclude
FamilyCode20Include.mapping=
FamilyCode20Include.class=com.qindesign.servlet.example.FamilyCode20Include
PotentiometerInclude.mapping=
PotentiometerInclude.class=com.qindesign.servlet.example.PotentiometerInclude
Note the use of four additional "include" servlets. You can
write your own family code servlets simply by adding yours to the
initialization parameters of this serlvet. Specify
familyCodeXX=<servlet name> .
There are two request attributes that will be passed to
these servlets. These are container and
queryString . The container attribute
will contain an instance of the specific container class appropriate
for the family code, and queryString will contain the
exact query string necessary to append to the request for access to
the included servlet.
In addition, there is a base OneWireSensorInclude
class that provides checking for a valid request, and also prints
a small header summarizing the name and address of the device.
The TemperatureInclude and SwitchInclude
servlets extend this class.
Please consult the source code for additional information.
|