Skip to main content

Imp API Reference

Electric Imp’s imp API provides a set of classes and global objects with which device and agent code may access local hardware and remote cloud functionality. This API augments the Squirrel Standard Library, which provides general programming functionality. For more general information about the Squirrel language, see the Squirrel Programming Guide.

  • Examples of code making use of the imp API can be found in the imp API Cookbook.

The imp API includes the following global, automatically instantiated objects:

Agent-Device-Server Communications

  • agent — A device-only object that enables communication with the paired agent
  • device — An agent-only object that enables communication with the paired device
  • server — An object used to access the Electric Imp impCloud™ servers

imp Hardware Management

* Currently available only on the imp004m and the imp006.
** Currently available only on the imp005.
*** Currently available only on the imp006 with impOS 44.

Internet Communications

  • http — An agent-only object which wraps HTTP-related functions and request creation
  • httprequest — An agent-only dispatcher for outbound HTTP requests
  • httpresponse — An agent-only response creator for inbound HTTP requests
  • httpstream — An agent-only dispatcher for outbound HTTP streaming
  • mqtt — An agent-only object which provides the lightweight publish/subscribe messaging protocol MQTT
  • crypto — An object which provides device-centric encryption functionality

Network Management And Local Networking

  • imp.net — Network selection, management and information tools
  • interface — A device-side object which represents local network interfaces
  • udpsocket — A device-side object which represents a single UDP (User Datagram Protocol) network socket available on the local network only

GNSS Operation

  • gnss-session — GNSS device location tasks. Currently available only on the imp006 with impOS 44
  • gnss-session.assist — GNSS assistance data management. Currently available only on the imp006 with impOS 44

Feedback via the forum is welcomed.