redvypr.devices.network.iored

Internet of Redvypr (iored) device

Multicast

The device provides a multicast based information of the datastreams provided by the redvypr host. It does also listens to multicasts from other redvypr hosts. If a info is received it is sent as a blank datapcket. The distribute_data/do_statistics functionality will add the remote device and host to the available datastreams and will create a datastream_changed signal. That signal is connected by iored and the display widget for an update of datastreams sent over multicast and displayed in the gui.

Zeromq pub/sub

The data that is published is a multipart packet:

  [b'test_device_0:redvypr@192.168.236.188::93328248922693-217', b't1675787270.261712', b'_redvypr:
device: test_device_0
devicemodulename: test_device
host:
  addr: 192.168.236.188
  hostname: redvypr
  local: true
  tstart: 1675787257.351031
  uuid: 93328248922693-217
numpacket: 4
t: 1675787257.50375

data: Hello World! t: 1675787257.50375 ‘]

The first part is the address of the device “test_device_0:redvypr@192.168.236.188::93328248922693-217”, the format is “’<device>:<host>@<addr>::<uuid>’” The second part the unix time as a string: “t1675787270.261712” The third part the data packet as a yaml string

How subscriptions work:

iored compares all subscriptions of this host with all online iored/redvyprs. If there is a match, the host will be subscribed.

The device infodata is a dictionary of this structure and is created by create_info_packet():

info_data = {'host': {'hostname': 'redvypr', 'tstart': 1677037052.8936212, 'addr': '192.168.178.26', 'uuid': '93328248922693-056', 'local': True}, 't': 1677037146.6887786, 'zmq_pub': 'tcp://192.168.178.26:18197', 'zmq_rep': 'tcp://192.168.178.26:18196', 'deviceinfo_all': {'iored_0': {'iored_0:redvypr@192.168.178.26::93328248922693-056': {'_redvypr': {'tag': {'93328248922693-056': 1}, 'device': 'iored_0', 'host': {'hostname': 'redvypr', 'tstart': 1677037052.8936212, 'addr': '192.168.178.26', 'uuid': '93328248922693-056', 'local': True}, 't': 1677037053.0344708, 'devicemodulename': 'iored', 'numpacket': 2}, 'datakeys': [], '_deviceinfo': {'subscribe': True, 'publish': True, 'devicemodulename': 'iored'}, '_keyinfo': {}}}, 'test_device_1': {'test_device_1:redvypr@192.168.178.26::93328248922693-056': {'_redvypr': {'tag': {'93328248922693-056': 1}, 'device': 'test_device_1', 'host': {'hostname': 'redvypr', 'tstart': 1677037052.8936212, 'addr': '192.168.178.26', 'uuid': '93328248922693-056', 'local': True}, 't': 1677037145.0688086, 'devicemodulename': 'test_device', 'numpacket': 144}, 'datakeys': ['data', 'count', 't'], '_deviceinfo': {'subscribe': False, 'publish': True, 'devicemodulename': 'test_device'}, '_keyinfo': {'data': {'unit': 'string', 'description': 'Some sentence sent'}, 'count': {'datatype': 'int', 'unit': 'count', 'description': 'Simple packetcount'}}}, 't2:redvypr@192.168.178.26::93328248922693-056': {'_redvypr': {'device': 't2', 'tag': {'93328248922693-056': 1}, 'host': {'hostname': 'redvypr', 'tstart': 1677037052.8936212, 'addr': '192.168.178.26', 'uuid': '93328248922693-056', 'local': True}, 't': 1677037145.0688086, 'devicemodulename': 'test_device', 'numpacket': 144}, 'datakeys': ['t', 'count'], '_deviceinfo': {}, '_keyinfo': {}}}}, 'hostinfo_opt': {'template_name': 'hostinfo_opt'}}

Functions

analyse_info_packet(datab)

Processes information packet from a redvypr instance.

connect_remote_host(remote_uuid, ...)

Connects to a remote iored by starting a thread :param remote_uuid:

create_datapacket_from_deviceinfo(device_info)

param redvypr_info:

create_info_packet(device_info, url_pub, url_rep)

Creates a binary information packet that is used to by iored to send the information about the redvypr instance.

create_info_packet_short(device_info, ...)

Creates a binary information packet that is used by iored to send the information about the redvypr instance.

create_stop_packet(device_info, url_pub, url_rep)

Creates a binary information packet to inform that the device is stopped :param device_info: :param url_pub: :param url_rep:

do_multicast(config, sock_multicast_recv, ...)

filter_deviceinfo(data)

Filters the deviceinfo_all data structure and removes devices that are not publishing :returns: data_filt dictionary with the devices filtered (at the moment if they publish)

process_host_information(redvypr_info, ...)

Save the hostinformation in hostinfo dictionary and creates/sends datapackages to the redvypr main task.

query_host(url, zmq_context[, timeout_ms])

Queries a host with url using a zmq req getinfo command :param url: str: address of the host, zmq rep url like tcp://localhost:18196

query_host_thread(urls[, timeout_ms, queryqueue])

A thread wrapper for query-host to be run as thread

start(device_info, config, dataqueue, ...)

param device_info:

start_zmq_reply(config, device_info, ...)

zeromq thread to reply for remote requests for information

start_zmq_sub(dataqueue, comqueue, ...)

zeromq thread for receiving data from a remote redvypr/iored host with a zmq.PUB socket.

zmq_publish_data(sock_zmq_pub, data[, ...])

Publishes data via sock_zmq_pub :param sock_zmq_pub: zmq publish socket :param data: redvypr data packet :param address_style: The style of the address that is used for subscription

Classes

Device(*args, **kwargs)

iored device

displayDeviceWidget(*args, **kwargs)