1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef NRFS_INTERNAL_TEMP_H
8 #define NRFS_INTERNAL_TEMP_H
9 
10 #include <internal/services/nrfs_generic.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 /** @brief Subscribe request data structure. */
17 typedef struct __NRFS_PACKED {
18 	uint16_t measure_rate_ms; /** Maximal acceptable time between subsequent temperature checks. */
19 	int32_t lower_threshold; /** Temperature lower threshold in a raw 2's complement signed format,
20 				   *  causing notification to be sent when crossed.
21 				   */
22 	int32_t upper_threshold; /** Temperature upper threshold in a raw 2's complement signed format,
23 				   *  causing notification to be sent when crossed.
24 				   */
25 } nrfs_temp_subscribe_data_t;
26 
27 /** @brief Temperature service notification data structure. */
28 typedef struct __NRFS_PACKED {
29 	int32_t raw_temp; /** Raw temperature in a 2's complement signed value representation. */
30 } nrfs_temp_rsp_data_t;
31 
32 /** @brief Temperature measure request structure. */
33 typedef struct __NRFS_PACKED {
34 	nrfs_hdr_t hdr; /**< Header of the message. */
35 	nrfs_ctx_t ctx; /**< Context of the message. */
36 } nrfs_temp_measure_t;
37 
38 /** @brief Subscribe request structure. */
39 typedef struct __NRFS_PACKED {
40 	nrfs_hdr_t hdr;			 /**< Header of the message. */
41 	nrfs_ctx_t ctx;			 /**< Context of the message. */
42 	nrfs_temp_subscribe_data_t data; /**< Data of the request. */
43 } nrfs_temp_subscribe_t;
44 
45 /** @brief Unsubscribe request structure. */
46 typedef struct __NRFS_PACKED {
47 	nrfs_hdr_t hdr; /**< Header of the message. */
48 	nrfs_ctx_t ctx; /**< Context of the message. */
49 } nrfs_temp_unsubscribe_t;
50 
51 /** @brief Temperature service notification structure. */
52 typedef struct __NRFS_PACKED {
53 	nrfs_hdr_t hdr;		   /**< Header of the message. */
54 	nrfs_ctx_t ctx;		   /**< Context of the message. */
55 	nrfs_temp_rsp_data_t data; /**< Data of the notification. */
56 } nrfs_temp_rsp_t;
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 
62 #endif /* NRFS_INTERNAL_TEMP_H */
63