API Documentation


#1

API DOCUMENTATION

####for Python:
https://s3.amazonaws.com/zk-sw-repo/zk_app_utils.py.pdf

####for C++:
https://s3.amazonaws.com/zk-sw-repo/zkAppUtilsClass.cpp.pdf

####for C:
https://s3.amazonaws.com/zk-sw-repo/zk_app_utils.c.pdf

Or you can find them on your Pi after software installation at /usr/share/zymkey/doc/


Using Perimeter Detect
#2

Hi, I finally received my zymkey 4i and it looks great!

I have a few question, I just tried to start to play to my zymkey:

  • I am using jessie
  • I installed all the packages thanks to your script
  • my zymkey looks to works “good”: blink and I also was able to run your two python examples scripts with success

I am interested to use C code. I look your API and tried to include “/home/zymbit/zk_app_utils/zk_app_utils.h” but I couldn’t find any zymkey user in /home !!

I finally was able to compile my C script with including <zymkey/zymkey.h> in my headers but got these error lines:

zymbit.c:(.text+0x18): undefined reference to 'zkOpen’
zymbit.c:(.text+0x2c): undefined reference to 'zkLEDFlash’
zymbit.c:(.text+0x34): undefined reference to ‘zkClose’

Could you help me and tell me what I missed??

Thx by advance!


#3

Hi

I can play fine the python module, but I still can’t use the C API.
Could you help me? Is there something I should link to my gcc line?

Thx by advance


#4

@Tgratier sorry for the late response. The include files for C/C++ are located in /usr/include/zymkey. You can directly include this path in your C code #include "/usr/include/zymkey/zk_app_utils.h". Or, you could #include <zk_app_utils.h> and put the path on the gcc include line:
gcc -I /usr/include/zymkey my_zymkey_program.c -o my_zymkey_program

The reason that you don’t see a user directory for user zymbit in /home (/home/zymbit) is that the account is deliberately created in the systemd service with no /home directory for security.

Please let us know if you have further questions.


#5

Hi

Thx for your help.

I am sorry but it didn’t change anything, I have the same “undefined reference to” errors than with
#include <zymkey/zk_app_utils.h>

You say the C/C++ files can be found in /usr/include/zymkey, but I only have these 3 files:

  • zkAppUtilsClass.h
  • zk_app_utils.h
  • zk_b64.h

I guess my code can’t find the code declaration of the functions I am calling. Where could I find the c code for these? don’t they should be in the same /usr/include/zymkey folder? If the answer is yes, could you help me to find what have I missed during my installation please?

Thx


#6

@Tgratier
You will also need to reference the Zymkey App Utilities, located at /usr/lib/libzk_app_utils.so, with the -l directive. For example:
gcc -I /usr/include/zymkey -lzk_app_utils my_zymkey_program.c -o my_zymkey_program


#7

Ok thx that was the thing I missed.


#8

Hi (it’s me again ¯_(ツ)_/¯ )

I just did a new clean install on a raspberry, but I suddenly have a segfault error just after these two lines:
zkCTX *ctx;
zkOpen(*ctx);

The compilation works fine with the previous help you told me above.
I am working on jessie distrib, and I enabled the I2C device, and the blue light of the zymbit is blinking every 3s.z

BTW The two python examples you gave are working fine.

Could you help me (again) to find what I forgot?


#9

and I have the same results with two different zymkey 4i modules and different raspberry and SD cards :-/


#10

You need to declare the Zymkey context plainly and then pass in the pointer to the context:

zkCTX ctx;
zkOpen(&ctx);

#11

Ok my bad… thx again


#12

No problem. Happy to help :slight_smile:


#13

Hi, I have the same problem. I tried your solutions (path included in my C code or in the gcc command), but I cannot compile my code.
Please help me.