Skip to content

Latest commit

 

History

History
123 lines (81 loc) · 5.03 KB

windows10-iot-core-avatar-csharp.md

File metadata and controls

123 lines (81 loc) · 5.03 KB

platform: windows 10 iot core device: avatar language: csharp

Run a simple Csharp sample on Inventec Avatar device running Windows 10 IoT Core


Table of Contents

Introduction

About this document

This document describes how to connect Inventec Avatar device running Windows 10 IoT Core with Azure IoT SDK. This multi-step process includes:

  • Configuring Azure IoT Hub
  • Registering your IoT device
  • Build and deploy Azure IoT SDK on device

Step 1: Prerequisites

You should have the following items ready before beginning the process:

Install Visual Studio 2015 and Tools

  • To create Windows IoT Core solutions, you will need to install Visual Studio 2015. You can install any edition of Visual Studio, including the free Community edition.

    Make sure to select the Universal Windows App Development Tools, the component required for writing apps Windows 10:

Step 2: Prepare your Device

  • Flash Windows 10 IoT Core image on to the device.

  • On the first boot of the device only, do the following:

    1. Plug the device into a USB port on your computer.

    2. Use ffutool -list to check if the device is enumerated correctly in the system.

    3. Use ffutool -massstorage to put the device into mass storage mode.

    4. Configure BCD store using the following command to enable KDNet debugging (<Host IP> is the IP address of your PC, E: is the storage drive of your module):

      bcdedit /store E:\efiesp\efi\Microsoft\Boot\BCD /dbgsettings net HOSTIP:<Host IP> PORT:50000 KEY:1.2.3.4
      bcdedit /store E:\efiesp\efi\Microsoft\Boot\BCD -set {default} debug on
      bcdedit /store E:\efiesp\efi\Microsoft\Boot\BCD -set {dbgsettings} busparams 1
      bcdedit /store E:\efiesp\efi\Microsoft\Boot\BCD -set {globalsettings} forceffumode off
      
    5. Unplug the device.

  • On your computer, run Virutal Ethernet (�VirtEth.exe� ) as administrator.

  • Plug the device into a USB port on your computer.

  • Wait for a few minutes for the device to enumerate, open WindowsIoTCoreWatcher to find your device.

Step 3: Build and Run the Sample

## 3.1 Connect the Device
  • On your computer, run Virtual Ethernet as administrator.
  • Plug the device into a USB port on your computer.
## 3.2 Build the Samples
  • Start a new instance of Visual Studio 2015. Open the iothub_csharp_client.sln solution (/azure-iot-sdks/csharp) from your local copy of the repository.

  • In Visual Studio, from Solution Explorer, navigate to the UWPSample(Universal Windows) project.

  • Locate the following code in the ConnectionStrings.cs file:

    public const string DeviceConnectionString = "<replace>";
    
  • Replace the above placeholder with device connection string you obtained in Step 1 and save the changes.

  • Choose the right architecture (ARM) and set the debugging method to "Remote Machine":

  • To deploy the binaries on your device, right-click on the UWPSample project in the Solution Explorer, select Properties and navigate to the Debug tab:

    Type in the IP Address of your device. Make sure the "Use authentication" box is unchecked.

  • Build the solution.

## 3.3 Run and Validate the Samples
  • On Windows, refer "Monitor device-to-cloud events" in DeviceExplorer Usage document to see the data your device is sending.

  • If you are running other OS, please use the JavaScript tool iot-hub explorer tool

  • In Visual Studio, from Solution Explorer, right-click the UWPSample(Universal Windows) project, click Debug −> Start new instance to build and run the sample.

  • You should be able to see the events received in the DeviceExplorer's data tab.

3.3.2 Receive messages from IoT Hub