Download Untitled

Transcript
41
Figure 22. Code snippet for Radiogram connection for SunSPOT.
SunSPOT basestation device is more like transparent device to sensors as the main
application for collecting data is running on desktop computer. Only the base station
device is allowing radio port communication from sensor and forwarding data to desktop
computer at COM9 port. Figure 23 shows the class diagram of SunSPOT host application
for sensor data collection and generating XML files for web client usage and information.
Figure 23. Class diagram of SunSPOT main application.
5.2 Setting Host Machine & Collecting Data
For sensor data collection and storing PostgreSQL 8.4 was database of choice, since it is
supported by Crossbow Technology default application xserve. For SunSPOT sensor data
collection the Netbeans editor is configured with Java Database Connectivity (JDBC)
with PostgresSQL plugin. The database is created with name ‘task’ with two tables. One
table for the Crossbow sensor named mts400_results and another table spot_results for
SunSPOT sensor. Both tables have respective fields for sensor data for example nodeid,
temp, light and degree (xaxis, yaxis and zaxis). Figure 24 shows the code snippet for
calling the JDBC in SunSPOT host application.