36 fetched from the connected device and written to the local file system |
36 fetched from the connected device and written to the local file system |
37 @signal putFileDone(localFile, deviceFile) emitted after the file was |
37 @signal putFileDone(localFile, deviceFile) emitted after the file was |
38 copied to the connected device |
38 copied to the connected device |
39 @signal deleteFileDone(deviceFile) emitted after the file has been deleted |
39 @signal deleteFileDone(deviceFile) emitted after the file has been deleted |
40 on the connected device |
40 on the connected device |
|
41 @signal putDataDone(deviceFile) emitted after data has been save to a file |
|
42 on the connected device |
41 @signal rsyncDone(localName, deviceName) emitted after the rsync operation |
43 @signal rsyncDone(localName, deviceName) emitted after the rsync operation |
42 has been completed |
44 has been completed |
43 @signal rsyncProgressMessage(msg) emitted to send a message about what |
45 @signal rsyncProgressMessage(msg) emitted to send a message about what |
44 rsync is doing |
46 rsync is doing |
45 @signal removeDirectoryDone() emitted after a directory has been deleted |
47 @signal removeDirectoryDone() emitted after a directory has been deleted |
55 currentDir = pyqtSignal(str) |
57 currentDir = pyqtSignal(str) |
56 currentDirChanged = pyqtSignal(str) |
58 currentDirChanged = pyqtSignal(str) |
57 getFileDone = pyqtSignal(str, str) |
59 getFileDone = pyqtSignal(str, str) |
58 putFileDone = pyqtSignal(str, str) |
60 putFileDone = pyqtSignal(str, str) |
59 deleteFileDone = pyqtSignal(str) |
61 deleteFileDone = pyqtSignal(str) |
|
62 putDataDone = pyqtSignal(str) |
60 rsyncDone = pyqtSignal(str, str) |
63 rsyncDone = pyqtSignal(str, str) |
61 rsyncProgressMessage = pyqtSignal(str) |
64 rsyncProgressMessage = pyqtSignal(str) |
62 removeDirectoryDone = pyqtSignal() |
65 removeDirectoryDone = pyqtSignal() |
63 createDirectoryDone = pyqtSignal() |
66 createDirectoryDone = pyqtSignal() |
64 fsinfoDone = pyqtSignal(tuple) |
67 fsinfoDone = pyqtSignal(tuple) |
146 self.__commandsInterface.get(deviceFileName, hostFileName) |
149 self.__commandsInterface.get(deviceFileName, hostFileName) |
147 self.getFileDone.emit(deviceFileName, hostFileName) |
150 self.getFileDone.emit(deviceFileName, hostFileName) |
148 except Exception as exc: |
151 except Exception as exc: |
149 self.error.emit("get", str(exc)) |
152 self.error.emit("get", str(exc)) |
150 |
153 |
|
154 def getData(self, deviceFileName): |
|
155 """ |
|
156 Public method to read data from the connected device. |
|
157 |
|
158 @param deviceFileName name of the file to read from |
|
159 @type str |
|
160 @return data read from the device |
|
161 @rtype bytes |
|
162 """ |
|
163 try: |
|
164 data = self.__commandsInterface.getData(deviceFileName) |
|
165 return data |
|
166 except Exception as exc: |
|
167 self.error.emit("getData", str(exc)) |
|
168 return b"" |
|
169 |
151 @pyqtSlot(str) |
170 @pyqtSlot(str) |
152 @pyqtSlot(str, str) |
171 @pyqtSlot(str, str) |
153 def put(self, hostFileName, deviceFileName=""): |
172 def put(self, hostFileName, deviceFileName=""): |
154 """ |
173 """ |
155 Public slot to put a file onto the device. |
174 Public slot to put a file onto the device. |
162 try: |
181 try: |
163 self.__commandsInterface.put(hostFileName, deviceFileName) |
182 self.__commandsInterface.put(hostFileName, deviceFileName) |
164 self.putFileDone.emit(hostFileName, deviceFileName) |
183 self.putFileDone.emit(hostFileName, deviceFileName) |
165 except Exception as exc: |
184 except Exception as exc: |
166 self.error.emit("put", str(exc)) |
185 self.error.emit("put", str(exc)) |
|
186 |
|
187 def putData(self, deviceFileName, data): |
|
188 """ |
|
189 Public method to write data to the connected device. |
|
190 |
|
191 @param deviceFileName name of the file to write to |
|
192 @type str |
|
193 @param content data to write |
|
194 @type bytes |
|
195 """ |
|
196 try: |
|
197 self.__commandsInterface.putData(deviceFileName, data) |
|
198 self.putDataDone.emit(deviceFileName) |
|
199 except Exception as exc: |
|
200 self.error.emit("putData", str(exc)) |
167 |
201 |
168 @pyqtSlot(str) |
202 @pyqtSlot(str) |
169 def delete(self, deviceFileName): |
203 def delete(self, deviceFileName): |
170 """ |
204 """ |
171 Public slot to delete a file on the device. |
205 Public slot to delete a file on the device. |