Example #1
0
    def __init__(self, settings, platform_info=None):

        # Fulfill singleton factory.
        TerkinDatalogger.__instance__ = self

        # Obtain configuration settings.
        self.settings = TerkinConfiguration()
        self.settings.add(settings)
        self.settings.add_user_file()

        self.application_info = ApplicationInfo(name=self.name,
                                                version=self.version,
                                                settings=self.settings,
                                                application=self,
                                                platform_info=platform_info)

        # Configure logging.
        logging_enabled = self.settings.get('main.logging.enabled', False)
        if not logging_enabled:
            log.info('Disabling logging to save bytes')
            logging.disable_logging()

        # Initialize transient storage.
        self.storage = TransientStorage()

        # Initialize device.
        self.device = TerkinDevice(self.application_info)

        # Button manager instance (optional).
        self.button_manager = None

        # Initialize sensor domain.
        self.sensor_manager = SensorManager()

        self.duty_chrono = GenericChronometer()
Example #2
0
    def __init__(self, settings, platform_info: PlatformInfo = None):

        # Reference to the chronometer used for general timekeeping.
        self.duty_chrono = bootloader.duty_chrono

        # Signal startup with first available timestamp.
        log.info('Starting Terkin datalogger')

        # Obtain configuration settings.
        self.settings = TerkinConfiguration()
        self.settings.add(settings)
        self.settings.add_user_file()

        # Configure logging.
        logging_enabled = self.settings.get('main.logging.enabled', False)
        if not logging_enabled:
            log.info('Disabling logging to save bytes')
            logging.disable_logging()

        # Initialize ApplicationInfo object.
        self.application_info = ApplicationInfo(
            name=self.name, version=self.version, settings=self.settings,
            application=self, platform_info=platform_info)

        # Initialize transient storage.
        self.storage = TransientStorage()

        # Initialize device.
        self.device = TerkinDevice(self.application_info)

        # Button manager instance (optional).
        self.button_manager = None

        # Initialize sensor domain.
        self.sensor_manager = SensorManager(self.settings)
Example #3
0
    def __init__(self, settings):

        # Obtain configuration settings.
        self.settings = TerkinConfiguration()
        self.settings.add(settings)

        # Configure logging.
        logging_enabled = self.settings.get('main.logging.enabled', False)
        if not logging_enabled:
            logging.disable_logging()

        # Initialize device.
        self.device = TerkinDevice(name=self.name, version=self.version, settings=self.settings)

        # Button manager instance (optional).
        self.button_manager = None

        # Initialize sensor domain.
        self.sensor_manager = SensorManager()