Table of Contents

Class FunctionExecutingModule

Namespace
Loehnert.Lisrt.Can.Protocol
Assembly
Loehnert.Lisrt.Can.Protocol.dll

Represents an base module for the default Löhnert CAN protocol.

public abstract class FunctionExecutingModule : LisrtModule, ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged
Inheritance
PropertyChangedBase
FunctionExecutingModule
Implements
INotifyPropertyChangedEx
Inherited Members
PropertyChangedBase.Refresh()
PropertyChangedBase.IsNotifying
PropertyChangedBase.PropertyChanged

Constructors

FunctionExecutingModule(string, ICanCommunication2)

Initializes a new instance of the FunctionExecutingModule class.

protected FunctionExecutingModule(string name, ICanCommunication2 canCommunication)

Parameters

name string

Name of the module.

canCommunication ICanCommunication2

Can communication.

Exceptions

ArgumentNullException

Thrown when any argument is null or empty.

Properties

Address

Gets or sets the card address (from 0 to 63).

[Configuration(1, Description = "0 to 63")]
public byte Address { get; set; }

Property Value

byte

Exceptions

ArgumentOutOfRangeException

Thrown when set value is not in range from Loehnert.Lisrt.Can.Protocol.FunctionExecutingModule.MinimumAddress to Loehnert.Lisrt.Can.Protocol.FunctionExecutingModule.MaximumAddress.

FirmwareVersion

Gets the firmware version of the device.

public Version FirmwareVersion { get; }

Property Value

Version

InitializationState

Gets or sets a value indicating whether the module is initialized.

public InitializationState InitializationState { get; protected set; }

Property Value

InitializationState

SerialNumber

Gets the unique serial number (hardware identification) of the device.

public string SerialNumber { get; }

Property Value

string

TimeoutInMS

Gets the communication timeout in milliseconds (300ms).

public virtual int TimeoutInMS { get; }

Property Value

int

TypeNumber

Gets the number for the type (from 0 to 15).

protected abstract uint TypeNumber { get; }

Property Value

uint

Methods

CreateFunction(byte, int)

Creates a function for a given functionCode.

protected Function CreateFunction(byte functionCode, int timeoutInMilliseconds)

Parameters

functionCode byte

Function code.

timeoutInMilliseconds int

Response timeout in milliseconds.

Returns

Function

A function.

CreateFunctions()

Creates the board functions.
If the overriding method doesn't call this base function, GetSerialNumber(), GetFirmwareVersion() and GetStateAndAcknowledge() will throw an NotSupportedException.

protected virtual void CreateFunctions()

Exit()

De initializes the module.

public virtual void Exit()

GetErrorStateByCode(uint)

Gets the state of the board by its error state code.

protected virtual State GetErrorStateByCode(uint errorStateCode)

Parameters

errorStateCode uint

Error state code from the board.

Returns

State

The state of the board.

Exceptions

ArgumentOutOfRangeException

Thrown if the errorStateCode is not 0, 1, 5 or 6.

GetFirmwareVersion()

Gets the device firmware version.

public Version GetFirmwareVersion()

Returns

Version

The firmware version.

Exceptions

NotInitializedException

Thrown when InitializationState is not Initialized.

FormatException

Thrown if the received data length is not 2 bytes.

NotSupportedException

Thrown if the function was not initialized (see CreateFunctions()).

GetSerialNumber()

Gets the serial number of the device.

public string GetSerialNumber()

Returns

string

The serial number.

Exceptions

NotInitializedException

Thrown when InitializationState is not Initialized.

FormatException

Thrown if the received data length is not 7 bytes.

NotSupportedException

Thrown if the function was not initialized (see CreateFunctions()).

GetStateAndAcknowledge()

Gets the state and acknowledges device errors.

public State GetStateAndAcknowledge()

Returns

State

The acknowledged error as State or OK if no error was acknowledged.

Exceptions

NotInitializedException

Thrown when InitializationState is not Initialized.

FormatException

Thrown if the received data length is not 2 bytes.

NotSupportedException

Thrown if the function was not initialized (see CreateFunctions()).

Initialize()

Initializes the module.

public virtual void Initialize()