10#include "../nyx_node_internal.h"
18 if(label == NULL || label[0] ==
'\0')
27 nyx_dict_set(result,
"<>", nyx_string_from_dup(
"defSwitch"));
29 nyx_dict_set(result,
"@name", nyx_string_from_dup(name));
30 nyx_dict_set(result,
"@label", nyx_string_from_dup(label));
32 nyx_dict_set(result,
"$", nyx_string_from_dup(nyx_onoff_to_str(value)));
45 return nyx_dict_set(prop,
"$", nyx_string_from_dup(nyx_onoff_to_str(value)));
52 return nyx_str_to_onoff(nyx_string_get((
nyx_string_t *) nyx_dict_get(prop,
"$")));
76 nyx_dict_set(result,
"<>", nyx_string_from_dup(
"defSwitchVector"));
78 nyx_dict_set(result,
"children", children);
82 nyx_dict_set(result,
"@client", nyx_string_from_dup(
"unknown"));
83 nyx_dict_set(result,
"@device", nyx_string_from_dup(device));
84 nyx_dict_set(result,
"@name", nyx_string_from_dup(name));
86 nyx_dict_set(result,
"@state", nyx_string_from_dup(nyx_state_to_str(state)));
87 nyx_dict_set(result,
"@perm", nyx_string_from_dup(nyx_perm_to_str(perm)));
88 nyx_dict_set(result,
"@rule", nyx_string_from_dup(nyx_rule_to_str(rule)));
92 internal_set_opts(result, opts);
96 for(; *props != NULL; props++) nyx_list_push(children, *props);
109 return internal_prop_to_set_vector(vector,
"setSwitchVector",
"oneSwitch");
#define STR_t
Alias for const char *.
bool nyx_switch_prop_set(nyx_dict_t *prop, nyx_onoff_t value)
Sets the new value of the provided property object.
nyx_onoff_t nyx_switch_prop_get(const nyx_dict_t *prop)
Gets the current value of the provided property object.
nyx_perm_t
Vector permission hint.
nyx_state_t
Vector state hint.
nyx_rule_t
Switch vector rule hint.
Struct describing a JSON dict object.
Struct describing a JSON list object.
Struct describing the options for INDI / Nyx vectors.
Struct describing a JSON string object.