Portable Agent
The Ayla Portable Solution consists of software libraries not tied to any specific communication module SDK or chipset. It enables OEMs to extend Ayla connectivity to communication modules not supported by Ayla Integrated Agents, and to pick and choose features to incorporate or omit (e.g. OTA, LAN mode, Wi-Fi setup). Learn more about the Ayla Portable Agent
First steps
-
Create an Ayla user account. You will probably need to have your Ayla Customer Account admin or Ayla support create a user account for you with admin or developer access rights.
-
Reserve a DSN. Browse to Ayla Dashboard Portal. On the sidebar, navigate to Factory Actions. Click the Reserve DSN button. For Model, select AY008ESP1. Click Submit, and then download the associated XML file. You will need DSN value and the key from the file.
-
Browse to the Ayla Developer Portal, and create a template with the following details.
Visibility: private Name: PDA v2.3.1-beta Description: PDA v2.3.1-beta Registration: Dsn Model: ledevb Version: pda-http-src-2.3.1-beta Type: Wifi -
After creating the template, copy & paste the following properties into a text file, and import the file.
base_type,direction,name,scope boolean,output,Blue_button,user boolean,input,Blue_LED,user string,input,cmd,user decimal,input,decimal_in,user decimal,output,decimal_out,user boolean,input,Green_LED,user integer,input,input,user string,output,log,user integer,output,output,user string,output,version,user
-
Finally, click the new
version
property, checkHost SW Version
, and clickOK
.
Build and Run
GCC/Ubuntu/Docker
This section provides directions for building an Ayla Portable Solution v2.3.1-beta using a Ubuntu/Docker development environment.
-
Download Ayla source code (pda-http-src-2.3.1-beta.tgz).
-
Install a Docker Engine on your computer.
-
Create a Docker ubuntu container:
$ docker run --net=host --name=pda -w /root -it ubuntu bash
You are root, and the current working directory is
/root
. -
Prepare your development environment:
- Enable multiarch environment (needed to compile Ayla executables):
# dpkg --add-architecture i386
- Update package list:
# apt update
- Install packages:
# apt install nano git build-essential python2.7 python-pip \ iproute2 net-tools wireless-tools iputils-ping rfkill psmisc \ libssl-dev libssl-dev:i386 libavahi-client-dev libavahi-client-dev:i386 libc6-dev-i386
- Enable multiarch environment (needed to compile Ayla executables):
-
Install Ayla source code:
- In a host terminal, copy
pda-http-src-2.3.1-beta.tgz
to your Docker container:$ docker cp /home/matt/Downloads/pda-http-src-2.3.1-beta.tgz pda:/root
- In your Docker terminal, extract the archive file, and, optionally, rename the resulting directory:
# tar zxvf pda-http-src-2.3.1-beta.tgz
- Change directory:
# cd pda-http-src-2.3.1-beta
- In a host terminal, copy
-
Fix Ayla source code issues:
- Fix
ayla/src/libada/client.c
. Modifysnprintf
invocations to check for negative return values:
Do this in the following three function definitions:if(snprintf(...) < 0) { ; }
- client_close_dp_put
- client_get_dp_loc_req
- client_cmd_put_rsp
- Fix
platform/linux/al_net_dns.c
. Add#include <signal.h>
. - Fix
platform/linux/al_net_if.c
. Add the following to theal_net_if_get_kind
function:else if (!memcmp(name, "wlp3s0", 6)) { return AL_IF_K_WLAN; }
- Fix
examples/common/demo_cli_client.c
. Changeif (lr.uri == '\0')
toif (*lr.uri == '\0')
.
- Fix
-
Configure
ledevb
to use your template:- Edit
examples/ledevb/demo_ledevb.c
. - Search for
demo_host_version
, and set the template version:static char demo_host_version[] = "pda-http-src-2.3.1-beta";
- Save the file.
- Edit
-
Build the Ayla executables:
# make # ls -1 ./ayla/bin/native altest apptest ledevb wifisetup
-
Create a configuration file for
ledevb
:- In a host terminal, copy the DSN XML file to your Docker container:
$ docker cp /home/matt/Downloads/Reserve_JobId_123456/AC000W000000001.xml pda:/root
- In your Docker terminal, generate a configuration file:
Note the parameters. The last three are positional:# pip install rsa # python2.7 ./platform/linux/utils/conf-gen.py -k 0123456789abcdef0123456789abcdef -r US ../AC000W000000001.xml 1234abcd ledevb
-k is the OEM Key/Secret. -r is the region (e.g. US, CN, EU). AC000W000000001.xml is the DSN file downloaded from Ayla Dashboard Portal. 1234abcd is the OEM ID. ledevb is the OEM Model.
- View the encrypted configuration file:
# cat /root/.pda/persist.conf { "factory": { "device_dsn": "QUMwMDBXMDA3MTI2ODEx", "device_key": "MIIBC...", "oem_id": "MGJiYjExMmU=", "oem_key": "i/AJ+I7...", "oem_model": "bGVkZXZi", "service_region": "VVM=" }, "startup": {} }
- In a host terminal, copy the DSN XML file to your Docker container:
-
Run
ledevb
:# ./ayla/bin/native/ledevb
-
Configure the program for developer mode:
PWB ledevb> conf set client/server/default 1
-
Activate the Ayla Agent which connects
ledevb
to an Ayla Cloud account:PWB ledevb> up
Output should be similar to the following:
[pda] 20:02:59.936 i c client: ada_client_up: IP 192.168.1.6 PWB ledevb> [pda] 20:02:59.936 i c client: get DSN AC000W000000001 [pda] 20:03:00.017 i c client: DNS: host ads-dev.aylanetworks.com at 100.25.244.184 [pda] 20:03:00.424 i c client: module name "AC000W000000001" key 1234567. [pda] 20:03:00.424 i c client: listen enabled [pda] 20:03:00.504 i c notify: ANS server ans.aylanetworks.com at 54.210.207.229 [pda] 20:03:00.570 i c client: ANS check event
The Ayla Cloud should create a digital twin (in the cloud) with all the properties defined in the template you specified, and it should pair
ledevb
with the new digital twin. As indicated in the output above, the unique id of this particular digital twin is1234567
, and both the DSN and the default name areAC000W000000001
.
GCC/Windows
Not written yet.
Register your device
-
Browse to the Ayla Dashboard Portal, click OEM Users in the sidebar, click your account, and copy your UUID (e.g.
a0000000-0000-0000-0000-000000000000
). -
Click Devices in the sidebar, and find the new device on the list:
-
Click the device row. Then, in the Device > Settings table, paste your UUID, and click Register:
-
View the device on the Devices list again. Note that the device is registered to you.
-
View the device in the Ayla Developer Portal:
-
View the device in the Aura Mobile App:
Updated almost 4 years ago