Esempio n. 1
0
import  logmaster
import  timestamp                   # The CoarseTimeStamp class is used in multiple places below.
import  communicator                # For communicating between proxy & real WiFi_Module 
from    communicator    import *    # Define "Connection"
import  ports                       # SensorNode._setupBridgeServers() uses LASER_PORT, MESON_PORT.
import  bridge                      # SensorNode._setupBridgeServers() uses bridge.BridgeServer().

import  model
#from    model           import *    # Define "SensorNode"

__all__ = [
    'WiFi_Module',          # A component of a wireless SensorNode - EZURiO Wi-Fi evaluation board.
    ]

    # Create logging channel for this module.
logger = logmaster.getLogger(logmaster.sysName + '.model.wifi')     # 'COSMICi.model.wifi' = object model of Wi-Fi modules

#class SensorNode:           pass        # Implemented below.
class WiFi_Module:          pass        # Partially implemented below.

    # Exception classes.

class BadBridgeMode(Exception): pass
    # The current Wi-Fi bridging mode does not support 


        #|===========================================================================
        #|
        #|      WiFi_Module                                 [public module class]
        #|
        #|          An instance of this class is an object model/proxy
Esempio n. 2
0
import communicator  # .Message class
import model  # .SensorHost class
import gps
import utils  # .WatchBox class
import publisher  # .Publisher class

# Export public names.

__all__ = [
    'CTU_Node',  # Subclass of SensorNode for the Central Timing Unit.
    'CTU_Host',  # A component of a CTU_Node - The CTU GPS app, now running on the DE3 board (Stratix III FPGA).
]

# Create module's logging channel.

logger = logmaster.getLogger(logmaster.sysName + '.model.ctu')


class CTU_Node(model.SensorNode):
    pass  # Forward declaration


#|--------------------------------------------------------------------------
#|
#|      CTU_Host                                [module public class]
#|
#|          Provides our object model/server-side proxy for the
#|          Central Timing Unit (CTU).
#|
#|vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Esempio n. 3
0
import sitedefs  # class MainServer uses MY_IP
import tikiterm  # used several places

# List of all exported (public) names.

__all__ = [
    'Acknowledge_MsgHndlr',  # Message handler classes.
    'TermDisp_MsgHndlr',
    'Command_MsgHndlr',
    'MainConnHandler',  # Other classes.
    'MainSrvReqHandler',
    'MainServer'
]

# Module logger.
logger = logmaster.getLogger(logmaster.appName + '.mnSrv')

global cosmicIserver, cosmicIServer, cis
cis = cosmicIserver = cosmicIServer = None  # Initialized by COSMICi_server module.

#===================================================================
#   Message handlers for use by MainConnHandler.
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv


class Acknowledge_MsgHndlr(
        communicator.BaseMessageHandler
):  # Message handler that just acknowledges message receipt.

    defHandlerName = "main.ack"
Esempio n. 4
0
import model  # Define ".SensorNode" class
import utils  # .WatchBox class
import publisher  # .Publisher class

__all__ = [
    'DetectorNode',  # Subclass of SensorNode for an actual particle-detecting node.
    'ShowerDetectorNode',  # Subclass of Detector_Node for multi-sensor coincidence-filtering nodes (like the FEDM, as presently configured).
    'DetectorHost',  # A component of a Detector_Node - A detector app, now running on the FEDM board (Stratix II FPGA).
    'ShowerDetectorHost',  # A component of a ShowerDetector_Node - Subclass of Detector_Host for coincidence-filtering shower-detection mode.
    'Threshold_DAC',  # A component of a Detector_Node - A DAC setting detection threshold levels.
    'PulseformChannel',  # A component of a Detector_Host - An input channel on which we can receive digitized, timestamped pulse shapes.
]

# Create module's logging channel.

logger = logmaster.getLogger(logmaster.sysName + '.model.fedm')

# Advance declarations.


class DetectorNode(model.SensorNode):
    pass


# Not using this intermediate class for anything yet.
class DetectorHost(model.SensorHost):
    pass  # Not yet implemented


# Shouldn't the following really be a nested class within ShowerDetectorHost?
Esempio n. 5
0
# Standard modules.

import time
import threading

# Custom modules.

import flag
import logmaster

global __all__, logger, MINS_PER_BEAT

__all__ = ['Heart', 'MINS_PER_BEAT']

logger = logmaster.getLogger(logmaster.appName + '.heart')

MINS_PER_BEAT = 5


class Heart(logmaster.ThreadActor):

    defaultRole = 'heart'

    defMinsPerBeat = MINS_PER_BEAT

    #-------------------------------------------------------------------------
    #   .__init__()
    #
    #       Default initializer for objects of class Heart.
    #
Esempio n. 6
0
    'EmptyCommand',  # Exception classes.
    'Command',
    'CommandHandler',  # Regular classes.
    'commandHandler'  # Global objects.
]

#====================================================================
#   logger                                          [private global]
#
#       A logger, subordinate to the main application logger,
#       for logging messages posted from within this module.
#
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

global logger
logger = logmaster.getLogger(logmaster.appName + ".cmds")

#====================================================================
#   cosmicIServer, cis                              [private globals]
#
#       This will be a copy of the main CosmicIServer object
#       from the COSMICi_server module.  It gets initialized
#       in the initializer for commandHandler, which is called
#       from the initializer for cosmicIServer, so we know that
#       the cosmicIServer instance has already been created at
#       that point.
#
#       cis is just a convenient abbreviation for cosmicIServer.
#
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Esempio n. 7
0
    # Standard modules.
    
import time
import threading

    # Custom modules.
    
import flag
import logmaster

global __all__, logger, MINS_PER_BEAT

__all__ = ['Heart', 'MINS_PER_BEAT']

logger = logmaster.getLogger(logmaster.appName + '.heart')

MINS_PER_BEAT = 5

class Heart(logmaster.ThreadActor):

    defaultRole = 'heart'

    defMinsPerBeat = MINS_PER_BEAT

        #-------------------------------------------------------------------------
        #   .__init__()
        #
        #       Default initializer for objects of class Heart.
        #
        #       If period is provided, it sets the time between beats in minutes.
Esempio n. 8
0
import  communicator        # .Message class
import  model               # .SensorHost class
import  gps
import  utils               # .WatchBox class
import  publisher           # .Publisher class

    # Export public names.

__all__ = [
    'CTU_Node',             # Subclass of SensorNode for the Central Timing Unit.
    'CTU_Host',             # A component of a CTU_Node - The CTU GPS app, now running on the DE3 board (Stratix III FPGA).
    ]

    # Create module's logging channel.

logger = logmaster.getLogger(logmaster.sysName + '.model.ctu')

class CTU_Node(model.SensorNode): pass  # Forward declaration

    #|--------------------------------------------------------------------------
    #|
    #|      CTU_Host                                [module public class]
    #|
    #|          Provides our object model/server-side proxy for the
    #|          Central Timing Unit (CTU).
    #|
    #|vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

class CTU_Host(model.SensorHost):

    sensorHostType = 'CTU_HOST'     # Override default value from parent class.
Esempio n. 9
0
#|
#|vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

import threading  # RLock()

# Imports of custom user modules.

import logmaster  # getLogger(), etc.
import worklist  # Worker class.
import flag  # Flag class.

__all__ = [
    'RunManager'  # A worker thread to setup/monitor data-collection run.
]

logger = logmaster.getLogger(logmaster.sysName + '.runmgr')


class RunManager(worklist.Worker):

    # Class variables:

    defaultRole = 'runmgr'  # Override value from parent class.

    # Public instance data members:
    #
    #   The following are input flags for dynamically communicating important
    #   changes of system state to the RunManager.
    #
    #       ctu_ready   - Raise this flag when CTU is ready to accept commands.
    #       fedm_ready  - Raise this flag when FEDM is ready to accept commands.
Esempio n. 10
0
__all__ = [
    
    'DetectorNode',         # Subclass of SensorNode for an actual particle-detecting node.
    'ShowerDetectorNode',   # Subclass of Detector_Node for multi-sensor coincidence-filtering nodes (like the FEDM, as presently configured).
    
    'DetectorHost',         # A component of a Detector_Node - A detector app, now running on the FEDM board (Stratix II FPGA).
    'ShowerDetectorHost',   # A component of a ShowerDetector_Node - Subclass of Detector_Host for coincidence-filtering shower-detection mode.
    
    'Threshold_DAC',        # A component of a Detector_Node - A DAC setting detection threshold levels.
    'PulseformChannel',     # A component of a Detector_Host - An input channel on which we can receive digitized, timestamped pulse shapes.
    ]

    # Create module's logging channel.

logger = logmaster.getLogger(logmaster.sysName + '.model.fedm')

    # Advance declarations.

class DetectorNode(model.SensorNode):       pass

    # Not using this intermediate class for anything yet.
class DetectorHost(model.SensorHost):       pass        # Not yet implemented

    # Shouldn't the following really be a nested class within ShowerDetectorHost?

class PulseformChannel:
    # Data members:
    #   chan_id - The channel's ID #, an integer 1-3.

    def __init__(inst, chan):
Esempio n. 11
0
                            #   ------------------------    --------------------
import logmaster            #   (module level)              getLogger(), appName
import communicator         #   (module level)              BaseMessageHandler, ...
import tikiterm             #   BridgeMsgHandler.handle()   Cyan, Green
import timestamp            #   BridgeMsgHandler.handle()   CoarseTimeStamp()
import sitedefs             #   BridgeServer.__init__()     MY_IP

    # Exported names (public).

__all__ = [ 'BridgeMsgHandler',             # Classes.
            'BridgeConnHandler',
            'BrdgSrvReqHandler',
            'BridgeServer'          ]

    # Module logger.
logger = logmaster.getLogger(logmaster.appName + '.brdg')

    #===========================================
    #   Class definitions.      [code section]
    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

        #==================================================================
        #   BridgeMsgHandler                            [public class]
        #
        #       This implementation subclass of the abstract class
        #       BaseMessageHandler has several jobs:
        #
        #           1) Echo the incoming/outgoing message (with a
        #               timestamp) to a file that transcribes all
        #               the messages received/sent over that bridge
        #               connection.
Esempio n. 12
0
    "Command",
    "CommandHandler",  # Regular classes.
    "commandHandler",  # Global objects.
]


# ====================================================================
#   logger                                          [private global]
#
#       A logger, subordinate to the main application logger,
#       for logging messages posted from within this module.
#
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

global logger
logger = logmaster.getLogger(logmaster.appName + ".cmds")


# ====================================================================
#   cosmicIServer, cis                              [private globals]
#
#       This will be a copy of the main CosmicIServer object
#       from the COSMICi_server module.  It gets initialized
#       in the initializer for commandHandler, which is called
#       from the initializer for cosmicIServer, so we know that
#       the cosmicIServer instance has already been created at
#       that point.
#
#       cis is just a convenient abbreviation for cosmicIServer.
#
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Esempio n. 13
0
#|vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

import  threading                   # RLock()

        # Imports of custom user modules.

import  logmaster                   # getLogger(), etc.
import  worklist                    # Worker class.
import  flag                        # Flag class.


__all__ = ['RunManager'     # A worker thread to setup/monitor data-collection run.
           ]


logger = logmaster.getLogger(logmaster.sysName + '.runmgr')


class   RunManager(worklist.Worker):

        # Class variables:
    
    defaultRole = 'runmgr'      # Override value from parent class.

    # Public instance data members:
    #
    #   The following are input flags for dynamically communicating important
    #   changes of system state to the RunManager.
    #
    #       ctu_ready   - Raise this flag when CTU is ready to accept commands.
    #       fedm_ready  - Raise this flag when FEDM is ready to accept commands.
Esempio n. 14
0
import communicator     # module-level uses MessageHandler
import ports            # class MainServer uses COSMO_PORT
import sitedefs         # class MainServer uses MY_IP
import tikiterm         # used several places

    # List of all exported (public) names.

__all__ = [ 'Acknowledge_MsgHndlr',     # Message handler classes.
            'TermDisp_MsgHndlr',
            'Command_MsgHndlr',
            'MainConnHandler',          # Other classes.
            'MainSrvReqHandler',
            'MainServer'            ]

    # Module logger.
logger = logmaster.getLogger(logmaster.appName + '.mnSrv')

global cosmicIserver, cosmicIServer, cis
cis = cosmicIserver = cosmicIServer = None  # Initialized by COSMICi_server module.

    #===================================================================
    #   Message handlers for use by MainConnHandler.
    #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    
class Acknowledge_MsgHndlr(communicator.BaseMessageHandler):    # Message handler that just acknowledges message receipt.
    
    defHandlerName = "main.ack"
    
    def handle(inst, msg):                                      # To handle a message,
        if msg.dir == communicator.DIR_IN:                                       # If it's an incoming message,
            logger.debug("Acknowledge_MsgHndlr.handle(): Acknowledging received message [%s]..." % msg.data.strip())