1 Reply Latest reply on Sep 25, 2014 1:10 PM by VictorZ_46

    Where does error from write callback get returned to?

      If there is an error that is returned from the write callback where does that actually end up?

       

      From client persepctive is this just seen as an abrupt error?

       

      Case in point if it is a requirement to start indications on a handle and someone attempts to write to the handle but client side has not yet started indications how can that error be propagated back to the client? We cant send an indication to the client for this handle because the very mere fact that indications have not yet been setup ...

       

      So, is there something in the stack itself that handles these types of errors that client can trap?

        • 1. Re: Where does error from write callback get returned to?
          VictorZ_46

          Attribute protocol allows server to reply 2 ways to the Write Request.  The first is to send Write Response which acknowledges the write and passes no parameters.  The second is to send Error Response which carries an Error Code which indicates the reason why operation was unsuccessful.  In the WICED Smart SDK when application's Write Handler returns something other than zero, the stack sends the Error Response rather than the Write Response.  (See cycling_... sample.) The stack can also generate the Error Response without even calling the callback.  For example if GATT database indicates that the authenticated writes should be used, but client attempts to write over unencrypted link.  Or when client tries to write too big of a value.

           

          It depends on your client implementation on how the error response is processed and if how your application is notified.  I hope it answers your question, because I do not understand the problem.  To enable indications client needs to write 0x02 into client configuration descriptor of that characteristic.  The fact that client has registered does not mean that you need to send indications right away.  You can have your own logic when to do it.  For example if you implement a weight scale client can register, and you may need to send indication only after somebody stands up on the scale.  That depends on the requirements of the profile you are implementing.

          1 of 1 people found this helpful