Exemplo n.º 1
0
 def connect(self, login=None, passcode=None, headers=None, versions=None, host=None, heartBeats=None):
     """Create a **CONNECT** frame and set the session state to :attr:`CONNECTING`."""
     self.__check('connect', [self.DISCONNECTED])
     self._versions = versions
     frame = commands.connect(login, passcode, headers, self._versions, host, heartBeats)
     self._state = self.CONNECTING
     return frame
Exemplo n.º 2
0
 def connect(self, login=None, passcode=None, headers=None, versions=None, host=None, heartBeats=None):
     """Create a **CONNECT** frame and set the session state to :attr:`CONNECTING`."""
     self.__check('connect', [self.DISCONNECTED])
     self._versions = versions
     (self._clientSendHeartBeat, self._clientReceiveHeartBeat) = (0, 0) if (heartBeats is None) else heartBeats
     frame = commands.connect(login, passcode, headers, self._versions, host, heartBeats)
     self._state = self.CONNECTING
     return frame
Exemplo n.º 3
0
 def connect(self, login=None, passcode=None, headers=None, versions=None, host=None, heartBeats=None):
     """Create a **CONNECT** frame and set the session state to :attr:`CONNECTING`."""
     self.__check("connect", [self.DISCONNECTED])
     self._versions = versions
     (self._clientSendHeartBeat, self._clientReceiveHeartBeat) = (0, 0) if (heartBeats is None) else heartBeats
     frame = commands.connect(login, passcode, headers, self._versions, host, heartBeats)
     self._state = self.CONNECTING
     return frame
Exemplo n.º 4
0
# uncomment used modules
# from moduleSensor import *
# liftings commands for a 96 well plate
from moduleLifter import lift_lid_from_plate96, lift_lid_from_holder_plate96
# placing commands for a 96 well plate
from moduleLifter import place_lid_onto_plate96, place_lid_onto_holder_plate96
from moduleTransportation import move_to_lidHolder, move_to_moduleLifter, \
    move_to_moduleSensor
# import measurement protocol scripted for a well palte format
from moduleTransportation import measure_96plate
from commands import connect, home_all

# reset robot
robot2.reset()

# if RPi is used, uncomment the next two lines
# camera.resolution = (750, 750)
# camera.rotation = 90

# define time for well measurement in moduleTransportation
# for example
# time_per_measurement = 120

# connect to USB ports
connect()
# home specified linear stages
home_all()


Exemplo n.º 5
0
                period: {obj.period}")
        ticks = []
        for i in obj.items:
            ticks.append([i.date, i.open, i.high, i.low, i.close])
        print(tabulate(ticks,
                       headers=['date', 'open', 'high', 'low', 'close']))
    else:
        # а все остальное на всякий случай печатаем
        print(f"CALLBACK {type(obj)}>\n{obj}")


if __name__ == '__main__':
    try:
        cmd.initialize("Logs", 3, custom_callback)
        login = os.environ['TRANSAQ_LOGIN']
        password = os.environ['TRANSAQ_PASS']
        cmd.connect(login, password, "tr1.finam.ru:3900")
        # Тут должна быть асинхронная логика,
        # но для примера просто ждем ответ сервера
        # Если не успевает произойти соединение - увеличьте время
        time.sleep(20)
        cmd.get_history('TQBR', 'GAZP', 2, count=10)
        # Тут должна быть асинхронная логика,
        # но для примера просто ждем ответ сервера
        time.sleep(10)
    except Exception as exc:
        print(f"EXCEPTION:{exc}")
    finally:
        print(cmd.disconnect())
        cmd.uninitialize()