Class FunctionExecutingModule
Represents an base module for the default Löhnert CAN protocol.
Implements
Inherited Members
Namespace: Loehnert.Lisrt.Can.Protocol
Assembly: Loehnert.Lisrt.Can.Protocol.dll
Syntax
public abstract class FunctionExecutingModule : LisrtModule, ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged
Constructors
FunctionExecutingModule(String, ICanCommunication2)
Initializes a new instance of the FunctionExecutingModule class.
Declaration
protected FunctionExecutingModule(string name, ICanCommunication2 canCommunication)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of the module. |
ICanCommunication2 | canCommunication | Can communication. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when any argument is null or empty. |
Properties
Address
Gets or sets the card address (from 0 to 63).
Declaration
[Configuration((byte)1, Description = "0 to 63")]
public byte Address { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
Exceptions
Type | Condition |
---|---|
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.
Declaration
public Version FirmwareVersion { get; }
Property Value
Type | Description |
---|---|
System.Version |
InitializationState
Gets or sets a value indicating whether the module is initialized.
Declaration
public InitializationState InitializationState { get; protected set; }
Property Value
Type | Description |
---|---|
InitializationState |
SerialNumber
Gets the unique serial number (hardware identification) of the device.
Declaration
public string SerialNumber { get; }
Property Value
Type | Description |
---|---|
String |
TimeoutInMS
Gets the communication timeout in milliseconds (300ms).
Declaration
public virtual int TimeoutInMS { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TypeNumber
Gets the number for the type (from 0 to 15).
Declaration
protected abstract uint TypeNumber { get; }
Property Value
Type | Description |
---|---|
System.UInt32 |
Methods
CreateFunction(Byte, Int32)
Creates a function for a given functionCode
.
Declaration
protected Function CreateFunction(byte functionCode, int timeoutInMilliseconds)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | functionCode | Function code. |
System.Int32 | timeoutInMilliseconds | Response timeout in milliseconds. |
Returns
Type | Description |
---|---|
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 System.NotSupportedException.
Declaration
protected virtual void CreateFunctions()
Exit()
De initializes the module.
Declaration
public virtual void Exit()
GetErrorStateByCode(UInt32)
Gets the state of the board by its error state code.
Declaration
protected virtual State GetErrorStateByCode(uint errorStateCode)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | errorStateCode | Error state code from the board. |
Returns
Type | Description |
---|---|
State | The state of the board. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | Thrown if the |
GetFirmwareVersion()
Gets the device firmware version.
Declaration
public Version GetFirmwareVersion()
Returns
Type | Description |
---|---|
System.Version | The firmware version. |
Exceptions
Type | Condition |
---|---|
NotInitializedException | Thrown when InitializationState is not Initialized. |
System.FormatException | Thrown if the received data length is not 2 bytes. |
System.NotSupportedException | Thrown if the function was not initialized (see CreateFunctions()). |
GetSerialNumber()
Gets the serial number of the device.
Declaration
public string GetSerialNumber()
Returns
Type | Description |
---|---|
String | The serial number. |
Exceptions
Type | Condition |
---|---|
NotInitializedException | Thrown when InitializationState is not Initialized. |
System.FormatException | Thrown if the received data length is not 7 bytes. |
System.NotSupportedException | Thrown if the function was not initialized (see CreateFunctions()). |
GetStateAndAcknowledge()
Gets the state and acknowledges device errors.
Declaration
public State GetStateAndAcknowledge()
Returns
Type | Description |
---|---|
State | The acknowledged error as State or OK if no error was acknowledged. |
Exceptions
Type | Condition |
---|---|
NotInitializedException | Thrown when InitializationState is not Initialized. |
System.FormatException | Thrown if the received data length is not 2 bytes. |
System.NotSupportedException | Thrown if the function was not initialized (see CreateFunctions()). |
Initialize()
Initializes the module.
Declaration
public virtual void Initialize()