API Reference

First Class functions

connect_commands(auth_mgr)

Establishes a connection to the RcWebApi Commands Socket and returns CommandServer object which can be used to interact with the socket.

connect_subscriber(auth_mgr)

Establishes a connection to the RcWebApi Subscribe Socket and returns SubscribeServer object which can be used to interact with the socket.

get_variable(cmd_server, prefix, name)

Returns the value of a given variable on the PLC

create_variable_getter(cmd_server, prefix)

Creates a function to get variable values with a fixed prefix and server.

set_variable(cmd_server, prefix, name, val)

Sets a variable on the PLC

create_variable_setter(cmd_server, prefix)

Creates a function to set variable values with a fixed prefix and server.

AuthMgr

AuthMgr()

Holds the auth_token, client_id, PCL IP and robot name

AuthMgr.login(ip, robot_name, user, passwd)

Authenticate to the PLC.

AuthMgr.auth_token()

Returns the Authtoken used to connect to the sockts.

AuthMgr.host_ip()

Returns the host ip address.

AuthMgr.robot_name()

Returns the robot name.

AuthMgr.client_id()

Returns the client id.

AuthMgr.set_client_id(id)

AuthMgr.is_client_id_set()

CommandServer

CommandServer()

Holds the connection to the RcWebApi's command socket.

CommandServer.disconnect()

Disconnects from the socket.

CommandServer.is_connected()

Returns whether the socket is connected or not.

CommandServer.start(cmd, **kwargs)

Sends the given command and it's parameters to the PLC returns a ticket

CommandServer.exec(cmd, **kwargs)

Sends the given command and it's parameters to the PLC and waits till it's finished.

Ticket

Ticket(server, id)

A Ticket represents one command sent to the socket.

Ticket.wait([timeout])

Waits and blocks until the ticket is completed or the timeout is reached.

Ticket.requestid()

Unique request id for this ticket.

Ticket.state

Current state of the Ticket

SubscribeServer

SubscribeServer()

Holds the connection to the RcWebApi's subscribe socket.

SubscribeServer.disconnect()

Unsubscribes from all active subscriptions and closes the connection to the socket.

SubscribeServer.is_connected()

Returns whether the socket ist connected or not.

SubscribeServer.subscribe(topic[, func, ...])

Subscribes to a topic.

SubscribeServer.unsubscribe(topic[, func])

Unsubscribe from a previously subscribed topic.