Commit 7ab55249 authored by Marco Buttu's avatar Marco Buttu
Browse files

LBand local oscillator managed by the SRTLPBandReceiver: draft

* New component and DataBlock attributes
* Added CDB configuration for testing
* Changed the receiver-board-server, adding the stop command
* Draft implementation of the SRTLPBandReceiver
parent c6e5468e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ IRALibrary_OBJECTS = String IRATools Error SerialPort Lecom Socket DataField DBT
IRALibrary_LIBS = acstime SlaLibrary maciClient

PY_PACKAGES  = IRAPy ReceiverBoardServer
PY_SCRIPTS = receiver-board-runserver
PY_SCRIPTS = recserver-start recserver-stop

EXECUTABLES     = FTrack STrack
EXECUTABLES_L   = Test1 Test2 TestDBTable TestTypes TestMicroControllerBoard TestReceiverControl TestLogDike TestTimeTaggedCircularArray  \
+33 −13
Original line number Diff line number Diff line
@@ -20,11 +20,17 @@ How To Use This Module
An alternative way is to execute directly this module from a shell::

       ./board_server.py

To stop the server::

       rs.stop()
"""

import socket, traceback, os, sys
import binhex
from random import randrange
from multiprocessing import Value


# Index of the byte that stores che command code
CMD_IDX = 3
@@ -70,6 +76,8 @@ CMD_STX = chr(0x02)
CMD_ETX = chr(0x03)
CMD_EOT = chr(0x04)

stop_server = Value('i', False)

class BoardServer:
    """A simulator of Franco Fiocchi (Medicina) board."""

@@ -99,6 +107,8 @@ class BoardServer:
        # Number of connections counter
        counter = 0
        while True:
            if stop_server.value:
                sys.exit(0)
            try:
                connection, clientaddr = self.s.accept()
                counter += 1 
@@ -110,7 +120,7 @@ class BoardServer:
                continue

            # Clean up old children
            reap()
            BoardServer.reap()

            # Fork a process for this connection
            pid = os.fork()
@@ -128,7 +138,11 @@ class BoardServer:
                counter = 0
                try:
                    while True:
                        data = connection.recv(2048)
                        data = connection.recv(1024)
                        if '#stop' in data:
                            stop_server.value = True
                            connection.close()
                            break
                        # Is the command short?
                        is_short = False
                        cmd = chr(0x00)
@@ -207,6 +221,14 @@ class BoardServer:
                # and not go back to the top of the loop
                sys.exit(0)

    @staticmethod
    def stop(server=('127.0.0.1', 5002)):
            sockobj = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sockobj.settimeout(2)
            sockobj.connect(server) 
            sockobj.sendall('#stop\r\n')

    @staticmethod
    def reap():
        """Collect any child processes that may be outstanding."""
        while True:
@@ -222,5 +244,3 @@ def reap():
if __name__ == "__main__":
    bs = BoardServer()
    bs.run()

+1 −2
Original line number Diff line number Diff line
#!/usr/bin/env python
"""Start the receiver board server"""

from ReceiverBoardServer.board_server import BoardServer

if __name__ == "__main__":
    server = BoardServer()
    server.run()

+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="ISO-8859-1"?>
<Container xmlns="urn:schemas-cosylab-com:Container:1.0"
           xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" 
           xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" 
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
           xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" 
           ImplLang="py"
           Timeout="30.0"
           UseIFR="true"
           ManagerRetry="10"
           Recovery="false">

    <Autoload>
        <cdb:_ string="baci" />
    </Autoload>

    <LoggingConfig 
		centralizedLogger="Log"
		minLogLevel="5"
		minLogLevelLocal="5"
		dispatchPacketSize="0"
		immediateDispatchLevel="8"
		flushPeriodSeconds="1"
	>
    </LoggingConfig>

</Container>
+10 −6
Original line number Diff line number Diff line
@@ -6,17 +6,21 @@ xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

Mode="C1C1"
LBandRFMin="1300.0 1300.0"
LBandRFMax="1800.0 1800.0"
PBandRFMin="305.0 305.0"
PBandRFMax="410.0 410.0"
LBandFilterID="1"
LBandRFMin="1300.0 1300.0"
LBandRFMax="1800.0 1800.0"
PBandFilterID="1"
LBandFilterID="1"
IFs="2"
LBandIFMin="100.0 100.0"
PBandIFMin="100.0 100.0"
PBandIFMin="305.0 305.0"
LBandIFMin="1300.0 1300.0"
Feeds="2" 
LBandPolarization="L R"
PBandPolarization="L R"
LBandPolarization="L R"
DefaultLO="2300.0 2300.0"
FixedLO2="0.0 0.0"
LOMin="100.0 100.0"
LOMax="100.0 100.0"
/>
Loading