Skip to content
Branch: master
Find file History
cawhitworth Assorted doc updates and fixes (#54)
* Assorted doc updates and fixes

* Couple more README updates

* Hardware README updates
Latest commit 470ccc8 Jun 24, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
HTTPS_Curl_Easy Update samples for 19.05 release (#48) May 30, 2019
HTTPS_Curl_Easy.sln Update samples for 19.05 release (#48) May 30, 2019
LICENSE.txt Update samples for 19.05 release (#48) May 30, 2019
README.md Assorted doc updates and fixes (#54) Jun 24, 2019

README.md

Sample: HTTPS_Curl_Easy

This sample C application demonstrates how to use the cURL "easy" API with Azure Sphere over a secure HTTPS connection. For details about using the libcurl library with Azure Sphere, see Connect to web services using curl.

The sample periodically downloads the index web page at example.com, by using cURL over a secure HTTPS connection. It uses the cURL "easy" API, which is a synchronous (blocking) API.

The sample can only connect to websites listed in the application manifest. In the "AllowedConnections" section of the app_manifest.json file, add the host name of each website to which you want the sample to connect. For example, the following adds Contoso.com to the list of allowed websites.

"Capabilities": {
    "AllowedConnections": [ "www.example.com", "www.Contoso.com"],
      .
      .
      .
  }

By default, this sample runs over a Wi-Fi connection to the internet. To use Ethernet instead, make the following changes:

  1. Configure Azure Sphere as described in Connect Azure Sphere to Ethernet.

  2. Add an Ethernet adapter to your hardware. If you are using an MT3620 RDB, see the wiring instructions.

  3. Add the following line to the Capabilities section of the app_manifest.json file: "NetworkConfig" : "true"

  4. In main.c, add a call to Networking_SetInterfaceState before any other networking calls:

     err = Networking_SetInterfaceState("eth0", true);
     if (err < 0) {
         Log_Debug("Error setting interface state %d\n",errno);
         return -1;
     }

The sample uses beta APIs and the following Azure Sphere libraries:

Library Purpose
log Displays messages in the Visual Studio Device Output window during debugging
storage Gets the path to the certificate file that is used to authenticate the server
libcurl Configures the transfer and downloads the web page

To build and run the sample

  1. Set up your Azure Sphere device and development environment as described in the Azure Sphere documentation.
  2. Even if you've performed this set up previously, ensure you have Azure Sphere SDK version 19.05 or above. In an Azure Sphere Developer Command Prompt, run azsphere show-version to check. Download and install the latest SDK as needed.
  3. Clone the Azure Sphere samples repo and then open the HTTPS_Curl_Easy sample from within your copy.
  4. Connect your Azure Sphere device to your PC by USB.
  5. Connect to the Internet and enable application development on your Azure Sphere device, if you have not already done so.
  6. In Visual Studio, open HTTPS_Curl_Easy.sln and press F5 to compile and build the solution and load it onto the device for debugging.

Troubleshooting the Azure Sphere app

  • Visual Studio returns the following error if the application fails to compile:

    1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Application Type\Linux\1.0\AzureSphere.targets(105,5): error MSB6006: "arm-poky-linux-musleabi-gcc.exe" exited with code 1.

    This error may occur for many reasons. Most often, the reason is that you did not clone the entire Azure Sphere Samples repository from GitHub. The samples depend on the hardware definition files that are supplied in the Hardware folder of the repository.

To get detailed error information

By default, Visual Studio may only open the Error List panel, so that you see error messages like this:

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Application Type\Linux\1.0\AzureSphere.targets(105,5): error MSB6006: "arm-poky-linux-musleabi-gcc.exe" exited with code 1.

To get more information, open the Build Output window. To open the window, select View->Output, then choose Build on the drop-down menu. The Build menu shows additional detail, for example:

1>------ Rebuild All started: Project: AzureIoT, Configuration: Debug ARM ------
1>main.c:36:10: fatal error: hw/sample_hardware.h: No such file or directory
1> #include <hw/sample_hardware.h>
1>          ^~~~~~~~~~~~~~~~~~~~~~
1>compilation terminated.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Application Type\Linux\1.0\AzureSphere.targets(105,5): error MSB6006: "arm-poky-linux-musleabi-gcc.exe" exited with code 1.
1>Done building project "AzureIoT.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

In this case, the error is that hardware definition files aren't available.

The Tools -> Options -> Projects and Solutions -> Build and Run panel provides further controls for build verbosity.

License

For details on license, see LICENSE.txt in this directory.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

You can’t perform that action at this time.