stasis_app_device_state.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. #ifndef _ASTERISK_STASIS_APP_DEVICE_STATE_H
  19. #define _ASTERISK_STASIS_APP_DEVICE_STATE_H
  20. /*! \file
  21. *
  22. * \brief Stasis Application Device State API. See \ref res_stasis "Stasis
  23. * Application API" for detailed documentation.
  24. *
  25. * \author Kevin Harwell <kharwell@digium.com>
  26. * \since 12
  27. */
  28. #include "asterisk/app.h"
  29. #include "asterisk/stasis_app.h"
  30. /*! @{ */
  31. /*!
  32. * \brief Convert device state to json.
  33. *
  34. * \param name the name of the device
  35. * \param state the device state
  36. * \return JSON representation.
  37. * \return \c NULL on error.
  38. */
  39. struct ast_json *stasis_app_device_state_to_json(
  40. const char *name, enum ast_device_state state);
  41. /*!
  42. * \brief Convert device states to json array.
  43. *
  44. * \return JSON representation.
  45. * \return \c NULL on error.
  46. */
  47. struct ast_json *stasis_app_device_states_to_json(void);
  48. /*! Stasis device state application result codes */
  49. enum stasis_device_state_result {
  50. /*! Application controlled device state is okay */
  51. STASIS_DEVICE_STATE_OK,
  52. /*! The device name is not application controlled */
  53. STASIS_DEVICE_STATE_NOT_CONTROLLED,
  54. /*! The application controlled device name is missing */
  55. STASIS_DEVICE_STATE_MISSING,
  56. /*! The application controlled device is unknown */
  57. STASIS_DEVICE_STATE_UNKNOWN,
  58. /*! The application controlled device has subscribers */
  59. STASIS_DEVICE_STATE_SUBSCRIBERS
  60. };
  61. /*!
  62. * \brief Changes the state of a device controlled by ARI.
  63. *
  64. * \note The controlled device must be prefixed with 'Stasis:'.
  65. * \note Implicitly creates the device state.
  66. *
  67. * \param name the name of the ARI controlled device
  68. * \param value a valid device state value
  69. *
  70. * \return a stasis device state application result.
  71. */
  72. enum stasis_device_state_result stasis_app_device_state_update(
  73. const char *name, const char *value);
  74. /*!
  75. * \brief Delete a device controlled by ARI.
  76. *
  77. * \param name the name of the ARI controlled device
  78. *
  79. * \returna stasis device state application result.
  80. */
  81. enum stasis_device_state_result stasis_app_device_state_delete(
  82. const char *name);
  83. /*! @} */
  84. #endif /* _ASTERISK_STASIS_APP_DEVICE_STATE_H */