Dear Dialog,
1. In the process of custom service creation, I have created two files custom_service.h and custom_service.c inside the "sdk -> ble-> services" folder of the ble_adv demo project. I am using the sdk 10.0.10. when I tried to build the project, I am getting this error for custom_service.h.
"fatal error: custom_service.h: No such file or directory
#include "custom_service.h"
|^ ~~~~~~~~~~~~~~~~
I am not understanding what's wrong with this new files addition. They are in the correct path and their project locations are the same. I checked the include paths in the c/c++ build settings as well. everything looks fine. I request you to please help me with this as I cannot test my my new additions whether they are working or not.
2. I have some confusion in understanding the call back functions prototype and their definition in ble_service.h and ble_service.c files in /ble_adv/sdk/ble/services/includes/ble_service.h and /ble_adv/sdk/ble/services/src/ble_service.c files respectvely in the sdk. I will attach here one function to explain what I did not understand.
//call back function prototype in ble_service.h typedef void (* connected_evt_t) ( ble_service_t *svc, const ble_evt_gap_connected_t *evt); // I am assuming the following is the above call back function(connected_evt) definition static void connected_evt(const ble_evt_gap_connected_t *evt) { int i; for (i = 0; i < MAX_SERVICES; i++) { ble_service_t *svc = services[i]; if (svc && svc->connected_evt) { svc->connected_evt( evt); } } }
So, here what I didnot get is
1.如果(* connected_evt_t)指向connected_evt()函数,为什么未在函数定义中传递第一个参数(ble_service_t * svc)。由于原型和定义应该与争论数量相同?
Thanks in advance.
Regards, Prasanna
Hi Prasanna,
As you mentioned in your initial post, you have started developing your own project. So, could you please take a look at theDA1469x Tutorial Starting a Projectto make sure that the setup is OK? In section 2, you will also find steps to include your own files.
Can you please also take a screenshot with the error and share it?
The typedef struct ble_service ble_service_t; is a global structure.
Thanks, PM_Dialog
Hi PM_Dialog,
I have imported the ble_adv demo project from the sdk and started to make changes to it. In this process, i added custom_service.h and custom_service.c to "sdk -> ble-> services" include and source files respectively. Is this the correct way to make changes to the existing demo project? Please find the error attached regarding adding files to ble_adv demo project.
2. Also, I encounter another problem. Whatever changes I do to one demo project under SDK, they are applying to other demo projects as well since they are under same SDK. For example if I add one header file to ble-> service->include of ble_adv project, they are also automatically added to the same path of the ble_custom_service project. This is bringing me additional problems of deleting and adding files. Please tell me how to rectify this problem.
Hi Prasanna,
You mentioned that the problem has been fixed in this ticket, hasn’t it?
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/error-undefined-reference-function
Could you please clarify your second question? There are tutorial and SW Examples demonstrating how to implement a custom service. You don’t need to modify any of the SDK files.
Thanks, PM_Dialog
Hi PM_Dialog,
My second question.
我用两个演示项目at the moment. One is the "ble-adv" demo and the other is the "da1469x_custom_ble_service_sample_code". I wanted to copy the custom_service.c and custom_service.h files created outside the sdk in the "da1469x_custom_ble_service_sample_code" to the "ble_adv" demo project inside the sdk/ble/services folder. So, now what's happening is those files are also being copied to the "custom_ble_service_sample_code" sdk inside ble/services folder.
Sumary:在其他项目SDK中自动看到SDK内的一个演示项目的新文件。所以,我明白它更好地在SDK外添加自己的文件。这样对吗?
Regards,Prasanna
Hi Prasanna,
Please follow the instructions given into this forum ticket:
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/error-undefined-reference-function
Thanks, PM_Dialog