Asterisk - The Open Source Telephony Project GIT-master-7e7a603
stasis_app_device_state.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2013, Digium, Inc.
5 *
6 * Kevin Harwell <kharwell@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19#ifndef _ASTERISK_STASIS_APP_DEVICE_STATE_H
20#define _ASTERISK_STASIS_APP_DEVICE_STATE_H
21
22/*! \file
23 *
24 * \brief Stasis Application Device State API. See \ref res_stasis "Stasis
25 * Application API" for detailed documentation.
26 *
27 * \author Kevin Harwell <kharwell@digium.com>
28 * \since 12
29 */
30
31#include "asterisk/app.h"
32#include "asterisk/stasis_app.h"
33
34/*! @{ */
35
36/*!
37 * \brief Convert device state to json.
38 *
39 * \param name the name of the device
40 * \param state the device state
41 * \return JSON representation.
42 * \retval NULL on error.
43 */
45 const char *name, enum ast_device_state state);
46
47/*!
48 * \brief Convert device states to json array.
49 *
50 * \return JSON representation.
51 * \retval NULL on error.
52 */
54
55/*! Stasis device state application result codes */
57 /*! Application controlled device state is okay */
59 /*! The device name is not application controlled */
61 /*! The application controlled device name is missing */
63 /*! The application controlled device is unknown */
65 /*! The application controlled device has subscribers */
67};
68
69/*!
70 * \brief Changes the state of a device controlled by ARI.
71 *
72 * \note The controlled device must be prefixed with 'Stasis:'.
73 * \note Implicitly creates the device state.
74 *
75 * \param name the name of the ARI controlled device
76 * \param value a valid device state value
77 *
78 * \return a stasis device state application result.
79 */
81 const char *name, const char *value);
82
83/*!
84 * \brief Delete a device controlled by ARI.
85 *
86 * \param name the name of the ARI controlled device
87 *
88 * \return stasis device state application result.
89 */
91 const char *name);
92
93/*! @} */
94
95#endif /* _ASTERISK_STASIS_APP_DEVICE_STATE_H */
ast_device_state
Device States.
Definition: devicestate.h:52
static const char name[]
Definition: format_mp3.c:68
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
Stasis Application API. See Stasis Application API for detailed documentation.
enum stasis_device_state_result stasis_app_device_state_update(const char *name, const char *value)
Changes the state of a device controlled by ARI.
enum stasis_device_state_result stasis_app_device_state_delete(const char *name)
Delete a device controlled by ARI.
struct ast_json * stasis_app_device_states_to_json(void)
Convert device states to json array.
stasis_device_state_result
@ STASIS_DEVICE_STATE_SUBSCRIBERS
@ STASIS_DEVICE_STATE_NOT_CONTROLLED
@ STASIS_DEVICE_STATE_OK
@ STASIS_DEVICE_STATE_MISSING
@ STASIS_DEVICE_STATE_UNKNOWN
struct ast_json * stasis_app_device_state_to_json(const char *name, enum ast_device_state state)
Convert device state to json.
Abstract JSON element (object, array, string, int, ...).
int value
Definition: syslog.c:37