Skip to content

Examples#

Control class examples#

The directory examples/all_classes contains a device that implements many different control classes. These can be used as a starting point when implementing a specific control class.

The directory examples/all_classes_simpleoca contains a similar device that uses simpleoca.

Static device examples#

The directory examples/devices contains several static device examples.

Firmware update#

The directory examples/firmware_update contains an example implementation of the OcaFirmwareManager.

Multi-Threaded controller#

The directory examples/multithread_controller contains an example of how to use the controller library in a multi-threaded environment.

POSIX UDP#

The directory examples/posix_udp contains an example of how to use this library without an event loop with UDP.

Simple Controller#

The directory examples/simple_controller contains an example that uses a device with custom object numbers

Session handling#

In some applications, it may be necessary to change the behavior of a device depending on the connection. The example in examples/sessions makes certain parameters read-only for sessions that have not authenticated.

TLS (OpenSSL)#

See OpenSSL TLS and examples/openssl/README.md.

  • examples/openssl/psk — TLS with pre-shared keys.
  • examples/openssl/server_cert — server certificate; client verifies the CA.
  • examples/openssl/mtls — mutual TLS (both sides present certificates).
  • examples/openssl/certs — script to generate demo PEMs for the cert examples.

See Mbed TLS and examples/mbedtls/README.md.

  • examples/mbedtls/psk — TLS-PSK with Mbed TLS.
  • examples/mbedtls/server_cert — server certificate TLS with Mbed TLS.
  • examples/mbedtls/mtls — mutual TLS with Mbed TLS.
  • examples/mbedtls/certs — demo PEM generator for the Mbed TLS cert examples.