Nyx Node
Loading...
Searching...
No Matches
nyx.obj.NyxObject Class Reference

Base class for JSON Nyx objects. More...

Inheritance diagram for nyx.obj.NyxObject:

Public Member Functions

 __init__ (self, int ptr)
 Wraps a C JSON object pointer.
typing.Callable on (self, typing.Callable callback)
 Registers a callback triggered when clients modify this object.
bool notify (self)
 Notifies this Nyx / INDI object to the clients.
str to_string (self, bool json_string=True)
 Returns a string representing this JSON object.
NyxXMLDoc to_xmldoc (self)
 Converts this JSON Nyx / INDI command to the XML one.

Static Public Member Functions

NyxObject from_string (str string)
 Parses a JSON object from a string.

Detailed Description

Base class for JSON Nyx objects.

Definition at line 44 of file obj.py.

Constructor & Destructor Documentation

◆ __init__()

nyx.obj.NyxObject.__init__ ( self,
int ptr )

Wraps a C JSON object pointer.

Parameters
ptrJSON object pointer.

Definition at line 51 of file obj.py.

Member Function Documentation

◆ on()

typing.Callable nyx.obj.NyxObject.on ( self,
typing.Callable callback )

Registers a callback triggered when clients modify this object.

Parameters
callbackCallback triggered when clients modify this object.
Returns
The registered callback.
@prop.on
def on_changed(new_value, old_value):
...
@vector.on
def on_changed(modified):
...

Definition at line 161 of file obj.py.

◆ notify()

bool nyx.obj.NyxObject.notify ( self)

Notifies this Nyx / INDI object to the clients.

Returns
True if the object was notified, False otherwise.

Definition at line 215 of file obj.py.

◆ from_string()

NyxObject nyx.obj.NyxObject.from_string ( str string)
static

Parses a JSON object from a string.

Parameters
stringJSON string.
Returns
The new JSON object.

Definition at line 227 of file obj.py.

◆ to_string()

str nyx.obj.NyxObject.to_string ( self,
bool json_string = True )

Returns a string representing this JSON object.

Parameters
json_stringIf True, the resulting string is escaped.
Returns
A string that represents this JSON document.

Definition at line 239 of file obj.py.

◆ to_xmldoc()

NyxXMLDoc nyx.obj.NyxObject.to_xmldoc ( self)

Converts this JSON Nyx / INDI command to the XML one.

Returns
The corresponding XML Nyx / INDI command.

Definition at line 255 of file obj.py.


The documentation for this class was generated from the following file: