Documentation
¶
Index ¶
- Constants
- func AesDecrypt(data []byte, secret []byte) ([]byte, error)
- func AesEncrypt(data []byte, secret []byte) ([]byte, error)
- func DecryptAesGcm(p *AesGcmParameter, data *types.GXByteBuffer) ([]byte, error)
- func EncryptAesGcm(param *AesGcmParameter, plainText []byte) ([]byte, error)
- func GenerateChallenge(authentication enums.Authentication, size byte) []byte
- func GenerateKDF(securitySuite enums.SecuritySuite, z []byte, otherInfo []byte) ([]byte, error)
- func GenerateKDFWithInfo(securitySuite enums.SecuritySuite, z []byte, algorithmID enums.AlgorithmID, ...) ([]byte, error)
- func GetEphemeralPublicKeyData(keyID int, ephemeralKey *types.GXPublicKey) ([]byte, error)
- func GetEphemeralPublicKeySignature(keyID int, ephemeralKey *types.GXPublicKey, signKey *types.GXPrivateKey) ([]byte, error)
- func IncreaseReceiverSequence(value uint8) uint8
- func IncreaseSendSequence(value uint8) uint8
- func Secure(settings *GXDLMSSettings, cipher GXICipher, ic uint32, data []byte, ...) ([]byte, error)
- func ValidateEphemeralPublicKeySignature(data []byte, sign []byte, publicSigningKey *types.GXPublicKey) (bool, error)
- type AesGcmParameter
- func NewAesGcmParameter(tag byte, settings *GXDLMSSettings, security enums.Security, ...) *AesGcmParameter
- func NewAesGcmParameter2(tag byte, settings *GXDLMSSettings, security enums.Security, ...) *AesGcmParameter
- func NewAesGcmParameter3(settings *GXDLMSSettings, systemTitle []byte, blockCipherKey []byte, ...) *AesGcmParameter
- func (g *AesGcmParameter) AuthenticationKey() []byte
- func (g *AesGcmParameter) BlockCipherKey() []byte
- func (g *AesGcmParameter) RecipientSystemTitle() []byte
- func (g *AesGcmParameter) Security() enums.Security
- func (g *AesGcmParameter) SetAuthenticationKey(value []byte) error
- func (g *AesGcmParameter) SetBlockCipherKey(value []byte) error
- func (g *AesGcmParameter) SetRecipientSystemTitle(value []byte) error
- func (g *AesGcmParameter) SetSetSecurity(value enums.Security) error
- func (g *AesGcmParameter) SetSystemTitle(value []byte) error
- func (g *AesGcmParameter) String() string
- func (g *AesGcmParameter) SystemTitle() []byte
- type CountType
- type GXCoAPSettings
- type GXDLMSGateway
- type GXDLMSPrimeDataConcentrator
- type GXDLMSSettings
- func (s *GXDLMSSettings) AssignedAssociation() any
- func (s *GXDLMSSettings) ChallengeSize() uint8
- func (s *GXDLMSSettings) CheckFrame(frame uint8, xml interface{}) bool
- func (s *GXDLMSSettings) CopyTo(target *GXDLMSSettings)
- func (s *GXDLMSSettings) Crypt(certificateType enums.CertificateType, data []byte, encrypt bool, ...) []byte
- func (s *GXDLMSSettings) CtoSChallenge() []byte
- func (s *GXDLMSSettings) ExpectedInvocationCounter() uint64
- func (s *GXDLMSSettings) GbtWindowSize() uint8
- func (s *GXDLMSSettings) GetKey(certificateType interface{}, systemTitle []byte, encrypt bool) any
- func (s *GXDLMSSettings) GetMaxServerPDUSize() uint16
- func (s *GXDLMSSettings) IncreaseBlockIndex()
- func (s *GXDLMSSettings) InvokeID() uint8
- func (s *GXDLMSSettings) IsCiphered(checkGeneralSigning bool) bool
- func (s *GXDLMSSettings) IsServer() bool
- func (s *GXDLMSSettings) KeepAlive() uint8
- func (s *GXDLMSSettings) MaxPduSize() uint16
- func (s *GXDLMSSettings) NextSend(first bool) uint8
- func (s *GXDLMSSettings) ReceiverReady() uint8
- func (s *GXDLMSSettings) ResetBlockIndex()
- func (s *GXDLMSSettings) ResetFrameSequence()
- func (s *GXDLMSSettings) SetAssignedAssociation(value any)
- func (s *GXDLMSSettings) SetChallengeSize(value uint8) error
- func (s *GXDLMSSettings) SetCtoSChallenge(value []byte)
- func (s *GXDLMSSettings) SetExpectedInvocationCounter(value uint64)
- func (s *GXDLMSSettings) SetGbtWindowSize(value uint8) error
- func (s *GXDLMSSettings) SetInvokeID(value uint8) error
- func (s *GXDLMSSettings) SetMaxPduSize(value uint16) error
- func (s *GXDLMSSettings) SetMaxServerPDUSize(value uint16)
- func (s *GXDLMSSettings) SetSourceSystemTitle(value []byte)
- func (s *GXDLMSSettings) SetStoCChallenge(value []byte)
- func (s *GXDLMSSettings) SetUseLogicalNameReferencing(value bool)
- func (s *GXDLMSSettings) SourceSystemTitle() []byte
- func (s *GXDLMSSettings) StoCChallenge() []byte
- func (s *GXDLMSSettings) UpdateInvokeID(value uint8)
- func (s *GXDLMSSettings) UpdateSecurity(systemTitle []byte, ss interface{})
- func (s *GXDLMSSettings) UpdateSecuritySettings(systemTitle []byte)
- func (s *GXDLMSSettings) UseLogicalNameReferencing() bool
- type GXDLMSTranslatorStructure
- func (g *GXDLMSTranslatorStructure) Append(tag int, start bool)
- func (g *GXDLMSTranslatorStructure) AppendComment(comment string)
- func (g *GXDLMSTranslatorStructure) AppendEmptyStringTag(tag string)
- func (g *GXDLMSTranslatorStructure) AppendEmptyTag(tag int)
- func (g *GXDLMSTranslatorStructure) AppendEndTag(tag int, plain bool)
- func (g *GXDLMSTranslatorStructure) AppendLine(tag string, name string, value any)
- func (g *GXDLMSTranslatorStructure) AppendLineFromTag(tag int, name string, value any)
- func (g *GXDLMSTranslatorStructure) AppendStartTag(tag int, name string, value string, plain bool)
- func (g *GXDLMSTranslatorStructure) AppendString(value string)
- func (g *GXDLMSTranslatorStructure) AppendStringLine(value string)
- func (g *GXDLMSTranslatorStructure) EndComment()
- func (g *GXDLMSTranslatorStructure) GetDataType(type_ enums.DataType) string
- func (g *GXDLMSTranslatorStructure) GetTag(tag int) string
- func (g *GXDLMSTranslatorStructure) GetXmlLength() int
- func (g *GXDLMSTranslatorStructure) IntegerToHex(value any, desimals int, forceHex bool) string
- func (g *GXDLMSTranslatorStructure) Offset() int
- func (g *GXDLMSTranslatorStructure) OmitNameSpace() bool
- func (g *GXDLMSTranslatorStructure) OutputType() enums.TranslatorOutputType
- func (g *GXDLMSTranslatorStructure) SetOffset(value int) error
- func (g *GXDLMSTranslatorStructure) SetXmlLength(value int)
- func (g *GXDLMSTranslatorStructure) StartComment(comment string)
- func (g *GXDLMSTranslatorStructure) String() string
- func (g *GXDLMSTranslatorStructure) Trim()
- type GXHdlcSettings
- func (g *GXHdlcSettings) MaxInfoRX() uint16
- func (g *GXHdlcSettings) MaxInfoTX() uint16
- func (g *GXHdlcSettings) SetMaxInfoRX(value uint16) error
- func (g *GXHdlcSettings) SetMaxInfoTX(value uint16) error
- func (g *GXHdlcSettings) SetWindowSizeRX(value uint8) error
- func (g *GXHdlcSettings) SetWindowSizeTX(value uint8) error
- func (g *GXHdlcSettings) WindowSizeRX() uint8
- func (g *GXHdlcSettings) WindowSizeTX() uint8
- type GXICipher
- type GXMBusSettings
- type GXPduSettings
- type GXPlcSettings
Constants ¶
const DataTypeOffset = int(0xFF0000)
Variables ¶
This section is empty.
Functions ¶
func DecryptAesGcm ¶
func DecryptAesGcm(p *AesGcmParameter, data *types.GXByteBuffer) ([]byte, error)
func EncryptAesGcm ¶
func EncryptAesGcm(param *AesGcmParameter, plainText []byte) ([]byte, error)
func GenerateChallenge ¶
func GenerateChallenge(authentication enums.Authentication, size byte) []byte
func GenerateKDF ¶
func GenerateKDFWithInfo ¶
func GetEphemeralPublicKeyData ¶
func GetEphemeralPublicKeyData(keyID int, ephemeralKey *types.GXPublicKey) ([]byte, error)
func GetEphemeralPublicKeySignature ¶
func GetEphemeralPublicKeySignature(keyID int, ephemeralKey *types.GXPublicKey, signKey *types.GXPrivateKey) ([]byte, error)
func IncreaseReceiverSequence ¶
IncreaseReceiverSequence increases the receiver sequence.
func IncreaseSendSequence ¶
IncreaseSendSequence increases the sender sequence.
Types ¶
type AesGcmParameter ¶
type AesGcmParameter struct {
InvocationCounter uint64
// xml This is used only on xml parser.
Xml *GXDLMSTranslatorStructure
Tag uint8
// Used transaction ID.
TransactionId uint64
Settings *GXDLMSSettings
// Is data send as a broadcast or unicast.
Broacast bool
// V.44 Compression is used.
Compression bool
Type CountType
CountTag []byte
// Date time.
DateTime []byte
// Other information.
OtherInformation []byte
// Key parameters.
KeyParameters int
// Key ciphered datg.
KeyCipheredData []byte
// Ciphered content.
CipheredContent []byte
// Signature.
Signature []byte
// Used security suite.
SecuritySuite enums.SecuritySuite
// System title is not send on pre-established connections.
IgnoreSystemTitle bool
// contains filtered or unexported fields
}
func NewAesGcmParameter ¶
func NewAesGcmParameter( tag byte, settings *GXDLMSSettings, security enums.Security, securitySuite enums.SecuritySuite, invocationCounter uint64, systemTitle []byte, blockCipherKey []byte, authenticationKey []byte, ) *AesGcmParameter
func NewAesGcmParameter2 ¶
func NewAesGcmParameter2( tag byte, settings *GXDLMSSettings, security enums.Security, securitySuite enums.SecuritySuite, invocationCounter uint64, kdf []byte, authenticationKey []byte, originatorSystemTitle []byte, recipientSystemTitle []byte, dateTime []byte, otherInformation []byte, ) *AesGcmParameter
func NewAesGcmParameter3 ¶
func NewAesGcmParameter3( settings *GXDLMSSettings, systemTitle []byte, blockCipherKey []byte, authenticationKey []byte) *AesGcmParameter
func (*AesGcmParameter) AuthenticationKey ¶
func (g *AesGcmParameter) AuthenticationKey() []byte
AuthenticationKey returns the authentication key.
func (*AesGcmParameter) BlockCipherKey ¶
func (g *AesGcmParameter) BlockCipherKey() []byte
BlockCipherKey returns the block cipher key.
func (*AesGcmParameter) RecipientSystemTitle ¶
func (g *AesGcmParameter) RecipientSystemTitle() []byte
RecipientSystemTitle returns the recipient system title.
func (*AesGcmParameter) Security ¶
func (g *AesGcmParameter) Security() enums.Security
Security returns the enumerated security level.
func (*AesGcmParameter) SetAuthenticationKey ¶
func (g *AesGcmParameter) SetAuthenticationKey(value []byte) error
SetAuthenticationKey sets the authentication key.
func (*AesGcmParameter) SetBlockCipherKey ¶
func (g *AesGcmParameter) SetBlockCipherKey(value []byte) error
SetBlockCipherKey sets the block cipher key.
func (*AesGcmParameter) SetRecipientSystemTitle ¶
func (g *AesGcmParameter) SetRecipientSystemTitle(value []byte) error
SetRecipientSystemTitle sets the recipient system title.
func (*AesGcmParameter) SetSetSecurity ¶
func (g *AesGcmParameter) SetSetSecurity(value enums.Security) error
SetSecurity sets the enumerated security level.
func (*AesGcmParameter) SetSystemTitle ¶
func (g *AesGcmParameter) SetSystemTitle(value []byte) error
SetSystemTitle sets the system title.
func (*AesGcmParameter) String ¶
func (g *AesGcmParameter) String() string
String implements the fmt.Stringer interface.
func (*AesGcmParameter) SystemTitle ¶
func (g *AesGcmParameter) SystemTitle() []byte
SystemTitle returns the system title.
type CountType ¶
type CountType int
--------------------------------------------------------------------------
Gurux Ltd
Filename: $HeadURL$
Version: $Revision$,
$Date$ $Author$
Copyright (c) Gurux Ltd ¶
---------------------------------------------------------------------------
DESCRIPTION
This file is a part of Gurux Device Framework.
Gurux Device Framework is Open Source software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. Gurux Device Framework is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
More information of Gurux products: https://www.gurux.org
This code is licensed under the GNU General Public License v2. Full text may be retrieved at http://www.gnu.org/licenses/gpl-2.0.txt ---------------------------------------------------------------------------
type GXCoAPSettings ¶
type GXCoAPSettings struct {
// CoAP version.
Version uint8
// CoAP type.
Type constants.CoAPType
// CoAP class code.
Class constants.CoAPClass
// CoAP Method.
Method constants.CoAPMethod
// CoAP Success.
Success constants.CoAPSuccess
// CoAP client error.
ClientError constants.CoAPClientError
// CoAP server error.
ServerError constants.CoAPServerError
// CoAP signaling.
Signaling constants.CoAPSignaling
// CoAP message Id.
MessageId uint16
// CoAP token.
Token uint64
// Uri host.
Host string
// Uri Path.
Path string
// Uri port.
Port uint16
// If none match.
IfNoneMatch enums.CoAPContentType
// Content format.
ContentFormat enums.CoAPContentType
// Max age.
MaxAge uint16
// Unknown options.
Options map[uint16]any
// contains filtered or unexported fields
}
CoAP settings contains CoAP settings.
type GXDLMSGateway ¶
type GXDLMSGateway struct {
// NetworkID is the network ID.
NetworkID uint8
// PhysicalDeviceAddress is the physical device address.
PhysicalDeviceAddress []byte
}
GXDLMSGateway represents gateway information for DLMS communication.
type GXDLMSPrimeDataConcentrator ¶
type GXDLMSPrimeDataConcentrator struct {
// MacAddress is the MAC address.
MacAddress []byte
}
GXDLMSPrimeDataConcentrator represents PRIME data concentrator notification information.
type GXDLMSSettings ¶
type GXDLMSSettings struct {
// LongInvokeID is the long Invoke ID.
LongInvokeID uint32
// SenderFrame is the HDLC sender frame sequence number.
SenderFrame uint8
// ReceiverFrame is the HDLC receiver frame sequence number.
ReceiverFrame uint8
// ClientPublicKeyCertificate is the optional ECDSA public key certificate that is sent in part of AARQ.
ClientPublicKeyCertificate *types.GXx509Certificate
// ServerPublicKeyCertificate is the optional ECDSA public key certificate that is sent in part of AARE.
ServerPublicKeyCertificate *types.GXx509Certificate
// PreEstablishedSystemTitle is the pre-established system title.
PreEstablishedSystemTitle []byte
// Kek is the Key Encrypting Key, also known as Master key.
Kek []byte
// Count is the Long data count.
Count uint32
// Index is the Long data index.
Index uint32
// TargetEphemeralKey is the target ephemeral public key.
TargetEphemeralKey interface{} // TODO: Replace with actual GXPublicKey type when implemented
// ProtocolVersion is the protocol version.
ProtocolVersion string
// ProposedConformance is what client tells it wants to use when connection is made.
ProposedConformance enums.Conformance
// NegotiatedConformance is what server tells is available and client will know it.
NegotiatedConformance enums.Conformance
// Cipher is the cipher interface.
// GXDLMSAssociationShortName and GXDLMSAssociationLogicalName use this if GMAC authentication is used.
Cipher GXICipher
// UserID is the identifier of the user.
// This value is used if user list on Association LN is used.
UserID int
// QualityOfService is the quality of service.
QualityOfService uint8
// UseUtc2NormalTime indicates if meter is configured to use UTC time (UTC to normal time).
// Standard says that Time zone is from normal time to UTC in minutes.
// If meter is configured to use UTC time (UTC to normal time) set this to true.
UseUtc2NormalTime bool
// DateTimeSkips are the skipped date time fields.
// This value can be used if meter can't handle deviation or status.
DateTimeSkips enums.DateTimeSkips
// Standard is the used standard.
Standard enums.Standard
// Command is the last executed command.
Command enums.Command
// CommandType is the last executed command type.
CommandType uint8
// InvocationCounter is the invocation counter object.
InvocationCounter interface{}
// EphemeralKek is the ephemeral KEK.
EphemeralKek []byte
// EphemeralBlockCipherKey is the ephemeral Block cipher key.
EphemeralBlockCipherKey []byte
// EphemeralBroadcastBlockCipherKey is the ephemeral broadcast block cipherKey.
EphemeralBroadcastBlockCipherKey []byte
// EphemeralAuthenticationKey is the ephemeral authentication key.
EphemeralAuthenticationKey []byte
// Keys is the list of certificates to decrypt the data (for XML).
Keys []*types.GXKeyValuePair[*types.GXPkcs8, *types.GXx509Certificate]
// UseCustomChallenge indicates if custom challenges are used.
// If custom challenge is used new challenge is not generated if it is set.
// This is for debugging purposes.
UseCustomChallenge bool
// StartingBlockIndex is the starting block index.
// Default is One based, but some meters use Zero based value.
// Usually this is not used.
StartingBlockIndex uint32
// DLMSVersion is the DLMS version number.
DLMSVersion uint8
// BlockIndex is the current block index.
BlockIndex uint32
// Priority is the used priority.
Priority enums.Priority
// ServiceClass is the used service class.
ServiceClass enums.ServiceClass
// Objects is the collection of the objects.
Objects interface{}
// Authentication is the used authentication.
Authentication enums.Authentication
// Password is the client password.
Password []byte
// Closing indicates if connection is closing.
// Some meters might return invalid data when disconnect is called and cause infinity loop.
// This property is used to ignore it.
Closing bool
// Connected is the connection state.
Connected enums.ConnectionState
// BlockNumberAck is the block number acknowledged in GBT.
BlockNumberAck uint16
// OverwriteAttributeAccessRights indicates if association view tells wrong access rights and they are overwritten.
OverwriteAttributeAccessRights bool
// Hdlc contains HDLC framing
Hdlc *GXHdlcSettings
// Gateway contains gateway
Gateway *GXDLMSGateway
// Plc contains PLC
Plc *GXPlcSettings
// MBus contains M-Bus
MBus *GXMBusSettings
// Pdu contains PDU
Pdu *GXPduSettings
// Coap contains CoAP
Coap *GXCoAPSettings
// Broadcast indicates if data is sent as a broadcast or unicast.
Broadcast bool
// Compression indicates if V.44 Compression is used.
Compression bool
// InterfaceType is the used interface.
InterfaceType enums.InterfaceType
// ClientAddress is the client address.
ClientAddress int
// PushClientAddress is the address server uses when sending push messages.
// Client address is used if PushAddress is zero.
PushClientAddress int
// GbtCount is the General Block Transfer count in server.
GbtCount uint8
// ServerAddress is the server address.
ServerAddress int
// ServerAddressSize is the size of Server address.
ServerAddressSize uint8
// Version can be used for backward compatibility.
Version int
// AutoIncreaseInvokeID indicates if Invoke ID is auto increased.
AutoIncreaseInvokeID bool
// CryptoNotifier for external HSM operations.
CryptoNotifier interface{} // TODO: Replace with GXCryptoNotifier when implemented
// contains filtered or unexported fields
}
GXDLMSSettings includes DLMS communication
func NewGXDLMSSettings ¶
func NewGXDLMSSettings(objects any) *GXDLMSSettings
NewGXDLMSSettings creates a new DLMS settings instance with default values.
func NewGXDLMSSettingsWithParams ¶
func NewGXDLMSSettingsWithParams(server bool, ln bool, interfaceType enums.InterfaceType, objects any) *GXDLMSSettings
NewGXDLMSSettingsWithParams creates a new DLMS settings instance with specified parameters.
func (*GXDLMSSettings) AssignedAssociation ¶
func (s *GXDLMSSettings) AssignedAssociation() any
AssignedAssociation returns the assigned association for the server.
func (*GXDLMSSettings) ChallengeSize ¶
func (s *GXDLMSSettings) ChallengeSize() uint8
ChallengeSize returns the challenge size.
func (*GXDLMSSettings) CheckFrame ¶
func (s *GXDLMSSettings) CheckFrame(frame uint8, xml interface{}) bool
CheckFrame checks if the frame is valid.
func (*GXDLMSSettings) CopyTo ¶
func (s *GXDLMSSettings) CopyTo(target *GXDLMSSettings)
CopyTo copies all settings to target.
func (*GXDLMSSettings) Crypt ¶
func (s *GXDLMSSettings) Crypt(certificateType enums.CertificateType, data []byte, encrypt bool, keyType interface{}) []byte
Crypt encrypts or decrypts data using external Hardware Security Module.
func (*GXDLMSSettings) CtoSChallenge ¶
func (s *GXDLMSSettings) CtoSChallenge() []byte
CtoSChallenge returns the Client to Server challenge.
func (*GXDLMSSettings) ExpectedInvocationCounter ¶
func (s *GXDLMSSettings) ExpectedInvocationCounter() uint64
ExpectedInvocationCounter returns the expected Invocation (Frame) counter value. Expected Invocation counter is not checked if value is zero.
func (*GXDLMSSettings) GbtWindowSize ¶
func (s *GXDLMSSettings) GbtWindowSize() uint8
GbtWindowSize returns the General Block Transfer window size.
func (*GXDLMSSettings) GetKey ¶
func (s *GXDLMSSettings) GetKey(certificateType interface{}, systemTitle []byte, encrypt bool) any
GetKey gets the encryption/signing key.
func (*GXDLMSSettings) GetMaxServerPDUSize ¶
func (s *GXDLMSSettings) GetMaxServerPDUSize() uint16
GetMaxServerPDUSize returns the server maximum PDU size.
func (*GXDLMSSettings) IncreaseBlockIndex ¶
func (s *GXDLMSSettings) IncreaseBlockIndex()
IncreaseBlockIndex increases block index.
func (*GXDLMSSettings) InvokeID ¶
func (s *GXDLMSSettings) InvokeID() uint8
InvokeID returns the Invoke ID.
func (*GXDLMSSettings) IsCiphered ¶
func (s *GXDLMSSettings) IsCiphered(checkGeneralSigning bool) bool
IsCiphered checks if data is ciphered.
func (*GXDLMSSettings) IsServer ¶
func (s *GXDLMSSettings) IsServer() bool
IsServer indicates if this is server or client
func (*GXDLMSSettings) KeepAlive ¶
func (s *GXDLMSSettings) KeepAlive() uint8
KeepAlive generates Keep Alive S-frame.
func (*GXDLMSSettings) MaxPduSize ¶
func (s *GXDLMSSettings) MaxPduSize() uint16
MaxPduSize returns the maximum PDU size.
func (*GXDLMSSettings) NextSend ¶
func (s *GXDLMSSettings) NextSend(first bool) uint8
NextSend generates I-frame.
func (*GXDLMSSettings) ReceiverReady ¶
func (s *GXDLMSSettings) ReceiverReady() uint8
ReceiverReady generates Receiver Ready S-frame.
func (*GXDLMSSettings) ResetBlockIndex ¶
func (s *GXDLMSSettings) ResetBlockIndex()
ResetBlockIndex resets block index to default value.
func (*GXDLMSSettings) ResetFrameSequence ¶
func (s *GXDLMSSettings) ResetFrameSequence()
ResetFrameSequence resets frame sequence.
func (*GXDLMSSettings) SetAssignedAssociation ¶
func (s *GXDLMSSettings) SetAssignedAssociation(value any)
SetAssignedAssociation sets the assigned association for the server.
func (*GXDLMSSettings) SetChallengeSize ¶
func (s *GXDLMSSettings) SetChallengeSize(value uint8) error
SetChallengeSize sets the challenge size. Random challenge is used if value is zero.
func (*GXDLMSSettings) SetCtoSChallenge ¶
func (s *GXDLMSSettings) SetCtoSChallenge(value []byte)
SetCtoSChallenge sets the Client to Server challenge.
func (*GXDLMSSettings) SetExpectedInvocationCounter ¶
func (s *GXDLMSSettings) SetExpectedInvocationCounter(value uint64)
SetExpectedInvocationCounter sets the expected Invocation (Frame) counter value.
func (*GXDLMSSettings) SetGbtWindowSize ¶
func (s *GXDLMSSettings) SetGbtWindowSize(value uint8) error
SetGbtWindowSize sets the General Block Transfer window size.
func (*GXDLMSSettings) SetInvokeID ¶
func (s *GXDLMSSettings) SetInvokeID(value uint8) error
SetInvokeID sets the Invoke ID.
func (*GXDLMSSettings) SetMaxPduSize ¶
func (s *GXDLMSSettings) SetMaxPduSize(value uint16) error
SetMaxPduSize sets the maximum PDU size.
func (*GXDLMSSettings) SetMaxServerPDUSize ¶
func (s *GXDLMSSettings) SetMaxServerPDUSize(value uint16)
SetMaxServerPDUSize sets the server maximum PDU size.
func (*GXDLMSSettings) SetSourceSystemTitle ¶
func (s *GXDLMSSettings) SetSourceSystemTitle(value []byte)
SetSourceSystemTitle sets the source system title.
func (*GXDLMSSettings) SetStoCChallenge ¶
func (s *GXDLMSSettings) SetStoCChallenge(value []byte)
SetStoCChallenge sets the Server to Client challenge.
func (*GXDLMSSettings) SetUseLogicalNameReferencing ¶
func (s *GXDLMSSettings) SetUseLogicalNameReferencing(value bool)
SetUseLogicalNameReferencing sets if Logical Name Referencing is used.
func (*GXDLMSSettings) SourceSystemTitle ¶
func (s *GXDLMSSettings) SourceSystemTitle() []byte
SourceSystemTitle returns the source system title.
func (*GXDLMSSettings) StoCChallenge ¶
func (s *GXDLMSSettings) StoCChallenge() []byte
StoCChallenge returns the Server to Client challenge.
func (*GXDLMSSettings) UpdateInvokeID ¶
func (s *GXDLMSSettings) UpdateInvokeID(value uint8)
UpdateInvokeID updates invoke ID and priority.
func (*GXDLMSSettings) UpdateSecurity ¶
func (s *GXDLMSSettings) UpdateSecurity(systemTitle []byte, ss interface{})
UpdateSecurity updates security settings from security setup object.
func (*GXDLMSSettings) UpdateSecuritySettings ¶
func (s *GXDLMSSettings) UpdateSecuritySettings(systemTitle []byte)
UpdateSecuritySettings updates security settings from assigned association.
func (*GXDLMSSettings) UseLogicalNameReferencing ¶
func (s *GXDLMSSettings) UseLogicalNameReferencing() bool
UseLogicalNameReferencing returns if Logical Name Referencing is used.
type GXDLMSTranslatorStructure ¶
type GXDLMSTranslatorStructure struct {
ShowStringAsHex bool
// Are comments added.
Comments bool
// Are spaces ignored.
IgnoreSpaces bool
// contains filtered or unexported fields
}
This class is used internally in GXDLMSTranslator to save generated xml.
func (*GXDLMSTranslatorStructure) Append ¶
func (g *GXDLMSTranslatorStructure) Append(tag int, start bool)
func (*GXDLMSTranslatorStructure) AppendComment ¶
func (g *GXDLMSTranslatorStructure) AppendComment(comment string)
AppendComment returns the append comment.
Parameters:
comment: Comment to add.
func (*GXDLMSTranslatorStructure) AppendEmptyStringTag ¶
func (g *GXDLMSTranslatorStructure) AppendEmptyStringTag(tag string)
func (*GXDLMSTranslatorStructure) AppendEmptyTag ¶
func (g *GXDLMSTranslatorStructure) AppendEmptyTag(tag int)
func (*GXDLMSTranslatorStructure) AppendEndTag ¶
func (g *GXDLMSTranslatorStructure) AppendEndTag(tag int, plain bool)
func (*GXDLMSTranslatorStructure) AppendLine ¶
func (g *GXDLMSTranslatorStructure) AppendLine(tag string, name string, value any)
func (*GXDLMSTranslatorStructure) AppendLineFromTag ¶
func (g *GXDLMSTranslatorStructure) AppendLineFromTag(tag int, name string, value any)
func (*GXDLMSTranslatorStructure) AppendStartTag ¶
func (g *GXDLMSTranslatorStructure) AppendStartTag(tag int, name string, value string, plain bool)
func (*GXDLMSTranslatorStructure) AppendString ¶
func (g *GXDLMSTranslatorStructure) AppendString(value string)
func (*GXDLMSTranslatorStructure) AppendStringLine ¶
func (g *GXDLMSTranslatorStructure) AppendStringLine(value string)
func (*GXDLMSTranslatorStructure) EndComment ¶
func (g *GXDLMSTranslatorStructure) EndComment()
EndComment returns the end comment section.
func (*GXDLMSTranslatorStructure) GetDataType ¶
func (g *GXDLMSTranslatorStructure) GetDataType(type_ enums.DataType) string
func (*GXDLMSTranslatorStructure) GetTag ¶
func (g *GXDLMSTranslatorStructure) GetTag(tag int) string
func (*GXDLMSTranslatorStructure) GetXmlLength ¶
func (g *GXDLMSTranslatorStructure) GetXmlLength() int
GetXmlLength returns the get XML Length.
Returns:
XML Length.
func (*GXDLMSTranslatorStructure) IntegerToHex ¶
func (g *GXDLMSTranslatorStructure) IntegerToHex(value any, desimals int, forceHex bool) string
IntegerToHex returns the convert integer to string.
Parameters:
value: Conveted value. desimals: Desimal count. forceHex: Force value as hex.
Returns:
Integer value as a string.
func (*GXDLMSTranslatorStructure) Offset ¶
func (g *GXDLMSTranslatorStructure) Offset() int
Offset returns the amount of spaces.
func (*GXDLMSTranslatorStructure) OmitNameSpace ¶
func (g *GXDLMSTranslatorStructure) OmitNameSpace() bool
Name space is omit.
func (*GXDLMSTranslatorStructure) OutputType ¶
func (g *GXDLMSTranslatorStructure) OutputType() enums.TranslatorOutputType
func (*GXDLMSTranslatorStructure) SetOffset ¶
func (g *GXDLMSTranslatorStructure) SetOffset(value int) error
SetOffset sets the amount of spaces.
func (*GXDLMSTranslatorStructure) SetXmlLength ¶
func (g *GXDLMSTranslatorStructure) SetXmlLength(value int)
SetXmlLength returns the set XML Length.
Parameters:
value: XML Length.
func (*GXDLMSTranslatorStructure) StartComment ¶
func (g *GXDLMSTranslatorStructure) StartComment(comment string)
StartComment returns the start comment section.
Parameters:
comment: Comment to add.
func (*GXDLMSTranslatorStructure) String ¶
func (g *GXDLMSTranslatorStructure) String() string
func (*GXDLMSTranslatorStructure) Trim ¶
func (g *GXDLMSTranslatorStructure) Trim()
Trim returns the remove \r\n.
type GXHdlcSettings ¶
type GXHdlcSettings struct {
// contains filtered or unexported fields
}
HDLC settings contains commands for retrieving and setting the limits of
field length and window size, when communicating with the server.
func NewGXHdlcSettings ¶
func NewGXHdlcSettings() *GXHdlcSettings
func (*GXHdlcSettings) MaxInfoRX ¶
func (g *GXHdlcSettings) MaxInfoRX() uint16
MaxInfoRX returns the the maximum information field length in receive.
func (*GXHdlcSettings) MaxInfoTX ¶
func (g *GXHdlcSettings) MaxInfoTX() uint16
MaxInfoTX returns the the maximum information field length in transmit.
func (*GXHdlcSettings) SetMaxInfoRX ¶
func (g *GXHdlcSettings) SetMaxInfoRX(value uint16) error
SetMaxInfoRX sets the the maximum information field length in receive.
func (*GXHdlcSettings) SetMaxInfoTX ¶
func (g *GXHdlcSettings) SetMaxInfoTX(value uint16) error
SetMaxInfoTX sets the the maximum information field length in transmit.
func (*GXHdlcSettings) SetWindowSizeRX ¶
func (g *GXHdlcSettings) SetWindowSizeRX(value uint8) error
SetWindowSizeRX sets the the window size in receive.
func (*GXHdlcSettings) SetWindowSizeTX ¶
func (g *GXHdlcSettings) SetWindowSizeTX(value uint8) error
SetWindowSizeTX sets the the window size in transmit.
func (*GXHdlcSettings) WindowSizeRX ¶
func (g *GXHdlcSettings) WindowSizeRX() uint8
WindowSizeRX returns the the window size in receive.
func (*GXHdlcSettings) WindowSizeTX ¶
func (g *GXHdlcSettings) WindowSizeTX() uint8
WindowSizeTX returns the the window size in transmit.
type GXICipher ¶
type GXICipher interface {
// Used security level.
Security() enums.Security
// Set security level.
SetSecurity(value enums.Security) error
SetSecurityChangeCheck(value bool) error
// Used security policy.
SecurityPolicy() enums.SecurityPolicy
// Set security policy.
SetSecurityPolicy(value enums.SecurityPolicy) error
// Used security suite.
SecuritySuite() enums.SecuritySuite
// System title.
SystemTitle() []byte
// Recipient system title.
RecipientSystemTitle() []byte
// Block cipher key.
BlockCipherKey() []byte
// Broadcast block cipher key.
BroadcastBlockCipherKey() []byte
// Authentication key.
AuthenticationKey() []byte
// Dedicated key.
DedicatedKey() []byte
// InvocationCounter returns the invocation counter value.
InvocationCounter() uint32
// SetInvocationCounter sets the invocation counter value.
SetInvocationCounter(value uint32) error
// Transaction Id.
TransactionId() []byte
// Ephemeral key pair.
EphemeralKeyPair() *types.GXKeyValuePair[*types.GXPublicKey, *types.GXPrivateKey]
// Client's key agreement key pair.
KeyAgreementKeyPair() *types.GXKeyValuePair[*types.GXPublicKey, *types.GXPrivateKey]
// Available certificates.
Certificates() []types.GXx509Certificate
// Signing key pair.
SigningKeyPair() *types.GXKeyValuePair[*types.GXPublicKey, *types.GXPrivateKey]
// TLS signing key pair.
TLSKeyPair() *types.GXKeyValuePair[*types.GXPublicKey, *types.GXPrivateKey]
// Used signing.
Signing() enums.Signing
// Used signing and ciphering order.
SignCipherOrder() enums.SignCipherOrder
// Are Initiate Request and Response signed.
SignInitiateRequestResponse() bool
//Reset returns the reset encrypt settings.
Reset()
// SetSystemTitle sets the system title.
SetSystemTitle(value []byte) error
// SetSecuritySuite sets the used security suite.
SetSecuritySuite(value enums.SecuritySuite) error
// Ephemeral key pair.
SetEphemeralKeyPair(value *types.GXKeyValuePair[*types.GXPublicKey, *types.GXPrivateKey]) error
// Client's key agreement key pair.
SetKeyAgreementKeyPair(value *types.GXKeyValuePair[*types.GXPublicKey, *types.GXPrivateKey]) error
// Signing key pair.
SetSigningKeyPair(value *types.GXKeyValuePair[*types.GXPublicKey, *types.GXPrivateKey]) error
// TLS signing key pair.
SetTLSKeyPair(value *types.GXKeyValuePair[*types.GXPublicKey, *types.GXPrivateKey]) error
// SetBlockCipherKey sets the block cipher key.
SetBlockCipherKey(value []byte) error
// SetBroadcastBlockCipherKey sets the broadcast block cipher key.
SetBroadcastBlockCipherKey(value []byte) error
// SetAuthenticationKey sets the authentication key.
SetAuthenticationKey(value []byte) error
// SetDedicatedKey sets the dedicated key.
SetDedicatedKey(value []byte) error
// SetRecipientSystemTitle sets the recipient system title.
SetRecipientSystemTitle(value []byte) error
// SetSigning sets the used signing.
SetSigning(value enums.Signing) error
}
type GXMBusSettings ¶
type GXMBusSettings struct {
// Device identification number.
Id uint32
// Manufacturer Id.
ManufacturerId string
// Version.
Version uint8
// Device type.
MeterType constants.MBusMeterType
}
M-Bus settings contains communication information when DLMS PDU is transported using M-Bus frames.
type GXPduSettings ¶
type GXPduSettings struct {
// Time to wait in ms for PDU to fully received.
// Because there is no end of the packet or data length app must wait given time to expect PDU to fully received.
WaitTime uint16
}
PDU settings contains settings for PDU without framing.
type GXPlcSettings ¶
type GXPlcSettings struct {
// Initial credit (IC) tells how many times the frame must be repeated. Maximum value is 7.
InitialCredit uint8
// The current credit (CC) initial value equal to IC and automatically decremented by the MAC layer after each repetition.
// Maximum value is 7.
CurrentCredit uint8
// Delta credit (DC) is used by the system management application entity
// (SMAE) of the Client for credit management, while it has no meaning for a Server or a REPEATER.
// It represents the difference(IC-CC) of the last communication originated by the system identified by the DA address to the system identified by the SA address.
// Maximum value is 3.
DeltaCredit uint8
// Source MAC address.
MacSourceAddress uint16
// Destination MAC address.
MacDestinationAddress uint16
// Response probability.
ResponseProbability uint8
// Allowed time slots.
AllowedTimeSlots uint16
// Server saves client system title.
ClientSystemTitle []byte
// contains filtered or unexported fields
}
PLC communication settings.