Lucon SDK 1.0.7
Loading...
Searching...
No Matches
Gefasoft.LuconV2.Device Class Reference

Implements IDevice by wrapping the Lucon C API. More...

Inheritance diagram for Gefasoft.LuconV2.Device:
Gefasoft.LuconV2.Infrastructure.InteropObject Gefasoft.LuconV2.Abstractions.IDevice

Public Member Functions

 Device (DeviceConnection connection, bool moveOwnership=false)
 Initialize a new instance of the Device class.
string GetInfo ()
 Composes a descriptive string by reading key parameters from the device.
Returns

void SavePermanently (bool restart)
 Persistently save the current parameters of the communication module in its EEPROM.Saves only(!) the communication modules parameters. Note that some parameters (e.g. the IPAddress) will only take effect after restarting the module.
void Restart (bool includingAllChannels)
 Triggers a restart of the Lucon.During a restart modules will reload their persisted settings. Transient changes will be lost! After the the function returns successfully, the connection will be lost! Only if the devices persisted connection settings are unmodified, the connection will be recovered after some time (typically <5s). Otherwise users must create a new Connection.
void SetChannelsToContinuousMode (IList< int > channelNumbers, ContinuousModeParameters[] modeParams)
 Sets multiple channels to ChannelMode.Continuous. The length of the input parameter arrays must match and ids must not contain duplicates. The output parameters given in modeParams are assigned in-order to the channels with the given

See also
ids

.The primary purpose is to reduce communication delays, if multiple channels need to be controlled simultaneously.

IList< byte > GetOnlineChannelNumbers ()
 Read a list of channel numbers of the available ("online") channels from the device.
Returns

void Connect ()
 Start communicating with the device.If not yet done, the related Connection will be opened. The connectivity to the device is checked with a handshake. Only if the expected answer is received, the call succeeds. Otherwise and error is returned. In this case the connection is closed again, if and only if it was opened during the call.
void Disconnect ()
 Stops communication and closes the Connection to the device.
bool CheckIsConnected ()
 Check connectivity and responsiveness of the device with a small handshake.
Returns
true, if the device responds to a request, false otherwise.

IsConnected

Public Member Functions inherited from Gefasoft.LuconV2.Infrastructure.InteropObject
void Dispose ()
 Dispose the object and free all related resources.

Protected Member Functions

override void Dispose (bool disposing)
 implements the standard pattern for IDisposable
Parameters
disposingtrue if disposing due to user call, false in case of finalizer

Properties

DeviceConnection Connection [get]
 The DeviceConnection used for communication.
bool IsConnected [get]
 Returns whether the device is connected and recently responsive.
See also
DeviceConnection.IsOpened
The call returns a cached state which is updated periodically.
IEnumerable< IChannelOnlineChannels [get]
 Reads a list of the currently available power modules from the Device and enumerates them.
ChannelCollection Channels [get]
 All channels owned by the device.Objects retrieved from the container can only be used as long as the Device object is alive, as the device disposes the container!
string SerialNumber [get]
 Read the serial number from the communication module as a string.Example: "220000024".
string MacAddress [get]
 Read the MAC address from the communication module as a string.Example: "68:27:19:95:1F:F5"
string IPAddress [get, set]
 Read/Write the IPv4 address setting of the communication module as a string.Example "10.0.30.2"The refers to the devices current transient setting. It may differ from the IP in use. Modifications will take effect only after saving and restarting the device.
string SubnetMask [get, set]
 Read/Write the the IPv4 subnet mask from the device.Example: "255.255.255.0"
string FirmwareVersion [get]
 Read the current firmware version from the device.Example: "1.0.1"

Events

EventHandler IsConnectedChanged [add, remove]
EventHandler DeviceRestarted [add, remove]
Events inherited from Gefasoft.LuconV2.Abstractions.IDevice
EventHandler IsConnectedChanged
 Raised, when the connection status of the Device changes.
EventHandler DeviceRestarted
 Raised, when the host receives a restart hint from the device.

Detailed Description

Implements IDevice by wrapping the Lucon C API.

The implementation is stateless: all properties read or set parameters on the hardware using the given Connection. If the communication fails properties and function will throw LuconExceptions.

Setting parameters will

Constructor & Destructor Documentation

◆ Device()

Gefasoft.LuconV2.Device.Device ( DeviceConnection connection,
bool moveOwnership = false )

Initialize a new instance of the Device class.

if moveOwnership is true, the Device will take ownership of the connection : disposal of the connection will be triggered when the Device is disposed.

Parameters
connectionThe connection to be used for communication
moveOwnershipwhether ownership of the connection is moved to the new Device
Exceptions
ArgumentNullException

Member Function Documentation

◆ CheckIsConnected()

bool Gefasoft.LuconV2.Device.CheckIsConnected ( )

Check connectivity and responsiveness of the device with a small handshake.

Returns
true, if the device responds to a request, false otherwise.

IsConnected

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ Connect()

void Gefasoft.LuconV2.Device.Connect ( )

Start communicating with the device.If not yet done, the related Connection will be opened. The connectivity to the device is checked with a handshake. Only if the expected answer is received, the call succeeds. Otherwise and error is returned. In this case the connection is closed again, if and only if it was opened during the call.

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ Disconnect()

void Gefasoft.LuconV2.Device.Disconnect ( )

Stops communication and closes the Connection to the device.

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ Dispose()

override void Gefasoft.LuconV2.Device.Dispose ( bool disposing)
protectedvirtual

implements the standard pattern for IDisposable

Parameters
disposingtrue if disposing due to user call, false in case of finalizer

Reimplemented from Gefasoft.LuconV2.Infrastructure.InteropObject.

◆ GetInfo()

string Gefasoft.LuconV2.Device.GetInfo ( )

Composes a descriptive string by reading key parameters from the device.

Returns

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ GetOnlineChannelNumbers()

IList< byte > Gefasoft.LuconV2.Device.GetOnlineChannelNumbers ( )

Read a list of channel numbers of the available ("online") channels from the device.

Returns

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ Restart()

void Gefasoft.LuconV2.Device.Restart ( bool includingAllChannels)

Triggers a restart of the Lucon.During a restart modules will reload their persisted settings. Transient changes will be lost! After the the function returns successfully, the connection will be lost! Only if the devices persisted connection settings are unmodified, the connection will be recovered after some time (typically <5s). Otherwise users must create a new Connection.

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ SavePermanently()

void Gefasoft.LuconV2.Device.SavePermanently ( bool restart)

Persistently save the current parameters of the communication module in its EEPROM.Saves only(!) the communication modules parameters. Note that some parameters (e.g. the IPAddress) will only take effect after restarting the module.

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ SetChannelsToContinuousMode()

void Gefasoft.LuconV2.Device.SetChannelsToContinuousMode ( IList< int > channelNumbers,
ContinuousModeParameters[] modeParams )

Sets multiple channels to ChannelMode.Continuous. The length of the input parameter arrays must match and ids must not contain duplicates. The output parameters given in modeParams are assigned in-order to the channels with the given

See also
ids

.The primary purpose is to reduce communication delays, if multiple channels need to be controlled simultaneously.

Implements Gefasoft.LuconV2.Abstractions.IDevice.

Property Documentation

◆ Channels

ChannelCollection Gefasoft.LuconV2.Device.Channels
get

All channels owned by the device.Objects retrieved from the container can only be used as long as the Device object is alive, as the device disposes the container!

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ Connection

DeviceConnection Gefasoft.LuconV2.Device.Connection
get

The DeviceConnection used for communication.

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ FirmwareVersion

string Gefasoft.LuconV2.Device.FirmwareVersion
get

Read the current firmware version from the device.Example: "1.0.1"

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ IPAddress

string Gefasoft.LuconV2.Device.IPAddress
getset

Read/Write the IPv4 address setting of the communication module as a string.Example "10.0.30.2"The refers to the devices current transient setting. It may differ from the IP in use. Modifications will take effect only after saving and restarting the device.

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ IsConnected

bool Gefasoft.LuconV2.Device.IsConnected
get

Returns whether the device is connected and recently responsive.

See also
DeviceConnection.IsOpened
The call returns a cached state which is updated periodically.

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ MacAddress

string Gefasoft.LuconV2.Device.MacAddress
get

Read the MAC address from the communication module as a string.Example: "68:27:19:95:1F:F5"

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ OnlineChannels

IEnumerable<IChannel> Gefasoft.LuconV2.Device.OnlineChannels
get

Reads a list of the currently available power modules from the Device and enumerates them.

The returned Channels are contained in the Channels collection and managed by the Device

See also
GetOnlineChannelNumbers

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ SerialNumber

string Gefasoft.LuconV2.Device.SerialNumber
get

Read the serial number from the communication module as a string.Example: "220000024".

Implements Gefasoft.LuconV2.Abstractions.IDevice.

◆ SubnetMask

string Gefasoft.LuconV2.Device.SubnetMask
getset

Read/Write the the IPv4 subnet mask from the device.Example: "255.255.255.0"

Implements Gefasoft.LuconV2.Abstractions.IDevice.


The documentation for this class was generated from the following file: