nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
nrf_cloud_alert.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NRF_CLOUD_ALERT_H_
8#define NRF_CLOUD_ALERT_H_
9
14#include <zephyr/kernel.h>
15#include <math.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
22
24#define NRF_CLOUD_ALERT_UNUSED_VALUE NAN
25
52};
53
59 float value;
61 const char *description;
63 unsigned int sequence;
67 int64_t ts_ms;
68};
69
81#if defined(CONFIG_NRF_CLOUD_ALERT) || defined(__DOXYGEN__)
82int nrf_cloud_alert_send(enum nrf_cloud_alert_type type, float value, const char *description);
83#else
84static inline int nrf_cloud_alert_send(enum nrf_cloud_alert_type type, float value,
85 const char *description)
86{
87 return 0;
88}
89#endif /* CONFIG_NRF_CLOUD_ALERT */
90
104#if defined(CONFIG_NRF_CLOUD_ALERT) || defined(__DOXYGEN__)
106 const char *const device_id,
107 enum nrf_cloud_alert_type type,
108 float value,
109 const char *description);
110#else
111static inline int nrf_cloud_rest_alert_send(struct nrf_cloud_rest_context *const rest_ctx,
112 const char *const device_id,
113 enum nrf_cloud_alert_type type,
114 float value,
115 const char *description)
116{
117 return 0;
118}
119#endif /* CONFIG_NRF_CLOUD_ALERT */
120
126void nrf_cloud_alert_control_set(bool alerts_enable);
127
135
138#ifdef __cplusplus
139#endif
140
141#endif /* NRF_CLOUD_ALERT_H_ */
int nrf_cloud_rest_alert_send(struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, enum nrf_cloud_alert_type type, float value, const char *description)
Transmit the specified alert to nRF Cloud using REST.
int nrf_cloud_alert_send(enum nrf_cloud_alert_type type, float value, const char *description)
Transmit the specified alert to nRF Cloud using MQTT or CoAP.
void nrf_cloud_alert_control_set(bool alerts_enable)
Enable or disable use of alerts.
bool nrf_cloud_alert_control_get(void)
Find out if alerts are enabled.
nrf_cloud_alert_type
Alert type.
Definition: nrf_cloud_alert.h:31
@ ALERT_TYPE_TEMPERATURE
Definition: nrf_cloud_alert.h:43
@ ALERT_TYPE_DEVICE_GOING_OFFLINE
Definition: nrf_cloud_alert.h:39
@ ALERT_TYPE_CUSTOM
Definition: nrf_cloud_alert.h:51
@ ALERT_TYPE_HUMIDITY
Definition: nrf_cloud_alert.h:45
@ ALERT_TYPE_NONE
Definition: nrf_cloud_alert.h:33
@ ALERT_TYPE_MSG
Definition: nrf_cloud_alert.h:41
@ ALERT_TYPE_DEVICE_NOW_ONLINE
Definition: nrf_cloud_alert.h:35
@ ALERT_TYPE_BATTERY
Definition: nrf_cloud_alert.h:47
@ ALERT_TYPE_DEVICE_NOW_ONLINE_WDT
Definition: nrf_cloud_alert.h:37
@ ALERT_TYPE_SHOCK
Definition: nrf_cloud_alert.h:49
float value
Definition: nrf_cloud_alert.h:59
unsigned int sequence
Definition: nrf_cloud_alert.h:63
const char * description
Definition: nrf_cloud_alert.h:61
int64_t ts_ms
Definition: nrf_cloud_alert.h:67
enum nrf_cloud_alert_type type
Definition: nrf_cloud_alert.h:57
Alert data.
Definition: nrf_cloud_alert.h:55
Parameters and data for using the nRF Cloud REST API.
Definition: nrf_cloud_rest.h:58