Connecting devices to applications for bidirectional communication.

Pattern Definition
Problem | How do I connect to devices so that enterprise applications can communicate with the devices? | |
Context | This pattern is applicable when there is a desire to connect to devices and allow on-premises or Cloud-based applications communicate with the devices. The communication with the devices is by directional. The applications may receive data and/or alerts from the devices. The applications may request data from the devices or send control messages to the devices. | |
Forces |
| |
Solution | This pattern employs an IoT Platform only in the Cloud. The IoT Platform functions as the intermediary between the devices and the applications. Devices can connect directly to the IoT Platform or may use a gateway for devices that cannot connect natively (i.e. run the client library). | |
Consequences | Pros:
|
Interaction View
Direct Connect Devices
Devices are connected directly to the IoT Platform.

Interaction
- Devices activate with the Internet of Things platform. Devices can be anything that can run the Client Library.
- Devices send data or alerts to the Internet of Things platform. The Internet of Things platform processes and/or routes the data/alert.
- The Internet of Things platform delivers a message to the device. The message may be a request for data or a control message for the device.
Notes
- To protect against invalid data or alerts, the devices must be registered before they are allowed to activate.
Gateway Connected Devices
Devices are connected to the IoT Platform via a Gateway.

Interaction
- The Gateway activates the devices that are connected to the gateway.
- Devices send data or alerts to the Gateway. The Gateway contains the device adapters that allow the Gateway to perform protocol translation for the devices.
- The Gateway delivers the data or alert to the Internet of Things platform. The Internet of Things platform processes and/or routes the data/alert.
- Internet of Things platform delivers a message to the Gateway for a device. The message may be a request for data or a control message for the device.
- The Gateway provides protocol translation and delivers the message to the Device.
Notes
- The Gateway must be registered with the Internet of Things platform before it can activate devices.
- The Gateway library may be deployed in the Cloud on PaaS or IaaS, to on-premises hardware, or to hardware deploy outside the data center (e.g. warehouse, factory, vehicle).
Enterprise Application Connection
An application (on premises or Cloud based) is connected to the IoT Platform.

Interaction
- The application (on premises or Cloud based) activates itself with the Internet of Things platform.
- The application registers a callback URL with the Internet of Things platform.
- The application sends a message to a device via the Internet of Things platform. The message may be a request for data or a control message for the device.
- Internet of Things platform delivers the message to the device. The device may be directly connected or may be connected via a Gateway.
- The Internet of Things platform delivers data and/or alerts from the devices via the callback URL.
Notes
- The application must be registered with the Internet of Things platform before it can activate