Пример #1
0
 def ping(self):
     """
         pings the logger
     """
     rsp = {}
     while rsp == {}:
         rsp = pakbus.ping_node(self.link, self.l_id, self.c_id)
     return rsp
Пример #2
0
# 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
#

# Upload directory data
FileData, Response = pakbus.fileupload(s, NodeId, MyNodeId, '.DIR')

# List files in directory
filedir = pakbus.parse_filedir(FileData)
for file in filedir['files']:
    print file
Пример #3
0
 def ping (self):
     """ Function doc """
     return pkb.ping_node(self.socket,self.logger_id,self.cpu_id)
Пример #4
0
# 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
#

# Upload directory data
FileData, Response = pakbus.fileupload(s, NodeId, MyNodeId, '.DIR')

# List files in directory
filedir = pakbus.parse_filedir(FileData)
for file in filedir['files']:
    print file