BLE_API

Revision:
504:817c6240e9d9
Parent:
503:4e69a47047c5
Child:
508:31e63ad6923f
diff -r 4e69a47047c5 -r 817c6240e9d9 public/GattClient.h
--- a/public/GattClient.h	Fri Jun 19 15:52:03 2015 +0100
+++ b/public/GattClient.h	Fri Jun 19 15:52:03 2015 +0100
@@ -23,10 +23,6 @@
 
 class GattClient {
 public:
-    enum Command_t {
-        OP_WRITE_CMD
-    };
-
     struct ReadResponse_t {
         GattAttribute::Handle_t  handle; /**< Attribute Handle. */
         uint16_t                 offset; /**< Offset of the attribute data. */
@@ -35,6 +31,24 @@
     };
     typedef void (*ReadCallback_t)(const ReadResponse_t *params);
 
+    enum WriteOp_t {
+        GATT_OP_INVALID        = 0x00,  /**< Invalid Operation. */
+        GATT_OP_WRITE_REQ      = 0x01,  /**< Write Request. */
+        GATT_OP_WRITE_CMD      = 0x02,  /**< Write Command. */
+        GATT_OP_SIGN_WRITE_CMD = 0x03,  /**< Signed Write Command. */
+        GATT_OP_PREP_WRITE_REQ = 0x04,  /**< Prepare Write Request. */
+        GATT_OP_EXEC_WRITE_REQ = 0x05,  /**< Execute Write Request. */
+    };
+
+    struct WriteResponse_t {
+        GattAttribute::Handle_t  handle;  /**< Attribute Handle. */
+        WriteOp_t                writeOp;
+        uint16_t                 offset;  /**< Offset of the attribute data. */
+        uint16_t                 len;     /**< Attribute data length. */
+        const uint8_t           *data;    /**< Attribute data, variable length. */
+    };
+    typedef void (*WriteCallback_t)(const WriteResponse_t *params);
+
 public:
     /**
      * Launch service discovery. Once launched, service discovery will remain
@@ -85,7 +99,7 @@
     /* Initiate a Gatt Client read procedure by attribute-handle.*/
     virtual ble_error_t read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const = 0;
 
-    virtual ble_error_t write(GattClient::Command_t cmd, Gap::Handle_t connHandle, size_t length, const uint8_t *value) const = 0;
+    virtual ble_error_t write(GattClient::WriteOp_t cmd, Gap::Handle_t connHandle, size_t length, const uint8_t *value) const = 0;
 
 #if 0
 public: