Trond Enger / d7a_1x

Fork of d7a_1x by WizziLab

Revision:
46:665391110051
Parent:
45:b85384e7d825
Child:
48:950406be9810
diff -r b85384e7d825 -r 665391110051 include/d7a.h
--- a/include/d7a.h	Thu Sep 01 09:35:27 2016 +0000
+++ b/include/d7a.h	Thu Sep 01 18:13:46 2016 +0000
@@ -125,6 +125,19 @@
 
 } d7a_errors_t;
 
+// Types of retry policies
+typedef enum {
+    ALP_RPOL_ONESHOT         = 0,
+    ALP_RPOL_SINGLE          = 1,
+    ALP_RPOL_REPORT          = 2,
+    ALP_RPOL_REPORT_CHECKED  = 3,
+    ALP_RPOL_BULK            = 4,
+    ALP_RPOL_SPARE_1         = 5,
+    ALP_RPOL_SPARE_2         = 6,
+    ALP_RPOL_SPARE_3         = 7,
+
+    ALP_RPOL_QTY,
+} alp_rpol_t;
 
 //======================================================================
 // Structures
@@ -158,6 +171,9 @@
                                         const uint16_t size,
                                         uint8_t* buf);
 
+typedef void (*NotifDoneFunction)(      const uint8_t file_id,
+                                        const uint8_t error);
+
 //======================================================================
 // d7a_fs_callbacks_t
 //----------------------------------------------------------------------
@@ -168,6 +184,8 @@
     WriteFileFunction   write_file;
     /// Read from local file
     ReadFileFunction    read_file;
+    /// Is call when the notification is finished if indicated in the retry policy
+    NotifDoneFunction   notif_done;
 } d7a_fs_callbacks_t;
 
 //======================================================================
@@ -357,9 +375,11 @@
 /// @param uint32_t             Offset from which to start reading
 /// @param uint32_t             Size of data to read
 /// @param uint8_t*             Buffer to retrieve data
+/// @param d7a_addressee_t*     Addressee to an eventual distant device
+/// @param alp_rpol_t           Index to the retry policy to use
 /// @return d7a_errors_t        Error code
 //======================================================================
-d7a_errors_t d7a_read(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* buf, d7a_addressee_t* addressee = NULL, uint8_t retry = 0, bool resp = true);
+d7a_errors_t d7a_read(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* buf, d7a_addressee_t* addressee = NULL, alp_rpol_t retry = ALP_RPOL_ONESHOT);
 
 //======================================================================
 // d7a_write
@@ -369,8 +389,21 @@
 /// @param uint32_t             Offset from which to start writing
 /// @param uint32_t             Size of data to write
 /// @param uint8_t*             Buffer of the data to write
+/// @param d7a_addressee_t*     Addressee to an eventual distant device
+/// @param alp_rpol_t           Index to the retry policy to use
 /// @return d7a_errors_t        Error code
 //======================================================================
-d7a_errors_t d7a_write(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* const buf, d7a_addressee_t* addressee = NULL, uint8_t retry = 0, bool resp = true);
+d7a_errors_t d7a_write(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* const buf, d7a_addressee_t* addressee = NULL, alp_rpol_t retry = ALP_RPOL_ONESHOT, bool resp = true);
+
+//======================================================================
+// d7a_write
+//----------------------------------------------------------------------
+/// @brief                      Write data to a file
+/// @param uint8_t              File ID of file to write
+/// @param uint32_t             Offset from which to start writing
+/// @param uint32_t             Size of data to write
+/// @return d7a_errors_t        Error code
+//======================================================================
+d7a_errors_t d7a_notify(const uint8_t file_id, const uint32_t offset, const uint32_t size);
 
 #endif // _D7A_H_
\ No newline at end of file