def get_programs (self): """ Function doc """ data, code = self.download('.DIR') if code: file_dir = pkb.parse_filedir(data) self.programs = [files['FileName'] for files in file_dir['files']] return code
def fetchprogs(self): """ makes a list of the programs avaible on the data logger """ FileData, Response = pakbus.fileupload(self.link, self.l_id, self.c_id , '.DIR') file_dir = pakbus.parse_filedir(FileData) for files in file_dir['files']: self.progs.append(files['FileName'])
# 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 # say good bye pakbus.send(s, pakbus.pkt_bye_cmd(NodeId, MyNodeId)) # close socket s.close()
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 # say good bye pakbus.send(s, pakbus.pkt_bye_cmd(NodeId, MyNodeId)) # close socket s.close()