Skip to content

Latest commit

 

History

History
95 lines (56 loc) · 3.58 KB

README.md

File metadata and controls

95 lines (56 loc) · 3.58 KB

remoteit-csharp

NuGet Build Status

remoteit-csharp is an open-source C# client for the remote.it REST API. With this package, you can programmatically list and securely connect to your remote.it devices. This client is distributed as a NuGet package targeting the .NET Core framework.

Anyone is welcome to contribute to this project. Feel free to make any issues and pull-requests.

Installation

Using the .NET Core Command Line Tools

If you are building with the .NET Core command-line tools, you can run the following command from within your project directory:

dotnet add package Remoteit

Using Visual Studio IDE

From within Visual Studio, you can use the NuGet GUI to search for and install the Remoteit NuGet package. Alternatively, you can use the built-in package manager console and write the following command.

Install-Package Remoteit

Usage

Authentication

var remoteitUsername = Environment.GetEnvironmentVariable("REMOTEIT_USERNAME");
var remoteitPassword = Environment.GetEnvironmentVariable("REMOTEIT_PASSWORD");
var remoteitDevKey = Environment.GetEnvironmentVariable("REMOTEIT_DEVELOPER_KEY");

var remoteitClient = new RemoteitClient(remoteitUsername, remoteitPassword, remoteitDevKey);

After authenticating, you can list your devices, connect to them, and terminate device connections.

Listing Your Devices

var remoteitClient = new RemoteitClient(remoteitUsername, remoteitPassword, remoteitDevKey);

List<RemoteitDevice> devices = await remoteitClient.GetDevices();

Connecting to a Device

var remoteitClient = new RemoteitClient(remoteitUsername, remoteitPassword, remoteitDevKey);

var deviceAddress = "80:00:00:00:01:XX:XX:XX";

// Create a device connection
ServiceConnection connectionData = await remoteitClient.ConnectToService(deviceAddress);

// Example: https://XXXasnap.p18.rt3.io/
string connectionUrl = connectionData.Proxy;

Terminating a Device Connection

var remoteitClient = new RemoteitClient(remoteitUsername, remoteitPassword, remoteitDevKey);

string deviceAddress = "80:00:00:00:01:XX:XX:XX";

// Create a device connection
ServiceConnection connectionData = await remoteitClient.ConnectToService(deviceAddress);

// Get the connection's ID from the service connection object.
string connectionId = connectionData.ConnectionId;

// Terminate the connection. An exception is thrown if the termination is unsucesful.
await remoteitClient.TerminateDeviceConnection(deviceAddress, connectionId);

Development

Dependencies

You can install the project's dependencies by running dotnet restore in the project root.

Testing

All tests are located in the Remoteit.Test project. The testing libraries used for this project are xUnit and Moq.

Continues integration is done through Azure Pipelines. The azure-pipelines.yml file configures this pipeline. Pipeline Link

Authors

  • Kyle O'Brien - Initial work - LinkedIn

License

This project is licensed under the MIT License - see the LICENSE.md file for details