remotivelabs.broker.sync
Synchronous connection to the remotiveBroker API.
Create a connection with the method remotivelabs.broker.sync.create_channel
.
For an example on how to use these we recommend looking at the samples for this library. Which is available at the repository remotiveLabs samples:
Link: https://github.com/remotivelabs/remotivelabs-samples/tree/main/python.
Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows::
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
Wrapper around protobuf generated class to make it a bit simpler to use to make us learn how we want the next version of the API to look like.
Use the signal.is_{type}() functions to validate type before you get value. Use signal.value() to get the actual value without any validation. Use signal.get_raw() to get the raw bytes Use signal.{type}_value() to get a validated typed value or error if something is wrong
Class for prepearing and writing signals via gRPC.
Get meta fields for signal or frame
Parameters
- name: Name of signal or frame
- namespace_name: Namespace for given signal or frame
Create object for signal.
Parameters
- name: Name of signal
- namespace_name: Namespace for signal
Get all frames in given namespace
Get frame for the given signal.
Parameters
- name: Name of signal
- namespace_name: Name of namespace
Returns
Protobuffer type for Signal
Common base class for all non-exit exceptions.
Inherited Members
- builtins.Exception
- Exception
- builtins.BaseException
- with_traceback
Create communication channels for gRPC calls.
Parameters
- url: URL to broker
- x_api_key: API key used with RemotiveBroker running in cloud (deprecated).
- authorization_token: Access token replacing api-keys moving forward.
Returns
gRPC channel
Publish array of values for signals
Parameters
- ClientId client_id: Named source for publisher
- NetworkServiceStub stub: Channel stub to send request
- Signal signals_with_payload: Array of signals with data
Debug printing of received array of signal with values.
Parameters
- signals: Array of signals with values
Calculate SHA256 for a file.
Parameters
- path: Path to file
Upload single file to internal storage on broker.
Parameters
- system_stub: System gRPC channel stub
- path: Path to file in local file system
- dest_path: Path to file in broker remote storage
Download file from Broker remote storage.
Parameters
- system_stub: System gRPC channel stub
- path: Path to file in broker remote storage
- dest_path: Path to file in local file system
Upload directory and its content to Broker remote storage.
Parameters
- system_stub: System gRPC channel stub
- folder: Path to directory in local file storage
Trigger reload of configuration on Broker.
Parameters
- system_stub: System gRPC channel stub
Check license to Broker. Throws exception if failure.
Parameters
- system_stub: System gRPC channel stub
Bind callback to be triggered when receiving any of the specified signals.
Parameters
- ClientId client_id: Named source for listener
- network_stub: Network gRPC channel stub
- sub_signals: List of signals to listen for
- on_change: Callback to be triggered
- fun: Callback for receiving signals update
- on_subscribed: Callback for successful subscription
Bind callback to be triggered when receiving any of the specified signals.
Parameters
- ClientId client_id: Named source for listener
- network_stub: Network gRPC channel stub
- script: Custom Lua mapping code
- on_change: Callback to be triggered
- fun: Callback for receiving signals update
- on_subscribed: Callback for successful subscription