uniflex.core.broker.
Broker
(xpub='tcp://127.0.0.1:8990', xsub='tcp://127.0.0.1:8989')¶Bases: threading.Thread
docstring for Broker
run
()¶stop
()¶uniflex.core.common.
UniFlexThread
(module)¶Bases: object
docstring for UniFlexThread
is_running
()¶is_stopped
()¶start
()¶stop
()¶task
()¶uniflex.core.common.
get_inheritors
(klass)¶uniflex.core.common.
get_inheritors_set
(klass)¶uniflex.core.common.
get_ip_address
(ifname)¶uniflex.core.common.
is_func_implemented
(func)¶uniflex.core.common.
override
()¶with this decorator you make sure you are overriding a method form base class
uniflex.core.events.
AgentExitEvent
¶uniflex.core.events.
AgentStartEvent
¶uniflex.core.events.
BrokerDiscoveredEvent
(dlink, ulink)¶uniflex.core.events.
CommandEvent
(ctx)¶uniflex.core.events.
ConnectionEstablishedEvent
¶uniflex.core.events.
ConnectionLostEvent
¶uniflex.core.events.
EventBase
¶Bases: object
event cannot be parametrized, user may only start it once
uniflex.core.events.
ExceptionEvent
(dest, cmdDesc, msg)¶uniflex.core.events.
HelloMsgEvent
¶uniflex.core.events.
HelloTimeoutEvent
¶uniflex.core.events.
NewNodeEvent
¶uniflex.core.events.
NodeExitEvent
(reason)¶uniflex.core.events.
NodeLostEvent
(reason)¶uniflex.core.events.
ReturnValueEvent
(ctx, msg)¶Bases: uniflex.core.events.EventBase
to_string
()¶uniflex.core.events.
TimeEvent
¶Bases: uniflex.core.events.EventBase
docstring for TimeEvent
uniflex.core.exceptions.
AgentNotAvailable
(msg=None, **kwargs)¶Bases: uniflex.core.exceptions.UniFlexException
message
= 'agent %(id)s not available'¶uniflex.core.exceptions.
FunctionExecutionFailed
¶alias of FunctionExecutionFailedException
uniflex.core.exceptions.
FunctionExecutionFailedException
(msg=None, **kwargs)¶Bases: uniflex.core.exceptions.UniFlexException
message
= 'function %(func_name)s was not correctly executed; error msg: %(err_msg)s'¶uniflex.core.exceptions.
InvalidArgumentException
(msg=None, **kwargs)¶Bases: uniflex.core.exceptions.UniFlexException
message
= 'function %(func_name)s called with wrong arguments'¶uniflex.core.exceptions.
SchedulingFunctionCallsInThePastException
(msg=None, **kwargs)¶Bases: uniflex.core.exceptions.UniFlexException
message
= 'function %(func_name)s was scheduled in the past for execution'¶uniflex.core.exceptions.
UniFlexException
(msg=None, **kwargs)¶Bases: Exception
Base class for all exceptions.
message
= 'An unknown exception'¶uniflex.core.exceptions.
UnsupportedFunctionException
(msg=None, **kwargs)¶Bases: uniflex.core.exceptions.UniFlexException
message
= 'function %(func_name)s is not supportedby connector_module %(conn_module)s'¶uniflex.core.module_manager.
ModuleManager
(agent)¶Bases: object
add_module_obj
(moduleName, uniflexModule)¶exit
()¶get_event_handlers
(ev, state=None)¶get_module_by_uuid
(uuid)¶my_import
(module_name)¶register_event_handlers
(i)¶register_module
(moduleName, pyModuleName, className, device=None, kwargs={})¶send_cmd_event
(event, dstNode)¶send_event
(event, dstNode=None)¶send_event_locally
(event)¶send_event_outside
(event, dstNode=None)¶serve_event_msg
(event)¶serve_event_queue
()¶start
()¶subscribe_for_event
(i)¶uniflex.core.module_proxy.
ApplicationProxy
¶Bases: uniflex.core.module_proxy.ModuleProxy
docstring for ApplicationProxy
is_running
()¶Check if remote control application is running. Returns True if remote app is running; otherwise False
send_event
(event)¶Send event to remote application in unicast mode. Node: event will be delivered only if remote application subscribe for it. Returns True if succeeded; otherwise False
start
()¶Start remote control application. Returns True if succeeded; otherwise False
stop
()¶Stop remote control application. Returns True if succeeded; otherwise False
subscribe_for_events
(eventType, callback)¶Subscribe for events of given type generated in remote control application. If event type is not given, subscribe for all events generated in remote control application. The callback function will be called on reception of event. Returns True if succeeded; otherwise False
unsubscribe_from_events
(eventType)¶Unsubscribe from events of given type generated in remote control application. If event type is not given unsubscribe from all events generated in remote control application. Returns True if succeeded; otherwise False
uniflex.core.module_proxy.
DeviceProxy
¶uniflex.core.module_proxy.
ModuleProxy
¶Bases: object
blocking
(value=True)¶callback
(callback)¶Execute operation of device in non-blocking mode and register callback function that will be called upon reception of return value from operation. If callbackFunction is not defined operation will be executed in non-blocking mode. Returns the same ModuleProxy object -> function chaning. Example: device.callback(myCallback).set_channel(11).
cmd_wrapper
(ftype, fname, *args, **kwargs)¶delay
(delay)¶Delay execution of operation by given amount of time. It will result in non-blocking call. Use callback function to register callback. Returns the same ModuleProxy object -> function chaning. Example: device.delay(5s).set_channel(11).
exec_time
(exec_time, interval=None, repetitionNum=None)¶Schedule execution of operation in remote device module. It will result in non-blocking call. Use callback function to register callback. Absolute time is UNIX time. Returns the same ModuleProxy object -> function chaning. Example: device.exec_time(execTime).set_channel(11).
generate_call_id
()¶get_name_string
(event)¶is_func_supported
(ftype, fName)¶send_cmd_event
(ctx)¶send_event
(event)¶subscribe_for_events
(eventType, callback)¶Subscribe for events of given type generated in remote device module. If event type is not given, subscribe for all events generated in remote device module. The callback function will be called on reception of event. Returns True if succeeded; otherwise False
timeout
(value)¶unsubscribe_from_events
(eventType)¶Unsubscribe from events of given type generated in remote device module. If event type is not given unsubscribe from all events generated in remote device module. Returns True if succeeded; otherwise False
uniflex.core.module_proxy.
ProtocolProxy
¶Bases: uniflex.core.module_proxy.ModuleProxy
docstring for ProtocolProxy
uniflex.core.modules.
ApplicationModule
¶uniflex.core.modules.
ControlApplication
¶Bases: uniflex.core.modules.UniFlexModule
get_local_node
()¶Get NodeProxy object for local node , i.e. the one that runs Application. Returns NodeProxy object.
get_node
(idx)¶get_node_by_hostname
(hostname)¶get_node_by_uuid
(uuid)¶get_nodes
()¶subscribe_for_events
(eventType, callback, mode)¶Subscribe for events of specific type using one of two modes: - node-broadcast — subscribe for events of specific type generated on local node - global-broadcast – subscribe for events of specific type generated at any node in network The callback function will be called on reception of event. Note: If event type is not specified, application subscribes for events of all types. Returns True if succeeded; otherwise False
unsubscribe_from_events
(eventType)¶Unsubscribe from event from specific type. If event type is not given, unsubscribe from all event types. Returns True if succeeded; otherwise False
uniflex.core.modules.
CoreModule
¶uniflex.core.modules.
DeviceModule
¶uniflex.core.modules.
ModuleWorker
(module)¶Bases: threading.Thread
add_task
(func, event)¶run
()¶stop
()¶uniflex.core.modules.
ProtocolModule
¶uniflex.core.modules.
UniFlexModule
¶Bases: object
get_device
()¶get_functions
()¶get_in_events
()¶get_out_events
()¶send_event
(event, dstNode=None)¶Sent event using one of two modes: nodebroadcast and global-broadcast. Returns True if succeeded; otherwise False
set_agent
(agent)¶set_module_manager
(mm)¶uniflex.core.modules.
after_call
(func)¶uniflex.core.modules.
before_call
(func)¶uniflex.core.modules.
on_event
(ev_cls, dispatchers=None)¶uniflex.core.modules.
on_first_call_to_module
()¶uniflex.core.node.
Node
(uuid)¶Bases: object
add_module_proxy
(module)¶create_node_from_msg
(msg)¶get_control_application
(uuid)¶Get Control Application proxy object by its UUID. Returns ControlApplicationProxy object.
get_control_applications
()¶Get proxy objects for all control
applications installed in remote node. Returns list of ControlApplicationProxy objects.
get_device
(devId)¶get_device_by_name
(name)¶get_device_by_uuid
(uuid)¶Get Device Module proxy object by its UUID. Returns DeviceModuleProxy object.
get_devices
()¶Get proxy objects for all device modules installed in remote node. Returns list of Device Module Proxy objects
get_module_by_uuid
(uuid)¶Get Module proxy object by its UUID. Returns ModuleProxy object.
get_modules
()¶Get proxy objects for all modules installed in remote node. Returns list of Module Proxy objects
get_protocol
(uuid)¶Get Protocol Module proxy object by its UUID. Returns ProtocolModuleProxy object.
get_protocols
()¶Get proxy objects for all protocol modules installed in remote node. Returns list of Protocol Module Proxy objects.
get_time
()¶Get time of remote node. Returns UNIX time of remote node.
get_time_synchronization_accuracy
()¶Get time synchronization accuracy. Returns time synchronization accuracy in milliseconds.
get_time_synchronization_source
()¶Get time synchronization source of remote node. Note: we need to check if remote node synchronizes with the same source as application’s local node. Returns name of synchronization source
is_synchronizing
()¶Check if remote node is synchronizing with some time server. Returns True is remote node runs time synchronization process; False otherwise
send_cmd_event
(event)¶send_event
(event)¶Send event to remote node in node-broadcast mode, i.e. event is delivered to node and broadcasted to all subscribed Control Applications. Returns True if succeeded; otherwise False
subscribe_for_events
(eventType, callback)¶Subscribe for events of given type generated in remote node. If event type is not given, subscribe for all events generated in remote node. The callback function will be called on reception of event. Returns True if succeeded; otherwise False
unsubscribe_from_events
(eventType)¶Unsubscribe from events of given type generated in remote node. If event type is not given unsubscribe from all events generated in remote node. Returns True if succeeded; otherwise False
uniflex.core.node_manager.
NodeManager
(agent)¶Bases: object
create_local_node
(agent)¶get_local_node
()¶get_node_by_uuid
(uuid)¶notify_new_node_event
(node)¶notify_node_exit
()¶remove_node_hello_timer
(node)¶send_event_cmd
(event, dstNode)¶send_hello_msg
(timeout=10)¶send_node_add_notification
(dest)¶send_node_info
(dest=None)¶send_node_info_request
(dest=None)¶serve_hello_msg
(msgContainer)¶serve_node_add_notification
(msgContainer)¶serve_node_exit_msg
(msgContainer)¶serve_node_info_msg
(msgContainer)¶uniflex.core.timer.
Timer
(handler_)¶Bases: object
cancel
()¶is_running
()¶start
(interval)¶interval is in seconds
uniflex.core.timer.
TimerEventSender
(app, ev_cls)¶Bases: uniflex.core.timer.Timer
uniflex.core.transport_channel.
HelloMsgTimeoutEvent
¶uniflex.core.transport_channel.
SendHelloMsgTimeEvent
¶uniflex.core.transport_channel.
TransportChannel
(agent)¶Bases: uniflex.core.modules.CoreModule
connect
(xpub_url, xsub_url)¶connect_to_broker
(event)¶connection_with_broker_lost
(event)¶disconnect
()¶process_msgs
(msgContainer)¶recv_msgs
()¶send
(msgContainer)¶send_event_outside
(event, dstNode=None)¶send_hello_msg
(event)¶set_downlink
(xpub_url)¶set_uplink
(xsub_url)¶start_module
()¶stop_module
()¶subscribe_to
(topic)¶