def ping(self): """ pings the logger """ rsp = {} while rsp == {}: rsp = pakbus.ping_node(self.link, self.l_id, self.c_id) return rsp
# 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
def ping (self): """ Function doc """ return pkb.ping_node(self.socket,self.logger_id,self.cpu_id)