COAP

This connector enables communication via CoAP Protocol.

Only allows to send data to the OpenGate platform. Operations can’t be received.

Dependencies

This module requires the following modules:

  • Core Commons: Provides many interfaces that this module will use.
  • Device Info Provider: Needed to know the Device Id of the device that are running the Agent, and the API Key to access to OpenGate. Both data are required to achieve a connection with OpenGate and transferred data will have the deviceId in its metadata.
  • AT Server: If connector is configured as AT type connector, this is necessary to use AT commands in the connector.

Configuration

To configure CoAP connector, a file named es.amplia.oda.connector.coap.cfg must be created with the next parameters:

  • type: UDP Connector by default. The available options are: UDP, DTLS, AT. Specify the type of connector that CoAP connector will be.
  • host: Required data. Specify the direction of the third system the connector have to send the data.
  • port: Automatically search a default. Port though the connector have to connect to the host.
  • path: Required data. Main section of the URI where the connector have to handle the data.
  • provisionPath: Required data. Last section of the URI.
  • timeout: 30 by default. Time connector will wait to achieve the connection.
  • messageProtocolVersion: 1.0.0 by default. Version of the protocol used to send the data.
  • localPort: 4123 by default. Port Of th current device where the connector will connect.
  • keyStoreType: “JKS” by default. Is the type of the KeyStore that the connector will use.
  • keyStoreLocation: null if not specified, Required if connector type is DTLS. Directory where the file of keys will be stored.
  • keyStorePassword: null if not specified, Required if connector type is DTLS. Password to access to the KeyStore.
  • clientKeyAlias: “client” by default. Alias used to find in KeyStore and TrustStore the key needed to connect.
  • trustStoreType: “JKS” by default. Is the type of the TrustStore that the connector will use.
  • trustStoreLocation: null if not specified, Required if connector type is DTLS. Directory where the file of keys will be stored.
  • trustStorePassword: null if not specified, Required if connector type is DTLS. Password to access to the TrustStore.
  • trustedCertificates: null if not specified, Required if connector type is DTLS. Names of certificates separated by commas.

The file es.amplia.oda.connector.coap.cfg can have several formats:

type=UDP
host=localhost
path=v80/devices
provisionPath=collect/iot
type=DTLS
host=localhost
path=v80/devices
provisionPath=collect/iot
keyStoreLocation=path/to/keyStore
keyStorePassword=passToAccess
trustStoreLocation=path/to/trustStore
trustStorePassword=passToAccess
trustedCertificates=certificates,separated,by,commas
type=AT
host=localhost
path=v80/devices
provisionPath=collect/iot

Source Code

You can check the source code here