Documentation

Mistake on this page? Email us
Mbed Cloud SDK for .NET

The Mbed Cloud SDK gives developers access to the full Mbed suite using .NET Core 2.0.

If you want to contribute to creating a SDK for another language the work is greatly appreciated and you can read more about the process here.

Installation

  1. Download the .NET Core SDK from here. There are installers for Windows, Linux and Mac.
  2. Create a new console application
1 dotnet new console -o myApp
2 cd myApp
  1. Install the MbedCloudSDK in your project
1 dotnet add package Mbed.Cloud.SDK
2 dotnet build
  1. To use the SDK you'll need an Api Key, which you can get from the Mbed Cloud Portal.

Example Usage

The following sample lists the first five devices in your Device Directory.

namespace demo
{
using System;
using System.Linq;
class Program
{
static void Main(string[] args)
{
// create new configuration object. When autostartNotifications is true, you don't need to open a notification channel manually
var config = new Config(apiKey: "<your api key>", autostartNotifications: true);
var connect = new ConnectApi(config);
// lists the first 50 connectedDevices
var connectedDevices = connect.ListConnectedDevices().Data;
// get the first connected device
var val = connectedDevices.FirstOrDefault()
// list the resources
?.ListResources()
// get the first resource that matches the path /3201/0/5853
?.FirstOrDefault(d => d.Path == "/3201/0/5853")
// get the value of the resource
?.GetResourceValue();
Console.WriteLine(val);
}
}
}

Further examples can be found in the Examples folder of the GitHub repository.

Contributing

Mbed Cloud SDK for .NET is open source and we would like your help; there is a brief guide on how to get started in CONTRIBUTING.

Licence

Mbed Cloud SDK for .NET is free-to-use and licensed under the Apache License 2.0. Please See LICENSE file for more information.