Skip to main content

imp.info()

Returns information about the imp on which your code is running

Availability

Device

Returns

Squirrel meta object with a key type — its value is a string indicating the imp type

Description

This method returns information about the imp. The object returned by imp.info() is not a Squirrel table, but a ‘meta’ object. This means the returned object can’t be examined as might a table — for example, using foreach to iterate over keys and values. However, its properties are accessed in the same way, using dot syntax as shown in the example below.

The returned object currently has one property, type. Its value is a string indicating the type of imp: "imp001", "imp002", "imp003", "imp004m", "imp005", "imp006" or "impC001".

For networking information, use imp.net.info(). To determine if your code is running in the impCloud™ as an agent, you can call imp.environment().

Example Code

The following code snippet shows how a customer might use imp.info() to support multiple versions of a product, each based on a different imp type, in the same application code by aliasing application peripherals to imp-specific objects.