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_method_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.dyn_json_sub_create(topic_name)

create subscriber

Parameters

topic_name (string) – the unique topic name

ecal.core.core.dyn_json_sub_destroy(topic_handle)

destroy subscriber

Parameters

topic_handle – the topic handle

ecal.core.core.dyn_json_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.dyn_json_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))

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.initialize(args, unit_name)

initialize eCAL API

Parameters
  • args – command line argument list (sys.argv)

  • unit_name (string) – instance unit name

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_publogging(state_, name_)

activate an eCAL internal publisher for logging info

Parameters
  • state – publisher state on / off

  • name (string) – topic name for the publisher

ecal.core.core.mon_pubmonitoring(state_, name_)

activate an eCAL internal publisher for monitoring info

Parameters
  • state – publisher state on / off

  • name (string) – topic name for the publisher

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_desc)

create publisher

Parameters
  • topic_name (string) – the unique topic name

  • topic_type (string) – optional type name

  • 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)

ecal.core.core.pub_set_description(topic_handle, description)

set publisher description

Parameters
  • topic_handle (string) – the topic handle

  • description (bytes) – the topic description

ecal.core.core.pub_set_layer_mode(topic_handle, layer, mode)

set send mode for specific transport layer

Parameters
  • topic_handle – the topic handle

  • layer (int) – 0 = udp, 1 = shm, 42 = inproc

  • mode (int) – 0 = off, 1 = on, 2 = auto

ecal.core.core.pub_set_max_bandwidth_udp(topic_handle, bandwidth)

set publisher maximum transmit bandwidth for the udp layer.

Parameters
  • topic_handle – the topic handle

  • bandwidth (int) – maximum bandwidth in bytes/s (-1 == unlimited)

ecal.core.core.pub_set_qos_historykind(topic_handle, qpolicy, depth)

set publisher quality of service historykind mode and depth

Parameters
  • topic_handle – the topic handle

  • qpolicy (int) – 0 = keep_last_history_qos, 1 = keep_all_history_qos

  • depth – history kind buffer depth

ecal.core.core.pub_set_qos_reliability(topic_handle, qpolicy)

set publisher quality of service reliability mode

Parameters
  • topic_handle – the topic handle

  • qpolicy (int) – 0 = best_effort_reliability_qos, 1 = reliable_reliability_qos

  • depth – history kind buffer depth

class ecal.core.core.publisher(topic_name, topic_type='', 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)

set_layer_mode(layer, mode)

set send mode for specific transport layer

Parameters
  • layer (int) – 0 = udp, 1 = shm, 42 = inproc

  • mode – 0 = off, 1 = on, 2 = auto

set_max_bandwidth_udp(bandwidth)

set publisher maximum transmit bandwidth for the udp layer.

Parameters

bandwidth (int) – maximum bandwidth in bytes/s (-1 == unlimited)

set_qos_historykind(qpolicy, depth)

set quality of service historykind mode and depth

Parameters
  • qpolicy – 0 = keep_last_history_qos, 1 = keep_all_history_qos

  • depth – history kind buffer depth

set_qos_reliability(qpolicy)

set quality of service reliability mode

Parameters

qpolicy – 0 = best_effort_reliability_qos, 1 = reliable_reliability_qos

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.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)

create subscriber

Parameters
  • topic_name (string) – the unique topic name

  • topic_type (string) – optional topic type

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))

ecal.core.core.sub_set_qos_historykind(topic_handle, qpolicy, depth)

set subscriber quality of service historykind mode and depth

Parameters
  • topic_handle – the topic handle

  • qpolicy (int) – 0 = keep_last_history_qos, 1 = keep_all_history_qos

  • depth (int) – history kind buffer depth

ecal.core.core.sub_set_qos_reliability(topic_handle, qpolicy)

set subscriber quality of service reliability mode

Parameters
  • topic_handle – the topic handle

  • qpolicy (int) – 0 = best_effort_reliability_qos, 1 = reliable_reliability_qos

class ecal.core.core.subscriber(topic_name, topic_type='')

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))

set_qos_historykind(qpolicy, depth)

set quality of service historykind mode and depth

Parameters
  • qpolicy (int) – 0 = keep_last_history_qos, 1 = keep_all_history_qos

  • depth (int) – history kind buffer depth

set_qos_reliability(qpolicy)

set quality of service reliability mode

Parameters

qpolicy (int) – 0 = best_effort_reliability_qos, 1 = reliable_reliability_qos

class ecal.core.core.subscriberDynJSON(topic_name)

Bases: object

eCAL Protobuf dynamic JSON subscriber

destroy()

destroy subscriber

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))