refactor: use new port negotiation style
As changed in the API document, this now uses the new port negotiation style. ref: N25B-168
This commit is contained in:
@@ -2,8 +2,6 @@ from abc import ABCMeta
|
||||
|
||||
import zmq
|
||||
|
||||
from robot_interface.utils import zmq_socket_type_int_to_str, zmq_socket_type_complement
|
||||
|
||||
|
||||
class SocketBase(object):
|
||||
__metaclass__ = ABCMeta
|
||||
@@ -11,16 +9,12 @@ class SocketBase(object):
|
||||
name = None
|
||||
socket = None
|
||||
|
||||
def __init__(self, name, data_type):
|
||||
def __init__(self, identifier):
|
||||
"""
|
||||
:param name: The name of the endpoint.
|
||||
:type name: str
|
||||
|
||||
:param data_type: The data type of the endpoint, e.g. "json", "binary", "text", etc.
|
||||
:type data_type: str
|
||||
:param identifier: The identifier of the endpoint.
|
||||
:type identifier: str
|
||||
"""
|
||||
self.name = name
|
||||
self.data_type = data_type
|
||||
self.identifier = identifier
|
||||
self.port = None # Set later by `create_socket`
|
||||
self.socket = None # Set later by `create_socket`
|
||||
self.bound = None # Set later by `create_socket`
|
||||
@@ -71,9 +65,7 @@ class SocketBase(object):
|
||||
:rtype: dict
|
||||
"""
|
||||
return {
|
||||
"name": self.name,
|
||||
"id": self.identifier,
|
||||
"port": self.port,
|
||||
"pattern": zmq_socket_type_int_to_str[zmq_socket_type_complement[self.socket.getsockopt(zmq.TYPE)]],
|
||||
"data_type": self.data_type,
|
||||
"bind": not self.bound
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user