On this page we give some examples of how software developers can integrate measured data and metadata from your Lufft I-BOX in applications.
- VBA – Visual Basic for Applications
- How to access data from the logger app?
VBA – Visual Basic for Applications
In Microsoft Word there is VBA (Visual Basic for Applications) builtin. Using VBA, values from the Lufft I-BOX can be transfered to Microsoft Word in the following steps.
Required: First install the OUT-App “CSV” on your Lufft I-BOX.
Step 1: Start VBA inside Microsoft Word
Step 2: Write your VBA-Script to get the data out of your Lufft I-BOX.
As an example, this is a procedure names “GetChannels” that loads channel metadata and inserts them at the current curser position. You can use this little VBA-snippet with copy&paste to your VBA code editor:
Sub GetChannels() Const URL$ = "http://<hostname>/ab/index.php/csv/1/api/getchannels" Dim txt As String, i As Long, ret As String With CreateObject("MSXML2.XMLHTTP") .Open "GET", URL, False .send txt = .responseText End With Selection.TypeText (txt) End Sub
Please replace <hostname> with the ip-address or hostname of your Lufft I-BOX.
Step 3: You can call this Procedure from your Microsoft Word document by calling the macro “GetChannels”.
To get real vealues replace the url in the snippet simply by
The <valueids> are shown in the GetChannels output. Your can get several values by separating them with commas.
How to access data from the logger app?
Here we give some quick advise how to work with the logger inside the lufft i-box. First of all, you have to install the logger app and the log-json app. If you don’t want to buy the logger app right now, you can go for a test drive with the logger demo app.
To active the data logger, add a new device (apps->datalogger->add new device) and also add a device for the logger json app (apps->loggerjson->add new device).
You can now configure you logger for your meaurement task: select the channels and make the settings. Don’t forget to start the logger device.
To access logger data go to the logger json device. There is a menu tab “API-Help” with extensive documentation about how to access logger data. The data access is performed by a http request. Here is a brief overview about the logger json API calls:
// Which logger are availabe in the I-BOX? http://<address>/websites/ab/index.php/loggerjson/api/getallloggers // Request information about the logger and the channels being logged http://<address>/websites/ab/index.php/loggerjson/api/getmetadata // Get values out of the logger // Using <params> the details of the request can be specified, // e.g. time constraints, paging, ... http://<address>/websites/ab/index.php/loggerjson/api/getvalues?<params>
There is a detailed description of each API call inside the logger json app. Since there are JSON libraries for may programming languages available, a request for any programming environment should be straight forward.