Skip to content

Latest commit

 

History

History
148 lines (134 loc) · 4.55 KB

device-types.md

File metadata and controls

148 lines (134 loc) · 4.55 KB

sputnik - Device Types

Table: sputnik-device-types

Description

A device type, DeviceType, describes a physical device. Not what that device does. Just a physical device. A Raspberry Pi is just a Raspberry Pi.

A Raspberry Pi that has a Sense Hat or a PiCamera is very different to a standard Raspberry Pi.

The differences between these hardware devices is defined in a DeviceType.

DeviceTypes have important fields such as their:

  • id: which is referred to by other blueprints
  • spec: which defines the specifics of said device

Object

{
    id: string;
    name: string;
    type: string;
    spec: any = {};
    createdAt: string;
    updatedAt: string;
}

Spec

The spec portion of a DeviceType is where the magic happens and is quite common to all blueprints. It is used to trigger creation of AWS IoT and AWS IoT Greengrass resources and capabilities.

The spec also contains a View section that is used by the console to display widgets and associate them to the data source coming from the blueprints.

  • For more information on the Deployment meta-language in the spec. See the doc.
  • For more information on enabling Widgets in the spec. See the doc.
Example: rpi3-sense-hat-picamera-v1.0
{
    "CoreDefinitionVersion": {
        "Cores": [{
            "CertificateArn": "[CORE_CERTIFICATE_ARN]",
            "SyncShadow": true,
            "ThingArn": "[CORE_ARN]"
        }]
    },
    "FunctionDefinitionVersion": {
        "Functions": [{
            "FunctionArn": "arn:aws:lambda:::function:GGIPDetector:1",
            "FunctionConfiguration": {
                "Environment": {
                    "AccessSysfs": true,
                    "Variables": {}
                },
                "MemorySize": 32768,
                "Pinned": true,
                "Timeout": 3
            }
        }]
    },
    "LoggerDefinitionVersion": {
        "Loggers": [{
                "Component": "GreengrassSystem",
                "Level": "INFO",
                "Type": "AWSCloudWatch"
            },
            {
                "Component": "Lambda",
                "Level": "INFO",
                "Type": "AWSCloudWatch"
            },
            {
                "Component": "GreengrassSystem",
                "Level": "INFO",
                "Space": 300000,
                "Type": "FileSystem"
            },
            {
                "Component": "Lambda",
                "Level": "INFO",
                "Space": 300000,
                "Type": "FileSystem"
            }
        ]
    },
    "ResourceDefinitionVersion": {
        "Resources": [{
            "Id": "sense-hat-led",
            "Name": "sense-hat-led",
            "ResourceDataContainer": {
                "LocalDeviceResourceData": {
                    "GroupOwnerSetting": {
                        "AutoAddGroupOwner": true
                    },
                    "SourcePath": "/dev/fb1"
                }
            }
        }, {
            "Id": "sense-hat-i2c",
            "Name": "sense-hat-i2c",
            "ResourceDataContainer": {
                "LocalDeviceResourceData": {
                    "GroupOwnerSetting": {
                        "AutoAddGroupOwner": true
                    },
                    "SourcePath": "/dev/i2c-1"
                }
            }
        }, {
            "Id": "sense-hat-event0",
            "Name": "sense-hat-event0",
            "ResourceDataContainer": {
                "LocalDeviceResourceData": {
                    "GroupOwnerSetting": {
                        "AutoAddGroupOwner": true
                    },
                    "SourcePath": "/dev/input/event0"
                }
            }
        }, {
            "Id": "picamera-vcsm",
            "Name": "picamera-vcsm-resource",
            "ResourceDataContainer": {
                "LocalDeviceResourceData": {
                    "GroupOwnerSetting": {
                        "AutoAddGroupOwner": true
                    },
                    "SourcePath": "/dev/vcsm"
                }
            }
        }, {
            "Id": "picamera-vchiq",
            "Name": "picamera-vchiq-resource",
            "ResourceDataContainer": {
                "LocalDeviceResourceData": {
                    "GroupOwnerSetting": {
                        "AutoAddGroupOwner": true
                    },
                    "SourcePath": "/dev/vchiq"
                }
            }
        }]
    }
}