You are here: Lua Scripting Resources eGuide > Lua Scripting API Reference Guide > Bluetooth® Smart Library > discoverCharacteristics

20.4.2 discoverCharacteristics

error = service:discoverCharacteristics([UUIDs, ] callback [, object])

Initiates the characteristics discovery procedure for the service object. The callback will be called once on completion of the procedure. The discovery may complete successfully or fail.

Parameter

Type

Description

UUID(s)

in strings(s)
(optional)

0 to 10 UUIDs, identifying characteristics to search for.
Omit this parameter to search for all characteristics. A UUID can be provided in 16- or 128-bit format.

callback

in function

Callback to inform about the completion of the characteristics discovery procedure. A call to getCharacteristics() of the service object provides the results.

object

in any (optional)

If an object is provided it will be passed as the first parameter to the specified callback function. The object can be of any type except nil

error

out string (optional)

If successful nil is returned, an error message otherwise

Introduced in platform.apiLevel = '2.5'

Callback Function

callback([object,] service [, error])

The callback function provided in discoverCharacteristics will be called once when the characteristics discovery procedure completes. Based on whether an object was provided in the call to discoverCharacteristics, the callback should have two or three parameters. The error will be nil if the procedure completed successfully. Calling getCharacteristics will retrieve the discovered characteristics..

Parameter

Type

Description

object

in any (optional)

If an object was provided as a parameter to the function discoverCharacteristics, it will be passed as the first parameter to this callback function

service

in service object

The service object offering the discovered characteristics

error

in string (optional) )

If successful the parameter will be nil, an error message otherwise

Introduced in platform.apiLevel = '2.5'