Esempio n. 1
0
# Initialize parameters
#

# Parse command line arguments
import optparse
parser = optparse.OptionParser()
parser.add_option('-c', '--config', help = 'read configuration from FILE [default: %default]', metavar = 'FILE', default = 'pakbus.conf')
(options, args) = parser.parse_args()

# Read configuration file
import ConfigParser, StringIO
cf = ConfigParser.SafeConfigParser()
print 'configuration read from %s' % cf.read(options.config)

# Data logger PakBus Node Id
NodeId = str2int(cf.get('pakbus', 'node_id'))
# My PakBus Node Id
MyNodeId = str2int(cf.get('pakbus', 'my_node_id'))

# Open socket
s = pakbus.open_socket(cf.get('pakbus', 'host'), cf.getint('pakbus', 'port'), cf.getint('pakbus', 'timeout'))

# check if remote node is up
msg = pakbus.ping_node(s, NodeId, MyNodeId)
if not msg:
    raise Warning('no reply from PakBus node 0x%.3x' % NodeId)

#
# Main program
#
Esempio n. 2
0
import optparse

parser = optparse.OptionParser()
parser.add_option(
    "-c", "--config", help="read configuration from FILE [default: %default]", metavar="FILE", default="pakbus.conf"
)
(options, args) = parser.parse_args()

# Read configuration file
import ConfigParser, StringIO

cf = ConfigParser.SafeConfigParser()
print "configuration read from %s" % cf.read(options.config)

# Data logger PakBus Node Id
NodeId = str2int(cf.get("pakbus", "node_id"))
# My PakBus Node Id
MyNodeId = str2int(cf.get("pakbus", "my_node_id"))

# Open socket
s = pakbus.open_socket(cf.get("pakbus", "host"), cf.getint("pakbus", "port"), cf.getint("pakbus", "timeout"))

# check if remote node is up
msg = pakbus.ping_node(s, NodeId, MyNodeId)
if not msg:
    raise Warning("no reply from PakBus node 0x%.3x" % NodeId)

#
# Main program
#
Esempio n. 3
0
# Parse command line arguments
import optparse
parser = optparse.OptionParser()
parser.add_option('-c', '--config', help = 'read configuration from FILE [default: %default]', metavar = 'FILE', default = 'GilbertTest.conf')
(options, args) = parser.parse_args()

# Read configuration file
import ConfigParser, StringIO
cf = ConfigParser.SafeConfigParser()
print 'configuration read from %s' % cf.read(options.config)

# Data logger PakBus Node Id
# NodeId = str2int(cf.get('pakbus', 'node_id'))
# My PakBus Node Id
MyNodeId = str2int(cf.get('pakbus', 'my_node_id'))

# Open socket
s = pakbus.open_socket(cf.get('pakbus', 'host'), cf.getint('pakbus', 'port'), cf.getint('pakbus', 'timeout'))






# normal time between each update to database from datalogger tables
database_update_time_gap = str2int(cf.get('GilbertTest', 'database_update_time_gap'))

# time gap when it retries connections to list of devices and updates list
connection_retry_time = str2int(cf.get('GilbertTest', 'connection_retry_time'))
Esempio n. 4
0
import optparse
parser = optparse.OptionParser()
parser.add_option('-c',
                  '--config',
                  help='read configuration from FILE [default: %default]',
                  metavar='FILE',
                  default='pakbus.conf')
(options, args) = parser.parse_args()

# Read configuration file
import ConfigParser, StringIO
cf = ConfigParser.SafeConfigParser()
print 'configuration read from %s' % cf.read(options.config)

# Data logger PakBus Node Id
NodeId = str2int(cf.get('pakbus', 'node_id'))
# My PakBus Node Id
MyNodeId = str2int(cf.get('pakbus', 'my_node_id'))

# Open socket
s = pakbus.open_socket(cf.get('pakbus', 'host'), cf.getint('pakbus', 'port'),
                       cf.getint('pakbus', 'timeout'))

# check if remote node is up
msg = pakbus.ping_node(s, NodeId, MyNodeId)
if not msg:
    raise Warning('no reply from PakBus node 0x%.3x' % NodeId)

#
# Main program
#
Esempio n. 5
0
parser.add_option('-c',
                  '--config',
                  help='read configuration from FILE [default: %default]',
                  metavar='FILE',
                  default='GilbertTest.conf')
(options, args) = parser.parse_args()

# Read configuration file
import ConfigParser, StringIO
cf = ConfigParser.SafeConfigParser()
print 'configuration read from %s' % cf.read(options.config)

# Data logger PakBus Node Id
# NodeId = str2int(cf.get('pakbus', 'node_id'))
# My PakBus Node Id
MyNodeId = str2int(cf.get('pakbus', 'my_node_id'))

# Open socket
s = pakbus.open_socket(cf.get('pakbus', 'host'), cf.getint('pakbus', 'port'),
                       cf.getint('pakbus', 'timeout'))

# normal time between each update to database from datalogger tables
database_update_time_gap = str2int(
    cf.get('GilbertTest', 'database_update_time_gap'))

# time gap when it retries connections to list of devices and updates list
connection_retry_time = str2int(cf.get('GilbertTest', 'connection_retry_time'))

if (connection_retry_time < database_update_time_gap):
    raise Warning(
        '"database_update_time_gap" is bigger than "connection_retry_time"')