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

20.3.2 getState

state = peripheral:getState()

Returns the connection state - disconnected, connecting, connected, disconnecting.

function isConnected(peripheral) 
        return peripheral:getState() == bleCentral.CONNECTED
end

Introduced in platform.apiLevel = '2.5'