Skip to content

Commit a657948

Browse files
Rafal-Nordicanangl
authored andcommitted
nrfs: Disabling subscription in the temp service
Code optimization for platforms which don't use subscription feature in the temperature service Signed-off-by: Rafal Dyla <[email protected]>
1 parent 9e1bc32 commit a657948

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

nrfs/include/services/nrfs_temp.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#define NRFS_TEMP_H
99

1010
#include <internal/services/nrfs_temp.h>
11+
#include <nrfs_config.h>
1112

1213
#ifdef __cplusplus
1314
extern "C" {
@@ -16,7 +17,9 @@ extern "C" {
1617
/** @brief Temperature service event types. */
1718
typedef enum __NRFS_PACKED {
1819
NRFS_TEMP_EVT_MEASURE_DONE, /** Temperature measurement done. */
20+
#ifdef NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED
1921
NRFS_TEMP_EVT_CHANGE, /** Temperature threshold crossed. */
22+
#endif
2023
NRFS_TEMP_EVT_REJECT, /** Request rejected. */
2124
} nrfs_temp_evt_type_t;
2225

@@ -58,6 +61,7 @@ void nrfs_temp_uninit(void);
5861
*/
5962
nrfs_err_t nrfs_temp_measure_request(void * p_context);
6063

64+
#ifdef NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED
6165
/**
6266
* @brief Function for subscribing to the temperature monitoring in Temperature service.
6367
*
@@ -86,6 +90,7 @@ nrfs_err_t nrfs_temp_subscribe(uint16_t measure_rate_ms,
8690
* @retval NRFS_ERR_IPC Backend returned error during request sending.
8791
*/
8892
nrfs_err_t nrfs_temp_unsubscribe(void);
93+
#endif /* NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED */
8994

9095
/**
9196
* @brief Function for converting the temperature value from raw data to Celsius scale.

nrfs/src/services/nrfs_temp.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ void nrfs_temp_service_notify(void *p_notification, size_t size)
3535
evt.type = NRFS_TEMP_EVT_MEASURE_DONE;
3636
m_cb.handler(&evt, (void *)p_rsp->ctx.ctx);
3737
break;
38-
38+
#ifdef NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED
3939
case NRFS_TEMP_REQ_SUBSCRIBE:
4040
evt.type = NRFS_TEMP_EVT_CHANGE;
4141
m_cb.handler(&evt, (void *)p_rsp->ctx.ctx);
4242
break;
43-
43+
#endif
4444
default:
4545
break;
4646
}
@@ -75,7 +75,7 @@ nrfs_err_t nrfs_temp_measure_request(void *p_context)
7575

7676
return nrfs_backend_send(&req, sizeof(req));
7777
}
78-
78+
#ifdef NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED
7979
nrfs_err_t nrfs_temp_subscribe(uint16_t measure_rate_ms,
8080
int32_t lower_threshold,
8181
int32_t upper_threshold,
@@ -108,3 +108,4 @@ nrfs_err_t nrfs_temp_unsubscribe(void)
108108

109109
return nrfs_backend_send(&req, sizeof(req));
110110
}
111+
#endif /* NRFS_TEMP_SERVICE_SUBSCRIPTION_ENABLED */

0 commit comments

Comments
 (0)