def sendStreamFunction(self, packet): """Send the packet and wait for the response :param packet: packet to be sent :type packet: :class:`secsgem.secsFunctionBase.secsStreamFunction` """ out_packet = hsmsPacket(hsmsStreamFunctionHeader(self.connection.get_next_system_counter(), packet.stream, packet.function, True, self.sessionID), packet.encode()) self.connection.send_packet(out_packet)
def sendResponse(self, function, system): """Send response function for system :param function: function to be sent :type function: :class:`secsgem.secsFunctionBase.secsStreamFunction` :param system: system to reply to :type system: integer """ out_packet = hsmsPacket(hsmsStreamFunctionHeader(system, function.stream, function.function, False, self.sessionID), function.encode()) self.connection.send_packet(out_packet)
def sendAndWaitForResponse(self, packet): """Send the packet and wait for the response :param packet: packet to be sent :type packet: :class:`secsgem.secsFunctionBase.secsStreamFunction` :returns: Packet that was received :rtype: :class:`secsgem.hsmsPackets.hsmsPacket` """ out_packet = hsmsPacket(hsmsStreamFunctionHeader(self.connection.get_next_system_counter(), packet.stream, packet.function, True, self.sessionID), packet.encode()) self.connection.send_packet(out_packet) return self.waitforSystem(out_packet.header.system, (packet.stream == 0))