コード例 #1
0
#!/usr/bin/env python3
# ____________developed by paco andres_10/04/2019___________________
import sys

from PYRobot.libs.starter import Comp_Starter
import PYRobot.libs.utils as utils
import PYRobot.libs.utils_BB as BB
from PYRobot.libs.botlogging.coloramadefs import P_Log

robots_dir = utils.get_PYRobots_dir()
sys.path.append(robots_dir)

if __name__ == '__main__':
    if len(sys.argv) >= 2:
        if sys.argv[1] == "start":
            server = Comp_Starter("bin", "bigbrother")
            if server.uri_BB == "0.0.0.0:0":
                server.Create("PYRobot")
                server.start()
        if sys.argv[1] == "stop":
            server = Comp_Starter("bin", "bigbrother")
            if server.uri_BB != "0.0.0.0:0":
                print(server.uri_BB)
                server.stop()
        if sys.argv[1] == "kill":
            pids = utils.findProcessIdByName("PYRobot/bigbrother")
            for p, n in pids:
                utils.kill_process(p)
                P_Log("killing {} PID:{}".format(n, p))
        if sys.argv[1] == "status":
            st = Comp_Starter("bin", "bigbrother")
コード例 #2
0
#!/usr/bin/env python3
# ____________developed by paco andres_10/04/2019___________________
import sys
import os
import time
from PYRobot.libs.starter import Comp_Starter
from PYRobot.libs.utils import get_PYRobots_dir, run_component
import PYRobot.libs.config_comp as conf
import PYRobot.libs.utils_BB as BB
from PYRobot.libs.botlogging.coloramadefs import P_Log
import PYRobot.libs.parser as parser

robots_dir = get_PYRobots_dir()
sys.path.append(robots_dir)


def params(cad):
    component = parser.get_COMPONENT(cad)
    if component != "":
        robot, comp = component.split("://")
        node, comp = comp.split("/")
        return robot, node, comp
    else:
        P_Log(
            "{} not valid sintax robot://node/component or robot://component".
            format(cad))
        exit()


if __name__ == '__main__':
    if len(sys.argv) == 2:
コード例 #3
0
# -*- coding: utf-8 -*-
# ____________developed by paco andres____________________

import os.path
from PYRobot.libs import utils, myjson
from PYRobot.libs.botlogging.coloramadefs import P_Log
from PYRobot.libs.comp_skel import Component_Skel, _OPTIONS, General_Skel
from PYRobot.libs.utils import get_PYRobots_dir
import PYRobot.libs.parser as parser

import importlib
import pprint
import copy
import inspect

PYROBOTS = get_PYRobots_dir()
robots_dir = get_PYRobots_dir()
dir_comp = "components/"


def init_ttys():
    ttydef, ttyout, ttyerr = utils.assing_ttys()
    P_Log("[FY]Availables TTYs:")
    P_Log("\t Terminal: {}".format(ttydef))
    P_Log("\t Components: {}".format(ttyout))
    P_Log("\t Components errors: {}".format(ttyerr))
    P_Log("")
    return ttydef, ttyout, ttyerr


def init_ethernet():