Skip to content

Pure C# Implementation of Various WiFi SmartConfig Protocols: AirKiss and ESPTouch

License

Notifications You must be signed in to change notification settings

oldrev/sandwych-smartconfig

Repository files navigation

Build status NuGet

Sandwych.SmartConfig

Sandwych.SmartConfig is a pure C# implementation of various WiFi SmartConfig protocols that build from scratch.

TD;LR: If you working on a Xamarin mobile app to deal with WiFi-capability IoT devices, you may need this library.

English | 简体中文

Getting Started

Features

  • A .NET Standard class library, works on both Xamarin and desktop.
  • No third-party library referenced.
  • Supported protocols: WeChat's AirKiss and Espressif's ESPTouch.
  • Clean architecture, easy to learn and add your own protocol.
  • IoC container friendly.

Getting Started

Prerequisites

  • Microsoft Visual Studio 2019
  • DocFX for API documents generation (Optional)

Supported Platforms

  • .NET Standard 2.0+

Installation

Install Sandwych.SmartConfig to your project by NuGet then you're good to go.

Examples

Usage

var provider = new EspSmartConfigProvider();
var ctx = provider.CreateContext();

ctx.DeviceDiscoveredEvent += (s, e) => {
	Console.WriteLine("Found device: IP={0}    MAC={1}", e.Device.IPAddress, e.Device.MacAddress);
};

var scArgs = new SmartConfigArguments()
{
	Ssid = "YourWiFiSSID",
	Bssid = PhysicalAddress.Parse("10-10-10-10-10-10"),
	Password = "YourWiFiPassword",

	// Your local IP address of WiFi network. It's important for using multiple network interfaces
	// See CliDemoApp for details.
	LocalAddress = IPAddress.Parse("192.168.1.10") 
};

// Do the SmartConfig job
using (var job = new SmartConfigJob(TimeSpan.FromSeconds(100))) // Set the timeout to 100 seconds
{
	await job.ExecuteAsync(ctx, scArgs);
}

Or much simpler if you perfer the callback style:

await SmartConfigStarter.StartAsync<EspSmartConfigProvider>(args, 
	onDeviceDiscovered: (s, e) => Console.WriteLine("Found device: IP={0}    MAC={1}", e.Device.IPAddress, e.Device.MacAddress));

The Demo Android App

APK Download: WIP

Donation

If this project is useful to you, you can buy me a beer:

Support via PayPal.me

Contributiors

  • Li "oldrev" Wei - Init work and the main maintainer - oldrev

License

Licensed under the MIT License. Copyright © Sandwych.SmartConfig Contributors.

See LICENSE.md for details.

Credits