Documentation ¶
Index ¶
- Constants
- Variables
- func CipherData(cfg Cipher, data []byte) ([]byte, error)
- func DecipherData(cfg *Cipher, data []byte) ([]byte, error)
- func EncodeAARQ(settings *Settings) (out []byte, err error)
- func EncodeRLRQ(settings *Settings) (out []byte, err error)
- func ErrWrongLength(current int, correct int) error
- func ErrWrongSlice(current []byte, correct []byte) error
- func ErrWrongTag(idx int, get byte, correct byte) error
- type AARE
- type AccessResultTag
- type ActResponse
- type ActionRequest
- type ActionRequestNextPBlock
- type ActionRequestNormal
- type ActionRequestWithFirstPBlock
- type ActionRequestWithList
- type ActionRequestWithListAndFirstPBlock
- type ActionRequestWithPBlock
- type ActionResponse
- type ActionResponseNextPBlock
- type ActionResponseNormal
- type ActionResponseWithList
- type ActionResponseWithPBlock
- type ActionResultTag
- type ApplicationContext
- type AssociationResult
- type AttributeDescriptor
- type AttributeDescriptorWithSelection
- type Authentication
- type Cipher
- type Ciphering
- type Client
- type ConfirmedServiceError
- type CosemI
- type CosemPDU
- type CosemTag
- type DataBlockG
- func CreateDataBlockG(lastBlock bool, blockNum uint32, result interface{}) *DataBlockG
- func CreateDataBlockGAsData(lastBlock bool, blockNum uint32, result interface{}) *DataBlockG
- func CreateDataBlockGAsResult(lastBlock bool, blockNum uint32, result AccessResultTag) *DataBlockG
- func DecodeDataBlockG(ori *[]byte) (out DataBlockG, err error)
- type DataBlockSA
- type DataChannel
- type DataNotification
- type Error
- type ErrorCode
- type EventNotificationRequest
- type ExceptionResponse
- type GetDataResult
- type GetRequest
- type GetRequestNext
- type GetRequestNormal
- type GetRequestWithList
- type GetResponse
- type GetResponseNormal
- type GetResponseWithDataBlock
- type GetResponseWithList
- type InitiateResponse
- type MethodDescriptor
- type Notification
- type Obis
- type RLRE
- type ReleaseRequestReason
- type ReleaseResponseReason
- type Security
- type SecurityLevel
- type SelectiveAccessDescriptor
- func CreateSelectiveAccessByEntryDescriptor(from uint32, to uint32) *SelectiveAccessDescriptor
- func CreateSelectiveAccessByRangeDescriptor(from time.Time, to time.Time, values []AttributeDescriptor) *SelectiveAccessDescriptor
- func DecodeSelectiveAccessDescriptor(ori *[]byte) (out SelectiveAccessDescriptor, err error)
- type SetRequest
- type SetRequestNormal
- type SetRequestWithDataBlock
- type SetRequestWithFirstDataBlock
- type SetRequestWithList
- type SetRequestWithListAndFirstDataBlock
- type SetResponse
- type SetResponseDataBlock
- type SetResponseLastDataBlock
- type SetResponseLastDataBlockWithList
- type SetResponseNormal
- type SetResponseWithList
- type Settings
- type SourceDiagnostic
- type Transport
- type TransportWithBroadcast
Constants ¶
const ( PduTypeProtocolVersion = 0 PduTypeApplicationContextName = 1 PduTypeCalledAPTitle = 2 PduTypeCalledAEQualifier = 3 PduTypeCalledAPInvocationID = 4 PduTypeCalledAEInvocationID = 5 PduTypeCallingAPTitle = 6 PduTypeCallingAEQualifier = 7 PduTypeCallingAPInvocationID = 8 PduTypeCallingAEInvocationID = 9 PduTypeSenderAcseRequirements = 10 PduTypeMechanismName = 11 PduTypeCallingAuthenticationValue = 12 PduTypeImplementationInformation = 29 PduTypeUserInformation = 30 )
APDU types
const ( BERTypeContext = 0x80 BERTypeApplication = 0x40 BERTypeConstructed = 0x20 )
BER encoding enumeration values
const ( ConformanceBlockReservedZero = 0b100000000000000000000000 ConformanceBlockGeneralProtection = 0b010000000000000000000000 ConformanceBlockGeneralBlockTransfer = 0b001000000000000000000000 ConformanceBlockRead = 0b000100000000000000000000 ConformanceBlockWrite = 0b000010000000000000000000 ConformanceBlockUnconfirmedWrite = 0b000001000000000000000000 ConformanceBlockReservedSix = 0b000000100000000000000000 ConformanceBlockReservedSeven = 0b000000010000000000000000 ConformanceBlockAttribute0SupportedWithSet = 0b000000001000000000000000 ConformanceBlockPriorityMgmtSupported = 0b000000000100000000000000 ConformanceBlockAttribute0SupportedWithGet = 0b000000000010000000000000 ConformanceBlockBlockTransferWithGetOrRead = 0b000000000001000000000000 ConformanceBlockBlockTransferWithSetOrWrite = 0b000000000000100000000000 ConformanceBlockBlockTransferWithAction = 0b000000000000010000000000 ConformanceBlockMultipleReferences = 0b000000000000001000000000 ConformanceBlockInformationReport = 0b000000000000000100000000 ConformanceBlockDataNotification = 0b000000000000000010000000 ConformanceBlockAccess = 0b000000000000000001000000 ConformanceBlockParametrizedAccess = 0b000000000000000000100000 ConformanceBlockGet = 0b000000000000000000010000 ConformanceBlockSet = 0b000000000000000000001000 ConformanceBlockSelectiveAccess = 0b000000000000000000000100 ConformanceBlockEventNotification = 0b000000000000000000000010 ConformanceBlockAction = 0b000000000000000000000001 )
Conformance block
const ( // DataAccessResult TagAccSuccess AccessResultTag = 0 TagAccHardwareFault AccessResultTag = 1 TagAccTemporaryFailure AccessResultTag = 2 TagAccReadWriteDenied AccessResultTag = 3 TagAccObjectUndefined AccessResultTag = 4 TagAccObjectClassInconsistent AccessResultTag = 9 TagAccTypeUnmatched AccessResultTag = 12 TagAccScopeAccessViolated AccessResultTag = 13 TagAccLongGetAborted AccessResultTag = 15 TagAccNoLongGetInProgress AccessResultTag = 16 TagAccLongSetAborted AccessResultTag = 17 TagAccNoLongSetInProgress AccessResultTag = 18 TagAccDataBlockNumberInvalid AccessResultTag = 19 TagAccOtherReason AccessResultTag = 250 // ActionResult TagActSuccess ActionResultTag = 0 TagActHardwareFault ActionResultTag = 1 TagActTemporaryFailure ActionResultTag = 2 TagActReadWriteDenied ActionResultTag = 3 TagActObjectUndefined ActionResultTag = 4 TagActObjectClassInconsistent ActionResultTag = 9 TagActTypeUnmatched ActionResultTag = 12 TagActScopeOfAccessViolated ActionResultTag = 13 TagActLongActionAborted ActionResultTag = 15 TagActNoLongActionInProgress ActionResultTag = 16 TagActOtherReason ActionResultTag = 250 )
const ( TagActionRequestNormal actionRequestTag = 0x1 TagActionRequestNextPBlock actionRequestTag = 0x2 TagActionRequestWithList actionRequestTag = 0x3 TagActionRequestWithFirstPBlock actionRequestTag = 0x4 TagActionRequestWithListAndFirstPBlock actionRequestTag = 0x5 TagActionRequestWithPBlock actionRequestTag = 0x6 )
const ( TagActionResponseNormal actionResponseTag = 0x1 TagActionResponseWithPBlock actionResponseTag = 0x2 TagActionResponseWithList actionResponseTag = 0x3 TagActionResponseNextPBlock actionResponseTag = 0x4 )
const ( TagErrInitiateError confirmedServiceErrorTag = 1 TagErrRead confirmedServiceErrorTag = 5 TagErrWrite confirmedServiceErrorTag = 6 )
const ( TagErrApplicationReference serviceErrorTag = 0 TagErrHardwareResource serviceErrorTag = 1 TagErrVdeStateError serviceErrorTag = 2 TagErrService serviceErrorTag = 3 TagErrDefinition serviceErrorTag = 4 TagErrAccess serviceErrorTag = 5 TagErrInitiate serviceErrorTag = 6 TagErrLoadDataSet serviceErrorTag = 7 TagErrTask serviceErrorTag = 9 TagErrOtherError serviceErrorTag = 10 )
const ( TagApplicationReferenceOther uint8 = 0 TagApplicationReferenceTimeElapsed uint8 = 1 TagApplicationReferenceApplicationUnreachable uint8 = 2 TagApplicationReferenceApplicationReferenceInvalid uint8 = 3 TagApplicationReferenceApplicationContextUnsupported uint8 = 4 TagApplicationReferenceProviderCommunicationError uint8 = 5 TagApplicationReferenceDecipheringError uint8 = 6 )
const ( TagExcServiceNotAllowed exceptionStateErrorTag = 1 TagExcServiceUnknown exceptionStateErrorTag = 2 )
const ( TagExcOperationNotPossible exceptionServiceErrorTag = 1 TagExcServiceNotSupported exceptionServiceErrorTag = 2 TagExcOtherReason exceptionServiceErrorTag = 3 )
const ( TagGetRequestNormal getRequestTag = 0x1 TagGetRequestNext getRequestTag = 0x2 TagGetRequestWithList getRequestTag = 0x3 )
const ( TagGetResponseNormal getResponseTag = 0x1 TagGetResponseWithDataBlock getResponseTag = 0x2 TagGetResponseWithList getResponseTag = 0x3 )
const ( DlmsVersion = 0x06 VAANameLN = 0x0007 VAANameSN = 0xFA00 )
const ( AccessSelectorRange accessSelector = 0x1 AccessSelectorEntry accessSelector = 0x2 )
const ( TagSetRequestNormal setRequestTag = 0x1 TagSetRequestWithFirstDataBlock setRequestTag = 0x2 TagSetRequestWithDataBlock setRequestTag = 0x3 TagSetRequestWithList setRequestTag = 0x4 TagSetRequestWithListAndFirstDataBlock setRequestTag = 0x5 )
const ( TagSetResponseNormal setResponseTag = 0x1 TagSetResponseDataBlock setResponseTag = 0x2 TagSetResponseLastDataBlock setResponseTag = 0x3 TagSetResponseLastDataBlockWithList setResponseTag = 0x4 TagSetResponseWithList setResponseTag = 0x5 )
Variables ¶
var ErrWrongVersion = errors.New("wrong DLMS version")
Functions ¶
func EncodeAARQ ¶
func EncodeRLRQ ¶
func ErrWrongLength ¶
func ErrWrongSlice ¶
Types ¶
type AARE ¶
type AARE struct { ApplicationContext ApplicationContext AssociationResult AssociationResult SourceDiagnostic SourceDiagnostic SourceSystemTitle []byte InitiateResponse *InitiateResponse ConfirmedServiceError *ConfirmedServiceError ReceivedIC *uint32 }
type AccessResultTag ¶
type AccessResultTag uint8
func GetAccessTag ¶
func GetAccessTag(in uint8) (out AccessResultTag, err error)
func (AccessResultTag) String ¶
func (s AccessResultTag) String() string
func (AccessResultTag) Value ¶
func (s AccessResultTag) Value() uint8
Value will return primitive value of the target. This is used for comparing with non custom typed object
type ActResponse ¶
type ActResponse struct { Result ActionResultTag ReturnParam *GetDataResult }
Response of ActionRequest. ReturnParam is optional parameter therefore pointer
func CreateActResponse ¶
func CreateActResponse(result ActionResultTag, returnParam *GetDataResult) *ActResponse
func DecodeActResponse ¶
func DecodeActResponse(ori *[]byte) (out ActResponse, err error)
func (ActResponse) Encode ¶
func (dt ActResponse) Encode() (out []byte, err error)
type ActionRequest ¶
type ActionRequest struct{}
ActionRequest implement CosemI
func (*ActionRequest) Decode ¶
func (gr *ActionRequest) Decode(src *[]byte) (out CosemPDU, err error)
func (*ActionRequest) New ¶
func (gr *ActionRequest) New(tag actionRequestTag) (out CosemPDU, err error)
type ActionRequestNextPBlock ¶
ActionRequestNextPBlock implement CosemPDU
func CreateActionRequestNextPBlock ¶
func CreateActionRequestNextPBlock(invokeID uint8, blockNum uint32) *ActionRequestNextPBlock
func DecodeActionRequestNextPBlock ¶
func DecodeActionRequestNextPBlock(ori *[]byte) (out ActionRequestNextPBlock, err error)
func (ActionRequestNextPBlock) Encode ¶
func (ar ActionRequestNextPBlock) Encode() (out []byte, err error)
type ActionRequestNormal ¶
type ActionRequestNormal struct { InvokePriority uint8 MethodInfo MethodDescriptor MethodParam *axdr.DlmsData }
ActionRequestNormal implement CosemPDU
func CreateActionRequestNormal ¶
func CreateActionRequestNormal(invokeID uint8, mth MethodDescriptor, dt *axdr.DlmsData) *ActionRequestNormal
func DecodeActionRequestNormal ¶
func DecodeActionRequestNormal(ori *[]byte) (out ActionRequestNormal, err error)
func (ActionRequestNormal) Encode ¶
func (ar ActionRequestNormal) Encode() (out []byte, err error)
type ActionRequestWithFirstPBlock ¶
type ActionRequestWithFirstPBlock struct { InvokePriority uint8 MethodInfo MethodDescriptor PBlock DataBlockSA }
ActionRequestWithFirstPBlock implement CosemPDU
func CreateActionRequestWithFirstPBlock ¶
func CreateActionRequestWithFirstPBlock(invokeID uint8, mth MethodDescriptor, dt DataBlockSA) *ActionRequestWithFirstPBlock
func DecodeActionRequestWithFirstPBlock ¶
func DecodeActionRequestWithFirstPBlock(ori *[]byte) (out ActionRequestWithFirstPBlock, err error)
func (ActionRequestWithFirstPBlock) Encode ¶
func (ar ActionRequestWithFirstPBlock) Encode() (out []byte, err error)
type ActionRequestWithList ¶
type ActionRequestWithList struct { InvokePriority uint8 MethodInfoCount uint8 MethodInfoList []MethodDescriptor MethodParamCount uint8 MethodParamList []axdr.DlmsData }
ActionRequestWithList implement CosemPDU
func CreateActionRequestWithList ¶
func CreateActionRequestWithList(invokeID uint8, mthList []MethodDescriptor, valList []axdr.DlmsData) *ActionRequestWithList
func DecodeActionRequestWithList ¶
func DecodeActionRequestWithList(ori *[]byte) (out ActionRequestWithList, err error)
func (ActionRequestWithList) Encode ¶
func (ar ActionRequestWithList) Encode() (out []byte, err error)
type ActionRequestWithListAndFirstPBlock ¶
type ActionRequestWithListAndFirstPBlock struct { InvokePriority uint8 MethodInfoCount uint8 MethodInfoList []MethodDescriptor PBlock DataBlockSA }
ActionRequestWithListAndFirstPBlock implement CosemPDU
func CreateActionRequestWithListAndFirstPBlock ¶
func CreateActionRequestWithListAndFirstPBlock(invokeID uint8, mthList []MethodDescriptor, dt DataBlockSA) *ActionRequestWithListAndFirstPBlock
func DecodeActionRequestWithListAndFirstPBlock ¶
func DecodeActionRequestWithListAndFirstPBlock(ori *[]byte) (out ActionRequestWithListAndFirstPBlock, err error)
func (ActionRequestWithListAndFirstPBlock) Encode ¶
func (ar ActionRequestWithListAndFirstPBlock) Encode() (out []byte, err error)
type ActionRequestWithPBlock ¶
type ActionRequestWithPBlock struct { InvokePriority uint8 PBlock DataBlockSA }
ActionRequestWithPBlock implement CosemPDU
func CreateActionRequestWithPBlock ¶
func CreateActionRequestWithPBlock(invokeID uint8, dt DataBlockSA) *ActionRequestWithPBlock
func DecodeActionRequestWithPBlock ¶
func DecodeActionRequestWithPBlock(ori *[]byte) (out ActionRequestWithPBlock, err error)
func (ActionRequestWithPBlock) Encode ¶
func (ar ActionRequestWithPBlock) Encode() (out []byte, err error)
type ActionResponse ¶
type ActionResponse struct{}
ActionResponse implement CosemI
func (*ActionResponse) Decode ¶
func (gr *ActionResponse) Decode(src *[]byte) (out CosemPDU, err error)
func (*ActionResponse) New ¶
func (gr *ActionResponse) New(tag actionResponseTag) (out CosemPDU, err error)
type ActionResponseNextPBlock ¶
func CreateActionResponseNextPBlock ¶
func CreateActionResponseNextPBlock(invokeID uint8, blockNum uint32) *ActionResponseNextPBlock
func DecodeActionResponseNextPBlock ¶
func DecodeActionResponseNextPBlock(ori *[]byte) (out ActionResponseNextPBlock, err error)
func (ActionResponseNextPBlock) Encode ¶
func (ar ActionResponseNextPBlock) Encode() (out []byte, err error)
type ActionResponseNormal ¶
type ActionResponseNormal struct { InvokePriority uint8 Response ActResponse }
func CreateActionResponseNormal ¶
func CreateActionResponseNormal(invokeID uint8, res ActResponse) *ActionResponseNormal
func DecodeActionResponseNormal ¶
func DecodeActionResponseNormal(ori *[]byte) (out ActionResponseNormal, err error)
func (ActionResponseNormal) Encode ¶
func (ar ActionResponseNormal) Encode() (out []byte, err error)
type ActionResponseWithList ¶
type ActionResponseWithList struct { InvokePriority uint8 ResponseCount uint8 ResponseList []ActResponse }
func CreateActionResponseWithList ¶
func CreateActionResponseWithList(invokeID uint8, resList []ActResponse) *ActionResponseWithList
func DecodeActionResponseWithList ¶
func DecodeActionResponseWithList(ori *[]byte) (out ActionResponseWithList, err error)
func (ActionResponseWithList) Encode ¶
func (ar ActionResponseWithList) Encode() (out []byte, err error)
type ActionResponseWithPBlock ¶
type ActionResponseWithPBlock struct { InvokePriority uint8 PBlock DataBlockSA }
func CreateActionResponseWithPBlock ¶
func CreateActionResponseWithPBlock(invokeID uint8, dt DataBlockSA) *ActionResponseWithPBlock
func DecodeActionResponseWithPBlock ¶
func DecodeActionResponseWithPBlock(ori *[]byte) (out ActionResponseWithPBlock, err error)
func (ActionResponseWithPBlock) Encode ¶
func (ar ActionResponseWithPBlock) Encode() (out []byte, err error)
type ActionResultTag ¶
type ActionResultTag uint8
func GetActionTag ¶
func GetActionTag(in uint8) (out ActionResultTag, err error)
func (ActionResultTag) String ¶
func (s ActionResultTag) String() string
func (ActionResultTag) Value ¶
func (s ActionResultTag) Value() uint8
Value will return primitive value of the target. This is used for comparing with non custom typed object
type ApplicationContext ¶
type ApplicationContext uint8
const ( ApplicationContextLNNoCiphering ApplicationContext = 1 ApplicationContextSNNoCiphering ApplicationContext = 2 ApplicationContextLNCiphering ApplicationContext = 3 ApplicationContextSNCiphering ApplicationContext = 4 )
Application context definitions
type AssociationResult ¶
type AssociationResult uint8
const ( AssociationResultAccepted AssociationResult = 0 AssociationResultPermanentRejected AssociationResult = 1 AssociationResultTransientRejected AssociationResult = 2 )
type AttributeDescriptor ¶
func CreateAttributeDescriptor ¶
func CreateAttributeDescriptor(c uint16, i string, a int8) *AttributeDescriptor
func DecodeAttributeDescriptor ¶
func DecodeAttributeDescriptor(ori *[]byte) (out AttributeDescriptor, err error)
func (AttributeDescriptor) Encode ¶
func (ad AttributeDescriptor) Encode() (out []byte, err error)
func (AttributeDescriptor) String ¶
func (ad AttributeDescriptor) String() string
type AttributeDescriptorWithSelection ¶
type AttributeDescriptorWithSelection struct { ClassID uint16 InstanceID Obis AttributeID int8 AccessDescriptor *SelectiveAccessDescriptor }
func CreateAttributeDescriptorWithSelection ¶
func CreateAttributeDescriptorWithSelection(c uint16, i string, a int8, sad *SelectiveAccessDescriptor) *AttributeDescriptorWithSelection
CreateAttributeDescriptorWithSelection will create AttributeDescriptorWithSelection object SelectiveAccessDescriptor is allowed to be nil value therefore pointer
func DecodeAttributeDescriptorWithSelection ¶
func DecodeAttributeDescriptorWithSelection(ori *[]byte) (out AttributeDescriptorWithSelection, err error)
func (AttributeDescriptorWithSelection) Encode ¶
func (ad AttributeDescriptorWithSelection) Encode() (out []byte, err error)
type Authentication ¶
type Authentication byte
const ( AuthenticationNone Authentication = 0 // No authentication is used. AuthenticationLow Authentication = 1 // Low authentication is used. AuthenticationHigh Authentication = 2 // High authentication is used. AuthenticationHighMD5 Authentication = 3 // High authentication is used. Password is hashed with MD5. AuthenticationHighSHA1 Authentication = 4 // High authentication is used. Password is hashed with SHA1. AuthenticationHighGmac Authentication = 5 // High authentication is used. Password is hashed with GMAC. AuthenticationHighSha256 Authentication = 6 // High authentication is used. Password is hashed with SHA-256. AuthenticationHighEcdsa Authentication = 7 // High authentication is used. Password is hashed with ECDSA. )
Authentication mechanism definitions
type Ciphering ¶
type Ciphering struct { Level SecurityLevel Security Security SystemTitle []byte SourceSystemTitle []byte UnicastKey []byte UnicastKeyIC uint32 UnicastExpectedIC uint32 AuthenticationKey []byte DedicatedKey []byte DedicatedKeyIC uint32 DedicatedExpectedIC uint32 }
func NewCiphering ¶
type Client ¶
type Client interface { Connect() error Disconnect() error IsConnected() bool GetSettings() Settings SetSettings(settings Settings) SetAddress(client int, server int) SetLogger(logger *log.Logger) Associate() error CloseAssociation() error IsAssociated() bool SetNotificationChannel(id string, nc chan Notification) GetRequest(att *AttributeDescriptor, data interface{}) (err error) GetRequestWithSelectiveAccess(att *AttributeDescriptor, selectiveAccess axdr.DlmsData, data interface{}) (err error) GetRequestWithSelectiveAccessByDate(att *AttributeDescriptor, start time.Time, end time.Time, data interface{}) (err error) GetRequestWithSelectiveAccessByDateAndValues(att *AttributeDescriptor, start time.Time, end time.Time, values []AttributeDescriptor, data interface{}) (err error) GetRequestWithStructOfElements(data interface{}) (err error) SetRequest(att *AttributeDescriptor, data interface{}) (err error) SetRequestWithStructOfElements(data interface{}, continueOnSetRejected bool) (err error) ActionRequest(mth *MethodDescriptor, data interface{}) (err error) CheckRequestWithStructOfElements(data interface{}) (err error) }
Client specifies the client layer.
type ConfirmedServiceError ¶
type ConfirmedServiceError struct { ConfirmedServiceError confirmedServiceErrorTag ServiceError serviceErrorTag Value uint8 }
func CreateConfirmedServiceError ¶
func CreateConfirmedServiceError(service confirmedServiceErrorTag, serviceError serviceErrorTag, value uint8) *ConfirmedServiceError
func DecodeConfirmedServiceError ¶
func DecodeConfirmedServiceError(ori *[]byte) (out ConfirmedServiceError, err error)
func (ConfirmedServiceError) Encode ¶
func (cse ConfirmedServiceError) Encode() (out []byte, err error)
func (ConfirmedServiceError) String ¶
func (cse ConfirmedServiceError) String() string
type CosemPDU ¶
func DecodeCosem ¶
DecodeCosem is a global function to decode payload based on implemented DLMS/COSEM APDU en/decoder
type CosemTag ¶
type CosemTag uint8
const ( // ---- standardized DLMS APDUs TagInitiateRequest CosemTag = 1 TagReadRequest CosemTag = 5 TagWriteRequest CosemTag = 6 TagInitiateResponse CosemTag = 8 TagReadResponse CosemTag = 12 TagWriteResponse CosemTag = 13 TagConfirmedServiceError CosemTag = 14 TagDataNotification CosemTag = 15 TagUnconfirmedWriteRequest CosemTag = 22 TagInformationReportRequest CosemTag = 24 TagGloInitiateRequest CosemTag = 33 TagGloInitiateResponse CosemTag = 40 TagGloConfirmedServiceError CosemTag = 46 TagAARQ CosemTag = 96 TagAARE CosemTag = 97 TagRLRQ CosemTag = 98 TagRLRE CosemTag = 99 // --- APDUs used for data communication services TagGetRequest CosemTag = 192 TagSetRequest CosemTag = 193 TagEventNotificationRequest CosemTag = 194 TagActionRequest CosemTag = 195 TagGetResponse CosemTag = 196 TagSetResponse CosemTag = 197 TagActionResponse CosemTag = 199 // --- global ciphered pdus TagGloGetRequest CosemTag = 200 TagGloSetRequest CosemTag = 201 TagGloEventNotificationRequest CosemTag = 202 TagGloActionRequest CosemTag = 203 TagGloGetResponse CosemTag = 204 TagGloSetResponse CosemTag = 205 TagGloActionResponse CosemTag = 207 // --- dedicated ciphered pdus TagDedGetRequest CosemTag = 208 TagDedSetRequest CosemTag = 209 TagDedEventNotificationRequest CosemTag = 210 TagDedActionRequest CosemTag = 211 TagDedGetResponse CosemTag = 212 TagDedSetResponse CosemTag = 213 TagDedActionResponse CosemTag = 215 TagExceptionResponse CosemTag = 216 )
type DataBlockG ¶
DataBlockG is DataBlock for the GET-response. Result must be either byte slice or AccessResultTag after creation, or else it will fail on Encode()
func CreateDataBlockG ¶
func CreateDataBlockG(lastBlock bool, blockNum uint32, result interface{}) *DataBlockG
func CreateDataBlockGAsData ¶
func CreateDataBlockGAsData(lastBlock bool, blockNum uint32, result interface{}) *DataBlockG
func CreateDataBlockGAsResult ¶
func CreateDataBlockGAsResult(lastBlock bool, blockNum uint32, result AccessResultTag) *DataBlockG
func DecodeDataBlockG ¶
func DecodeDataBlockG(ori *[]byte) (out DataBlockG, err error)
func (DataBlockG) Encode ¶
func (dt DataBlockG) Encode() (out []byte, err error)
func (DataBlockG) ResultAsAccess ¶
func (dt DataBlockG) ResultAsAccess() (out AccessResultTag, err error)
func (DataBlockG) ResultAsBytes ¶
func (dt DataBlockG) ResultAsBytes() (out []byte, err error)
type DataBlockSA ¶
DataBlockSA is DataBlock for the SET-request, ACTION-request and ACTION-response
func CreateDataBlockSA ¶
func CreateDataBlockSA(lastBlock bool, blockNum uint32, result interface{}) *DataBlockSA
func DecodeDataBlockSA ¶
func DecodeDataBlockSA(ori *[]byte) (out DataBlockSA, err error)
func (DataBlockSA) Encode ¶
func (dt DataBlockSA) Encode() (out []byte, err error)
type DataChannel ¶
type DataChannel chan []byte
type DataNotification ¶
type DataNotification struct { InvokeIDAndPriority uint32 DateTime *time.Time DataValue axdr.DlmsData }
func CreateDataNotification ¶
func DecodeDataNotification ¶
func DecodeDataNotification(ori *[]byte) (out DataNotification, err error)
func (DataNotification) Encode ¶
func (dn DataNotification) Encode() (out []byte, err error)
type ErrorCode ¶
type ErrorCode int
const ( ErrorUnspecified ErrorCode = iota ErrorInvalidState ErrorInvalidParameter ErrorCommunicationFailed ErrorInvalidResponse ErrorAuthenticationFailed ErrorInvalidPassword ErrorWrongKeys ErrorFailureInvocationCounter ErrorGetRejected ErrorSetRejected ErrorActionRejected ErrorSetPartial ErrorCheckDoesNotMatch )
type EventNotificationRequest ¶
type EventNotificationRequest struct { Time *time.Time AttributeInfo AttributeDescriptor AttributeValue axdr.DlmsData }
func CreateEventNotificationRequest ¶
func CreateEventNotificationRequest(tm *time.Time, attInfo AttributeDescriptor, attValue axdr.DlmsData) *EventNotificationRequest
func DecodeEventNotificationRequest ¶
func DecodeEventNotificationRequest(ori *[]byte) (out EventNotificationRequest, err error)
func (EventNotificationRequest) Encode ¶
func (ev EventNotificationRequest) Encode() (out []byte, err error)
type ExceptionResponse ¶
type ExceptionResponse struct { StateError exceptionStateErrorTag ServiceError exceptionServiceErrorTag }
func CreateExceptionResponse ¶
func CreateExceptionResponse(stateError exceptionStateErrorTag, serviceError exceptionServiceErrorTag) *ExceptionResponse
func DecodeExceptionResponse ¶
func DecodeExceptionResponse(ori *[]byte) (out ExceptionResponse, err error)
func (ExceptionResponse) Encode ¶
func (er ExceptionResponse) Encode() (out []byte, err error)
type GetDataResult ¶
type GetDataResult struct { IsData bool Value interface{} }
func CreateGetDataResult ¶
func CreateGetDataResult(value interface{}) *GetDataResult
func CreateGetDataResultAsData ¶
func CreateGetDataResultAsData(value axdr.DlmsData) *GetDataResult
func CreateGetDataResultAsResult ¶
func CreateGetDataResultAsResult(value AccessResultTag) *GetDataResult
func DecodeGetDataResult ¶
func DecodeGetDataResult(ori *[]byte) (out GetDataResult, err error)
func (GetDataResult) Encode ¶
func (dt GetDataResult) Encode() (out []byte, err error)
func (GetDataResult) ValueAsAccess ¶
func (dt GetDataResult) ValueAsAccess() (out AccessResultTag, err error)
func (GetDataResult) ValueAsData ¶
func (dt GetDataResult) ValueAsData() (out axdr.DlmsData, err error)
type GetRequest ¶
type GetRequest struct{}
GetRequest implement CosemI
func (*GetRequest) New ¶
func (gr *GetRequest) New(tag getRequestTag) (out CosemPDU, err error)
type GetRequestNext ¶
GetRequestNext implement CosemPDU
func CreateGetRequestNext ¶
func CreateGetRequestNext(invokeID uint8, blockNum uint32) *GetRequestNext
func DecodeGetRequestNext ¶
func DecodeGetRequestNext(ori *[]byte) (out GetRequestNext, err error)
func (GetRequestNext) Encode ¶
func (gr GetRequestNext) Encode() (out []byte, err error)
type GetRequestNormal ¶
type GetRequestNormal struct { InvokePriority uint8 AttributeInfo AttributeDescriptor SelectiveAccessInfo *SelectiveAccessDescriptor }
GetRequestNormal implement CosemPDU. SelectiveAccessDescriptor is optional
func CreateGetRequestNormal ¶
func CreateGetRequestNormal(invokeID uint8, att AttributeDescriptor, acc *SelectiveAccessDescriptor) *GetRequestNormal
func DecodeGetRequestNormal ¶
func DecodeGetRequestNormal(ori *[]byte) (out GetRequestNormal, err error)
func (GetRequestNormal) Encode ¶
func (gr GetRequestNormal) Encode() (out []byte, err error)
type GetRequestWithList ¶
type GetRequestWithList struct { InvokePriority uint8 AttributeCount uint8 AttributeInfoList []AttributeDescriptorWithSelection }
GetRequestWithList implement CosemPDU
func CreateGetRequestWithList ¶
func CreateGetRequestWithList(invokeID uint8, attList []AttributeDescriptorWithSelection) *GetRequestWithList
func DecodeGetRequestWithList ¶
func DecodeGetRequestWithList(ori *[]byte) (out GetRequestWithList, err error)
func (GetRequestWithList) Encode ¶
func (gr GetRequestWithList) Encode() (out []byte, err error)
type GetResponse ¶
type GetResponse struct{}
GetResponse implement CosemI
func (*GetResponse) New ¶
func (gr *GetResponse) New(tag getResponseTag) (out CosemPDU, err error)
type GetResponseNormal ¶
type GetResponseNormal struct { InvokePriority uint8 Result GetDataResult }
GetResponseNormal implement CosemPDU. SelectiveAccessDescriptor is optional
func CreateGetResponseNormal ¶
func CreateGetResponseNormal(invokeID uint8, res GetDataResult) *GetResponseNormal
func DecodeGetResponseNormal ¶
func DecodeGetResponseNormal(ori *[]byte) (out GetResponseNormal, err error)
func (GetResponseNormal) Encode ¶
func (gr GetResponseNormal) Encode() (out []byte, err error)
type GetResponseWithDataBlock ¶
type GetResponseWithDataBlock struct { InvokePriority uint8 Result DataBlockG }
GetResponseNext implement CosemPDU
func CreateGetResponseWithDataBlock ¶
func CreateGetResponseWithDataBlock(invokeID uint8, res DataBlockG) *GetResponseWithDataBlock
func DecodeGetResponseWithDataBlock ¶
func DecodeGetResponseWithDataBlock(ori *[]byte) (out GetResponseWithDataBlock, err error)
func (GetResponseWithDataBlock) Encode ¶
func (gr GetResponseWithDataBlock) Encode() (out []byte, err error)
type GetResponseWithList ¶
type GetResponseWithList struct { InvokePriority uint8 ResultCount uint8 ResultList []GetDataResult }
GetResponseWithList implement CosemPDU
func CreateGetResponseWithList ¶
func CreateGetResponseWithList(invokeID uint8, resList []GetDataResult) *GetResponseWithList
func DecodeGetResponseWithList ¶
func DecodeGetResponseWithList(ori *[]byte) (out GetResponseWithList, err error)
func (GetResponseWithList) Encode ¶
func (gr GetResponseWithList) Encode() (out []byte, err error)
type InitiateResponse ¶
type InitiateResponse struct { NegotiatedQualityOfService *uint8 NegotiatedConformance uint32 ServerMaxReceivePduSize uint16 }
func CreateInitiateResponse ¶
func CreateInitiateResponse(qualityOfService *uint8, conformance uint32, maxReceivePduSize uint16) *InitiateResponse
func DecodeInitiateResponse ¶
func DecodeInitiateResponse(ori *[]byte) (out InitiateResponse, err error)
func (InitiateResponse) Encode ¶
func (ir InitiateResponse) Encode() (out []byte, err error)
type MethodDescriptor ¶
func CreateMethodDescriptor ¶
func CreateMethodDescriptor(c uint16, i string, a int8) *MethodDescriptor
func DecodeMethodDescriptor ¶
func DecodeMethodDescriptor(ori *[]byte) (out MethodDescriptor, err error)
func (MethodDescriptor) Encode ¶
func (ad MethodDescriptor) Encode() (out []byte, err error)
func (MethodDescriptor) String ¶
func (ad MethodDescriptor) String() string
type Notification ¶
type Notification struct { ID string DataNotification DataNotification }
type Obis ¶
type Obis struct {
// contains filtered or unexported fields
}
this object doesn't have header/length part, unlike axdr.DlmsData OctetString
func CreateObis ¶
func DecodeObis ¶
type ReleaseRequestReason ¶
type ReleaseRequestReason uint8
const ( ReleaseRequestReasonNormal ReleaseRequestReason = 0 ReleaseRequestReasonUrgent ReleaseRequestReason = 1 ReleaseRequestReasonUserDefined ReleaseRequestReason = 30 )
type ReleaseResponseReason ¶
type ReleaseResponseReason uint8
const ( ReleaseResponseReasonNormal ReleaseResponseReason = 0 ReleaseResponseReasonNotFinished ReleaseResponseReason = 1 ReleaseResponseReasonUserDefined ReleaseResponseReason = 30 )
type SecurityLevel ¶
type SecurityLevel byte
const ( SecurityLevelNone SecurityLevel = iota SecurityLevelGlobalKey SecurityLevelDedicatedKey )
type SelectiveAccessDescriptor ¶
type SelectiveAccessDescriptor struct { AccessSelector accessSelector AccessParameter axdr.DlmsData }
func CreateSelectiveAccessByEntryDescriptor ¶
func CreateSelectiveAccessByEntryDescriptor(from uint32, to uint32) *SelectiveAccessDescriptor
func CreateSelectiveAccessByRangeDescriptor ¶
func CreateSelectiveAccessByRangeDescriptor(from time.Time, to time.Time, values []AttributeDescriptor) *SelectiveAccessDescriptor
func DecodeSelectiveAccessDescriptor ¶
func DecodeSelectiveAccessDescriptor(ori *[]byte) (out SelectiveAccessDescriptor, err error)
func (SelectiveAccessDescriptor) Encode ¶
func (s SelectiveAccessDescriptor) Encode() (out []byte, err error)
type SetRequest ¶
type SetRequest struct{}
SetRequest implement CosemI
func (*SetRequest) New ¶
func (gr *SetRequest) New(tag setRequestTag) (out CosemPDU, err error)
type SetRequestNormal ¶
type SetRequestNormal struct { InvokePriority uint8 AttributeInfo AttributeDescriptor SelectiveAccessInfo *SelectiveAccessDescriptor Value axdr.DlmsData }
SetRequestNormal implement CosemPDU
func CreateSetRequestNormal ¶
func CreateSetRequestNormal(invokeID uint8, att AttributeDescriptor, acc *SelectiveAccessDescriptor, dt axdr.DlmsData) *SetRequestNormal
func DecodeSetRequestNormal ¶
func DecodeSetRequestNormal(ori *[]byte) (out SetRequestNormal, err error)
func (SetRequestNormal) Encode ¶
func (sr SetRequestNormal) Encode() (out []byte, err error)
type SetRequestWithDataBlock ¶
type SetRequestWithDataBlock struct { InvokePriority uint8 DataBlock DataBlockSA }
SetRequestWithDataBlock implement CosemPDU
func CreateSetRequestWithDataBlock ¶
func CreateSetRequestWithDataBlock(invokeID uint8, dt DataBlockSA) *SetRequestWithDataBlock
func DecodeSetRequestWithDataBlock ¶
func DecodeSetRequestWithDataBlock(ori *[]byte) (out SetRequestWithDataBlock, err error)
func (SetRequestWithDataBlock) Encode ¶
func (sr SetRequestWithDataBlock) Encode() (out []byte, err error)
type SetRequestWithFirstDataBlock ¶
type SetRequestWithFirstDataBlock struct { InvokePriority uint8 AttributeInfo AttributeDescriptor SelectiveAccessInfo *SelectiveAccessDescriptor DataBlock DataBlockSA }
SetRequestWithFirstDataBlock implement CosemPDU
func CreateSetRequestWithFirstDataBlock ¶
func CreateSetRequestWithFirstDataBlock(invokeID uint8, att AttributeDescriptor, acc *SelectiveAccessDescriptor, dt DataBlockSA) *SetRequestWithFirstDataBlock
func DecodeSetRequestWithFirstDataBlock ¶
func DecodeSetRequestWithFirstDataBlock(ori *[]byte) (out SetRequestWithFirstDataBlock, err error)
func (SetRequestWithFirstDataBlock) Encode ¶
func (sr SetRequestWithFirstDataBlock) Encode() (out []byte, err error)
type SetRequestWithList ¶
type SetRequestWithList struct { InvokePriority uint8 AttributeCount uint8 AttributeInfoList []AttributeDescriptorWithSelection ValueCount uint8 ValueList []axdr.DlmsData }
SetRequestWithList implement CosemPDU
func CreateSetRequestWithList ¶
func CreateSetRequestWithList(invokeID uint8, attList []AttributeDescriptorWithSelection, valList []axdr.DlmsData) *SetRequestWithList
func DecodeSetRequestWithList ¶
func DecodeSetRequestWithList(ori *[]byte) (out SetRequestWithList, err error)
func (SetRequestWithList) Encode ¶
func (sr SetRequestWithList) Encode() (out []byte, err error)
type SetRequestWithListAndFirstDataBlock ¶
type SetRequestWithListAndFirstDataBlock struct { InvokePriority uint8 AttributeCount uint8 AttributeInfoList []AttributeDescriptorWithSelection DataBlock DataBlockSA }
SetRequestWithListAndFirstDataBlock implement CosemPDU
func CreateSetRequestWithListAndFirstDataBlock ¶
func CreateSetRequestWithListAndFirstDataBlock(invokeID uint8, attList []AttributeDescriptorWithSelection, dt DataBlockSA) *SetRequestWithListAndFirstDataBlock
func DecodeSetRequestWithListAndFirstDataBlock ¶
func DecodeSetRequestWithListAndFirstDataBlock(ori *[]byte) (out SetRequestWithListAndFirstDataBlock, err error)
func (SetRequestWithListAndFirstDataBlock) Encode ¶
func (sr SetRequestWithListAndFirstDataBlock) Encode() (out []byte, err error)
type SetResponse ¶
type SetResponse struct{}
SetResponse implement CosemI
func (*SetResponse) New ¶
func (gr *SetResponse) New(tag setResponseTag) (out CosemPDU, err error)
type SetResponseDataBlock ¶
SetResponseDataBlock implement CosemPDU
func CreateSetResponseDataBlock ¶
func CreateSetResponseDataBlock(invokeID uint8, blockNum uint32) *SetResponseDataBlock
func DecodeSetResponseDataBlock ¶
func DecodeSetResponseDataBlock(ori *[]byte) (out SetResponseDataBlock, err error)
func (SetResponseDataBlock) Encode ¶
func (sr SetResponseDataBlock) Encode() (out []byte, err error)
type SetResponseLastDataBlock ¶
type SetResponseLastDataBlock struct { InvokePriority uint8 Result AccessResultTag BlockNum uint32 }
SetResponseLastDataBlock implement CosemPDU
func CreateSetResponseLastDataBlock ¶
func CreateSetResponseLastDataBlock(invokeID uint8, result AccessResultTag, blockNum uint32) *SetResponseLastDataBlock
func DecodeSetResponseLastDataBlock ¶
func DecodeSetResponseLastDataBlock(ori *[]byte) (out SetResponseLastDataBlock, err error)
func (SetResponseLastDataBlock) Encode ¶
func (sr SetResponseLastDataBlock) Encode() (out []byte, err error)
type SetResponseLastDataBlockWithList ¶
type SetResponseLastDataBlockWithList struct { InvokePriority uint8 ResultCount uint8 ResultList []AccessResultTag BlockNum uint32 }
SetResponseLastDataBlockWithList implement CosemPDU
func CreateSetResponseLastDataBlockWithList ¶
func CreateSetResponseLastDataBlockWithList(invokeID uint8, resList []AccessResultTag, blockNum uint32) *SetResponseLastDataBlockWithList
func DecodeSetResponseLastDataBlockWithList ¶
func DecodeSetResponseLastDataBlockWithList(ori *[]byte) (out SetResponseLastDataBlockWithList, err error)
func (SetResponseLastDataBlockWithList) Encode ¶
func (sr SetResponseLastDataBlockWithList) Encode() (out []byte, err error)
type SetResponseNormal ¶
type SetResponseNormal struct { InvokePriority uint8 Result AccessResultTag }
SetResponseNormal implement CosemPDU
func CreateSetResponseNormal ¶
func CreateSetResponseNormal(invokeID uint8, result AccessResultTag) *SetResponseNormal
func DecodeSetResponseNormal ¶
func DecodeSetResponseNormal(ori *[]byte) (out SetResponseNormal, err error)
func (SetResponseNormal) Encode ¶
func (sr SetResponseNormal) Encode() (out []byte, err error)
type SetResponseWithList ¶
type SetResponseWithList struct { InvokePriority uint8 ResultCount uint8 ResultList []AccessResultTag }
SetResponseWithList implement CosemPDU
func CreateSetResponseWithList ¶
func CreateSetResponseWithList(invokeID uint8, resList []AccessResultTag) *SetResponseWithList
func DecodeSetResponseWithList ¶
func DecodeSetResponseWithList(ori *[]byte) (out SetResponseWithList, err error)
func (SetResponseWithList) Encode ¶
func (sr SetResponseWithList) Encode() (out []byte, err error)
type Settings ¶
type Settings struct { Authentication Authentication Password []byte Ciphering Ciphering MaxPduRecvSize int MaxPduSendSize int ConformanceBlock int UseBroadcast bool }
type SourceDiagnostic ¶
type SourceDiagnostic uint8
const ( SourceDiagnosticNone SourceDiagnostic = 0 SourceDiagnosticNoReasonGiven SourceDiagnostic = 1 SourceDiagnosticApplicationContextNameNotSupported SourceDiagnostic = 2 SourceDiagnosticCallingAPTitleNotRecognized SourceDiagnostic = 3 SourceDiagnosticCallingAPInvocationIdentifierNotRecognized SourceDiagnostic = 4 SourceDiagnosticCallingAEQualifierNotRecognized SourceDiagnostic = 5 SourceDiagnosticCallingAEInvocationIdentifierNotRecognized SourceDiagnostic = 6 SourceDiagnosticCalledAPTitleNotRecognized SourceDiagnostic = 7 SourceDiagnosticCalledAPInvocationIdentifierNotRecognized SourceDiagnostic = 8 SourceDiagnosticCalledAEQualifierNotRecognized SourceDiagnostic = 9 SourceDiagnosticCalledAEInvocationIdentifierNotRecognized SourceDiagnostic = 10 SourceDiagnosticAuthenticationMechanismNameNotRecognized SourceDiagnostic = 11 SourceDiagnosticAuthenticationMechanismNameRequired SourceDiagnostic = 12 SourceDiagnosticAuthenticationFailure SourceDiagnostic = 13 SourceDiagnosticAuthenticationRequired SourceDiagnostic = 14 )
type Transport ¶
type Transport interface { Close() Connect() (err error) Disconnect() (err error) IsConnected() bool SetAddress(client int, server int) SetReception(dc DataChannel) Send(src []byte) error Recv(count int) (data []byte, err error) SetLogger(logger *log.Logger) }
Transport specifies the transport layer.
type TransportWithBroadcast ¶
TransportWithBroadcast are optional methods for transport layers with broadcast capabilities
Source Files ¶
- aare.go
- aarq.go
- accessActionResult.go
- actionRequest.go
- actionResponse.go
- attributeDescriptor.go
- attributeDescriptorWithSelection.go
- cipher.go
- client.go
- confirmedServiceError.go
- cosemPdu.go
- dataNotification.go
- errors.go
- eventNotificationRequest.go
- exceptionResponse.go
- getDataResult.go
- getRequest.go
- getResponse.go
- initiateResponse.go
- methodDescriptor.go
- obis.go
- rlre.go
- rlrq.go
- selectiveAccessDescriptor.go
- setRequest.go
- setResponse.go
- settings.go
- transport.go