error = peripheral:discoverServices([UUIDs, ] callback [, object])
Initiates the services discovery procedure for the peripheral 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) |
0 to 10 UUIDs, identifying services to search for. Omit this parameter to search for all services. A UUID can be provided in 16- or 128-bit format. |
callback |
in function |
Callback to inform about the completion of the service discovery procedure. A call to getServices() of the peripheral object provides the results. |
object |
out 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([object, ] peripheral [, error])
The callback function provided in discoverServices will be called once when the services discovery procedure completes. Based on whether an object was provided in the call to discoverServices, the callback should have two or three parameters. The error will be nil if the procedure completed successfully. Calling getServices will retrieve the discovered services.
Parameter |
Type |
Description |
---|---|---|
object |
in any (optional) |
If an object was provided as a parameter to the function discoverServices, it will be passed as the first parameter to this callback function |
peripheral |
in peripheral object |
The peripheral object offering the discovered services |
error |
in string (optional) ) |
If successful the parameter will be nil, an error message otherwise |
Introduced in platform.apiLevel = '2.5'