libamxd  6.4.1
Data Model Manager
amxd_object_event.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** SPDX-License-Identifier: BSD-2-Clause-Patent
4 **
5 ** SPDX-FileCopyrightText: Copyright (c) 2023 SoftAtHome
6 **
7 ** Redistribution and use in source and binary forms, with or without modification,
8 ** are permitted provided that the following conditions are met:
9 **
10 ** 1. Redistributions of source code must retain the above copyright notice,
11 ** this list of conditions and the following disclaimer.
12 **
13 ** 2. Redistributions in binary form must reproduce the above copyright notice,
14 ** this list of conditions and the following disclaimer in the documentation
15 ** and/or other materials provided with the distribution.
16 **
17 ** Subject to the terms and conditions of this license, each copyright holder
18 ** and contributor hereby grants to those receiving rights under this license
19 ** a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable
20 ** (except for failure to satisfy the conditions of this license) patent license
21 ** to make, have made, use, offer to sell, sell, import, and otherwise transfer
22 ** this software, where such license applies only to those patent claims, already
23 ** acquired or hereafter acquired, licensable by such copyright holder or contributor
24 ** that are necessarily infringed by:
25 **
26 ** (a) their Contribution(s) (the licensed copyrights of copyright holders and
27 ** non-copyrightable additions of contributors, in source or binary form) alone;
28 ** or
29 **
30 ** (b) combination of their Contribution(s) with the work of authorship to which
31 ** such Contribution(s) was added by such copyright holder or contributor, if,
32 ** at the time the Contribution is added, such addition causes such combination
33 ** to be necessarily infringed. The patent license shall not apply to any other
34 ** combinations which include the Contribution.
35 **
36 ** Except as expressly stated above, no rights or licenses from any copyright
37 ** holder or contributor is granted under this license, whether expressly, by
38 ** implication, estoppel or otherwise.
39 **
40 ** DISCLAIMER
41 **
42 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
45 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
46 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
48 ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49 ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
51 ** USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 **
53 ****************************************************************************/
54 
55 #if !defined(__AMXD_OBJECT_EVENT_H__)
56 #define __AMXD_OBJECT_EVENT_H__
57 
58 #ifdef __cplusplus
59 extern "C"
60 {
61 #endif
62 
63 #include <stdint.h>
64 #include <amxd/amxd_types.h>
65 
123 void amxd_object_send_signal(amxd_object_t* const object,
124  const char* name,
125  amxc_var_t* const data,
126  bool trigger);
127 
143  const char* name,
144  amxc_var_t* const data) {
145  amxd_object_send_signal(object, name, data, false);
146 }
147 
163  const char* name,
164  amxc_var_t* const data) {
165  amxd_object_send_signal(object, name, data, true);
166 }
167 
216 void amxd_object_send_add_inst(amxd_object_t* instance, bool trigger);
217 
231  amxd_object_send_add_inst(instance, false);
232 }
233 
247  amxd_object_send_add_inst(instance, true);
248 }
249 
250 void amxd_object_send_del_object(amxd_object_t* object, bool trigger);
251 
304 void amxd_object_send_del_inst(amxd_object_t* instance, bool trigger);
318  amxd_object_send_del_object(instance, false);
319 }
320 
334  amxd_object_send_del_object(instance, true);
335 }
336 
383  amxc_var_t* params,
384  bool trigger);
385 
400  amxc_var_t* params) {
401  amxd_object_send_changed(object, params, false);
402 }
403 
418  amxc_var_t* params) {
419  amxd_object_send_changed(object, params, true);
420 }
421 
468  uint32_t sec);
469 
486 
488  amxc_var_t* const value,
489  amxd_dm_access_t access);
490 
511  const char* event_name,
512  amxc_var_t* event_data);
513 
534  const char* event_name);
535 
552 void amxd_object_remove_event(amxd_object_t* const object,
553  const char* event_name);
554 
571 amxc_var_t* amxd_object_new_event_data(const amxd_object_t* object,
572  const char* event_name);
573 
574 #ifdef __cplusplus
575 }
576 #endif
577 
578 #endif // __AMXD_OBJECT_EVENT_H__
579 
void amxd_object_send_del_object(amxd_object_t *object, bool trigger)
amxd_status_t amxd_object_describe_events(amxd_object_t *const object, amxc_var_t *const value, amxd_dm_access_t access)
enum _amxd_status amxd_status_t
#define AMXD_INLINE
Definition: amxd_types.h:66
enum _amxd_dm_access amxd_dm_access_t
Access level.
AMXD_INLINE void amxd_object_emit_add_inst(amxd_object_t *instance)
Emit an add instance object event.
AMXD_INLINE void amxd_object_trigger_changed(amxd_object_t *object, amxc_var_t *params)
Trigger an object changed event.
void amxd_object_remove_event(amxd_object_t *const object, const char *event_name)
Removes an event definition to the object.
void amxd_object_send_add_inst(amxd_object_t *instance, bool trigger)
Send an add instance object event.
AMXD_INLINE void amxd_object_emit_changed(amxd_object_t *object, amxc_var_t *params)
Emit an object changed event.
amxd_status_t amxd_object_add_event_ext(amxd_object_t *const object, const char *event_name, amxc_var_t *event_data)
Adds an event definition to the object.
AMXD_INLINE void amxd_object_trigger_signal(amxd_object_t *const object, const char *name, amxc_var_t *const data)
Emit an object signal/event.
amxd_status_t amxd_object_add_event(amxd_object_t *const object, const char *event_name)
Adds an event definition to the object.
void amxd_object_send_changed(amxd_object_t *object, amxc_var_t *params, bool trigger)
Send an object changed event.
amxc_var_t * amxd_object_new_event_data(const amxd_object_t *object, const char *event_name)
Allocates a variant that contains the predefined event data.
AMXD_INLINE void amxd_object_trigger_del_inst(amxd_object_t *instance)
Trigger a delete instance object event.
AMXD_INLINE void amxd_object_emit_signal(amxd_object_t *const object, const char *name, amxc_var_t *const data)
Emit an object signal/event.
amxd_status_t amxd_object_new_pi(amxd_object_t *object, uint32_t sec)
Creates and starts a periodic inform event timer.
void amxd_object_send_del_inst(amxd_object_t *instance, bool trigger)
Send a delete instance object event.
AMXD_INLINE void amxd_object_trigger_add_inst(amxd_object_t *instance)
Trigger an add instance object event.
amxd_status_t amxd_object_delete_pi(amxd_object_t *object)
Stops and deletes a periodic inform event timer.
AMXD_INLINE void amxd_object_emit_del_inst(amxd_object_t *instance)
Emit a delete instance object event.
void amxd_object_send_signal(amxd_object_t *const object, const char *name, amxc_var_t *const data, bool trigger)
Send an object signal/event.