Skip to content
Merged
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
5 changes: 5 additions & 0 deletions nrfs/include/services/nrfs_temp.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define NRFS_TEMP_H

#include <internal/services/nrfs_temp.h>
#include <nrfs_config.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -16,7 +17,9 @@ extern "C" {
/** @brief Temperature service event types. */
typedef enum __NRFS_PACKED {
NRFS_TEMP_EVT_MEASURE_DONE, /** Temperature measurement done. */
#ifdef NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED
NRFS_TEMP_EVT_CHANGE, /** Temperature threshold crossed. */
#endif
NRFS_TEMP_EVT_REJECT, /** Request rejected. */
} nrfs_temp_evt_type_t;

Expand Down Expand Up @@ -58,6 +61,7 @@ void nrfs_temp_uninit(void);
*/
nrfs_err_t nrfs_temp_measure_request(void * p_context);

#ifdef NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED
/**
* @brief Function for subscribing to the temperature monitoring in Temperature service.
*
Expand Down Expand Up @@ -86,6 +90,7 @@ nrfs_err_t nrfs_temp_subscribe(uint16_t measure_rate_ms,
* @retval NRFS_ERR_IPC Backend returned error during request sending.
*/
nrfs_err_t nrfs_temp_unsubscribe(void);
#endif /* NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED */

/**
* @brief Function for converting the temperature value from raw data to Celsius scale.
Expand Down
7 changes: 4 additions & 3 deletions nrfs/src/services/nrfs_temp.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ void nrfs_temp_service_notify(void *p_notification, size_t size)
evt.type = NRFS_TEMP_EVT_MEASURE_DONE;
m_cb.handler(&evt, (void *)p_rsp->ctx.ctx);
break;

#ifdef NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED
case NRFS_TEMP_REQ_SUBSCRIBE:
evt.type = NRFS_TEMP_EVT_CHANGE;
m_cb.handler(&evt, (void *)p_rsp->ctx.ctx);
break;

#endif
default:
break;
}
Expand Down Expand Up @@ -75,7 +75,7 @@ nrfs_err_t nrfs_temp_measure_request(void *p_context)

return nrfs_backend_send(&req, sizeof(req));
}

#ifdef NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED
nrfs_err_t nrfs_temp_subscribe(uint16_t measure_rate_ms,
int32_t lower_threshold,
int32_t upper_threshold,
Expand Down Expand Up @@ -108,3 +108,4 @@ nrfs_err_t nrfs_temp_unsubscribe(void)

return nrfs_backend_send(&req, sizeof(req));
}
#endif /* NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED */