characteristic:setWriteCompleteListener(callback [, object])
Sets or removes the write-complete listener callback for write requests. To remove the callback, use nil as the callback parameter. This callback is only called for write requests and not write commands. The type of the write procedure depends on the boolean value specified when calling write. This function can be called at any time to update the write complete listener callback for a discovered characteristic.
Parameter |
Type |
Description |
---|---|---|
callback |
in function |
Callback to inform about the completion of the write procedure |
object |
in any (optional) |
If a callback is provided, optionally an object can be specified which will be passed as the first parameter to the specified callback function. The object can be of any type except nil. |
callback([object,] characteristic [, error])
The callback function will be called to confirm completion of a write request procedure.
Parameter |
Type |
Description |
---|---|---|
object |
in any (optional) |
If an object was provided as a parameter to the function setWriteCompleteListener, it will be passed as the first parameter to this callback function |
characteristic |
in characteristic object |
The characteristic for which the value was written |
error |
in string (optional) ) |
If successful the parameter will be nil, an error message otherwise |
Introduced in platform.apiLevel = '2.5'