dotnet / dotnet/iot

Simulation API - Suggestions and Requirements

Open
#1,828 17 comments 4 reactions 0 assignees View on GitHub
api-suggestion area-device-bindings area-tools Design Discussion enhancement Priority:3
Dominant language
C#
Stars
2.4k
Forks
630
Avg merge
11d 3h
Merged PRs (30d)
2

Description

We have several PRs suggesting the addition of a simulation GPIO Driver to simplify development and testing without actual hardware (see #1827 and #1823). The team has agreed that such a simulation is desirable, but it should include, at least as possible further extensions, simulation components for other hardware interfaces, particularly I2C, SPI or PWM.

Suggested class structure:

```csharp
namespace Iot.Devices.Simulation
{
public class SimulationBoard : Board
{
// ....
public override GpioController CreateGpioController()
{
return new GpioController(PinNumberingScheme.Logical, new SimulationGpioDriver(NumberOfPinsToSimulate));
}
}

public class SimulationGpioDriver : GpioDriver
{
// ....
}

public class SimulationI2cBus : I2cBus
{
// ...
}
// ....
}
```

To simulate the behavior of the actual hardware, the simulation devices should have a "backend" interface that allows connecting a simulation implementation, either by having events to connect to, such as showcased [here](https://github.com/dotnet/iot/pull/1823/files), or something like a REST api to connect an external simulation Gui to. That simulation GUI could then simulate the wiring between inputs/outputs or simulate devices on the I2C bus.

Suggestions or improvements?

I do not expect that a first implementation would be able to support all cases, but it shouldn't block further development towards such a scenario.

@HumJ0218 @mcNets

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.