22
ODBC interface for ODBC interface for Remote Wireless Sensor Remote Wireless Sensor Network Network Jun Ma Jun Ma [email protected] [email protected] u u

ODBC interface for Remote Wireless Sensor Network Jun Ma [email protected]

  • View
    227

  • Download
    1

Embed Size (px)

Citation preview

Page 1: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

ODBC interface for Remote ODBC interface for Remote Wireless Sensor NetworkWireless Sensor Network

Jun MaJun Ma

[email protected]@csiro.au

Page 2: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

What is Wireless Sensor NetworkWhat is Wireless Sensor Network This wireless sensor is called a “This wireless sensor is called a “motemote”. It’s a ”. It’s a

small-scale computers with small-scale computers with sensorssensors, a , a microprocessormicroprocessor, , RF communicationRF communication and and batterybattery..

It is intended to be very small and very cheap so It is intended to be very small and very cheap so that it can be massively distributed.that it can be massively distributed.

Page 3: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

A number of wireless sensors forms an wireless adhoc netwA number of wireless sensors forms an wireless adhoc network which provides functionality like message routing.ork which provides functionality like message routing.

WSN can be used in a wide range of applications, including WSN can be used in a wide range of applications, including environmental monitoring, surveillance, smart buildings, healenvironmental monitoring, surveillance, smart buildings, health, traffic monitoring, and military systems. th, traffic monitoring, and military systems.

What is Wireless Sensor NetworkWhat is Wireless Sensor Network

Page 4: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

What is Remote WSN A wireless sensor

network deployed at very remote locations.

Data is collected remotely through telephone network like GPRS or CDMA.

Page 5: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

A Database for WSNs TinyDB is a database system written in jav

a for extracting information from a WSN.

Page 6: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Project Motivation

We can’t interface with WSN like a standard database.

WSN can be much easier to use if it could be used directly from the standard tools for programmatically interfacing with database.

Page 7: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Objective Improve usability of WSN by providing a standard

ODBC interface between TinyDB and most normally available database tools.

Map the sensor network to a database paradigm. Make the whole sensor network looks like an

standard database table.

Node ID Temperature Humidity Light Sound

1 21.5 13 67 34

2 22.2 14 56 40

3 23.8 12 77 21

Page 8: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au
Page 9: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Software platform An ODBC driver for Windows platform. Wireless sensor runs TinyOS which is an open-so

urce operating system designed specially for wireless embedded sensor networks.

GPRS modem runs Nut/OS which is an open-source operating system designed for Atmel microcontroller.

TinyDB which is a database engine for WSN. TinyDB proxy which is a java application which tra

nslates SQL query into something motes can understand.

Programming language: C, C++ and Java

Page 10: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Driver Development An ODBC driver is a DLL on windows platform. The driver implements functions specified in the

ODBC standard. The driver must make sure the ODBC functions ar

e called in correct sequence. Sending query to TinyDB Proxy server Retrieving data from the XMLBlaster server. Decoding TinyDB binary messages. Mapping errors to ODBC SQLSTATEs.

Page 11: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Programming Considerations

Make the ODBC driver fully thread-safe, so that the driver can handle an ODBC call from any thread at any time .

The ODBC driver resides in the same memory space of the user application.

All the ODBC functions must be exported with its original name using a module-definition (.DEF) file instead of __declspec(dllexport).

A event logger is needed for debugging.

Page 12: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Research issues

Supporting TinyDB specific SQL . How effectively can a sensor network be ma

pped to database paradigm. Balancing query latency vs. power consump

tion.

Page 13: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Supporting TinyDB specific SQL .

If a query contains TinyDB-Speicific SQL, the driver sends it to TinyDB proxy for processing.

A SAMPLE PERIOD is appended to SQL queries if it doesn’t exist.

Replace “*” in the query with a list of all available attributes in the sensor network.

Page 14: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Mapping sensor network to database paradigm

Step 1: Connect

SQLAllocHandle(ENV)

SQLSetEnvAttr

SQLAllocHandle(DBC)

SQLDriverConnect

SQLSetConnectAttr

SQLGetInfo

SQLGetFunctions

SQLAllocHandle(STMT)

SQLSetStmtAttr

Step 2: Building and Executing an SQL statement

SQLTables

SQLNumResultCols

SQLDescribeCol

SQLBindCol

SQLFetch

SQLExecuteDirect

Step 3: Fetch result

SQLNumResultCols

SQLDescribeCol

SQLBindCol

SQLFetch

SQLGetData

Page 15: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Balancing query latency vs. power consumption.

Polling instead of continuous sampling saves power.

Changing the schedule scheme to balance power consumption vs. latency.

Page 16: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Summary

With an standard ODBC interface, Wireless Sensor networks have greater usability, functionality, extensibility and ease of integration.

However some new restrictions like large latency and difficulties with event driven sampling are introduced.

Page 17: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Any Questions?

Page 18: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au
Page 19: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Function Sequence

Applications retrieve data from ODBC driver by calling functions in a certain sequence.

Page 20: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

Decorated NameEXPORTED FUNCTION ORDINAL DECORATED NAME

Prod 1 ?Prod@@YAJJJ@Z

Sum 2 ?Sum@@YAJJJ@Z

CMyClass::CMyClass() 3 ??0CMyClass@@QAE@XZ

CMyClass::~CMyClass() 4 ??1CMyClass@@QAE@XZ

CMyClass::operator= 5 ??4CMyClass@@QAEAAV0@ABV0@@Z

CMyClass::SAbout() 6 ?SAbout@CMyClass@@QAEXXZ

CMyClass::SHowdy() 7 ?SHowdy@CMyClass@@QAEXXZ

LIBRARY ODBCWSNEXPORTS;SQLAllocConnect @1;SQLAllocEnv @2;SQLAllocStmt @3;SQLBindCol @4;SQLCancel @5

DEF file

Page 21: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au

TinyDB packet

Page 22: ODBC interface for Remote Wireless Sensor Network Jun Ma Jun.Ma@csiro.au