The device object provides the agent with a representation of its device: the imp-based hardware operating in the field. It is used to is used to pass communication from the agent to the device, and to check the imp’s connection status. As such, device is not available on the device itself — it uses the equivalent object agent.
The device object is instantiated and initialized automatically.
Electric Imp’s ConnectionManager library provides a powerful framework for using the functionality delivered by device.on(), device.send() and agent. We strongly recommend customers take advantage of this free-to-use code library.
For more information on the interaction between the Internet, agents and imp-enabled devices, see the Developer Guide ‘Managing app-agent-device Communications’.
For sample code that can be used to manage messaging between agent and device, see ‘imp API Cookbook: Agent-Device Communications’.
The device object has the following member methods: