|
25 | 25 |
|
26 | 26 |
|
27 | 27 | name = 'upydevice' |
28 | | -version = '0.2.1' |
| 28 | +version = '0.2.2' |
29 | 29 |
|
30 | 30 |
|
31 | 31 | class W_UPYDEVICE: |
@@ -2664,14 +2664,35 @@ def get_datalog(self, dvars=None, fs=None, time_out=None, units=None): |
2664 | 2664 | temp_dict['u'] = units |
2665 | 2665 | self.datalog = temp_dict |
2666 | 2666 |
|
| 2667 | + def cmd(self, cmd, silent=False, rtn=False, ssl=False, nb_queue=None): |
| 2668 | + if not self.connected: |
| 2669 | + self.open_wconn(ssl=ssl, auth=True) |
| 2670 | + self.wr_cmd(cmd, silent=True) |
| 2671 | + if self.connected: |
| 2672 | + self.close_wconn() |
| 2673 | + self.get_output() |
| 2674 | + if not silent: |
| 2675 | + print(self.response) |
| 2676 | + if rtn: |
| 2677 | + return self.output |
| 2678 | + if nb_queue is not None: |
| 2679 | + nb_queue.put((self.output), block=False) |
| 2680 | + |
2667 | 2681 | def cmd_nb(self, command, silent=False, rtn=True, long_string=False, |
2668 | 2682 | rtn_resp=False, follow=False, pipe=None, multiline=False, |
2669 | 2683 | dlog=False): |
2670 | | - self.dev_process_raw = multiprocessing.Process( |
2671 | | - target=self.wr_cmd, args=(command, silent, rtn, long_string, rtn_resp, |
2672 | | - follow, pipe, multiline, dlog, |
2673 | | - self.output_queue)) |
2674 | | - self.dev_process_raw.start() |
| 2684 | + # do a |
| 2685 | + if self.connected: |
| 2686 | + self.dev_process_raw = multiprocessing.Process( |
| 2687 | + target=self.wr_cmd, args=(command, silent, rtn, long_string, rtn_resp, |
| 2688 | + follow, pipe, multiline, dlog, |
| 2689 | + self.output_queue)) |
| 2690 | + self.dev_process_raw.start() |
| 2691 | + else: |
| 2692 | + self.dev_process_raw = multiprocessing.Process( |
| 2693 | + target=self.cmd, args=(command, silent, False, False, |
| 2694 | + self.output_queue)) |
| 2695 | + self.dev_process_raw.start() |
2675 | 2696 |
|
2676 | 2697 | def get_nb_opt(self): |
2677 | 2698 | try: |
|
0 commit comments