Exemple #1
0
    try:

        syslog.openlog("genmon")
        syslog.syslog("%s" % Message)
        syslog.closelog()

    except Exception as e1:
        log.error("Error: " + str(e1))
        console.error("Error: " + str(e1))


#------------------- Command-line interface for gengpio ------------------------
if __name__ == '__main__':  #

    console, ConfigFilePath, address, port, loglocation, log = MySupport.SetupAddOnProgram(
        "gensyslog")

    # Set the signal handler
    signal.signal(signal.SIGINT, signal_handler)

    try:

        GenNotify = GenNotify(host=address,
                              port=port,
                              onready=OnReady,
                              onexercise=OnExercise,
                              onrun=OnRun,
                              onrunmanual=OnRunManual,
                              onalarm=OnAlarm,
                              onservice=OnService,
                              onoff=OnOff,
Exemple #2
0
    time.sleep(1)
    GPIO.output(pin, GPIO.LOW)
    time.sleep(1)

    for i in range(nfast):
        GPIO.output(pin, GPIO.HIGH)
        time.sleep(blinkdelay)
        GPIO.output(pin, GPIO.LOW)
        time.sleep(blinkdelay)


#------------------- Command-line interface for gengpioledblink ----------------
if __name__ == '__main__':  # usage program.py [server_address]

    try:
        console, ConfigFilePath, address, port, loglocation, log = MySupport.SetupAddOnProgram(
            "gengpioledblink")
        # Set the signal handler
        signal.signal(signal.SIGINT, signal_handler)

        conf_file = os.path.join(ConfigFilePath, 'gengpioledblink.conf')
        if os.path.isfile(conf_file):
            config = MyConfig(filename=conf_file,
                              section='gengpioledblink',
                              log=log)

            led_pin = config.ReadValue('ledpin', return_type=int, default=12)

        MyClientInterface = ClientInterface(host=address, port=port, log=log)

        #setup GPIO using Board numbering
        GPIO.setmode(GPIO.BOARD)