Пример #1
0
 def completeConnection(self, sock):
     self.sock = sock
     self.rcv_thread = Thread(target=self.receive)
     self.rcv_thread.start()
     self.contextWait = True
     self.connectDialog.contextWait()
     sleep(
         1
     )  ## TODO sync issue - the responses are received before the application is ready to process them
     message1 = messages_pb2.ClientToServer()
     message1.type = messages_pb2.ClientToServer.Type.Value(
         'GENERAL_REQUEST')
     message1.generalRequest.type = request_pb2.GeneralRequest.RequestType.Value(
         'SCANNER_CONTEXT')
     self.sock.send(message1.SerializeToString())
     sleep(0.25)
     message2 = messages_pb2.ClientToServer()
     message2.type = messages_pb2.ClientToServer.Type.Value(
         'GENERAL_REQUEST')
     message2.generalRequest.type = request_pb2.GeneralRequest.RequestType.Value(
         'DEMOD_CONTEXT')
     self.sock.send(message2.SerializeToString())
     sleep(0.25)
     message3 = messages_pb2.ClientToServer()
     message3.type = messages_pb2.ClientToServer.Type.Value(
         'GENERAL_REQUEST')
     message3.generalRequest.type = request_pb2.GeneralRequest.RequestType.Value(
         'SYSTEM_INFO')
     self.sock.send(message3.SerializeToString())
Пример #2
0
 def setSquelch(self, value):
     message = messages_pb2.ClientToServer()
     message.type = messages_pb2.ClientToServer.Type.Value('DEMOD_REQUEST')
     message.demodRequest.type = request_pb2.DemodRequest.DemodFunc.Value(
         'SET_SQUELCH')
     message.demodRequest.level = value
     self.sock.send(message.SerializeToString())
Пример #3
0
 def hold(self):
     message = messages_pb2.ClientToServer()
     message.type = messages_pb2.ClientToServer.Type.Value(
         'SCANNER_STATE_REQUEST')
     message.scanStateRequest.state = request_pb2.ScannerStateRequest.NewState.Value(
         'HOLD')
     self.sock.send(message.SerializeToString())
Пример #4
0
 def setGain(self, value):
     message = messages_pb2.ClientToServer()
     message.type = messages_pb2.ClientToServer.Type.Value('DEMOD_REQUEST')
     message.demodRequest.type = request_pb2.DemodRequest.DemodFunc.Value(
         'SET_GAIN')
     message.demodRequest.level = value
     self.sendData(message.SerializeToString())
Пример #5
0
 def manualEntry(self, frequency, modulation):
     message = messages_pb2.ClientToServer()
     message.type = messages_pb2.ClientToServer.Type.Value(
         'SCANNER_STATE_REQUEST')
     message.scanStateRequest.state = request_pb2.ScannerStateRequest.NewState.Value(
         'MANUAL')
     message.scanStateRequest.manFreq = frequency
     message.scanStateRequest.manModulation = modulation
     self.sock.send(message.SerializeToString())
Пример #6
0
 def handleSquelchSlider(self, value):
     val = float(value)
     if abs(val - self.lastSquelchSlide) < 0.5:
         message = messages_pb2.ClientToServer()
         message.type = messages_pb2.ClientToServer.Type.DEMOD_REQUEST
         message.demodRequest.type = request_pb2.DemodRequest.DemodFunc.SET_SQUELCH
         message.demodRequest.level = val
         self.sock.send(message.SerializeToString())
     self.lastSquelchSlide = val
Пример #7
0
 def setGain(self):
     self._job = None
     val = float(self.lastGainVal)
     #if abs(val - self.lastGainSlide) < 0.25:
     message = messages_pb2.ClientToServer()
     message.type = messages_pb2.ClientToServer.Type.DEMOD_REQUEST
     message.demodRequest.type = request_pb2.DemodRequest.DemodFunc.SET_GAIN
     message.demodRequest.level = val
     self.sock.send(message.SerializeToString())
Пример #8
0
    def receive(self):
        message1 = messages_pb2.ClientToServer()
        message1.type = messages_pb2.ClientToServer.Type.GENERAL_REQUEST
        message1.generalRequest.type = request_pb2.GeneralRequest.RequestType.SCANNER_CONTEXT
        self.sock.send(message1.SerializeToString())
        message2 = messages_pb2.ClientToServer()
        message2.type = messages_pb2.ClientToServer.Type.GENERAL_REQUEST
        message2.generalRequest.type = request_pb2.GeneralRequest.RequestType.DEMOD_CONTEXT
        self.sock.send(message2.SerializeToString())

        while True:
            try:
                data = self.sock.recv(2048)
                self.inmsg.ParseFromString(data)
                self.decodeMessage(message=self.inmsg)
            except OSError:
                break
            except proto.DecodeError as e:
                print("Parse error")
                print(e)
Пример #9
0
    def handleTune(self):
        freq = self.builder.get_object('FreqEntry', self.master).get()
        freq = int(float(freq) * 1000000)

        message = messages_pb2.ClientToServer()
        message.type = messages_pb2.ClientToServer.Type.SCANNER_STATE_REQUEST
        message.scanStateRequest.state = request_pb2.ScannerStateRequest.NewState.MANUAL
        message.scanStateRequest.manFreq = freq
        self.sock.send(message.SerializeToString())

        self.mandialog.close()
Пример #10
0
    def completeConnection(self, sock, host, use_audio, audio_port):
        self.sock = sock
        self.rcv_thread = Thread(target=self.receive, name='socket monitor')
        self.rcv_thread.start()
        self.contextWait = True
        self.connectDialog.contextWait()
        sleep(
            1
        )  ## TODO sync issue - the responses are received before the application is ready to process them
        message1 = messages_pb2.ClientToServer()
        message1.type = messages_pb2.ClientToServer.Type.Value(
            'GENERAL_REQUEST')
        message1.generalRequest.type = request_pb2.GeneralRequest.RequestType.Value(
            'SCANNER_CONTEXT')
        self.sendData(message1.SerializeToString())
        sleep(0.25)
        message2 = messages_pb2.ClientToServer()
        message2.type = messages_pb2.ClientToServer.Type.Value(
            'GENERAL_REQUEST')
        message2.generalRequest.type = request_pb2.GeneralRequest.RequestType.Value(
            'DEMOD_CONTEXT')
        self.sendData(message2.SerializeToString())
        sleep(0.25)
        message3 = messages_pb2.ClientToServer()
        message3.type = messages_pb2.ClientToServer.Type.Value(
            'GENERAL_REQUEST')
        message3.generalRequest.type = request_pb2.GeneralRequest.RequestType.Value(
            'SYSTEM_INFO')
        self.sendData(message3.SerializeToString())

        if use_audio:
            self.use_audio = self.audio.startRtspAudioStream(host, audio_port)
            #self.setAudioVolume(50)
        else:
            self.use_audio = False
        self.scanner.setVolumeVisible(self.use_audio)
Пример #11
0
 def handleButton2(self):
     message = messages_pb2.ClientToServer()
     message.type = messages_pb2.ClientToServer.Type.SCANNER_STATE_REQUEST
     message.scanStateRequest.state = request_pb2.ScannerStateRequest.NewState.HOLD
     print(message)
     self.sock.send(message.SerializeToString())