lightduer_interactive_class.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /**
  2. * Copyright (2017) Baidu Inc. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * File: lightduer_interactive_class.h
  18. * Auth: Chen Xihao (chenxihao@baidu.com)
  19. * Desc: Interactive class APIs.
  20. */
  21. #ifndef BAIDU_DUER_LIGHTDUER_INCLUDE_LIGHTDUER_INTERACTIVE_CLASS_H
  22. #define BAIDU_DUER_LIGHTDUER_INCLUDE_LIGHTDUER_INTERACTIVE_CLASS_H
  23. #include <stdbool.h>
  24. #include "baidu_json.h"
  25. #include "lightduer_types.h"
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. typedef struct duer_interactive_class_handler_s {
  30. duer_status_t (*handle_control_light)(bool on);
  31. duer_status_t (*handle_notice)(baidu_json *payload);
  32. } duer_interactive_class_handler_t;
  33. /**
  34. * DESC:
  35. * Init interactive class.
  36. *
  37. * PARAM: none
  38. *
  39. * @RETURN: none.
  40. */
  41. void duer_interactive_class_init(void);
  42. /**
  43. * DESC:
  44. * Open interactive class.
  45. *
  46. * PARAM: none
  47. *
  48. * @RETURN: success return DUER_OK, failed return DUER_ERR_FAILED.
  49. */
  50. duer_status_t duer_interactive_class_open(void);
  51. /**
  52. * DESC:
  53. * Close interactive class.
  54. *
  55. * PARAM: none
  56. *
  57. * @RETURN: success return DUER_OK, failed return DUER_ERR_FAILED.
  58. */
  59. duer_status_t duer_interactive_class_close(void);
  60. /**
  61. * DESC:
  62. * Whether interactive class is living.
  63. *
  64. * PARAM: none
  65. *
  66. * @RETURN: living return true, not return false.
  67. */
  68. bool duer_interactive_class_is_living(void);
  69. /**
  70. * DESC:
  71. * Set the handler to handle callbacks, such as control light, handle notice
  72. *
  73. * PARAM: handler, the point of handler defined by user
  74. *
  75. * @RETURN: none.
  76. */
  77. void duer_interactive_class_set_handler(duer_interactive_class_handler_t *handler);
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif /* BAIDU_DUER_LIGHTDUER_INCLUDE_LIGHTDUER_INTERACTIVE_CLASS_H */