Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrfs: error handling in NRFS dispatcher with unsolicited handler #264

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions nrfs/include/internal/nrfs_hdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ typedef struct __NRFS_PACKED {

#define NRFS_HDR_FILTER_ERR_SET(_p_hdr) NRFS_FILTER_ERR_SET((_p_hdr)->req)

/* Warning! All "UNSOLICITED" features are not supported. This is intended for possible future use. */
#define NRFS_HDR_UNSOLICITED_GET(_p_hdr) NRFS_UNSOLICITED_GET((_p_hdr)->req)

/* Warning! All "UNSOLICITED" features are not supported. This is intended for possible future use. */
#define NRFS_HDR_UNSOLICITED_SET(_p_hdr) NRFS_UNSOLICITED_SET((_p_hdr)->req)

#ifdef __cplusplus
Expand Down
2 changes: 0 additions & 2 deletions nrfs/include/internal/requests/nrfs_reqs_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@

#define NRFS_FILTER_ERR_SET(_req) ((_req) |= NRFS_FILTER_ERR_MASK)

/* Warning! All "UNSOLICITED" features are not supported. This is intended for possible future use. */
#define NRFS_UNSOLICITED_GET(_req) (((_req) & NRFS_UNSOLICITED_MASK) >> NRFS_UNSOLICITED_BITPOS)

/* Warning! All "UNSOLICITED" features are not supported. This is intended for possible future use. */
#define NRFS_UNSOLICITED_SET(_req) ((_req) |= NRFS_UNSOLICITED_MASK)

#ifdef __cplusplus
Expand Down
10 changes: 8 additions & 2 deletions nrfs/src/internal/nrfs_dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ static const nrfs_service_cb_t services_callbacks[] = {
#endif
};

/* Warning! All "UNSOLICITED" features are not supported. This is intended for possible future use. */
/**
* @brief Callback function for general messages, not related to any service.
*
* @param p_buffer Data associated with the message,
* @param size Size of the data buffer.
*
*/
void __attribute__((weak)) nrfs_unsolicited_handler(void *p_buffer, size_t size)
{
(void)p_buffer;
Expand All @@ -79,7 +85,7 @@ void nrfs_dispatcher_notify(void *p_notification, size_t size)
(services_callbacks[srv_id] != NULL)) {
services_callbacks[srv_id](p_notification, size);
} else {
/* TODO: error! unknown service */
nrfs_unsolicited_handler(NULL, 0);
}
}
}