Use of USER_CONFIG in app.c

5 posts / 0 new
Last post
ebanwart
Offline
Last seen:3 years 2 days ago
Joined:2015-03-18 14:03
Use of USER_CONFIG in app.c

I'm using SDK 5.0.3 (which isn't an option when selecting the SDK for forum posts). There is a USER_CONFIG definition in user_config.h that is used throughout the SDK to allow the user to override default options. In the file app.c most of the functions make use of it to allow customized configuration options from structures in user_config.h. However, the function app_easy_gap_start_connection_to_msg_create() does not follow this convention. In fact, the latest DSPS release completely hacks this function and hard codes it to use custom values. The default struct used in this function contains values that are invalid for establishing a connection. What's worse is that connection attempts using the default values silently fail with no notification message to the user app. The only option a user has is to modify the SDK which is not ideal. Could you please fix this in the next release?

Device:
MT_dialog
Offline
Last seen:2 weeks 2 hours ago
Staff
Joined:2015-06-08 11:34
Hi ebanwart,

Hi ebanwart,

Your message is forwarded in the SDK team, thanks for indicating. You can also try to use the _get_active() function in order to set your message with the appropriate values.

Thanks MT_dialog

oren
Offline
Last seen:1 year 5 months ago
Expert
Joined:2014-06-28 22:03
We are also using SDK 5.0.3.

We are also using SDK 5.0.3.
We have set USER_CONFIG to 0 since we are making modules with configurable advertising (i.e. the advertising conf is not constant and can be controlled remotely) - There is no need to build the whole advertising command if we are going to override it anyways with our own mechanism.
I want to mention that it is not clear which constants in user_config.h are used only when USER_CONFIG is 1 (and can be nullified to 0 when USER_CONFIG is 0 to avoid later confusion), and which constants are used anyways and should not be nullified.
We found that user_connection_param_conf and user_default_hnd_conf may be accessed even if USER_CONFIG is 0, but the other constants cannot.
Why did you wrap the USER_CONFIG checks withif (USER_CONFIG) {...}instead of preprocessor code:#if USER_CONFIG? Using preprocessor code would allow to comment-out or remove completely the constants in user_config.h that are not used.

此外,注意到user_connection_param_config.time_out isMS_TO_TIMERUNITS(1250)by default, but in default_param_update_cmd it isMS_TO_TIMERUNITS(1000). This means that by default, if USER_CONFIG is set to 0, the functions user_app_connection and user_catch_rest_hdnl (case GAPC_PARAM_UPDATED_IND) will see thatparam->sup_togive "unexpected" values (the code requested 1000ms but expects 1250ms).

oren
Offline
Last seen:1 year 5 months ago
Expert
Joined:2014-06-28 22:03
And why do you call memcpy

And why do you callmemcpy(cmd, ...);everywhere, when the source type is the same as cmd? Why not:*cmd = default_...;?

MT_dialog
Offline
Last seen:2 weeks 2 hours ago
Staff
Joined:2015-06-08 11:34
Hi Oren,

Hi Oren,

Most of your indications are corrected in the new SDK release (not released yet), now regarding the memcpy instead of a simple assignment, its something that is used from most of the SDK team, it is a matter of preference and as far as i know there isn't any significant difference between the struct assignment and the memcpy.

Thanks MT_dialog