Пример #1
0
 def upload(self, filename, s_cond = 0x0000, swath = 0x0200):
     """
         upload a file to the logger
     
     arguments:
         filename:   (string) the file to be uploaded
         s_cond:     (int) the security condition
         swath:      (int) 
         
     returns:
         the response from the logger
     """
     self.ping()
     try:
         f = open(filename, 'rb')
     except IOError:
         return "File Error"
     f_contents = f.read()
     f.close()
     
     
     rsp = pakbus.filedownload(self.link, self.l_id, self.c_id, 
                         "CPU:"+filename, f_contents , s_cond, swath)
     self.fetchprogs()
     return rsp
Пример #2
0
 def upload (self, file_name, data):
     """ Function doc """
     code = pkb.filedownload(self.socket, 
                             self.logger_id, 
                             self.cpu_id, 
                             file_name, 
                             data, 
                             self.security_code)
     return True if code == 0 else False