Defining Your Own Attributes
The Afero Profile Editor allows you to create a custom set of attributes that you can monitor and manipulate with your application via the Attribute Daemon Client. User-defined attributes set via Profile Editor are numbered from 1 through 1023. You can define the type, default value, and flags for any attribute your application needs. By default, all attributes from 1–1023 are owned by your Attribute Client application and will always be writeable by your application.
Obtaining the Afero Profile Editor
The Profile Editor is available to all Afero partner-developers and can be downloaded for either Windows or macOS:
For all the details, refer to the Afero Profile Editor User Guide.
Sample Profile for Attribute Daemon Clients
In this section, we will create a small sample profile to create some attributes you can manipulate through Attribute Daemon Client. These attributes will be referenced in the examples in the following sections.
- Open the Profile Editor and sign in using your Afero developer account email and password.
- Select New to open the New Project dialog box. For Module Type, select the module for your Linux hub. In the example, we’ll use “Potenco”, but ensure that the Module Type here matches your Linux hub product. Give your Device Type a name, which will also be used for your default project name. Click the Create button to save your new project.
- Click Attributes in the left-hand navigation bar. You’ll define two attributes for this project.
- Select the network interfaces available in your Linux hub hardware to enable or disable support for that network interface in your device. For Potenco devices, ensure Wi-Fi is checked.
- Still in the Attributes window, click +Device Attribute. Create a new attribute using:
- ID = 1
- Name = Output
- Data type = Boolean
- Attribute Options = Select both Read and Write checkboxes.
- Click +Device Attribute again. Create a new attribute using:
- ID = 2
- Name = Input
- Data type = Boolean
- Attribute Options = Select Read checkbox only, leaving Write unchecked.
- Click Save in the upper-right of the window to save your attribute definitions.
- Click UI Controls in the left-hand navigation bar. You’ll now start defining the user interface.
- Click +Attribute Option to open the Attribute Option Details dialog box for the Output attribute. Complete the fields as shown:
Click OK to save the Output attribute details.
- Click +Attribute Option again to open the Attribute Option details for the Input attribute. Complete the fields as shown:
Click OK to save the Input attribute details.
- Still on the UI Controls window, under Define the UI Controls heading, click +Control to assign a UI control to the Output attribute. Select Menu as the control type. Click Add to assign the control. On the pane that opens, select “Output” for the Attribute Option and “Inline” as the View Style.
- Click +Control again to assign a UI control to the Input attribute. Select Menu as the control type as well. Click Add to assign it. On the pane that opens, select “Input” as the Attribute Option and “Inline” as the View Style.
- Click Save in the upper-right of the window to save your UI Controls.
- Click UI Control Groups in the navigation bar. You’ll now define the last part of the user interface: grouping your two menu controls.
- Click the + button to create a new group and give the group a name, like “IO”. Drag both UI Controls from the far-right pane into the group.
- Click Save in the upper-right of the window to save your UI Control Group.
- Click Publish in the left-hand navigation bar. If you have a Linux hub device on your Afero account, you can publish this profile to that device now from the Publish window. This will update the device profile that is visible to Attribute daemon and you can then access and modify these attributes via client applications described elsewhere in this Afero Linux SDK Guide.
Attribute Definition Reference
In the directory where you saved your profile, there is a file called
device-description.h. This file is a C-format header file that defines the names, data types, and other information in the profile you just created. If you create Attribute Client applications using the available C API, this file is handy to include in your application to access attribute information. If you make any changes to your profile in the Profile Editor, this file will be updated, so as you develop your profile remember to copy it to your application.