discovery module¶
-
class
vidhubcontrol.discovery.BMDDiscovery(mainloop, service_type='_blackmagic._tcp.local.')[source]¶ Bases:
vidhubcontrol.discovery.ListenerZeroconf listener for Blackmagic devices
-
vidhubs¶ Contains discovered Videohub devices. This
DictPropertycan be used to subscribe to changes.Type: dict
-
smart_views¶ Contains discovered SmartView devices. This
DictPropertycan be used to subscribe to changes.Type: dict
-
smart_scopes¶ Contains discovered SmartScope devices. This
DictPropertycan be used to subscribe to changes.Type: dict
-
-
class
vidhubcontrol.discovery.Listener(mainloop, service_type)[source]¶ Bases:
pydispatch.dispatch.DispatcherAn async zeroconf service listener
Allows async communication with
zeroconf.Zeroconfthroughasyncio.AbstractEventLoop.run_in_executor()calls.Parameters: - mainloop (
asyncio.BaseEventLoop) – asyncio event loop instance - service_type (str) – The fully qualified service type name to subscribe to
-
services¶ All services currently discovered as instances of
ServiceInfo. Stored usingServiceInfo.idas keysType: dict
-
message_queue¶ Used to communicate actions and events with instances of
MessageType: asyncio.Queue
-
published_services¶ Stores services that have been published using
publish_service()asServiceInfoinstances.Type: dict
-
coroutine
add_message(msg)[source]¶ Adds a message to the
message_queueParameters: msg ( Message) – Message to send
-
coroutine
publish_service(type_, port, name=None, addresses=None, properties=None, ttl=60)[source]¶ Publishes a service on the network
Parameters: - type (str) – Fully qualified service type
- port (int) – The service port
- name (str, optional) – Fully qualified service name. If not provided,
this will be generated from the
type_and the hostname detected byget_local_hostname() - addresses (optional) – If provided, an
iterableof IP addresses to publish. Can beipaddress.IPv4Addressor any type that can be parsed byipaddress.ip_address() - properties (dict, optional) – Custom properties for the service
- ttl (int, optional) – The TTL value to publish.
Defaults to
PUBLISH_TTL
-
coroutine
run()[source]¶ Main loop for communicating with
zeroconf.ZeroconfWaits for messages on the
message_queueand processes them. The loop will exit if an object placed on the queue is not an instance ofMessage.When the loop exits, the
zeroconf.Zeroconfinstance will be closed.
-
run_zeroconf()[source]¶ Starts
zeroconf.Zeroconfandzeroconf.ServiceBrowserinstancesThis is meant to be called inside of an
concurrent.futures.Executorand not used directly.
-
coroutine
start()[source]¶ Starts the service listener
Runs
zeroconf.Zeroconfin anExecutorinstance through asyncio.AbstractEventLoop.run_in_executor (seerun_zeroconf()).
-
stop_zeroconf()[source]¶ Closes the
zeroconf.ZeroconfinstanceThis is meant to be called inside of an
concurrent.futures.Executorand not used directly.
-
coroutine
unpublish_service(type_, port, name=None, addresses=None, properties=None)[source]¶ Removes a service published through
publish_service()Parameters: - type (str) – Fully qualified service type
- port (int) – The service port
- name (str, optional) – Fully qualified service name. If not provided,
this will be generated from the
type_and the hostname detected byget_local_hostname() - addresses (optional) – If provided, an
iterableof IP addresses to unpublish. Can beipaddress.IPv4Addressor any type that can be parsed byipaddress.ip_address() - properties (dict, optional) – Custom properties for the service
- mainloop (
-
class
vidhubcontrol.discovery.Message(info)[source]¶ Bases:
objectA message to communicate actions to and from
Listener-
info¶ The
ServiceInforelated to the message
Note
This class and its subclasses are not meant to be used directly. They are used internally in
Listenermethods.-
-
class
vidhubcontrol.discovery.ServiceInfo(**kwargs)[source]¶ Bases:
pydispatch.dispatch.DispatcherContainer for Zeroconf service information
Closely related to
zeroconf.ServiceInfo-
address¶ The service ip address
Type: ipaddress.IPv4Address
-
classmethod
from_zc_info(info)[source]¶ Creates an instance from a
zeroconf.ServiceInfoobjectParameters: info ( zeroconf.ServiceInfo) –Returns: An instance of ServiceInfo
-
update(other)[source]¶ Updates the
propertiesfrom anotherServiceInfoinstance
-