Note

You are viewing the legacy Cascade documentation, which only applies to some Rigado customers. To view the current Cascade documentation, click here.

1.3. Accessing System Resources

1.3.1. Introduction

This document provides an overview of the Ubuntu Core access system for system resources. It is intended for anyone building snaps for deployment using Rigado Edge Direct.

1.3.2. Ubuntu Core System Access

Ubuntu Core provides access to system resources such as the network, a serial port, Bluetooth, or system logs through an interface system. The interface system comprises of Slots (connectable components) and Plugs (snap declarations which connect to Slots).

Example slots

network: provides network access for the snap
network-bind: give the snap the ability to bind to a port on the network
bluetooth-control: provides low level bluetooth access (HCI)

The system has many other slots available. A full list is found on the Snap Interfaces page.

Note

Not all of the interfaces listed on the Snap Interfaces page are available for use on the Rigado Cascade-500 IoT Gateway.

You can get a list of available interfaces by running snap interfaces from within the SSH console (see Using SSH to Connect Directly to a Gateway).

Snaps can also declare their own slots. For example, the wifi-ap snap declares a slot named control:

slots:
  control:
    interface: content
    content: socket-directory
    write:
      - $SNAP_DATA/sockets

1.3.3. Plug Declarations

The plugs required by a given snap are declared in that Snap’s snapcraft.yaml file. The plugs are defined for each app within the snapcraft.yaml file. For example:

apps:
  service:
    command: startup.sh
    daemon: simple
    plugs: [network, network-bind]
  another-service:
    command: run-service
    daemon: simple
    plugs: [bluetooth-control]

In the above example, the service app declares that it needs both network access and the ability to bind to a port via the network-bind plug. The another-service app declares that it needs low level Bluetooth access.

1.3.4. Automatic Plug Connections

Some plugs are automatically connected to a corresponding slot though many are not. Rigado has selected the following plugs for automatic connection through Edge Direct:

avahi-observe
bluetooth-control
greengrass-support
hardware-random-observe
network-control
network-observe

The Edge Direct service will also automatically connect certain serial ports and the BlueZ service for accessing the BlueZ D-Bus API.

1.3.5. BlueZ Service plug definition

To connect a snap to the bluez:service slot, the snapcraft.yaml file should define a plugs section and declare a plug named bluez-client with interface set to bluez:

plugs:
  bluez-client:
    interface: bluez

Add the plug bluez-client to each app which needs the plug:

apps:
  some-app:
    command: startup.sh
    daemon: simple
    plugs: [network, network-bind, bluez-client]

1.3.6. Serial Port connections

Multiple serial pots are available on the gateway depending on hardware configuration.

Edge Direct expects a snap requiring access to any of ttymxc2, ttymxc3, ttymxc4, ttymxc6, and ttymxc7 to define its plugs using the following mapping:

ttymxc2 -> radio0 //on board BMD-345 radio
ttymxc3 -> radio1 //Rigado Tau Expansion board radio
ttymxc4 -> radio2 //Rigado Tau Expansion board radio
ttymxc6 -> radio3 //Rigado Tau Expansion board radio
ttymxc7 -> radio4 //Rigado Tau Expansion board radio

In order for Edge Direct to connect a snap to any of the available serial port slots, the snapcraft.yaml file must define a plugs section using the interface: serial-port property.

For example, the following block shows a declaration which includes radio0 and radio3:

plugs:
  radio0:
    interface: serial-port
  radio3:
    interface: serial-port

Add the plugs radio0 and radio3 to the apps which use them:

apps:
  some-app:
    command: startup.sh
    daemon: simple
    plugs: [network, radio0]
  another-app:
    command: startup.sh
    daemon: simple
    plugs: [radio3, network-bind]

1.3.7. Conclusion

This article provided a brief introduction to the Ubuntu Core interface system and information about the plugs which are automatically connected on the Rigado Cascade Edge-as-a-Service platform.

Additional Reading

Interface management

Note

You are viewing the legacy Cascade documentation, which only applies to some Rigado customers. To view the current Cascade documentation, click here.