Wednesday, December 24, 2008

Data Acquisition Software TWedge 2.0 Released

Merry Christmas!
It's Christmas. In Austria that usually includes snow, silence (for some people), last-minute gift-shopping (for most people) and holidays. For TEC-IT customers this also means that the new version of the data acquisition software TWedge was released to the public.

New and Flexible Data Acquisition Software
TWedge version 2.0 captures data from serial, USB, Bluetooth or TCP/IP based devices and forwards this data to arbitrary applications or databases.



The highlight of TWedge is the embedded scripting language (based on JavaScript). Using this scripting language any user can embed custom logic or data acquisition functions. It is very easy to extend the functionality of this software wedge, even direct database access functions (via ODBC) and file access methods are available.

Downloads
Check out the demo version: scriptable data acquisition software
Press release: Universal Data-Acquisition Software

Example (Simple)
After adjusting the interface for data acquisition (e.g. serial port COM1, 9600 baud, 8 data bits, 1 stop bit, no parity) TWedge should be supplied with at least one script which is called whenever data is received via the configured interface.

The perfect place for this script is the the OnData() section. TWedge also offers OnStart(), OnStop(), OnTimer() and OnHotkey() - I assume you guess what these scripts are for.

A very simple OnData() script looks like this:

// start of script
SendKeyStrokes(DATA);
// end of script

The function SendKeyStrokes() simple converts captured data into virtual keystrokes. In other words: Using this simple command TWedge works as keyboard wedge. The captured data is available in the variable DATA by default (TWedge ensures correct device communication).

Example (Complex)
A more complex script writes captured data into a database. OnStart() is used for database initialization and it gets called by TWedge automatically whenever the user invokes device communication:

// start of script
// open the database
if (!myDB.Open("DSN=TWedge_Sample;"))
{
MessageBox("Could not open database TWedge_Sample!");
return;
}

// delete all records stored in a previous session
myDB.Execute ("DELETE * from tbl_Scans");
// end of script

Each time TWedge receives data from the external device it calls the function OnData(). The OnData()-code below enters captured data into the database (along with the hostename and the current date/time):

// start of script
// get the current date and time
var d = new Date();
// d.getMonth returns the month zero-based (e.g. 0=January, 11=December); thus add 1
var sDate = (d.getMonth() + 1) + "-" + d.getDate() + "-" + d.getFullYear();
var sTime = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();

// build the INSERT statement
var insert = "INSERT INTO tbl_Scans (ProdID, ScanDate, ScanTime, Host) VALUES (";
insert += "'" + DATA + "', ";
insert += "'" + sDate + "', ";
insert += "'" + sTime + "', ";
insert += "'" + "localhost" + "');";

// execute the INSERT statement
var nRet = myDB.Execute(insert);
if (nRet < -1) MessageBox ("Error during INSERT:" + myDB.LastError); else if (nRet == -1) MessageBox ("This should not happen when executing an INSERT statement"); else MessageBox (nRet + " record(s) inserted!"); // end of script


Nice - But I don't know JavaScript!
Don't worry. TWedge comes with predefined scripts for common usage scenarios (e.g. keyboard wedge functionality). Just select the template which matches your requirements. Or contact TEC-IT for support.

End of Post
Merry Christmas and a Happy New Year!
 
Programming Blog Directory Add to Technorati Favorites Blogverzeichnis frisch gebloggt Bloggeramt.de RSS Verzeichnis RSS World Software
Blogging Fusion Blog Directory Find the best blogs at Blogs.com. Directory of Computers/Tech Blogs BlogESfera Directorio de Blogs Hispanos - Agrega tu Blog US Business Directory & Local Blogs
2D Barcode Software and RFID/AIDC News N1 Website Directory Central Blogs
BloggerInternet.com - Browse our directory for collection of weblogs, blogs about entertainment, internet, media, music, personal, politics, sports, travel and more.
Blog Catalog Submit Blog Directory The Blog Resource Blog Directory SEOTalk Web Directory Bulla Racing