def __init__(self, ip_hostname='pulsestreamer'): print("Connect to Pulse Streamer via google-RPC.") print("IP / Hostname:", ip_hostname) self.ip_address = ip_hostname try: channel = insecure_channel(ip_hostname + ':50051') self.stub = PulseStreamerStub(channel) try: void = VoidMessage() self.stub.getSerial(void, timeout=PulseStreamer.TIMEOUT) except: try: void = VoidMessage() self.stub.isRunning(void, timeout=PulseStreamer.TIMEOUT) assert False, "Pulse Streamer class not compatible with current firmware. Please update your firmware." \ "For detailed information visit https://www.swabianinstruments.com/pulse-streamer-8-2-firmware/ " \ "or contact [email protected]" except AssertionError: raise except: assert False, "No Pulse Streamer found at IP/Host-address: " + ip_hostname except AssertionError: raise except: assert False, "No Pulse Streamer found at IP/Host-address: " + ip_hostname void = VoidMessage() firmware_version = self.stub.getFirmwareVersion( void, timeout=PulseStreamer.TIMEOUT).string_value self.__version_1_1_or_higher = True if _compare_version_number( firmware_version, '1.1.0') >= 0 else False print("Pulse Streamer 8/2 firmware: v" + firmware_version) print("Client software: v" + __CLIENT_VERSION__) if (_compare_version_number(firmware_version) >= 0): print( "The Pulse Streamer 8/2 firmware is more up to date than your client software. We recommend to update your client software." ) print( "For detailed information visit https://www.swabianinstruments.com/support/downloads/ or contact [email protected]" ) elif (_compare_version_number( '.'.join(__CLIENT_VERSION__.split('.')[0:2] + ['0']), '.'.join(firmware_version.split('.')[0:2] + ['0'])) > 0): print( "Your client software is more up to date than the Pulse Streamer 8/2 firmware. We recommend to update the firmware of your Pulse Streamer 8/2." ) print( "For detailed information visit https://www.swabianinstruments.com/support/downloads/ or contact [email protected]" )
def getAnalogCalibration(self): void = VoidMessage() response = self.stub.getAnalogCalibration( void, timeout=PulseStreamer.TIMEOUT) key_list = ['dc_offset_a0', 'dc_offset_a1', 'slope_a0', 'slope_a1'] return dict( zip(key_list, [ response.dc_offset_a0, response.dc_offset_a1, response.slope_a0, response.slope_a1 ]))
def getFPGAID(self): if (self.__version_1_1_or_higher): void = VoidMessage() return self.stub.getFPGAID( void, timeout=PulseStreamer.TIMEOUT).string_value else: s = GetSerialMessage() s.serial = 0 return self.stub.getSerial( s, timeout=PulseStreamer.TIMEOUT).string_value
def getDebugRegister(self): void = VoidMessage() return self.stub.getDebugRegister( void, timeout=PulseStreamer.PulseStreamer.TIMEOUT).value
def getUnderflow(self): void = VoidMessage() return self.stub.getUnderflow(void, timeout=PulseStreamer.TIMEOUT).value
def getTemperature(self): void = VoidMessage() return self.stub.getTemperature( void, timeout=PulseStreamer.TIMEOUT).string_value
def testNetworkConf(self): void = VoidMessage() return self.stub.testNetworkConf(void, timeout=PulseStreamer.TIMEOUT).value
def getNetworkConf(self): void = VoidMessage() return self.stub.getNetworkConf( void, timeout=PulseStreamer.TIMEOUT).string_value
def isStreaming(self): void = VoidMessage() return self.stub.isStreaming(void, timeout=PulseStreamer.TIMEOUT).value
def flash_lic(self): void = VoidMessage() return self.stub.flash_lic(void, timeout=PulseStreamer.TIMEOUT).string_value
def getFirmwareVersion(self): void = VoidMessage() return self.stub.getFirmwareVersion( void, timeout=PulseStreamer.TIMEOUT).string_value
def getClock(self): void = VoidMessage() return ClockSource( self.stub.getClock(void, timeout=PulseStreamer.TIMEOUT).value)
def startNow(self): void = VoidMessage() return self.stub.startNow(void, timeout=PulseStreamer.TIMEOUT).value
def hasFinished(self): void = VoidMessage() return self.stub.hasFinished(void, timeout=PulseStreamer.TIMEOUT).value
def hasSequence(self): void = VoidMessage() return self.stub.hasSequence(void, timeout=PulseStreamer.TIMEOUT).value
def getTriggerRearm(self): void = VoidMessage() return TriggerRearm( self.stub.getTriggerRearm(void, timeout=PulseStreamer.TIMEOUT).value)
def reset(self): void = VoidMessage() return self.stub.reset(void, timeout=PulseStreamer.TIMEOUT).value
def forceFinal(self): void = VoidMessage() return self.stub.forceFinal(void, timeout=PulseStreamer.TIMEOUT).value