caspia.meadow.client package

Submodules

caspia.meadow.client.browser module

class caspia.meadow.client.browser.ServiceBrowser(host=None, connection=None, loop=None, lookup=None, name=None)[source]

Bases: object

UPDATE_DELAY = 0.1
add_services_update_hook(func: Callable[[Set[caspia.meadow.services.base.ServiceBase], Set[caspia.meadow.services.base.ServiceBase]], None])[source]

Register given hook to be called on every services updated.

Example:

async def my_func(added_services, removed_services):
    print(added_services, removed_services)

browser.add_services_update_hook(my_func)
gateway_of(service) → Optional[str][source]

Name of gateway broadcasting given service (or None).

property gateways

Broadcasted gateways within meadow.

property lookup

Lookup object holding all known services.

async prepare()[source]
property services

Broadcasted services within meadow.

caspia.meadow.client.consumer module

class caspia.meadow.client.consumer.ServiceConsumerMixin(*args, **kwargs)[source]

Bases: object

async characteristic_read(characteristic, timeout=1.0, **_)[source]
async characteristic_subscribe(characteristic, on_value, on_error=None)[source]
async characteristic_write(characteristic, value, extra, timeout=1.0, **_)[source]
async enable_notifications()[source]

Receive notifications for all characteristics related to this service.

property meadow_connection
async on_gateways_update(gateways)[source]
caspia.meadow.client.consumer.get_class(service_type)[source]
caspia.meadow.client.consumer.is_consumer_service(service)[source]

caspia.meadow.client.gateway module

class caspia.meadow.client.gateway.Gateway(name, broker_url=None, connection=None, services=None, loop=None)[source]

Bases: object

add(services: Iterable[Union[GatewayServiceMixin, caspia.meadow.services.ServiceBase]], update_immediately=False)[source]

Register service(s) for the gateway.

property busy
property connection
async on_gateway_registered()[source]
async prepare()[source]
remove(services: Iterable[Union[GatewayServiceMixin, caspia.meadow.services.ServiceBase]], update_immediately=False)[source]

Remove service(s) from the gateway.

property services

All registered services for the gateway.

class caspia.meadow.client.gateway.ServiceGatewayMixin(*args, **kwargs)[source]

Bases: object

attach(connection)[source]
property attached
characteristic_cached_read(characteristic)[source]
characteristic_cached_write(characteristic, value_and_meta)[source]
async characteristic_read(characteristic, **kwargs)[source]
async characteristic_write(characteristic, value, **kwargs)[source]
detach()[source]
async notify(characteristic, value, if_changed=False, extra=None)[source]
async published()[source]
caspia.meadow.client.gateway.characteristic_read_handler(characteristic_name: str)[source]
caspia.meadow.client.gateway.characteristic_write_handler(characteristic_name: str)[source]

Module contents