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

20.3.6 getServices

table [, error] = peripheral:getServices()

Returns a table containing the list of services discovered which can be traversed with the help of the ipairs function. An empty table is returned if no services were discovered or if getServices gets called before the service discovery procedure completes. In case of an error, nil is returned together with an error message.

Parameter

Type

Description

table

out table

A table containing the discovered services otherwise nil
if an error occurred

error

out string (optional)

If successful nil is returned, an error message otherwise

Introduced in platform.apiLevel = '2.5'