Class FunctionExecutingModule
Represents an base module for the default Löhnert CAN protocol.
public abstract class FunctionExecutingModule : LisrtModule, ILisrtModule, IInitializable, INotifyPropertyChangedEx, INotifyPropertyChanged
- Inheritance
-
PropertyChangedBaseFunctionExecutingModule
- Implements
-
INotifyPropertyChangedEx
- Inherited Members
-
PropertyChangedBase.Refresh()PropertyChangedBase.IsNotifyingPropertyChangedBase.PropertyChanged
Constructors
FunctionExecutingModule(string, ICanCommunication2)
Initializes a new instance of the FunctionExecutingModule class.
protected FunctionExecutingModule(string name, ICanCommunication2 canCommunication)
Parameters
name
stringName of the module.
canCommunication
ICanCommunication2Can 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
Exceptions
- ArgumentOutOfRangeException
Thrown when set value is not in range from MinimumAddress to MaximumAddress.
FirmwareVersion
Gets the firmware version of the device.
public Version FirmwareVersion { get; }
Property Value
InitializationState
Gets or sets a value indicating whether the module is initialized.
public InitializationState InitializationState { get; protected set; }
Property Value
SerialNumber
Gets the unique serial number (hardware identification) of the device.
public string SerialNumber { get; }
Property Value
TimeoutInMS
Gets the communication timeout in milliseconds (300ms).
public virtual int TimeoutInMS { get; }
Property Value
TypeNumber
Gets the number for the type (from 0 to 15).
protected abstract uint TypeNumber { get; }
Property Value
Methods
CreateFunction(byte, int)
Creates a function for a given functionCode
.
protected Function CreateFunction(byte functionCode, int timeoutInMilliseconds)
Parameters
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
uintError 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
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()