def get_version_ascii(self, request, reply): self.__logger.debug("get_version_ascii") reply_data = bytearray(1) + self.__version_string.encode("ascii") reply_data[0] = self.__host_address reply = TMCL_Reply.from_buffer(reply_data) reply.special = True return reply
def send(self, opcode, opType, motor, value, moduleID=None): """ Send a TMCL datagram and read back a reply. This function blocks until the reply has been received. """ if not(type(opcode) == type(opType) == type(motor) == type(value) == int): raise TypeError("Expected integer values") # If no module ID is given, use the default one if not moduleID: moduleID = self._MODULE_ID request = TMCL_Request(moduleID, opcode, opType, motor, value) if self._debug: request.dump() self._send(self._HOST_ID, moduleID, request.toBuffer()) reply = TMCL_Reply.from_buffer(self._recv(self._HOST_ID, moduleID)) if self._debug: reply.dump() return reply
def send_request(self, request, moduleID=None): """ Send a TMCL_Request and read back a TMCL_Reply. This function blocks until the reply has been received. """ if not moduleID: moduleID = self._MODULE_ID if self._debug: request.dump() self._send(self._HOST_ID, moduleID, request.toBuffer()) reply = TMCL_Reply.from_buffer(self._recv(self._HOST_ID, moduleID)) if self._debug: reply.dump() return reply