![]() |
IOLink Python 1.11.0
|
Public Member Functions | |
| __init__ (self, *args, **kwargs) | |
| get_capabilities (self) | |
| support (self, flags) | |
| get_size (self) | |
| to_string (self) | |
| resize (self, newSize) | |
| write (self, offset, src) | |
| read (self, offset, dst) | |
| __repr__ (self) | |
Public Member Functions inherited from iolink.iolink.DataAccess | |
| get_storage (self) | |
| get_resource_id (self) | |
Properties | |
| thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") | |
| capabilities = property(get_capabilities, doc=get_capabilities.__doc__) | |
| size = property(get_size, doc=get_size.__doc__) | |
Properties inherited from iolink.iolink.DataAccess | |
| thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag") | |
| storage = property(get_storage, doc=get_storage.__doc__) | |
| resource_id = property(get_resource_id, doc=get_resource_id.__doc__) | |
Interface representing a generic array-like accessor. This interface capabilities are indicated by the RandomAccessCapabilitySet returned by the method RandomAccess::capabilities. Each capability enables the use of a specific set of methods. When one of those methods is called, if its corresponding capability is not supported, a NotImplemented exception will be thrown. See also: RandomAccessCapability for capabilities managed by this object
| iolink.iolink.RandomAccess.__init__ | ( | self, | |
| * | args, | ||
| ** | kwargs | ||
| ) |
Reimplemented from iolink.iolink.DataAccess.
| iolink.iolink.RandomAccess.__repr__ | ( | self | ) |
Reimplemented from iolink.iolink.DataAccess.
| iolink.iolink.RandomAccess.get_capabilities | ( | self | ) |
:rtype: :py:class:`RandomAccessCapabilitySet`
:return: capabilities for current RandomAccess
| iolink.iolink.RandomAccess.get_size | ( | self | ) |
Return the number of bytes of the resource accessed.
| iolink.iolink.RandomAccess.read | ( | self, | |
| offset, | |||
| dst | |||
| ) |
Read data from the accessor.
Accessor must have the READ capability to use this method.
Args:
offset (int): The index of the byte to start reading from.
dst (bytearray or int): The buffer where data should be read, or
when using the self-allocating mode, the numbers of bytes to read.
Returns:
When using classic mode, returns the number of bytes read.
When using self-allocating mode, return a bytes instance containing the
read data, its size should match the size given with argument dst.
Raises:
iolink.NotImplemented: if the accessor does not have the READ capability.
| iolink.iolink.RandomAccess.resize | ( | self, | |
| newSize | |||
| ) |
Resize content data.
Available when the RandomAccess has the RESIZE capability.
:type newSize: int
:param newSize: New size of data. Content of data is undefined after being resized.
| iolink.iolink.RandomAccess.support | ( | self, | |
| flags | |||
| ) |
Checks if the RandomAccess supports the given capabilities.
| iolink.iolink.RandomAccess.to_string | ( | self | ) |
Return a string representation
| iolink.iolink.RandomAccess.write | ( | self, | |
| offset, | |||
| src | |||
| ) |
Write content of src buffer into data.
Available when the RandomAccess has the WRITE capability.
:type offset: int
:param offset: Offset in byte to the beginning of write area
:type src: uint8_t
:param src: Source buffer. This buffer should have a size of "size"
:raises: exception if offset is out of range
:rtype: int
:return: Count of written bytes (can be zero or less than given size).