question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simulation API - Suggestions and Requirements

See original GitHub issue

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:

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, 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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:17 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
pgrawehrcommented, Feb 9, 2023

From @raffaeler’s suggestions on #383:

The goals for this proposal:

  • ability to mock all the devices for testing purposes without having to use Moq or similar frameworks
  • ability to log the sequence of I/O writes
  • ability to create a framework to replay a sequence to simulate a complete I/O handshake without any connected device
  • ability to run the application on a host which doesn’t have any device connected. For example, this is useful to test the other parts of the application on Windows and later run the real one on the embedded board.
0reactions
krwqcommented, Feb 9, 2023
Read more comments on GitHub >

github_iconTop Results From Across the Web

Skill Simulation REST API Reference | Alexa Skills Kit
Skill Simulation REST API Reference · API endpoint · Authentication · Operations · Simulate skill · Get simulation results · Object definitions.
Read more >
Features | API Simulator
The API Simulator is a feature-rich tool for easy API simulations / mocking / virtualization. For APIs over HTTP/2 and HTTP/1.x. Free forever!...
Read more >
How to simulate a REST API?
I simulated REST API by using combination of cucumberjs, phantomjs with setting proxy server to 127.0.0.1 and hooking a node.js process with ...
Read more >
Create Low-Cost Sandbox Environments With API Simulation
It's a powerful solution when it comes to API simulation by stabilizing test environments and enabling rapid agile development. The power ...
Read more >
API Mocking: Best Practices & Tips for Getting Started
Mocking: basic functionality required for a specific testing or development purpose; Simulation: complete functionality for testing or development purposes ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found