Table of Contents

Class SimulatedPart

Namespace
Pamoja.Hal
Assembly
Pamoja.Hal.dll

A part that is not there, of any of the three kinds a simulated bus holds.

public abstract class SimulatedPart : IDisposable
Inheritance
SimulatedPart
Implements
Derived
Inherited Members

Remarks

I2cPart answers from registers a byte wide, as Bosch's parts do; WordPart from registers sixteen bits wide, as Texas Instruments' parts do; and CommandPart from commands and the replies they leave, as Sensirion's parts do. A simulated bus takes any of them, and Part(byte) gives each back as its own kind.

Properties

Address

The address the part answers to.

public byte Address { get; }

Property Value

byte

Transfers

How many transfers the part has served.

public int Transfers { get; }

Property Value

int

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

FromHandle(NativeHandle)

Wraps a part a native call made as the kind it is.

public static SimulatedPart FromHandle(NativeHandle handle)

Parameters

handle NativeHandle

The part's handle, released with pamoja_i2c_part_free.

Returns

SimulatedPart

An I2cPart, a WordPart, or a CommandPart.

Use<TResult>(Func<nint, TResult>)

Runs a native call that needs this part's handle.

public TResult Use<TResult>(Func<nint, TResult> call)

Parameters

call Func<nint, TResult>

The native call to make.

Returns

TResult

Whatever the native call returned.

Type Parameters

TResult

What the native call returns.