Skip to content

hololinked.client.abstractions.ConsumedThingProperty

Source code in hololinked\client\abstractions.py
class ConsumedThingProperty:

    __slots__ = ['_resource', '_schema_validator', '__name__', '__qualname__', '__doc__']   

    # property get set abstraction
    # Dont add doc otherwise __doc__ in slots will conflict with class variable

    def __init__(self, 
                resource: PropertyAffordance, 
                **kwargs
            ) -> None:
        """
        Parameters
        ----------
        resource: PropertyAffordance
            dataclass object representing the property
        """
        self._resource = resource

    @property # i.e. cannot have setter
    def last_read_value(self) -> typing.Any:
        """cache of last read value"""
        raise NotImplementedError("implement last_read_value per protocol")

    def set(self, value: typing.Any) -> None:
        """
        Set or write property value.

        Parameters
        ----------
        value: typing.Any
            value to set
        """
        raise NotImplementedError("implement property set per protocol")

    def get(self) -> typing.Any:
        """
        Get or read property value.

        Returns
        -------
        typing.Any
            property value
        """
        raise NotImplementedError("implement property get per protocol")

    async def async_set(self, value: typing.Any) -> None:
        """
        Async set property value - asynchronous at the network level, may not necessarily be at the server level.

        Parameters
        ----------
        value: typing.Any
            value to set
        """
        raise NotImplementedError("implement async property set per protocol")

    async def async_get(self) -> typing.Any:
        """
        Async get or read property value.

        Returns
        -------
        typing.Any
            property value
        """
        raise NotImplementedError("implement async property get per protocol")

    def noblock_get(self) -> str:
        """
        Get or read property value without blocking, i.e. collect it later as the method returns immediately.

        Returns
        -------
        str
            id of the request or message (UUID4 as string)
        """
        raise NotImplementedError("implement property noblock get per protocol")

    def noblock_set(self, value: typing.Any) -> str:
        """
        Set property value without blocking, i.e. collect aknowledgement later as the method returns immediately

        Parameters
        ----------
        value: typing.Any
            value to set

        Returns
        -------
        str
            id of the request or message (UUID4 as string)
        """
        raise NotImplementedError("implement property noblock set per protocol")

    def oneway_set(self, value: typing.Any) -> None:
        """
        Set property value without waiting for acknowledgement. The server also does not send any reply.

        Parameters
        ----------
        value: typing.Any
            value to set
        """
        raise NotImplementedError("implement property oneway set per protocol")

    def observe(self, *callbacks: typing.Callable) -> None:
        """
        Observe property value changes

        Parameters
        ----------
        *callbacks: typing.Callable
            callback to call when property value changes
        """
        raise NotImplementedError("implement property observe per protocol")

    def unobserve(self) -> None:
        """Stop observing property value changes"""
        raise NotImplementedError("implement property unobserve per protocol")

Functions

__init__

__init__(resource: PropertyAffordance, **kwargs) -> None

Parameters:

Name Type Description Default

resource

PropertyAffordance

dataclass object representing the property

required
Source code in hololinked\client\abstractions.py
def __init__(self, 
            resource: PropertyAffordance, 
            **kwargs
        ) -> None:
    """
    Parameters
    ----------
    resource: PropertyAffordance
        dataclass object representing the property
    """
    self._resource = resource

set

set(value: typing.Any) -> None

Set or write property value.

Parameters:

Name Type Description Default

value

Any

value to set

required
Source code in hololinked\client\abstractions.py
def set(self, value: typing.Any) -> None:
    """
    Set or write property value.

    Parameters
    ----------
    value: typing.Any
        value to set
    """
    raise NotImplementedError("implement property set per protocol")

get

get() -> typing.Any

Get or read property value.

Returns:

Type Description
Any

property value

Source code in hololinked\client\abstractions.py
def get(self) -> typing.Any:
    """
    Get or read property value.

    Returns
    -------
    typing.Any
        property value
    """
    raise NotImplementedError("implement property get per protocol")

async_get async

async_get() -> typing.Any

Async get or read property value.

Returns:

Type Description
Any

property value

Source code in hololinked\client\abstractions.py
async def async_get(self) -> typing.Any:
    """
    Async get or read property value.

    Returns
    -------
    typing.Any
        property value
    """
    raise NotImplementedError("implement async property get per protocol")

async_set async

async_set(value: typing.Any) -> None

Async set property value - asynchronous at the network level, may not necessarily be at the server level.

Parameters:

Name Type Description Default

value

Any

value to set

required
Source code in hololinked\client\abstractions.py
async def async_set(self, value: typing.Any) -> None:
    """
    Async set property value - asynchronous at the network level, may not necessarily be at the server level.

    Parameters
    ----------
    value: typing.Any
        value to set
    """
    raise NotImplementedError("implement async property set per protocol")

noblock_set

noblock_set(value: typing.Any) -> str

Set property value without blocking, i.e. collect aknowledgement later as the method returns immediately

Parameters:

Name Type Description Default

value

Any

value to set

required

Returns:

Type Description
str

id of the request or message (UUID4 as string)

Source code in hololinked\client\abstractions.py
def noblock_set(self, value: typing.Any) -> str:
    """
    Set property value without blocking, i.e. collect aknowledgement later as the method returns immediately

    Parameters
    ----------
    value: typing.Any
        value to set

    Returns
    -------
    str
        id of the request or message (UUID4 as string)
    """
    raise NotImplementedError("implement property noblock set per protocol")

noblock_get

noblock_get() -> str

Get or read property value without blocking, i.e. collect it later as the method returns immediately.

Returns:

Type Description
str

id of the request or message (UUID4 as string)

Source code in hololinked\client\abstractions.py
def noblock_get(self) -> str:
    """
    Get or read property value without blocking, i.e. collect it later as the method returns immediately.

    Returns
    -------
    str
        id of the request or message (UUID4 as string)
    """
    raise NotImplementedError("implement property noblock get per protocol")

oneway_set

oneway_set(value: typing.Any) -> None

Set property value without waiting for acknowledgement. The server also does not send any reply.

Parameters:

Name Type Description Default

value

Any

value to set

required
Source code in hololinked\client\abstractions.py
def oneway_set(self, value: typing.Any) -> None:
    """
    Set property value without waiting for acknowledgement. The server also does not send any reply.

    Parameters
    ----------
    value: typing.Any
        value to set
    """
    raise NotImplementedError("implement property oneway set per protocol")