Hi,

You  will need to read the specification sheets of your temperature and
humidity devices and they will give you a conversion formula. In your
java application for Oscilloscope application, after reading in the
values, you can convert the values according to the formula.

 

For your other query, you will need a JDBC connection to your MySQL
database. I have done that with my application successfully. I will post
snippets of my java code which does the JDBC connection.

 

static String userid="root", password="xxxxx";

                static String url = "jdbc:mysql://localhost/wsn"; 

                static Connection con = null;

                static Statement stmt = null;

 

                public static Connection getJDBCConnection(){

                                try {

 
Class.forName("com.mysql.jdbc.Driver");

                                } catch(java.lang.ClassNotFoundException
e) {

 
System.err.print("ClassNotFoundException: ");

 
System.err.println(e.getMessage());

                                }

                                try {

                                   con =
DriverManager.getConnection(url, userid, password);

                                } catch(SQLException ex) {

 
System.err.println("SQLException: " + ex.getMessage());

                                }

                                return con;

                }

 

                public void messageReceived(int dest_addr, Message
message) {

                                try {

Connection con = getJDBCConnection();               

                                } catch (Exception ex) {

 
System.err.println("Exception at start: " + ex.getMessage());

                                }              

                                

                                                                

                                if (message instanceof OscilloscopeMsg)
{

                                                OscilloscopeMsg packet =
(OscilloscopeMsg)message;                   

                                                try {

                                                                if(con!=
null) {

 
// Get a statement from the connection

 
Statement stmt = con.createStatement();

 
String sql;

                                

 
sql = "SELECT Count(*) as Count FROM OscilloscopeMsg WHERE source = "
+packet.get_source() ;

 


 
ResultSet rs = stmt.executeQuery(sql) ;

                                                                

 
//SQL SPECIFIC CODE

 

 
rs.close() ;


 
stmt.executeUpdate(sql);

 
stmt.close() ;

 
con.close() ;                       

                                                                } else {

 
System.out.println("Could not Get Connection for oscilloscope message");

                                                                }


                                                } catch (Exception ex) {

 
System.err.println("Exception: " + ex.getMessage());

                                                } 

                                }

                }

 

 

I hope this helps. 

 

Cheers,

 

Varun Jain

 

From: [email protected]
[mailto:[email protected]] On Behalf Of MOHSIN
MURAD
Sent: Sunday, 24 May 2009 7:34 AM
To: [email protected]
Subject: [Tinyos-help] Oscilloscope Data Injection Into mySQL Database

 

Hello All,

I am using TinyOS & telosB Motes to fetch humidity and temperature
values of multiple locations using the Oscilloscope application, I
wanted to ask how can I convert these values into centigrades or
fahrenheits and what can I do to make them accessible from the internet
like how to inject them to a mySQL databse?

Regards,

Mohsin Murad

 

________________________________

What can you do with the new Windows Live? Find out
<http://www.microsoft.com/windows/windowslive/default.aspx> 

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to