Ejemplo n.º 1
0
#!/usr/bin/python3
#
# Author:
#     Mateusz Kruszyński <*****@*****.**>

from obci.mx_legacy.multiplexer_constants import types
from obci.utils import tags_helper
from obci.configs import variables_pb2

import queue


from obci.drivers import drivers_logging as logger
LOGGER = logger.get_logger("tags_to_mxmsg", "info")


class TagMsg(object):

    def get_message(self, tag, ts, mx=True):
        t = self._get_message(tag, ts)
        if mx:
            return types.TAG, tags_helper.pack_tag_from_tag(t)
        else:
            return types.TAG, t

    def _get_message(self, tag, ts):
        diff = tag['end_timestamp'] - tag['start_timestamp']
        tag['start_timestamp'] = ts
        tag['end_timestamp'] = ts + diff
        return tag
Ejemplo n.º 2
0
from obci.control.launcher.launcher_tools import obci_root
import json

DISCOVERY_MODULE_NAMES = [
                        'amplifier_virtual_discovery',
                        'amplifier_tmsi_bt_discovery',
			'amplifier_gtec_usb_discovery',
                        'amplifier_tmsi_usb_discovery',
			'amplifier_openbciv3_usb_discovery']
BASE_MODULE = 'obci.drivers.eeg.driver_discovery'

LOADED_MODULE_NAMES = []

discovery_modules = []

LOGGER = logger.get_logger("DriverDiscovery", "info")

for mod_name in DISCOVERY_MODULE_NAMES:
    name = BASE_MODULE + '.' + mod_name
    try:
        __import__(name)

    except ImportError:
        LOGGER.error("could not import discovery module %s" % name)
        continue
    discovery_modules.append(sys.modules[name])
    LOADED_MODULE_NAMES.append(mod_name)


def find_drivers():
    return _find_amps(discovery_modules)
Ejemplo n.º 3
0
#from obci.control.peer.configured_multiplexer_server import ConfiguredMultiplexerServer
from obci.control.launcher.launcher_tools import obci_root
import json

DISCOVERY_MODULE_NAMES = [
                        'amplifier_virtual_discovery',
                        'amplifier_tmsi_bt_discovery',
			'amplifier_gtec_usb_discovery',
                        'amplifier_tmsi_usb_discovery']
BASE_MODULE = 'obci.drivers.eeg.driver_discovery'

LOADED_MODULE_NAMES = []

discovery_modules = []

LOGGER = logger.get_logger("DriverDiscovery", "info")

for mod_name in DISCOVERY_MODULE_NAMES:
    name = BASE_MODULE + '.' + mod_name
    try:
        __import__(name)
        discovery_modules.append(sys.modules[name])
        LOADED_MODULE_NAMES.append(mod_name)
    except:
        LOGGER.warning("Failed to load discovery module: " + mod_name)

def find_drivers():
    return _find_amps(discovery_modules)

def _filter_modules(pattern):
    return [sys.modules[BASE_MODULE + '.' + mod] for mod in LOADED_MODULE_NAMES if pattern in mod]
Ejemplo n.º 4
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Author:
#     Mateusz Kruszyński <*****@*****.**>

from multiplexer.multiplexer_constants import peers, types
from obci.utils import tags_helper
from obci.configs import variables_pb2

import Queue


from obci.drivers import drivers_logging as logger
LOGGER = logger.get_logger("tags_to_mxmsg", "info")

class TagMsg(object):
    def get_message(self, tag, ts, mx=True):
        t = self._get_message(tag, ts)
        if mx:
            return types.TAG, tags_helper.pack_tag_from_tag(t)
        else:
            return types.TAG, t

    def _get_message(self, tag, ts):
        diff = tag['end_timestamp'] - tag['start_timestamp']
        tag['start_timestamp'] = ts
        tag['end_timestamp'] = ts + diff
        return tag

class BlinkMsg(object):