C# Class Gurux.DLMS.GXDLMSServer

GXDLMSServer implements methods to implement DLMS/COSEM meter/proxy.
Datei anzeigen Open project: Gurux/Gurux.DLMS.Net Class Usage Examples

Private Properties

Property Type Description
GenerateConfirmedServiceError byte[]
GenerateDisconnectRequest void
HandleAarqRequest void
HandleCommand byte[]
HandleSnrmRequest void
NotifyAction void
NotifyFindObject Gurux.DLMS.Objects.GXDLMSObject
NotifyInvalidConnection void
NotifyRead void
NotifyWrite void
ReportError byte[]

Public Methods

Method Description
GXDLMSServer ( ) : System

Constructor.

GXDLMSServer ( bool logicalNameReferencing, InterfaceType type ) : System

Constructor.

HandleRequest ( byte buff ) : byte[]

Handles client request.

HandleRequest ( byte buff, GXDLMSConnectionEventArgs connectionInfo ) : byte[]

Handles client request.

Initialize ( ) : void

Initialize server.

This must call after server objects are set.

Reset ( ) : void

Reset after connection is closed.

Reset ( bool connected ) : void

Reset settings when connection is made or close.

Update ( UpdateType type, ValueEventArgs e ) : void

Get selected value.

Protected Methods

Method Description
Action ( ValueEventArgs args ) : void

Action is occurred.

Connected ( GXDLMSConnectionEventArgs connectionInfo ) : void

Accepted connection is made for the server.

All initialization is done here. Example access level of the COSEM objects is good to update here.

Disconnected ( GXDLMSConnectionEventArgs connectionInfo ) : void

Server has close the connection. All clean up is made here.

FindObject ( ObjectType objectType, int sn, String ln ) : GXDLMSObject

Find object.

InvalidConnection ( GXDLMSConnectionEventArgs connectionInfo ) : void

Client has try to made invalid connection. Password is incorrect.

IsTarget ( int serverAddress, int clientAddress ) : bool

Check is data sent to this server.

Read ( ValueEventArgs args ) : void

Read selected item.

ValidateAuthentication ( Authentication authentication, byte password ) : SourceDiagnostic

Check whether the authentication and password are correct.

Write ( ValueEventArgs args ) : void

Write selected item.

Private Methods

Method Description
GenerateConfirmedServiceError ( ConfirmedServiceError service, ServiceError type, byte code ) : byte[]

Generate confirmed service error.

GenerateDisconnectRequest ( ) : void

Generates disconnect request.

HandleAarqRequest ( GXByteBuffer data, GXDLMSConnectionEventArgs connectionInfo ) : void

Parse AARQ request that client send and returns AARE request.

HandleCommand ( Command cmd, GXByteBuffer data, GXDLMSConnectionEventArgs connectionInfo ) : byte[]

Handle received command.

HandleSnrmRequest ( ) : void

Parse SNRM Request. If server do not accept client empty byte array is returned.

NotifyAction ( ValueEventArgs args ) : void

Action is occurred.

NotifyFindObject ( ObjectType objectType, int sn, String ln ) : GXDLMSObject

Find object.

NotifyInvalidConnection ( GXDLMSConnectionEventArgs connectionInfo ) : void

Client has try to made invalid connection. Password is incorrect.

NotifyRead ( ValueEventArgs args ) : void

Read selected item.

NotifyWrite ( ValueEventArgs args ) : void

Write selected item.

ReportError ( Command cmd, ErrorCode error ) : byte[]

Method Details

Action() protected abstract method

Action is occurred.
protected abstract Action ( ValueEventArgs args ) : void
args ValueEventArgs Handled action requests.
return void

Connected() protected abstract method

Accepted connection is made for the server.
All initialization is done here. Example access level of the COSEM objects is good to update here.
protected abstract Connected ( GXDLMSConnectionEventArgs connectionInfo ) : void
connectionInfo GXDLMSConnectionEventArgs Connection information.
return void

Disconnected() protected abstract method

Server has close the connection. All clean up is made here.
protected abstract Disconnected ( GXDLMSConnectionEventArgs connectionInfo ) : void
connectionInfo GXDLMSConnectionEventArgs Connection information.
return void

FindObject() protected abstract method

Find object.
protected abstract FindObject ( ObjectType objectType, int sn, String ln ) : GXDLMSObject
objectType ObjectType Object type. In Short Name referencing this is not used.
sn int Short Name. In Logical name referencing this is not used.
ln String Logical Name. In Short Name referencing this is not used.
return Gurux.DLMS.Objects.GXDLMSObject

GXDLMSServer() public method

Constructor.
public GXDLMSServer ( ) : System
return System

GXDLMSServer() public method

Constructor.
public GXDLMSServer ( bool logicalNameReferencing, InterfaceType type ) : System
logicalNameReferencing bool
type InterfaceType
return System

HandleRequest() public method

Handles client request.
public HandleRequest ( byte buff ) : byte[]
buff byte /// Received data from the client.
return byte[]

HandleRequest() public method

Handles client request.
public HandleRequest ( byte buff, GXDLMSConnectionEventArgs connectionInfo ) : byte[]
buff byte /// Received data from the client.
connectionInfo GXDLMSConnectionEventArgs
return byte[]

Initialize() public method

Initialize server.
This must call after server objects are set.
public Initialize ( ) : void
return void

InvalidConnection() protected abstract method

Client has try to made invalid connection. Password is incorrect.
protected abstract InvalidConnection ( GXDLMSConnectionEventArgs connectionInfo ) : void
connectionInfo GXDLMSConnectionEventArgs Connection information.
return void

IsTarget() protected abstract method

Check is data sent to this server.
protected abstract IsTarget ( int serverAddress, int clientAddress ) : bool
serverAddress int Server address.
clientAddress int Client address.
return bool

Read() protected abstract method

Read selected item.
protected abstract Read ( ValueEventArgs args ) : void
args ValueEventArgs Handled read requests.
return void

Reset() public method

Reset after connection is closed.
public Reset ( ) : void
return void

Reset() public method

Reset settings when connection is made or close.
public Reset ( bool connected ) : void
connected bool
return void

Update() public abstract method

Get selected value.
public abstract Update ( UpdateType type, ValueEventArgs e ) : void
type UpdateType
e ValueEventArgs Handle get request.
return void

ValidateAuthentication() protected abstract method

Check whether the authentication and password are correct.
protected abstract ValidateAuthentication ( Authentication authentication, byte password ) : SourceDiagnostic
authentication Authentication Authentication level.
password byte Password
return SourceDiagnostic

Write() protected abstract method

Write selected item.
protected abstract Write ( ValueEventArgs args ) : void
args ValueEventArgs Handled write requests.
return void