void
CopyToDriveJob::run ()
{
- if (!_nanomsg.nonblocking_send(String::compose("W\n%1\n%2\n", _dcp.string(), _drive.internal_name()))) {
+ if (!_nanomsg.nonblocking_send(String::compose(DISK_WRITER_WRITE "\n%1\n%2\n", _dcp.string(), _drive.internal_name()))) {
throw CopyError ("Could not communicate with writer process", 0);
}
*/
-/* dcpomatic_disk_writer receives
-
-DCP pathname\n
-Internal name of drive to write to\n
+/* We have the front-end application dcpomatic2_disk and the back-end
+ * dcpomatic2_disk_writer. The communication is line-based, separated
+ * by \n.
+ */
- Then responds with one of the following.
-*/
+/* REQUEST TO WRITE DCP */
-/** Write finished and everything was OK, e.g.
+// Front-end sends:
+
+#define DISK_WRITER_WRITE "W"
+// DCP pathname
+// Internal name of the drive to write to
-D\n
+// Back-end responds:
-*/
+// everything is ok
#define DISK_WRITER_OK "D"
-/** There was an error. Following this will come
-
-error message\n
-error number\n
-
-e.g.
-
-E\n
-Disc full\n
-42\n
-
-*/
+// there was an error
#define DISK_WRITER_ERROR "E"
+// Error message
+// Error number
-/** The disk writer is formatting the drive. It is not possible
- * to give progress reports on this so the writer just tells us
- * it's happening. This is finished when DISK_WRITER_PROGRESS
- * messages start arriving
- */
+// the drive is being formatted
#define DISK_WRITER_FORMATTING "F"
-/** Some progress has been made in the main "copy" part of the task.
- * Following this will come
+// data is being copied, 30% done
+#define DISK_WRITER_PROGRESS "P"
+// 0.3\n
-progress as a float from 0 to 1\n
-e.g.
+/* REQUEST TO QUIT */
-P\n
-0.3\n
+// Front-end sends:
+#define DISK_WRITER_QUIT "Q"
-*/
-#define DISK_WRITER_PROGRESS "P"
-/** dcpomatic_disk_writer may also receive
+/* REQUEST TO UNMOUNT A DRIVE */
-Q\n
+// Front-end sends:
+#define DISK_WRITER_UNMOUNT "U"
+// Internal name of the drive to write to
-as a request to quit.
-*/
-#define DISK_WRITER_QUIT "Q"
+// Back-end responds:
+// DISK_WRITER_OK
+// or
+// DISK_WRITER_ERROR