Tutorials - PDF.book

Tutorials - PDF.book
mangOH™ Green
mangOH Fundamentals—
Linux Computer + Legato CLI
4118961-LinCLI
Rev 5
Contents subject to change
Preface
Important
Notice
Due to the nature of wireless communications, transmission and reception of data can
never be guaranteed. Data may be delayed, corrupted (i.e., have errors) or be totally
lost. Although significant delays or losses of data are rare when wireless devices such
as the Sierra Wireless modem are used in a normal manner with a well-constructed
network, the Sierra Wireless modem should not be used in situations where failure to
transmit or receive data could result in damage of any kind to the user or any other
party, including but not limited to personal injury, death, or loss of property. Sierra
Wireless accepts no responsibility for damages of any kind resulting from delays or
errors in data transmitted or received using the Sierra Wireless modem, or for failure
of the Sierra Wireless modem to transmit or receive such data.
Limitation of
Liability
The information in this manual is subject to change without notice and does not
represent a commitment on the part of Sierra Wireless. SIERRA WIRELESS AND ITS
AFFILIATES SPECIFICALLY DISCLAIM LIABILITY FOR ANY AND ALL DIRECT,
INDIRECT, SPECIAL, GENERAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR
EXEMPLARY DAMAGES INCLUDING, BUT NOT LIMITED TO, LOSS OF PROFITS
OR REVENUE OR ANTICIPATED PROFITS OR REVENUE ARISING OUT OF THE
USE OR INABILITY TO USE ANY SIERRA WIRELESS PRODUCT, EVEN IF
SIERRA WIRELESS AND/OR ITS AFFILIATES HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES OR THEY ARE FORESEEABLE OR FOR
CLAIMS BY ANY THIRD PARTY.
Notwithstanding the foregoing, in no event shall Sierra Wireless and/or its affiliates
aggregate liability arising under or in connection with the Sierra Wireless product,
regardless of the number of events, occurrences, or claims giving rise to liability, be in
excess of the price paid by the purchaser for the Sierra Wireless product.
Patents
This product may contain technology developed by or for Sierra Wireless Inc.
This document contains information which is proprietary to Sierra Wireless Inc. and is
licensed pursuant to Creative Commons Attribution 4.0 International License.
Document
details
Title: mangOH Green mangOH Fundamentals—Linux Computer + Legato CLI
Author: Sierra Wireless
Source: http://mangoh.io/
Copyright
© May 1, 2017 Sierra Wireless. Licensed under the Creative Commons Attribution 4.0
license, http://creativecommons.org/licenses/by/4.0/
Disclaimer
Indicate any modifications made to the original document.
Trademarks
mangOH™ and the mangOH logo are trademarks of Sierra Wireless.
Other trademarks are the property of their respective owners.
Rev 5 5/1/17
2
4118961-LinCLI
mangOH Green Fundamentals
Revision
History
Revision
number
Release date
Changes
1
April 2016
Document created
2
April 2016
Identified alternate methods of accessing attachments in main document introduction.
3
June 2016
New attachment versions
4
June 2016
New attachment versions
5
April 2016
Cleanup and HTML5 release
Rev 5 5/1/17
3
4118961-LinCLI
Contents
Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Before you begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Set up your mangOH Green . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Prepare your computer for Legato development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
System requirements for using Legato . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Prepare a Linux computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Connect the mangOH Green to your computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Install Required Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Develop and test applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Develop using the CLI—Command Line Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Configure your host terminal windows for development . . . . . . . . . . . . . . . . . . . . . . . .16
Develop and test applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Connect To Mobile Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Connect the target to a mobile network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Connect to the IoT Cloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Register and connect to AirVantage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Register with AirVantage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Connect to AirVantage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Finding your SIM’s APN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Using the Linux Terminal program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Useful Linux commands for this tutorial (and more) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Rev 5 5/1/17
4
4118961-LinCLI
1: Getting Started
1
Now that you have your mangOH Green, it’s time to start using it.
When you finish this tutorial, you will know how to assemble the mangOH Green,
prepare your computer for Legato development, and develop, install, and run
applications on the mangOH Green, and connect to the IoT Cloud via AirVantage,
which is Sierra Wireless’ cloud-based services platform for over-the-air (OTA) device
management.
Tip: If you have only one monitor, you may want to print this document and use it when you
don’t want to switch back and forth between the PDF and the various windows/applications
you’ll be opening during the tutorial.
This tutorial includes:
•
Before you begin on page 6
•
Set up your mangOH Green on page 7
•
Prepare your computer for Legato development on page 12
•
Develop and test applications on page 16
•
Connect To Mobile Networks on page 21
•
Connect to the IoT Cloud on page 24
•
Tips on page 30
Note: This tutorial includes instructions for Linux® computers using the Legato CLI (character
interface).
Important: To get maximum benefit from this tutorial, you are strongly recommended to
carefully follow the procedures as described, since the tutorial continually builds on earlier
procedures and results. If you skip steps or use alternate methods, you may encounter difficulty
completing the tutorial.
Rev 5 5/1/17
5
4118961-LinCLI
2: Before you begin
2
Before you begin the tutorial, here are a few items that you might find helpful:
•
Make sure your computer meets the requirements for Legato development. See
Table 4-1, Minimum System Requirements, on page 12.
•
A few terms:
·
“CF3”—The mangOH Green supports CF3 (Common Form Factor)
embedded modules, such as the WP8548.
Throughout this tutorial,”CF3” is used to refer to the module that comes with
your mangOH Green kit.
·
In this tutorial, the ‘host’ is your computer, and the ‘target’ is the CF3 module
in your mangOH Green.
•
Some symbols used in this document:
·
Shell (console) commands are shown with a symbol before the command:
·
‘$’—Command is entered on the Linux computer
·
·
•
Rev 5 5/1/17
‘#’—Command is entered on the target (the CF3 module in your
mangOH Green)
‘~’ and “$HOME” both represent your ‘home directory’ in Linux
Passwords, etc:
·
CF3 module:
·
USB ECM IP address—192.168.2.2
·
User name—root
·
Password—<none>
6
4118961-LinCLI
Set up your
mangOH
Green
Connect To
Mobile
Networks
Develop
and test
applications
Prepare your
computer for
Legato
development
Connect to
the IoT
Cloud
3: Set up your mangOH Green
3
In this section, you will see how to connect the basic components of your mangOH
Green that are needed to begin using it for developing applications.
Your mangOH Green kit comes with the basic parts you need to set up and begin
developing applications:
•
mangOH Green board
•
CF3 (Common Form Factor) module, cover, and release tool
•
micro-USB cable
•
AC adapter
•
Antennas (main and GNSS)
•
USB Flash drive (adapter with microSDHC card), pre-loaded with Linux and
Windows installation files (Note: For the latest installation files, visit mangoh.io/
getting-started.)
Top view
To set up the mangOH Green with these components:
1. Insert the CF3 module in the primary slot as shown. (Position matters!)
Make sure triangle is in this corner
when you place the module.
Top view
Rev 5 5/1/17
7
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect To
Mobile
Networks
Develop
and test
applications
Connect to
the IoT
Cloud
2. Place the cover over the module and press it (on the edges) in to place.
Top view
3. If you have a mini-SIM that has been activated by a mobile network provider,
insert it in the appropriate slot on the bottom side of the mangOH Green.
(micro-SIM support is forthcoming.)
(Note: The SIM is needed if you want to connect the mangOH Green to a mobile
network later in the tutorial. You can continue the tutorial without a SIM until the
procedure in Connect To Mobile Networks on page 21.)
Note the location of the notched corner.
Bottom view
Rev 5 5/1/17
8
4118961-LinCLI
Set up your
mangOH
Green
Connect To
Mobile
Networks
Develop
and test
applications
Prepare your
computer for
Legato
development
Connect to
the IoT
Cloud
4. Attach the antennas.
(Note: The main antenna is required if you want to connect the mangOH Green to
a mobile network in Connect To Mobile Networks on page 21. The GNSS antenna
is not used in this tutorial.)
Main
Top view
GNSS
Tip: If you have trouble connecting an antenna, make sure it is positioned directly on the
connector and push straight down. If you try to attach the antenna to the connector at a slight
angle, it will not connect.
5. Connect the mangOH to your computer with the micro-USB cable.
Computer
Rev 5 5/1/17
Bottom view
9
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect To
Mobile
Networks
Develop
and test
applications
Connect to
the IoT
Cloud
6. Power up the mangOH using the power adapter or micro-USB cable:
·
Using the power adapter
Move the power select jumper to select DC power, if required. (Note: The
board comes with DC power selected).
DC power (jumper on pins
closest to power connector)
See detail below.
Top view
DC power (jumper on pins
closest to power connector)
Top view
Rev 5 5/1/17
10
4118961-LinCLI
Set up your
mangOH
Green
Connect To
Mobile
Networks
Develop
and test
applications
Prepare your
computer for
Legato
development
·
Connect to
the IoT
Cloud
Using USB
Move the power select jumper to select USB power, if required. (Note: The
board comes with DC power selected).
USB power (jumper on pins
farthest from power connector)
See detail below.
Top view
USB power (jumper on pins
farthest from power connector)
Top view
When the mangOH is powered:
·
The Power LED turns on immediately—The mangOH is working.
·
The W_Disable LED turns on as the CF3 module tries to connect to the
mobile network (the CF3 module will not be able to connect until you set
up the APN in the next tutorial)
Power LED
W_Disable LED
Top view
Now you are ready to Prepare your computer for Legato development on page 12.
Rev 5 5/1/17
11
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect To
Mobile
Networks
Develop
and test
applications
Connect to
the IoT
Cloud
4: Prepare your computer for Legato
development
4
In this section, you will prepare your Linux or Windows computer for application
development by installing the Legato development environment and any required
applications or packages.
4.1 System requirements for using Legato
To install and use Legato, your computer must meet the requirements in Table 4-1.
Table 4-1: Minimum System Requirements
Linux
O/S
Ubuntu
CPU
Dual core @ 2.6 GHz
RAM
4 GB
HDD
10 GB free space
Important: Download, installation and use of Legato is subject to the Legato License and
Open Source Licenses. (Note: These links automatically download the licenses as PDF files.)
Use your Legato installation USB drive to prepare your Linux computer for the Legato
development environment.
Note: The USB drive is pre-loaded with Linux installation files. You can use these files, or visit
mangoh.io/getting-started to check whether there is a newer version available to download.
4.2 Prepare a Linux computer
The Legato development environment can be installed on Ubuntu Linux distributions.
Ubuntu distributions
To use a Ubuntu Linux computer for Legato development, you must:
Rev 5 5/1/17
•
Install Java 8, if required
•
Install the Legato Developer Studio and CLI
12
4118961-LinCLI
Set up your
mangOH
Green
Connect To
Mobile
Networks
Develop
and test
applications
Prepare your
computer for
Legato
development
Connect to
the IoT
Cloud
4.2.1 Connect the mangOH Green to your
computer
1. On the host, open a Terminal window—Press Ctrl+Alt+T (Note: This shortcut
works for the Terminal program in Ubuntu. It may be different for other distributions.).
2. Test the USB connection to the mangOH Green:
a. If not already connected, connect the computer to the mangOH Green using
the micro-USB cable.
Computer
Bottom view
b. Wait 10-15 seconds for the mangOH Green to enumerate.
c. Test the connection:
$ ping 192.168.2.2
You should receive ping responses. Press Ctrl+C to return to the command
prompt.
4.2.2 Install Required Packages
1. Install packages that are required for the Legato development environment to
work properly:
a. Display your Ubuntu version:
$ lsb_release -d
b. If your version is lower than 14.10, download and install OpenJDK 8 Java
Runtime Environment (Java 8 is pre-installed with 14.10 and higher).
Enter the following commands and follow the prompts:
$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jre
$ sudo update-alternatives --config java
Rev 5 5/1/17
13
4118961-LinCLI
Set up your
mangOH
Green
Connect To
Mobile
Networks
Develop
and test
applications
Prepare your
computer for
Legato
development
Connect to
the IoT
Cloud
c. Install dependencies (additional required files):
$ sudo apt-get install openjdk-8-jre libwebkitgtk-1.0-0
build-essential python-jinja2 ninja-build
Steps 2 and onward are re-ordered
and modified w.r.t. rev2.
(alternate method added, etc.)
2. Check whether your Linux computer is 32-bit or 64-bit:
$ uname -m
The computer’s hardware name appears —e.g. “x86_64” is a 64-bit system.
3. Prepare the installation files using either of the following methods:
·
If you will be using the installation files on the USB drive (that is, you are not
downloading a newer version from mangoh.io), mount the USB drive onto the
Linux filesystem:
i. Make sure you are in your home directory:
$ cd ~
ii. Make a directory to ‘mount’ the USB drive onto (for example, ~/usb):
$ mkdir ~/usb
This creates the ‘usb’ directory in your home directory.
iii. Mount the USB drive onto the directory (the USB drive’s internal label is
“mangoh”):
$ sudo mount /dev/disk/by-label/mangoh ~/usb
iv. Check that the USB drive mounted properly:
$ ls ~/usb
·
A list of files/folders appears.
If you are downloading a newer version of the installation files from
mangoh.io:
i. Download the appropriate legato zip archive (32-bit or 64-bit) from
mangoh.io/getting-started to a directory in the Linux filesystem.
4. Install the Legato development environment (Developer Studio and CLI):
a. Go to the directory where the installation file is located:
·
If you are using the file on the USB stick, go to the stick’s Linux directory:
$ cd ~/usb/Linux
·
If you downloaded the file, go to the directory containing the file—for
example, if you downloaded to ~/tempdownloads:
$ cd ~/tempdownloads
Rev 5 5/1/17
14
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect To
Mobile
Networks
Develop
and test
applications
Connect to
the IoT
Cloud
b. Extract the 32-bit or 64-bit legato zip archive to the ‘legato’ subdirectory in
your home directory—the following command creates the subdirectory if it is
not already there. (Replace “##” with “32” or “64” as appropriate.)
Note: ‘legato’ is the recommended subdirectory name. If you want to use a different
subdirectory name, replace “~/legato” with “~/<yourDirectoryName>”.).
$ unzip legato*##* -d ~/legato
Example: unzip legato*64* ~/legato extracts the 64-bit environment
to the ‘legato’ directory.
c. Finish installing Legato:
$ cd ~/legato
$ ./legato-spm --installed --update-link
Note: This may take a minute to run.
Now that the Legato development environment is installed, you can begin to Develop
and test applications on page 16 using the Legato CLI (Command Line Interface).
Rev 5 5/1/17
15
4118961-LinCLI
Set up your
mangOH
Green
Develop and
test
applications
Prepare your
computer for
Legato
development
Connect To
Mobile
Networks
Connect to
the IoT
Cloud
5: Develop and test applications
5
In this section, you will learn how to use the Legato development environment to build
a simple application (“Hello World”), install it onto the CF3 module in your mangOH
Green, and test that the application runs.
Legato provides two interfaces for developing applications:
•
CLI—Command Line Interface in a terminal window.
•
Developer Studio—A GUI (Graphical User Interface) development environment.
This document describes development using CLI.
Tip: This tutorial touches on the basics of using the Legato development environment. For
detailed references, forums, etc., see http://legato.io/legato-docs/latest/mangOH_developers.html.
5.1 Develop using the CLI—Command Line
Interface
5.1.1 Configure your host terminal windows for
development
Note: If you installed Legato to a subdirectory of your home directory using a different name
than ‘legato’, replace “~/legato” with “~/<yourDirectory>” in the commands in this section.
Every time you want to use the Legato CLI in a host terminal window, you must
configure the window for Legato using the following command:
$ source ~/legato/packages/legato.sdk.latest/resources/configlegatoenv
You can create an alias for the command to save time (and keystrokes) as follows:
1. In a host terminal window, make a backup copy of your .bashrc file, which is a
script that runs automatically each time you open a new terminal window:
$ cp ~/.bashrc ~/.bashrc.tmp
2. Copy the following command into the host terminal window and run it (this
example uses ‘cfgLegato’ for the alias. If you want to use a different name, make
sure it is not already a Linux or Legato command.) NOTE: Make sure to use “>>”
in the command. If you use a single ‘>’, your .bashrc file will be replaced and you
will have to replace it with the backup copy from the previous step.
echo ‘alias cfgLegato=”source ~/legato/packages/
legato.sdk.latest/resources/configlegatoenv”’ >> ~/.bashrc
Now each time you open a new host terminal window, you can enter the alias instead
of the long command:
$ cfgLegato
Rev 5 5/1/17
16
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Develop and
test
applications
Connect To
Mobile
Networks
Connect to
the IoT
Cloud
Note: The alias is created when you open a terminal window. If you want to start using it
immediately in your current window, enter the command:
$ . ~/.bashrc
Continue to 5.1.2 Develop and test applications.
5.1.2 Develop and test applications
When you installed Legato, sample application files were also stored, including a
“hello world” application. This section uses the “hello world” application for examples.
Compile an application on the host computer, and install it on the target:
1. Connect the mangOH Green to the host using the micro-USB cable.
2. On the host, open a new terminal window (referred to as DEV_TERM in this
procedure).
3. Use one of the following commands to configure the terminal window:
·
Configure DEV_TERM for Legato:
$ cfgLegato
or
·
If you did not create an alias in section 5.1.1 Configure your host terminal
windows for development on page 16:
$ source ~/legato/packages/legato.sdk.latest/resources/
configlegatoenv
4. Go to the sample application directory for Hello World:
$ cd $LEGATO_ROOT/apps/sample/helloWorld
5. Compile the application for the correct target type. In this example, we are using a
WP85XX CF3 module, and the target type is “wp85”.
$ make wp85
6. Install the application on the target:
$ instapp helloWorld.wp85.update 192.168.2.2
7. If the message “The authenticity of host ...” appears, type “yes” and press Enter
to continue.
Run the application on the target:
1. Set up a window to show the application’s output (the “Hello World” application
writes to a log file) as follows:
a. Open a new terminal window (referred to as LOG_TERM in this procedure).
b. Connect to the target’s console:
$ ssh root@192.168.2.2
Rev 5 5/1/17
17
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Develop and
test
applications
Connect To
Mobile
Networks
Connect to
the IoT
Cloud
c. The first time you use a ssh (secure shell) connection to your device, the
following error message may appear.
If it does appear:
i. Enter the command:
$ ssh-keygen -f “/home/legato/ssh/known_hosts” -R
192.168.2.2
ii. Try again to connect to the target’s console:
$ ssh root@192.168.2.2
iii. If prompted to continue connecting, type “yes” and press Enter.
Prompt to
continue
d. Watch the log file and show when a message from “hello world” appears:
# logread -f | grep “Hello”
Note: Nothing will appear to happen until you run the Hello World application ion in the next
step. Leave this command running until after you see the Hello World output, then you can
press Ctrl+C to terminate it.
2. Run the application:
a. Open an existing or new terminal window to run the application (referred to as
APP_TERM in this procedure).
Rev 5 5/1/17
18
4118961-LinCLI
Set up your
mangOH
Green
Develop and
test
applications
Prepare your
computer for
Legato
development
Connect To
Mobile
Networks
Connect to
the IoT
Cloud
b. Connect to the target‘s console:
$ ssh root@192.168.2.2
c. Check that the application is installed:
# app status
Hello World application
The “hello world” application should appear in the list with a status of
‘Running’. The application was built to run automatically; when you write your
own applications, you can make them install without running, if you prefer.
d. Stop the application (so you can restart it and see the output):
# app stop helloWorld
e. Run the application and see that it outputs a “Hello, world.” message to
LOG_TERM:
# app start helloWorld
f.
(Optional) If you want to see information about the application, use:
# app info helloWorld
You have now successfully compiled a working application, and installed, stopped,
and run it on the module.
Rev 5 5/1/17
19
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Develop and
test
applications
Connect To
Mobile
Networks
Connect to
the IoT
Cloud
Now you are ready to Connect To Mobile Networks on page 21.
Rev 5 5/1/17
20
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect
To Mobile
Networks
Develop
and test
applications
Connect to
the IoT
Cloud
6: Connect To Mobile Networks
6
In this section, you will learn how to connect your device to a mobile network. (Note:
You must have an activated mini-SIM in the mangOH Green.
Note the location of the notched corner.
6.1 Connect the target to a mobile network
If you have installed an activated SIM in the mangOH Green, you can connect the
target (the CF3 module) to a mobile network:
1. Connect to the target’s console:
a. On the host, open an existing or new terminal window.
b. Connect to the target as the root user using the target’s default USB ECM IP
address:
$ ssh root@192.168.2.2
2. Start a data connection:
a. Enter the following commands:
# cm info
This shows information about the target. Record the FSN (serial number) and
IMEI in case you need them in the future for support.
# cm radio
This shows information about the mobile network the target is registered on.
Rev 5 5/1/17
21
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect
To Mobile
Networks
Develop
and test
applications
Connect to
the IoT
Cloud
# cm data
This shows the connection status. Because your SIMs APN is not set yet, the
device cannot connect to the network.
b. Set the APN, replacing “<your apn>” with the actual APN (for example “cm
data apn internet.com” for a Rogers Wireless SIM):
# cm data apn <your apn>
Note: If your mobile network operator uses different APNs for 3G and LTE, make sure to use
the APN for the correct network based on your CF3 module type. For example, the WP8548 is
a 3G-only module that does not support LTE—the APN for the network operator’s 3G network
should be used.
If you do not know the APN for your SIM:
i. Get your Home Network Operator name:
# cm sim info
ii. Search the Internet for the APN for your Home Network Operator (for
example, search for “Rogers Wireless APN”).
c. (Optional) If you want to make sure you set the APN correctly, enter:
# cm data
Rev 5 5/1/17
22
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect
To Mobile
Networks
Develop
and test
applications
Connect to
the IoT
Cloud
d. The target is now set up to attempt a data connection. Enter the following
command (the ampersand (‘&’) runs the process in the background so you
can keep working in the terminal):
# cm data connect &
When the data connection is established, the ‘Connect through interface ...’
message appears, and the Connection LED turns on.
e. (Optional) To prove that the target has a data connection to the mobile
network, ‘ping’ a URL that you know is working:
# ping mangoh.io
Note: To stop the ping responses, press Ctrl+C.
Now that you know how to start a data connection, you are ready to Connect to the
IoT Cloud on page 24 to load your application to the ‘cloud’.
Rev 5 5/1/17
23
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect To
Mobile
Networks
Develop
and test
applications
Connect to
the IoT
Cloud
7: Connect to the IoT Cloud
7
In this section, you will register your device with Sierra Wireless‘AirVantage platform.
which is a cloud-based service that you can use to collect data from your device.
7.1 Register and connect to AirVantage
Your mangOH Green kit includes a free account on the AirVantage IoT Acceleration
Platform for your CF3 module. This platform provides Sierra Wireless’ cloud-based
services for over-the-air (OTA) device management and application enablement.
These services provide the infrastructure you need to build, connect, and operate
your IoT applications in a single platform.
Note: Your free account allows you to register up to five devices.
Before you can use AirVantage, you must register your device with AirVantage, and
then start a connection to the AirVantage server.
7.1.1 Register with AirVantage
1. In a browser, navigate to https://eu.airvantage.net/accounts/
signup?type=Mangoh.
Rev 5 5/1/17
24
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect To
Mobile Networks
Develop
and test
applications
Connect to
the IoT
Cloud
2. In the MangOH Signup area, enter your:
·
First and last names
·
Email address—Use a valid address. This is needed to complete the registration process and is also used as your account name.
·
Account name —Use a unique name such as a combination of your company
name, the project name, your name, etc.
·
Phone number—Use international format (for example, for North American
phone numbers, use “001” plus the 10-digit area code and phone number).
3. Review the Terms of Service and select “I agree to the Terms of Service”.
4. Click Signup.
An email is sent automatically to your email address with a confirmation link.
5. Open the email and click the link to confirm your AirVantage signup request.
6. Your browser opens to confirm the signup request. Enter a password that satisfies
the requirements shown on-screen, and re-enter the password to confirm.
7. Click Save.
If your password is acceptable, the AirVantage Login screen appears.
Rev 5 5/1/17
25
4118961-LinCLI
Set up your
mangOH
Green
Connect To
Mobile
Networks
Develop
and test
applications
Prepare your
computer for
Legato
development
Connect to
the IoT
Cloud
8. Enter your account’s email address and password, and click Log In.
Note: What you are registering on AirVantage is the CF3 module that is included with your
mangOH Green Kit. If you purchase another module and want to use it with AirVantage (using
the same mangOH Green), you must register that module separately.
9. In the Register mangOH section, enter the Serial Number (FSN) and IMEI of the
module in your mangOH Green. If you did not record them earlier, open a
terminal window and connect to the module’s console, then use the command “cm
info” to display the information.
·
·
·
·
Rev 5 5/1/17
Serial Number—Enter the module’s FSN.
IMEI/ESN—Enter the module’s IMEI.
Name—(Optional) Enter a descriptive name for the device (e.g. “Test Device
1”, “Parking Meter”, etc.)
Pre-configure system—Do not select this option.
26
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect To
Mobile Networks
Develop
and test
applications
Connect to
the IoT
Cloud
10. Click Register.
The device appears in the ‘Registered systems’ section at the bottom of the
screen.
Monitor system
11. Now that your device is registered, click the monitor icon at the right side of your
device entry ( ) to go to the System Details screen (see next step).
12. The System Details screen displays several widgets that report information about
your device, communications received from it, running applications, etc.
The areas shown below (Last Communication andSystem Info) are both blank
because you have not connected your mangOH Green to AirVantage yet. Leave
this browser window open and continue to Connect to AirVantage on page 28.
Last Communication
(When you have your
device registered, your
last communication will
appear here.)
System Info
(Details about the CF3
module in your mangOH
will appear here.)
Rev 5 5/1/17
27
4118961-LinCLI
Connect To
Mobile
Networks
Develop
and test
applications
Prepare your
computer for
Legato
development
Set up your
mangOH
Green
Connect to
the IoT
Cloud
7.1.2 Connect to AirVantage
1. Start a connection to AirVantage:
a. On the host, open an existing or new terminal window.
b. Connect to the target as the root user using the target’s default USB ECM IP
address:
$ ssh root@192.168.2.2
c. Open an AT port on the target—after you enter this command, you will not
see a command prompt (you are in the AT command entry mode):
# microcom -E /dev/ttyAT
Waiting for you to enter
AT commands
d. Make sure you can enter AT commands—Type “at” and press Enter. If this is
working, the command returns “OK”:
e. Type “at+wdsi = 8191” and press Enter. This configures your CF3 module to
connect to the AirVantage server.
f.
Type “at+wdss=1,1” and press Enter. This connects your CF3 module to the
AirVantage server. If the command returns OK, you have connected to
AirVantage.
Connected to AirVantage
Note: The values shown in the response above may vary. The “+WDSI” parts of the response
are internal status codes. The key part of the response is the “OK” message. If you receive an
error instead of “OK”, redo step e and step f.
g. Press Ctrl+X to leave AT entry mode and return to the command prompt.
Rev 5 5/1/17
28
4118961-LinCLI
Set up your
mangOH
Green
Prepare your
computer for
Legato
development
Connect To
Mobile Networks
Develop
and test
applications
Connect to
the IoT
Cloud
h. Refresh the AirVantage System Details screen in your web browser—the
System Info section now shows details about your module, and the Last
Communication section shows the connection you just completed.
Last Communication
(Shows when your
board last communicated
with AirVantage, and
the type of
communication.
For example, this CF3
communicated its
Registration.
System Info
(Information about
the CF3 module in
your mangOH board)
You have now registered and connected your device to AirVantage, and completed
the mangOH Green Fundamentals tutorial. For more information on the mangOH
platform, visit mangoh.io.
To begin developing applications to communicate with AirVantage, work through the
tutorial at https://source.sierrawireless.com/airvantage/av/howto/hardware/samples/
legato-asset-data/.
Rev 5 5/1/17
29
4118961-LinCLI
A: Tips
A
A.1 Finding your SIM’s APN
Your SIM provider should give you the APN that you use to connect to their network. If
you don’t have the APN, you should be able to find it online.
Common APNs:
·
Rogers Wireless—“internet.com”
·
Others—Search the Internet for “<provider> APN”. For example, “Rogers
Wirelesss APN”
A.2 Using the Linux Terminal program
Ubuntu includes a terminal emulator, which is labeled as “Terminal” in the desktop
environment. The emulator allows you to execute command-line programs that
interact with the Legato framework tools on your computer and the CF3 module in the
mangOH Green.
For this tutorial, here are some useful tips:
Rev 5 5/1/17
•
Open a terminal window. In the Unity desktop shell used by default on Ubuntu
Linux, do this using either of these methods:
·
Click the Search icon and type “terminal”, then run the application that is
listed.
·
Press Ctrl+Alt+T
•
Open a new tab in a window—Press Ctrl+Shift+T
•
Change a tab namein a window—Right-click in the tab and select Set Title.
•
Copy text from a window—Highlight the text and press Ctrl+Insert.
•
Paste text into a window—Press Shift+Insert.
•
For in-depth detail, refer to https://help.ubuntu.com/community/UsingTheTerminal.
30
4118961-LinCLI
mangOH Green Fundamentals
A.3 Useful Linux commands for this tutorial
(and more)
The following table describes the Linux commands you will use in this tutorial, plus
other useful commands.
Table A-1: Linux commands
Command types
Versioning
Radio
Command
Description
cm info
Display the modules model, IMEI, FSN (serial number), and firmware
and bootloader versions.
legato version
Display the Legato framework version.
cm radio
Display the radio status.
cm radio on
cm radio off
Enable or disable the radio.
Refer to cm radio (http://legato.io/legato-docs/latest/toolsTarget_cm.html#toolsTarget_cm_radio) for
more details and command options.
Data connections
cm data
cm data info
Display information about the current profile in use.
cm data apn <yourAPN>
Set the APN for your profile to the APN from your SIM provider.
cm data connect
Start a data connection.
cm data connect <timeout> Start a data connection (keep trying for up to <timeout> seconds).
Refer to cm data (http://legato.io/legato-docs/latest/toolsTarget_cm.html#toolsTarget_cm_data) for
more details and command options.
SIM
cm sim info
Display information about the SIM.
cm sim status
Display the SIM status
cm sim enterpin
Enter a SIM PIN code to be able to use the SIM.
Refer to cm sim (http://legato.io/legato-docs/latest/toolsTarget_cm.html#toolsTarget_cm_sim) for
more details and command options.
Applications
app status
Display the status of installed applications (running, stopped).
app start <appName>
app stop <appName>
app remove <appName>
Start, stop, or remove an application.
Refer to app (http://legato.io/legato-docs/latest/toolsTarget_app.html) for more details and command
options.
Rev 5 5/1/17
31
4118961-LinCLI
Table A-1: Linux commands (Continued)
Command types
Packages
Command
Description
add-apt-repository
Add a package repository to your list of locations where the apt-get
package management tool searches for the packages you request.
apt-get update
Update the list of repositories to include those you added with add-aptrepository.
apt-get install
Search the repositories for a package, and install it.
update-alternatives
TBD
A.4 Definitions
Table A-2: Definitions
Term
Rev 5 5/1/17
Definition
sudo
Allows you to run commands that require another user’s security
privileges. In this tutorial, the sudo command is used to run
commands that require root/admin privileges.
Legato
Open source platform for developing applications.
wget
Gets files from a web server
.bashrc
A shell script that runs when you open a Linux terminal window.
IDE perspective
A defined layout of the IDE. Each perspective will show different
view (panel) combinations.
IDE view
A panel of information. For example, a directory structure, a
panel for entering Terminal commands, etc.
32
4118961-LinCLI
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising