I'm attempting to use GATT on my Linux box to set up a custom service with a load of characteristics.
Using this question, and the ones it links to, I was able to identify the code that I would need to write (making use of the gatt_service_add()
function).
I've created a separate file called gatt_service.c, and written the code I think that I need. However, I cannot work out how to link my code to the Bluez libraries in order to compile and run my solution. For example this site (whilst not being for BLE development) links against libbluetooth using -lbluetooth
as a gcc parameter, and I cannot work out what to link against to make my code work.
I haven't posted any samples because I'm not sure what to post - if there is any that is required, or I've failed to mention something, please let me know.
Thanks in advance.
EDIT - more information:
Following the comments, I've used plugins/time as a base to write my own file for my own "Broadcaster service". Full code located: here (I don't know which bit of the code to put in the answer!).
My compilation command is: gcc gatt_broadcaster_service.c -Wall -o gatt_broadcaster_service -lbluetooth 'pkg-config --cflags --libs glib-2.0' -I/home/alexander/Documents/bluez-5.29/lib
(including the glib bit to fix the issue reported here).
The error I get is: gatt_broadcaster_service.c:11:27: fatal error: lib/bluetooth.h: No such file or directory #include "lib/bluetooth.h"
My C file is stored in Documents, and my research tells me that it can't find lib/bluetooth.h because it's not looking in the correct place (this and this talk about using include flags for the compiler when a file isn't in the general locations, but I can't make that work.
Thanks again!