First steps with the ZWay library

The Z-Wave "RaZberry" installation comes with everything needed to be able to do some custom development in C; everything is installed in the /opt/z-way-server directory.
There, one can find:
  • A set of (documented, nice!) C header files found in /opt/z-way-server/libzway-dev:
    • CommandClassesPublic.h
    • FunctionClassesPublic.h
    • ZDataPublic.h
    • ZDefsPublic.h
    • ZErrors.h
    • ZPlatform.h
    • ZWayLib.h
  • A set of libraries found in /opt/z-way-server/libs:
    • libmicrohttpd.so
    • libv8.so
    • libzwayhttp.so
    • libzwayjs.so
    • libzway.so
For the ZWay stack to run properly, it is needed to provide the necessary configuration files. Instead of using these directly from the installation folder, I made a copy in order not to mess up too much with my working/configured setup. The following directories from the ZWay installation folder are needed:
  • config
  • translations
  • ZDDX
For experimenting I made a small Makefile in order to build and run.
 main.out: main.c  
     gcc -I/opt/z-way-server/libzway-dev -L/opt/z-way-server/libs -L/lib/arm-linux-gnueabihf -L/usr/lib/arm-linux-gnueabihf -lzway -lxml2 -lpthread -lcrypto -o main.out main.c  
   
 clean:  
     rm -f main.out  
   
 run:  main.out  
     export LD_LIBRARY_PATH=/opt/z-way-server/libs && ./main.out  
   

Now it is time to start experimenting...

Comments

  1. How has this worked out? Have you made any source code you want to share, github?

    Have you checked out OpenRemote?
    http://www.openremote.org/display/docs/OpenRemote+2.0+How+To+-+Z-Wave+with+Razberry

    ReplyDelete
  2. This worked well so far, my "prototype" is moving further, just lacking time :) No there is not yet source code available, but I guess after I get to something decent to share, I will.

    About OpenRemote, I saw the announcement on the Razberry pages but I did not look into the details as it was based on the HTTP/JScript APIs of ZWay.

    ReplyDelete
  3. Hey Vincent,
    I tried to build my file like you showed in top. But my compiler cannot find -lxml2. When I try to install lxml2 with apt-get install, it is said that the package lxml2 is unable to locate
    What can I do?

    ReplyDelete
  4. The package you miss is normally "libxml2".
    "-l" is a "shortcut" for "lib"

    ReplyDelete
  5. Yeah I know. "libxml2" is already installed, when I install "xm21" it still isn't working

    ReplyDelete
  6. /usr/lib/arm-linux-gnueabihf/libxml2.so.2 should be installed; you probably only miss the symbolic links to it e.g.
    lrwxrwxrwx 1 root root 12 Mar 16 2013 libxml2.so -> libxml2.so.2
    lrwxrwxrwx 1 root root 16 Mar 9 2013 libxml2.so.2 -> libxml2.so.2.8.0
    -rw-r--r-- 1 root root 1196108 Mar 9 2013 libxml2.so.2.8.0

    ReplyDelete
  7. How can I fix the problem?

    ReplyDelete

Post a Comment

Popular posts from this blog

ZWay: getting the device list.

Libcurl: perform a REST HTTP PUT