]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/interfaces/Write.nc
New Write and WriteNow interfaces.
[tinyos-2.x.git] / tos / interfaces / Write.nc
diff --git a/tos/interfaces/Write.nc b/tos/interfaces/Write.nc
new file mode 100644 (file)
index 0000000..d46948e
--- /dev/null
@@ -0,0 +1,39 @@
+/* Copyright (c) 2006-2010 by Sporian Microsystems, Inc.
+ * All Rights Reserved.
+ *
+ * This document is the proprietary and confidential property of Sporian
+ * Microsystems, Inc.  All use, distribution, reproduction or re-distribution
+ * is disallowed without the prior express written consent of Sporian
+ * Microsystems, Inc.
+ */
+
+/**
+ * The Write interface is intended for split-phase low-rate or
+ * high-latency writing of small values. The type of the value is
+ * given as a template argument. Because this interface is
+ * split-phase, these values may be backed by hardware, or a
+ * long-running computation.  This interface is the output analog
+ * of the standard Read interface.
+ *
+ * @param val_t the type of the object that will be written
+ *
+ * @author R. Steve McKown <rsmckown@gmail.com>
+ */
+
+
+interface Write<val_t> {
+  /**
+   * Initiate a write of the provided value.
+   *
+   * @param val The value to write.
+   * @return SUCCESS if <code>writeDone()</code> will later be signalled,
+   * EBUSY if a write is already in progress, or FAIL for other errors.
+   */
+  command error_t write(val_t val);
+
+  /**
+   * Signalled upon completion of the write operation initiated by the previous
+   * <code>write()</code> command.
+   */
+  event void writeDone(error_t error);
+}