Пример #1
0
    def __init__(self, p_ugm_engine, p_ip, p_use_tagger, context=ctx.get_dummy_context('UdpServer')):
        """Init server and store ugm engine."""
        self.context = context
        self._ugm_engine = p_ugm_engine
        self._use_tagger = p_use_tagger
        if self._use_tagger:
            self._tagger = tagger.get_tagger()

        self.socket = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
        self.socket.bind((p_ip, 0))
Пример #2
0
    def __init__(self,
                 p_ugm_engine,
                 p_ip,
                 p_use_tagger,
                 context=ctx.get_dummy_context('UdpServer')):
        """Init server and store ugm engine."""
        self.context = context
        self._ugm_engine = p_ugm_engine
        self._use_tagger = p_use_tagger
        if self._use_tagger:
            self._tagger = tagger.get_tagger()

        self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        self.socket.bind((p_ip, 0))
Пример #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author:
#     Mateusz Kruszyński <*****@*****.**>

from obci.utils import tagger
import time

TAGGER = tagger.get_tagger()
COLORS = ['czerwony', 'zielony', 'niebieski', 'bialy']
NAMES = ['pozytywny', 'negatywny', 'neutralny']
import random

from obci.control.peer.configured_client import ConfiguredClient
from multiplexer.multiplexer_constants import peers, types
from obci.configs import settings

class AutoTagGenerator(ConfiguredClient):
    def __init__(self, addresses):
        super(AutoTagGenerator, self).__init__(addresses, peers.TAGS_SENDER)
        self.ready()


    def run(self):
        while True:
            time.sleep(1.0 + random.random()*10.0)
            name = NAMES[random.randint(0, len(NAMES)-1)]

            t= time.time()
            print("SEND TAG name"+name+" with time: "+repr(t))
            if name == 'pozytywny' or name == 'negatywny':