ctrlX Data Layer API for Python  3.3.0
The ctrlX Data Layer API allows access to the ctrlX Data Layer with Python
Client Class Reference

Public Member Functions

def __init__ (self, C_DLR_CLIENT c_client)
 
def __enter__ (self)
 
def __exit__ (self, exc_type, exc_val, exc_tb)
 
Result browse_async (self, str address, ResponseCallback cb, userData_c_void_p userdata=None)
 
def browse_sync (self, str address)
 
def close (self)
 
Result create_async (self, str address, Variant data, ResponseCallback cb, userData_c_void_p userdata=None)
 
def create_bulk (self)
 
def create_subscription_async (self, Variant prop, ctrlxdatalayer.subscription.ResponseNotifyCallback cnb, ResponseCallback cb, userData_c_void_p userdata=None)
 
def create_subscription_sync (self, Variant prop, ctrlxdatalayer.subscription.ResponseNotifyCallback cnb, userData_c_void_p userdata=None)
 
def create_sync (self, str address, Variant data)
 
str get_auth_token (self)
 
def get_handle (self)
 
def get_token (self)
 
bool is_connected (self)
 
Result metadata_async (self, str address, ResponseCallback cb, userData_c_void_p userdata=None)
 
def metadata_sync (self, str address)
 
Result ping_async (self, ResponseCallback cb, userData_c_void_p userdata=None)
 
Result ping_sync (self)
 
Result read_async (self, str address, ResponseCallback cb, userData_c_void_p userdata=None)
 
Result read_async_args (self, str address, Variant args, ResponseCallback cb, userData_c_void_p userdata=None)
 
def read_json_sync (self, Converter conv, str address, int indent, Variant data=None)
 
def read_sync (self, str address)
 
def read_sync_args (self, str address, Variant args)
 
Result remove_async (self, str address, ResponseCallback cb, userData_c_void_p userdata=None)
 
Result remove_sync (self, str address)
 
def set_auth_token (self, str token)
 
Result set_timeout (self, TimeoutSetting timeout, int value)
 
Result write_async (self, str address, Variant data, ResponseCallback cb, userData_c_void_p userdata=None)
 
def write_json_sync (self, Converter conv, str address, str json)
 
def write_sync (self, str address, Variant data)
 

Detailed Description

Client interface for accessing data from the system.

Hint see python context manager for instance handling

Definition at line 61 of file client.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
C_DLR_CLIENT  c_client 
)

Member Function Documentation

◆ browse_async()

Result browse_async (   self,
str  address,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Browse an object.

This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function.

Parameters
[in]addressAddress of the node to browse
[in]callbackCallback to call when function is finished
[in]userdataUser data - will be returned in callback as userdata. You can use this userdata to identify your request
Returns
<Result> status of function call

Definition at line 337 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, ProviderNode.__create_callback(), Client.__create_callback(), and Client.__token.

◆ browse_sync()

def browse_sync (   self,
str  address 
)

Browse an object.

This function is synchronous: It will wait for the answer.

Parameters
[in]addressAddress of the node to browse
Returns
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, Children of the node. Data will be provided as Variant array of strings.

Definition at line 227 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

◆ create_async()

Result create_async (   self,
str  address,
Variant  data,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Create an object.

This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function.

Parameters
[in]addressAddress of the node to create object in
[in]dataData of the object
[in]callbackCallback to call when function is finished
[in]userdataUser data - will be returned in callback as userdata. You can use this userdata to identify your request
Returns
<Result> status of function call

Definition at line 305 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, ProviderNode.__create_callback(), Client.__create_callback(), and Client.__token.

◆ create_bulk()

def create_bulk (   self)

Setup a bulk object.

Returns
Bulk Bulk object

Definition at line 513 of file client.py.

◆ create_subscription_async()

def create_subscription_async (   self,
Variant  prop,
ctrlxdatalayer.subscription.ResponseNotifyCallback  cnb,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Set up a subscription.

Parameters
[in]rulesetVariant that describe ruleset of subscription as subscription.fbs
[in]publishCallbackCallback to call when new data is available
[in]userdataUser data - will be returned in publishCallback as userdata. You can use this userdata to identify your subscription
Returns
<Result>, status of function cal

Definition at line 442 of file client.py.

◆ create_subscription_sync()

def create_subscription_sync (   self,
Variant  prop,
ctrlxdatalayer.subscription.ResponseNotifyCallback  cnb,
userData_c_void_p   userdata = None 
)

Set up a subscription.

Parameters
[in]rulesetVariant that describe ruleset of subscription as subscription.fbs
[in]publishCallbackCallback to call when new data is available
[in]userdataUser data - will be returned in publishCallback as userdata. You can use this userdata to identify your subscription
Returns
<Result>, status of function cal

Definition at line 426 of file client.py.

◆ create_sync()

def create_sync (   self,
str  address,
Variant  data 
)

Create an object.

This function is synchronous: It will wait for the answer.

Parameters
[in]addressAddress of the node to create object in
[in]variantData of the object
Returns
tuple (Result, Variant)
<Result>, status of function call
<Variant>, variant result of write

Definition at line 204 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

◆ get_auth_token()

str get_auth_token (   self)

returns persistent security access token for authentication

Returns
<str> security access token for authentication

Definition at line 183 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

◆ is_connected()

bool is_connected (   self)

returns whether provider is connected

Returns
<bool> status of connection

Definition at line 165 of file client.py.

References SubscriptionAsync.__client, and SubscriptionSync.__client.

◆ metadata_async()

Result metadata_async (   self,
str  address,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Read metadata of an object.

This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function.

Parameters
[in]addressAddress of the node to read metadata
[in]callbackCallback to call when function is finished
[in]userdataUser data - will be returned in callback as userdata. You can use this userdata to identify your request
Returns
<Result>, status of function call

Definition at line 402 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, ProviderNode.__create_callback(), Client.__create_callback(), and Client.__token.

◆ metadata_sync()

def metadata_sync (   self,
str  address 
)

Read metadata of an object.

This function is synchronous: It will wait for the answer.

Parameters
[in]addressAddress of the node to read metadata of
Returns
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, Metadata of the node. Data will be provided as Variant flatbuffers with metadata.fbs data type.

Definition at line 280 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

◆ ping_async()

Result ping_async (   self,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Ping the next hop.

This function is asynchronous. It will return immediately. Callback will be called if function call is finished.

Parameters
[in]callbackCallback to call when function is finished
[in]userdataUser data - will be returned in callback as userdata. You can use this userdata to identify your request
Returns
<Result> status of function call

Definition at line 293 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, ProviderNode.__create_callback(), and Client.__create_callback().

◆ ping_sync()

Result ping_sync (   self)

Ping the next hop.

This function is synchronous: It will wait for the answer.

Returns
<Result> status of function call

Definition at line 193 of file client.py.

References SubscriptionAsync.__client, and SubscriptionSync.__client.

◆ read_async()

Result read_async (   self,
str  address,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Read an object.

This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function.

Parameters
[in]addressAddress of the node to read
[in]callbackCallback to call when function is finished
[in]userdataUser data - will be returned in callback as userdata. You can use this userdata to identify your request
Returns
<Result>, status of function call

Definition at line 351 of file client.py.

References Client.read_async_args().

◆ read_async_args()

Result read_async_args (   self,
str  address,
Variant  args,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Read an object.

This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function.

Parameters
[in]addressAddress of the node to read
[in]argsRead arguments data of the node
[in]callbackCallback to call when function is finished
[in]userdataUser data - will be returned in callback as userdata. You can use this userdata to identify your request
Returns
<Result>, status of function call

Definition at line 364 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, ProviderNode.__create_callback(), Client.__create_callback(), and Client.__token.

Referenced by Client.read_async().

◆ read_json_sync()

def read_json_sync (   self,
Converter  conv,
str  address,
int  indent,
Variant   data = None 
)

This function reads a values as a JSON string.

Parameters
[in]converterReference to the converter (see System json_converter())
[in]addressAddress of the node to read
[in]indentStepIndentation length for json string
[in]jsonGenerated JSON as Variant (string)
Returns
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, Generated JSON as Variant (string)

Definition at line 472 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

◆ read_sync()

def read_sync (   self,
str  address 
)

Read an object.

This function is synchronous: It will wait for the answer.

Parameters
[in]addressAddress of the node to read
Returns
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, Data of the node

Definition at line 241 of file client.py.

References Client.read_sync_args().

◆ read_sync_args()

def read_sync_args (   self,
str  address,
Variant  args 
)

Read an object.

This function is synchronous: It will wait for the answer.

Parameters
[in]addressAddress of the node to read
[in,out]argsRead arguments data of the node
Returns
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, Data of the node

Definition at line 253 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

Referenced by Client.read_sync().

◆ remove_async()

Result remove_async (   self,
str  address,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Remove an object.

This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function.

Parameters
[in]addressAddress of the node to remove
[in]callbackCallback to call when function is finished
[in]userdataUser data - will be returned in callback as userdata. You can use this userdata to identify your request
Returns
<Result> status of function call

Definition at line 319 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, ProviderNode.__create_callback(), Client.__create_callback(), and Client.__token.

◆ remove_sync()

Result remove_sync (   self,
str  address 
)

Remove an object.

This function is synchronous: It will wait for the answer.

Parameters
[in]addressAddress of the node to remove
Returns
<Result> status of function call

Definition at line 215 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

◆ set_auth_token()

def set_auth_token (   self,
str  token 
)

Set persistent security access token for authentication as JWT payload.

Parameters
[in]tokenSecurity access &token for authentication

Definition at line 172 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

◆ set_timeout()

Result set_timeout (   self,
TimeoutSetting  timeout,
int  value 
)

Set client timeout value.

Parameters
[in]timeoutTimeout to set (see DLR_TIMEOUT_SETTING)
[in]valueValue to set
Returns
<Result>, status of function call

Definition at line 157 of file client.py.

References SubscriptionAsync.__client, and SubscriptionSync.__client.

◆ write_async()

Result write_async (   self,
str  address,
Variant  data,
ResponseCallback  cb,
userData_c_void_p   userdata = None 
)

Write an object.

This function is synchronous: It will wait for the answer.

Parameters
[in]addressAddress of the node to read metadata
[in]dataData of the object
[in]callbackCallback to call when function is finished
[in]userdataUser data - will be returned in callback as userdata. You can use this userdata to identify your request
Returns
<Result>, status of function call

Definition at line 383 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, ProviderNode.__create_callback(), Client.__create_callback(), and Client.__token.

◆ write_json_sync()

def write_json_sync (   self,
Converter  conv,
str  address,
str  json 
)

This function writes a JSON value.

Parameters
[in]converterReference to the converter (see System json_converter())
[in]addressAddress of the node to write
[in]jsonJSON value to write
[in,out]errorError of conversion as variant string
Returns
result status of the function
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, Error of conversion as variant string

Definition at line 496 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.

◆ write_sync()

def write_sync (   self,
str  address,
Variant  data 
)

Write an object.

This function is synchronous: It will wait for the answer.

Parameters
[in]addressAddress of the node to write
[in]variantNew data of the node
Returns
tuple (Result, Variant)
<Result>, status of function call,
<Variant>, result of write

Definition at line 267 of file client.py.

References SubscriptionAsync.__client, SubscriptionSync.__client, and Client.__token.