def generate_request(queue, satelliteId):
    # Send the first request to activate the stream. Telemetry will start
    # to be received at this point.
    satellite_stream_request = stellarstation_pb2.SatelliteStreamRequest(
        satellite_id=satelliteId)
    satellite_stream_request.accepted_framing.extend(
        [transport.AX25, transport.BITSTREAM])
    yield satellite_stream_request

    try:
        while True:
            commands = queue.get()
            command_request = stellarstation_pb2.SendSatelliteCommandsRequest(
                command=commands)

            satellite_stream_request = stellarstation_pb2.SatelliteStreamRequest(
                satellite_id=satelliteId,
                send_satellite_commands_request=command_request)

            satellite_stream_request.accepted_framing.extend(
                [transport.AX25, transport.BITSTREAM])

            yield satellite_stream_request
            queue.task_done()
            while True:
                time.sleep(3)
    except Exception as e:
        print("Encountered error")
        print(e)
def generate_request(queue):
    # Send the first request to activate the stream. Telemetry will start
    # to be received at this point.
    yield stellarstation_pb2.SatelliteStreamRequest(satellite_id=SATELLITE_ID)

    while True:
        commands = queue.get()
        command_request = stellarstation_pb2.SendSatelliteCommandsRequest(command=commands)

        satellite_stream_request = stellarstation_pb2.SatelliteStreamRequest(
            satellite_id=SATELLITE_ID,
            send_satellite_commands_request=command_request)

        yield satellite_stream_request
        queue.task_done()
Example #3
0
def generate_request():
    # Send the first request to activate the stream. Telemetry will start
    # to be received at this point.
    yield stellarstation_pb2.SatelliteStreamRequest(satellite_id=SATELLITE_ID)

    while True:
        command_request = stellarstation_pb2.SendSatelliteCommandsRequest(
            command=[
                bytes(b'a' * 5000),
                bytes(b'b' * 5000),
                bytes(b'c' * 5000),
                bytes(b'd' * 5000),
                bytes(b'e' * 5000),
            ])

        satellite_stream_request = stellarstation_pb2.SatelliteStreamRequest(
            satellite_id=SATELLITE_ID,
            send_satellite_commands_request=command_request)

        yield satellite_stream_request
        time.sleep(3)
Example #4
0
    def _createRequest(self):
        """This method creates a request for the satellite stream"""
        if self.framing is None:
            self._l.info('Satellite stream, framing ANY')
            yield stellarstation_pb2.SatelliteStreamRequest(
                satellite_id=str(self.satellite_id))
        else:
            self._l.info('Satellite stream, framing = %s', self.framing)
            yield stellarstation_pb2.SatelliteStreamRequest(
                satellite_id=str(self.satellite_id),
                accepted_framing=[self.framing])

        # Leaves the generator open and the stream is not closed
        while True:
            self._l.debug('.')
            time.sleep(3000)

            if self._die:
                # when this process wakes up, in case it has been marked to "die", it will stop itself by breaking
                # this loop - it will reset the "_die" flag set by the external process
                self._die = False
                break
Example #5
0
    def sendTelecommand(self, tcArray):
        """
        This method sends an array of telecommands through the open stream.

        @param tcArray -- array of telecommands to be sent, each of them needs to be a bytearray object
        """
        self._l.debug('Telecommands array request')

        command_request = stellarstation_pb2.SendSatelliteCommandsRequest(
            output_framing=self.framing, command=tcArray)
        satellite_stream_request = stellarstation_pb2.SatelliteStreamRequest(
            satellite_id=self.satellite_id,
            send_satellite_commands_request=command_request)

        yield satellite_stream_request
        self._l.debug('Telecommands array sent')