ecal.core.core module#
@package ecal Python wrapper for eCAL the enhanced communication abstraction layer.
You can use the eCAL API in a function style or OO manner.
- ecal.core.core.client_add_response_callback(client_handle, callback)#
add response callback to client
- Parameters:
client_handle – the client handle
callback – the response callback function (f(service_info, response))
- ecal.core.core.client_call_method(client_handle, method_name, request, timeout=-1)#
call a method of the service
- Parameters:
client_handle – the client handle
method_name (string) – the method name to call
request (bytes) – the request argument for the method
timeout (integer) – maximum time before operation returns (in milliseconds, -1 means infinite)
- ecal.core.core.client_create(service_name)#
create client
- Parameters:
service_name (string) – the unique service name
- ecal.core.core.client_destroy(client_handle)#
destroy client
- Parameters:
client_handle – the client handle
- ecal.core.core.client_rem_response_callback(client_handle)#
remove response callback from client
- Parameters:
client_handle – the client handle
- ecal.core.core.client_set_hostname(client_handle, host_name)#
set host name of the service
- Parameters:
client_handle – the client handle
host_name (string) – the host name the service is running on
- ecal.core.core.enable_loopback(state)#
enable ecal message loopback
- Parameters:
state (int) – switch on ecal message loop back (default 0)
- ecal.core.core.finalize()#
finalize eCAL API
- ecal.core.core.getdate()#
get ecal date string
- ecal.core.core.getmicroseconds()#
get ecal microsecond timestamp
- ecal.core.core.getversion()#
get ecal version string
- ecal.core.core.getversion_components()#
get ecal version as major, minor, patch tuple
- ecal.core.core.initialize(args, unit_name)#
initialize eCAL API
- Parameters:
args – command line argument list (sys.argv)
unit_name (string) – instance unit name
- ecal.core.core.is_initialized()#
get if ecal has been initialized
- ecal.core.core.log_message(message)#
log message
- Parameters:
message (string) – the message to log
- ecal.core.core.log_setcoretime(time)#
log core time
- Parameters:
time (int) – module core time in ms
- ecal.core.core.log_setlevel(level)#
set log level
- Parameters:
level (int) – log level (info = 1, warning = 2, error = 3, fatal = 4)
- ecal.core.core.mon_finalize()#
finalize eCAL monitoring API
- ecal.core.core.mon_initialize()#
initialize eCAL monitoring API
- ecal.core.core.mon_logging()#
get list of ecal log messages
- ecal.core.core.mon_monitoring()#
get all host, process and topic information as dictionary
- ecal.core.core.mon_setexclfilter(filter_)#
Set topics filter blacklist regular expression
- Parameters:
filter (string) – filter string as regular expression
- ecal.core.core.mon_setfilterstate(state_)#
Switch eCAL monitoring filter on/off
- Parameters:
state – filter state on / off
- ecal.core.core.mon_setinclfilter(filter_)#
Set topics filter whitelist regular expression
- Parameters:
filter (string) – filter string as regular expression
- ecal.core.core.ok()#
returns ecal process state
- ecal.core.core.pub_create(topic_name, topic_type, topic_enc, topic_desc)#
create publisher
- Parameters:
topic_name (string) – the unique topic name
topic_type (string) – optional type name
topic_enc (string) – optional type encoding
topic_desc (bytes) – optional type description
- ecal.core.core.pub_destroy(topic_handle)#
destroy publisher
- Parameters:
topic_handle – the topic handle
- ecal.core.core.pub_send(topic_handle, msg_payload, msg_time=-1)#
send publisher content
- Parameters:
topic_handle – the topic handle
msg_payload (bytes) – message python string (can contain zeros)
msg_time (int) – optional message time in us (default -1 == eCAL system time)
- class ecal.core.core.publisher(topic_name, topic_type='', topic_enc='', topic_desc=b'')#
Bases:
object
eCAL publisher
- destroy()#
destroy publisher
- send(msg_payload, msg_time=-1)#
send publisher content
- Parameters:
msg_payload (bytes) – message python string (can contain zeros)
msg_time (int) – optional message time in us (default -1 == eCAL system time)
- ecal.core.core.server_add_method_callback(server_handle, method_name, req_type, resp_type, callback)#
add method callback to server
- Parameters:
server_handle – the server handle
method_name – the name of method to add
method_name – string
req_type – the type of the method request (optional)
resp_type – the type of the method response (optional)
callback – the method callback function (response = f(method_name, req_type, resp_type, request))
- ecal.core.core.server_create(service_name)#
create server
- Parameters:
service_name (string) – the unique service name
- ecal.core.core.server_destroy(server_handle)#
destroy server
- Parameters:
server_handle – the server handle
- ecal.core.core.server_rem_method_callback(server_handle, method_name)#
remove method callback from server
- Parameters:
server_handle – the server handle
method_name – the name of method to add
method_name – string
- ecal.core.core.set_process_state(severity, level, info)#
set the process state
- Parameters:
severity (int) – severity (unknown = 0, healthy = 1, warning = 2, critical = 3, failed = 4)
level (int) – severity level (level1 = 1, level2 = 2, level3 = 3, level4 = 4, level5 = 5)
info (string) – info message
- ecal.core.core.set_unit_name(unit_name)#
set/change the unit name of the current module
- Parameters:
unit_name (string) – Name of the eCAL unit
- ecal.core.core.shutdown_core()#
shutdown ecal core components
- ecal.core.core.shutdown_process_id(process_id)#
shutdown ecal user processes with specified process id
- Parameters:
process_id – process ID of the process to shut down
- ecal.core.core.shutdown_process_uname(unit_name)#
shutdown ecal user processes with specified unit name
- Parameters:
unit_name – unit name of the process to shut down
- ecal.core.core.shutdown_processes()#
shutdown all ecal user processes
- ecal.core.core.sub_create(topic_name, topic_type, topic_enc, topic_desc)#
create subscriber
- Parameters:
topic_name (string) – the unique topic name
topic_type (string) – optional type name
topic_enc (string) – optional type encoding
topic_desc (bytes) – optional type description
- ecal.core.core.sub_destroy(topic_handle)#
destroy subscriber
- Parameters:
topic_handle – the topic handle
- ecal.core.core.sub_receive(topic_handle, timeout=0)#
receive subscriber content with timeout
- Parameters:
topic_handle – the topic handle
timeout (int) – receive timeout in ms
- ecal.core.core.sub_rem_callback(topic_handle, callback)#
remove callback function for incoming messages
- Parameters:
topic_handle – the topic handle
callback – python callback function (f(topic_name, msg, time))
- ecal.core.core.sub_set_callback(topic_handle, callback)#
set callback function for incoming messages
- Parameters:
topic_handle – the topic handle
callback – python callback function (f(topic_name, msg, time))
- class ecal.core.core.subscriber(topic_name, topic_type='', topic_enc='', topic_desc=b'')#
Bases:
object
eCAL subscriber
- destroy()#
destroy subscriber
- receive(timeout=0)#
receive subscriber content with timeout
- Parameters:
timeout (int) – receive timeout in ms
- rem_callback(callback)#
remove callback function for incoming messages
- Parameters:
callback – python callback function (f(topic_name, msg, time))
- set_callback(callback)#
set callback function for incoming messages
- Parameters:
callback – python callback function (f(topic_name, msg, time))