Esempio n. 1
0
 def __init__(self, channel, visualizer, conf_file):
     self.channel = channel
     result = self.channel.queue_declare(queue='')
     queue_name = result.method.queue
     self.channel.queue_bind(
         queue=queue_name,
         exchange=configReader.ConfigReader(conf_file).exchange_name)
     self.channel.basic_consume(queue=queue_name,
                                auto_ack=True,
                                on_message_callback=self.callback)
     self.visualizer = visualizer
Esempio n. 2
0
    def __init__(self,
                 configFile="config.xml",
                 scannerIDIn=None,
                 serverAddressIn=None,
                 serverPortIn=None,
                 updateDelayIn=None,
                 gpsPortIn=None,
                 gpsBaudIn=None,
                 mapsURLIn=None,
                 mapsZoomIn=None,
                 mapsMagnificationIn=None):
        self.configReader = configReader.ConfigReader(configFile)
        serverAddress = self.configReader.getGT06ServerHostname()
        serverPort = int(self.configReader.getGT06ServerPort())
        gpsPort = self.configReader.getGPSDevicePort()
        gpsBaud = int(self.configReader.getGPSDeviceBaud())
        mapsURL = self.configReader.getMapsURL()
        mapsZoom = int(self.configReader.getMapsZoom())
        mapsMagnification = int(self.configReader.getMapsMagnification())
        self.scannerID = self.configReader.getScannerID()
        self.updateDelay = int(self.configReader.getGT06ServerUpdateDelay())

        if serverAddressIn:
            serverAddress = serverAddressIn
        if serverPortIn:
            serverPort = int(serverPortIn)

        if gpsPortIn:
            gpsPort = gpsPortIn
        if gpsBaudIn:
            gpsBaud = int(gpsBaudIn)

        if scannerIDIn:
            self.scannerID = scannerIDIn

        if updateDelayIn:
            self.updateDelay = int(updateDelayIn)

        if mapsURL and mapsZoom != None and mapsMagnification != None:
            self.displayLocation = displayLocation.DisplayLocation(
                mapsURL, mapsZoom, mapsMagnification)
        elif mapsURL and mapsZoom != None:
            self.displayLocation = displayLocation.DisplayLocation(
                mapsURL, mapsZoom)
        elif mapsURL:
            self.displayLocation = displayLocation.DisplayLocation(mapsURL)

        self.gt06Client = gt06Client.GT06Client(serverAddress, serverPort)

        self.gpsScanner = gpsScanner.GPSScanner(gpsPort, gpsBaud)
Esempio n. 3
0
 def create_channel(self):
     config_reader = configReader.ConfigReader(self.conf_file)
     user_credentials = pika.credentials.PlainCredentials(
         config_reader.message_broker_user,
         config_reader.message_broker_pwd)
     connection = pika.BlockingConnection(
         pika.ConnectionParameters(
             host=config_reader.message_broker_ip,
             port=config_reader.message_broker_port,
             virtual_host=config_reader.message_broker_virtual_host,
             credentials=user_credentials))
     channel = connection.channel()
     channel.exchange_declare(exchange=config_reader.exchange_name,
                              exchange_type=self.exchange_type)
     return channel
    def __init__(self, config_file):
        self.SECTION = "Manager"
        self.CONF_DIR = "ConfDir"
        self.MAIL_SERVER = "mailServer"
        self.MAIL_SENDER = "mailSender"
        self.MAIL_PASSWORD = "******"
        self.MAIL_RECEIVER = "mailReceiver"
        self.HTTP_PROXY_ADDR = "http-proxy-addr"
        self.HTTP_PROXY_PORT = "http-proxy-port"
        self.MAIL_SUBJECT = "mailSubject"  #"JCS_Config_Change_Notification"
        self.BUCKET = "s3Bucket"

        try:
            self.configReader = configReader.ConfigReader(
                config_file)  #("/tmp/Config_Manager_config.conf")
            self.S3_BUCKET = self.configReader.getValue(
                self.SECTION, self.BUCKET)
        except Exception:
            logger.error("Invalid config file")
        self.s3Dao = s3Dao.S3Dao()
        self.s3Dao.setBucket(self.S3_BUCKET)
    def __init__(self,
                 configFile="config.xml",
                 directionsAPIURLIn=None,
                 directionsAPIKeyIn=None,
                 geocodingAPIURLIn=None,
                 placeSearchAPIURLIn=None,
                 gpsPortIn=None,
                 gpsBaudIn=None,
                 audioInputDeviceIndexIn=None,
                 audioThresholdIn=None,
                 timeoutLengthIn=None,
                 googleServiceAccountJSONIn=None,
                 ttsWordRateIn=None):
        self.configReader = configReader.ConfigReader(configFile)

        self.directionsAPIURL = self.configReader.getDirectionsAPIURL()
        if directionsAPIURLIn:
            self.directionsAPIURL = directionsAPIURLIn

        self.directionsAPIKey = self.configReader.getDirectionsAPIKey()
        if directionsAPIKeyIn:
            self.directionsAPIKey = directionsAPIKeyIn

        self.geocodingAPIURL = self.configReader.getGeocodingAPIURL()
        if geocodingAPIURLIn:
            self.geocodingAPIURL = geocodingAPIURLIn

        self.placeSearchAPIURL = self.configReader.getPlaceSearchAPIURL()
        if placeSearchAPIURLIn:
            self.placeSearchAPIURL = placeSearchAPIURLIn

        ttsWordRate = self.configReader.getTextToSpeechWordRate()
        if ttsWordRateIn:
            ttsWordRate = ttsWordRateIn

        googleServiceAccountJSON = self.configReader.getGoogleServiceAccountJSONFilePath(
        )
        if googleServiceAccountJSONIn:
            googleServiceAccountJSON = googleServiceAccountJSONIn

        audioInputDeviceIndex = self.configReader.getAudioInputDeviceIndex()
        if audioInputDeviceIndexIn != None:
            audioInputDeviceIndex = audioInputDeviceIndexIn

        audioThreshold = self.configReader.getAudioThreshold()
        if audioThresholdIn != None:
            audioThreshold = audioThresholdIn

        timeoutLength = self.configReader.getTimeoutLength()
        if timeoutLengthIn != None:
            timeoutLength = timeoutLengthIn

        gpsPort = self.configReader.getGPSDevicePort()
        if gpsPortIn:
            gpsPort = gpsPortIn

        gpsBaud = self.configReader.getGPSDeviceBaud()
        if gpsBaudIn:
            gpsBaud = gpsBaudIn

        self.savedAddresses = self.configReader.getSavedAddresses()

        self.textToSpeech = pyttsx3.init()
        self.textToSpeech.setProperty("rate", ttsWordRate)

        self.googleASR = googleASR.GoogleASR(
            googleServiceAccountJSON=googleServiceAccountJSON,
            audioInputDeviceIndex=audioInputDeviceIndex,
            audioThreshold=audioThreshold,
            timeoutLength=timeoutLength)

        self.pocketSphinxASRYesNo = pocketSphinxASR.PocketSphinxASR(
            audioInputDeviceIndex=audioInputDeviceIndex,
            audioThreshold=audioThreshold,
            timeoutLength=timeoutLength,
            lmPath=os.path.join(os.getcwd(), "yesno.lm"),
            dictPath=os.path.join(os.getcwd(), "yesno.dict"))

        self.pocketSphinxASRLocType = pocketSphinxASR.PocketSphinxASR(
            audioInputDeviceIndex=audioInputDeviceIndex,
            audioThreshold=audioThreshold,
            timeoutLength=timeoutLength,
            lmPath=os.path.join(os.getcwd(), "loctype.lm"),
            dictPath=os.path.join(os.getcwd(), "loctype.dict"))
Esempio n. 6
0
def main():
    cfg = configReader.ConfigReader()
    cfg.readConfig()
    myBot = MephaBot(cfg)
    myBot.runBot()
Esempio n. 7
0
import configReader
import sys

if len(sys.argv) is not 5:
    raise Exception(
        "Required arguments - [config_file_path, section, key, value]")

config_file = sys.argv[1]
section = sys.argv[2]
key = sys.argv[3]
value = sys.argv[4]

reader = configReader.ConfigReader(config_file)
reader.setValue(section, key, value)
Esempio n. 8
0
nearPedestals = [0, 2, 8, 6]

leftPedestals = [[1, 2],
[5, 8],
[7, 6],
[3, 0]]

rightPedestals = [[3, 6],
[1, 0],
[5, 2],
[7, 8]]

homeMarker = [0, 21, 14, 7]

c = configReader.ConfigReader(R.usbkey, d)
v = voltaged.Voltaged(R, d)
l = lift.Lift(R)
if c.getDebug():
    f = function.Driver(R, m, c.getMaxSpeed(), c.getDistModifier(), c.getDistModifierBegin(), (c.getCamResX(), c.getCamResY()), d)
else:
    f = function.Driver(R, m, c.getMaxSpeed(), c.getDistModifier(), c.getDistModifierBegin(), (c.getCamResX(), c.getCamResY()))
    
a = anticollisiond.AntiCollisiond(R)
l.daemon = True
m.daemon = True
a.daemon = True
v.daemon = True

b = c.getTokenOrder()
command = c.getCommands()