Capturing and storing new sensor frames

We have created two template code files in order to help developers to create their own capture and storage applications.

The default ZigBee "capturer and storer" comes with the next structure (pseudocode):

main()
{
  init(); //initializes the serial port to communicate with the XBee radio

  while(1)
  {
    getFrame();             // read the frame received from the ZigBee radio
    parseFrame();           // parse the frame in order to extract the data
    storeInAFile(fileName); // store the data in a file (if enabled)
    storeInADB(LOCAL);      // store the data in the local DB (if enabled)
    storeInADB(EXTERNAL);   // store the data in an external DB (if enabled)
  }
}

The real files (zigbeeStorer.h, zigbeeStorer.c) can be downloaded here.

You can download these files and change them in order to make it compatible for your specific sensor configuration.

Compilation:

The compilation can be done in the same Meshlium. Just copy these files in a folder accessing by SSH and execute:

#gcc -o zigbeeStorer -I/usr/include/mysql zigbeeStorer.c -L/usr/lib/mysql -lmysqlclient -Wall

Before starting to execute the new binary "zigbeeStorer" stop the default ZigBee daemon:

#/etc/init.d/ZigbeeScanD.sh stop

If you want your own ZigBee capturer application to execute each time Meshlium starts you have to change the daemon file (/etc/init.d/ZigbeeScanD.sh) in order to execute your binary.

You will find support in the Libelium Forum at: http://www.libelium.com/forum

Download code

You can download the code of this tutorial.


© Libelium Comunicaciones Distribuidas S.L.

| Terms of use