go_dlt698_45

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

dlt698.45 规约解析

所有APDU全部实现

客户端

内置了一个TCP客户端。

需要使用者手动实现其他的连接方式,可参照TCP客户端的编写方式。

案例

  • statute_test.go是一个生成报文的案例,囊括了所有的类型

基于tcp的dlt698客户端使用方式

  1. 创建客户端
client, err := go_dlt698_45.NewDLT698TCPClient("000000000000", "127.0.0.1", 992, 3*time.Second, 1*time.Second)
  1. 设置回调,如果报文解析正确,就会调用回调中的方法,也就是说使用者无需关注规约编解码的具体实现
client.ProxyResponseHandle = &MyProxyResponseHandle{}

请按需设置回调,回调类型如下,请着重关注LinkBusHandler

    LinkBusHandler            LinkBusHandler             //连接状态通知和判定的回调
	LinkRequestHandle         LinkRequestHandler         //预连接请求(LINK-Request)的回调
	LinkResponseHandle        LinkResponseHandler        //预连接响应(LINK-Response)的回调
	ConnectRequestHandle      ConnectRequestHandler      //建立应用连接响应(CONNECT-Response)的回调
	ConnectResponseHandle     ConnectResponseHandler     //建立应用连接响应(CONNECT-Response)的回调
	ReleaseRequestHandle      ReleaseRequestHandler      //请求断开应用连接(RELEASE-Request)的回调
	ReleaseResponseHandle     ReleaseResponseHandler     //请求断开应用连接响应(RELEASE-Response)的回调
	ReleaseNotificationHandle ReleaseNotificationHandler //断开应用连接通知(RELEASE-Notification)的回调
	GetRequestHandle          GetRequestHandler          //请求读取(GET-Request)的回调
	GetResponseHandle         GetResponseHandler         //响应读取(GET-Response)的回调
	SetRequestHandle          SetRequestHandler          //设置请求(SET-Request)的回调
	SetResponseHandle         SetResponseHandler         //响应设置(SET-Response)的回调
	ActionRequestHandle       ActionRequestHandler       //请求操作一个对象方法(ActionRequestNormal)的回调
	ActionResponseHandle      ActionResponseHandler      //响应操作(ACTION-Response)的回调
	ReportNotificationHandle  ReportNotificationHandler  //通知上报(REPORT-Notification)的回调
	ReportResponseHandle      ReportResponseHandler      //响应上报(REPORT-Response)的回调
	ProxyRequestHandle        ProxyRequestHandler        //请求代理(PROXY-Request)的回调
	ProxyResponseHandle       ProxyResponseHandler       //响应代理(PROXY-Response)的回调
	SecurityRequestHandle     SecurityRequestHandler     //请求安全传输(SECURITY-Request)的回调
	SecurityResponseHandle    SecurityResponseHandler    //响应安全传输(SECURITY-Response)的回调
	ErrorResponseHandle       ErrorResponseHandler       //响应异常(ERROR-Response)的回调
  1. 启动
client.Connect()

Documentation

Index

Constants

View Source
const (
	ActionRequestType              byte = 7
	ActionRequestNormal            byte = 1 //请求操作一个对象方法
	ActionRequestNormalList        byte = 2 //请求操作若干个对象方法
	ActionThenGetRequestNormalList byte = 3 //请求操作若干个对象方法后读取若干个对象属性
)
View Source
const (
	ActionResponseType byte = 135

	ActionResponseNormal            byte = 1 //操作一个对象方法的响应
	ActionResponseNormalList        byte = 2 //操作若干个对象方法的响应
	ActionThenGetResponseNormalList byte = 3 //操作若干个对象方法后读取若干个属性的响应
)
View Source
const (
	GetRequestType = 0x05 //请求读取

	GetRequestNormal     byte = 1 //请求读取一个对象属性
	GetRequestNormalList byte = 2 //请求读取若干个对象属性
	GetRequestRecord     byte = 3 //请求读取一个记录型对象属性
	GetRequestRecordList byte = 4 //请求读取若干个记录型对象属性
	GetRequestNext       byte = 5 //请求读取分帧传输的下一帧
	GetRequestMD5        byte = 6 //请求读取一个对象属性的MD5值
)
View Source
const (
	GetResponseType byte = 133

	GetResponseNormal     byte = 1 //读取一个对象属性的响应
	GetResponseNormalList byte = 2 //读取若干个对象属性的响应
	GetResponseRecord     byte = 3 //读取一个记录型对象属性的响应
	GetResponseRecordList byte = 4 //读取若干个记录型对象属性的响应
	GetResponseNext       byte = 5 //读取分帧传输的下一帧的响应
	GetResponseMD5        byte = 6 //读取一个对象属性的MD5值的响应
)
View Source
const (
	ProxyRequestType              byte = 9
	ProxyGetRequestList                = 1 //请求代理读取若干个服务器的若干个对象属性
	ProxyGetRequestRecord              = 2 //请求代理读取一个服务器的一个记录型对象属性
	ProxySetRequestList                = 3 //请求代理设置若干个服务器的若干个对象属性
	ProxySetThenGetRequestList         = 4 //请求代理设置后读取若干个服务器的若干个对象属性
	ProxyActionRequestList             = 5 //请求代理操作若干个服务器的若干个对象方法
	ProxyActionThenGetRequestList      = 6 //请求代理操作后读取若干个服务器的若干个对象方法和属性
	ProxyTransCommandRequest           = 7 //请求代理透明转发命令
)
View Source
const (
	ProxyResponseType              = 137
	ProxyGetResponseList           = 1 //代理读取若干个服务器的若干个对象属性的响应
	ProxyGetResponseRecord         = 2 //代理读取一个服务器的一个记录型对象属性的响应
	ProxySetResponseList           = 3 //代理设置若干个服务器的若干个对象属性的响应
	ProxySetThenGetResponseList    = 4 //代理设置后读取若干个服务器的若干个对象属性的响应
	ProxyActionResponseList        = 5 //代理操作若干个服务器的若干个对象方法的响应
	ProxyActionThenGetResponseList = 6 //代理操作后读取若干个服务器的若干个对象方法和属性的响应
	ProxyTransCommandResponse      = 7 //代理透明转发命令的响应
)
View Source
const (
	ReportNotificationType       byte = 136
	ReportNotificationList       byte = 1 //通知上报若干个对象属性
	ReportNotificationRecordList byte = 2 //通知上报若干个记录型对象属性
	ReportNotificationTransData  byte = 3 //通知上报透明数据
)
View Source
const (
	ReportResponseType = 0x08

	ReportResponseList       = 1 //上报若干个对象属性的响应
	ReportResponseRecordList = 2 //上报若干个记录型对象属性的响应
	ReportResponseTransData  = 3 //上报透明数据的响应
)
View Source
const (
	SetRequestType byte = 0x06

	SetRequestNormal            byte = 1 //请求设置一个对象属性
	SetRequestNormalList        byte = 2 //请求设置若干个对象属性
	SetThenGetRequestNormalList byte = 3 //请求设置后读取若干个对象属性
)
View Source
const (
	SetResponseType              byte = 134
	SetResponseNormal                 = 1 //设置一个对象属性的响应
	SetResponseNormalList             = 2 //设置若干个对象属性的响应
	SetThenGetResponseNormalList      = 3 //设置的确认信息以及读取的响应
)
View Source
const (
	ConnectRequestType byte = 0x02 //请求建立应用连接的标志
)
View Source
const (
	ConnectResponseType byte = 130 //建立应用连接响应的标志
)
View Source
const (
	ErrorResponseType byte = 238
)
View Source
const (
	LinkRequestType = 0x01
)
View Source
const (
	LinkResponseType = 129 //预连接响应标志
)
View Source
const (
	ReleaseNotificationType byte = 132 //建立应用连接响应的标志
)
View Source
const (
	ReleaseRequestType byte = 0x03
)
View Source
const (
	ReleaseResponseType = 131
)
View Source
const (
	SecurityRequestType byte = 16
)
View Source
const (
	SecurityResponseType byte = 144
)

Variables

View Source
var ActionRequestTypeStr = fmt.Sprintf("%02X", ActionRequestType)
View Source
var ActionResponseTypeStr = fmt.Sprintf("%02X", ActionResponseType)
View Source
var ConnectRequestTypeStr = fmt.Sprintf("%02X", ConnectRequestType)
View Source
var ConnectResponseTypeStr = fmt.Sprintf("%02X", ConnectResponseType)
View Source
var ErrorResponseTypeStr = fmt.Sprintf("%02X", ErrorResponseType)
View Source
var GetRequestTypeStr = fmt.Sprintf("%02X", GetRequestType)
View Source
var GetResponseTypeStr = fmt.Sprintf("%02X", GetResponseType)
View Source
var LinkRequestTypeStr = fmt.Sprintf("%02X", LinkRequestType)
View Source
var LinkResponseTypeStr = fmt.Sprintf("%02X", LinkResponseType)
View Source
var ProxyRequestStr = fmt.Sprintf("%02X", ProxyRequestType)
View Source
var ProxyResponseStr = fmt.Sprintf("%02X", ProxyResponseType)
View Source
var ReleaseNotificationTypeStr = fmt.Sprintf("%02X", ReleaseNotificationType)
View Source
var ReleaseRequestTypeStr = fmt.Sprintf("%02X", ReleaseRequestType)
View Source
var ReleaseResponseTypeStr = fmt.Sprintf("%02X", ReleaseResponseType)
View Source
var ReportNotificationTypeStr = fmt.Sprintf("%02X", ReportNotificationType)
View Source
var ReportResponseTypeStr = fmt.Sprintf("%02X", ReportResponseType)
View Source
var SecurityRequestTypeStr = fmt.Sprintf("%02X", SecurityRequestType)
View Source
var SecurityResponseTypeStr = fmt.Sprintf("%02X", SecurityResponseType)
View Source
var SetRequestTypeStr = fmt.Sprintf("%02X", SetRequestType)
View Source
var SetResponseTypeStr = fmt.Sprintf("%02X", SetResponseType)

Functions

func CheckTCPError

func CheckTCPError(err error) bool

CheckTCPError 校验错误,判定是否重新连接

func NewActionRequestNormal

func NewActionRequestNormal(termAddr string, omd *dt.OMD, data dt.Data) (frame []byte, pid byte, err error)

NewActionRequestNormal 请求操作一个对象方法(ActionRequestNormal)的报文

func NewActionRequestNormalList

func NewActionRequestNormalList(termAddr string, item ...*ActionRequestItem) ([]byte, byte, error)

NewActionRequestNormalList 请求操作若干个对象方法(ActionRequestNormalList)的报文

func NewActionResponseNormal

func NewActionResponseNormal(termAddr string, omd *dt.OMD, dar byte, data dt.Data, pid byte) ([]byte, error)

NewActionResponseNormal 响应操作一个对象方法(ActionResponseNormal)的报文

func NewActionResponseNormalList

func NewActionResponseNormalList(termAddr string, pid byte, item ...*ActionResponseItem) ([]byte, error)

NewActionResponseNormalList 响应操作若干个对象方法(ActionResponseNormalList)的报文

func NewActionThenGetRequestNormalList

func NewActionThenGetRequestNormalList(termAddr string, item ...*ActionRequestItem) ([]byte, byte, error)

NewActionThenGetRequestNormalList 请求操作若干个对象方法后读取若干个对象属性(ActionThenGetRequestNormalList)的报文

func NewActionThenGetResponseNormalList

func NewActionThenGetResponseNormalList(termAddr string, pid byte, item ...*ActionResponseItem) ([]byte, error)

NewActionThenGetResponseNormalList 响应操作若干个对象方法后读取若干个属性(ActionThenGetResponseNormalList)的报文

func NewConnectRequest

func NewConnectRequest(termAddr string, cmiType byte, items ...[]byte) (frame []byte, pid byte, err error)

NewConnectRequest 创建一个请求建立应用连接的报文 termAddr 地址 cmiType 认证对象类型 items 对象参数,pwd 密文,客户机签名 请按顺序,但是不能同时传入pwd 密文,客户机签名,CmiType

func NewConnectResponseFrame

func NewConnectResponseFrame(termAddr, vendorCode, softwareVersion, softwareVersionDate, hardwareVersion, hardwareVersionDate, vendorExtension string, protocolVersion uint16, result byte, pid byte) ([]byte, error)

NewConnectResponseFrame 创建一个建立应用连接响应的报文 termAddr 终端地址 vendorCode 厂商代码 softwareVersion 软件版本号 softwareVersionDate 软件版本日期 hardwareVersion 硬件版本号 hardwareVersionDate 硬件版本日期 vendorExtension 厂商扩展信息 protocolVersion 商定的协议版本号 result 认证结果 pid

func NewErrorResponse

func NewErrorResponse(termAddr string, code byte, pid byte) ([]byte, error)

func NewGetRequestMD5

func NewGetRequestMD5(termAddr string, oad [4]byte) (frame []byte, pid byte, err error)

NewGetRequestMD5 创建请求读取一个对象属性MD5值的报文

func NewGetRequestNext

func NewGetRequestNext(termAddr string, nextNumber uint16) (frame []byte, pid byte, err error)

NewGetRequestNext 创建请求读取分帧传输的下一帧的报文

func NewGetRequestNormal

func NewGetRequestNormal(termAddr string, oad [4]byte) (frame []byte, pid byte, err error)

NewGetRequestNormal 创建一个GetRequestNormal报文

func NewGetRequestNormalList

func NewGetRequestNormalList(termAddr string, oad ...[4]byte) (frame []byte, pid byte, err error)

NewGetRequestNormalList 创建一个GetRequestNormalList报文

func NewGetRequestRecord

func NewGetRequestRecord(termAddr string, gt *dt.GetRecord) (frame []byte, pid byte, err error)

NewGetRequestRecord 创建一个请求读取一个记录型对象属性的报文

func NewGetRequestRecordList

func NewGetRequestRecordList(termAddr string, gt ...*dt.GetRecord) (frame []byte, pid byte, err error)

NewGetRequestRecordList 创建若干请求读取一个记录型对象属性的报文

func NewGetResponseMD5

func NewGetResponseMD5(termAddr string, oad [4]byte, md5 string, pid byte) ([]byte, error)

NewGetResponseMD5 创建一个响应读取对象属性MD5值的正常报文 termAddr 终端地址 oad md5

func NewGetResponseMD5ByDar

func NewGetResponseMD5ByDar(termAddr string, oad [4]byte, dar byte, pid byte) ([]byte, error)

NewGetResponseMD5ByDar 创建一个响应读取对象属性MD5值的错误报文 termAddr 终端地址 dar 错误信息

func NewGetResponseNextByAResultNormal

func NewGetResponseNextByAResultNormal(termAddr string, endFrameFlag byte, frameIndex uint16, pid byte, arn ...*dt.AResultNormal) ([]byte, error)

NewGetResponseNextByAResultNormal 创建响应读取分帧传输的下一帧的A-ResultNormal报文 termAddr 终端地址 endFrameFlag 末帧标志 frameIndex 分帧序号 arn

func NewGetResponseNextByAResultRecord

func NewGetResponseNextByAResultRecord(termAddr string, endFrameFlag byte, frameIndex uint16, pid byte, arn ...*dt.AResultRecord) ([]byte, error)

NewGetResponseNextByAResultRecord 创建响应读取分帧传输的下一帧的A-ResultRecord报文 termAddr 终端地址 endFrameFlag 末帧标志 frameIndex 分帧序号 arn

func NewGetResponseNextByDar

func NewGetResponseNextByDar(termAddr string, endFrameFlag byte, frameIndex uint16, dar byte, pid byte) ([]byte, error)

NewGetResponseNextByDar 创建响应读取分帧传输的下一帧的错误报文 termAddr 终端地址 endFrameFlag 末帧标志 frameIndex 分帧序号 dar 错误信息

func NewGetResponseNormalByDar

func NewGetResponseNormalByDar(termAddr string, oad [4]byte, dar byte, pid byte) ([]byte, error)

NewGetResponseNormalByDar 创建一个响应读取一个对象属性的报文, 返回错误数据 termAddr 终端地址 oad dar 错误信息

func NewGetResponseNormalByData

func NewGetResponseNormalByData(termAddr string, oad [4]byte, data dt.Data, pid byte) ([]byte, error)

NewGetResponseNormalByData 创建一个响应读取一个对象属性的报文,返回正确数据 termAddr 终端地址 oad data 信息

func NewGetResponseNormalList

func NewGetResponseNormalList(termAddr string, pid byte, result ...*dt.AResultNormal) ([]byte, error)

NewGetResponseNormalList 创建响应读取若干个对象属性的报文 termAddr 终端地址 result 结果

func NewGetResponseRecord

func NewGetResponseRecord(termAddr string, record *dt.AResultRecord, pid byte) ([]byte, error)

NewGetResponseRecord 创建响应读取一个记录型对象属性的报文 termAddr 终端地址

func NewGetResponseRecordList

func NewGetResponseRecordList(termAddr string, pid byte, record ...*dt.AResultRecord) ([]byte, error)

NewGetResponseRecordList 创建一个响应读取若干个记录型对象属性的报文 termAddr 终端地址

func NewLinkRequestFrame

func NewLinkRequestFrame(termAddr string, linkRequestType byte, cardiacCycle uint16) (frame []byte, pid byte, err error)

NewLinkRequestFrame 创建一个预连接请求的报文 termAddr 地址 LinkRequestType 登录 (0),心跳 (1),退出登录 (2) cardiacCycle 心跳周期

func NewLinkResponse

func NewLinkResponse(termAddr string, pid byte, requestTime time.Time) ([]byte, error)

NewLinkResponse 创建一个预连接响应 termAddr 终端地址 pid requestTime 请求时间

func NewProxyActionRequestList

func NewProxyActionRequestList(termAddr string, timeout uint16, item ...*ProxyActionRequestListItem) ([]byte, byte, error)

NewProxyActionRequestList 请求代理操作若干个服务器的若干个对象方法(ProxyActionRequestList)的报文

func NewProxyActionResponseList

func NewProxyActionResponseList(termAddr string, pid byte, item ...*ProxyActionResponseListItem) ([]byte, error)

NewProxyActionResponseList 响应代理操作若干个服务器的若干个对象方法(ProxyActionResponseList)的报文

func NewProxyActionThenGetRequestList

func NewProxyActionThenGetRequestList(termAddr string, timeout uint16, item ...*ProxyActionRequestListItem) ([]byte, byte, error)

NewProxyActionThenGetRequestList 请求代理操作后读取若干个服务器的若干个对象方法和属性(ProxyActionThenGetRequestList)的报文

func NewProxyActionThenGetResponseList

func NewProxyActionThenGetResponseList(termAddr string, pid byte, item ...*ProxyActionResponseListItem) ([]byte, error)

NewProxyActionThenGetResponseList 响应代理操作后读取若干个服务器的若干个对象方法和属性(ProxyActionThenGetResponseList)的报文

func NewProxyGetRequestList

func NewProxyGetRequestList(termAddr string, timeout uint16, item ...*ProxyGetRequestListItem) ([]byte, byte, error)

NewProxyGetRequestList 请求代理读取若干个服务器的若干个对象属性(ProxyGetRequestList)的报文

func NewProxyGetRequestRecord

func NewProxyGetRequestRecord(termAddr string, timeout uint16, serverAddr string, oad [4]byte, rsd *dt.RSD, rcsd *dt.RCSD) ([]byte, byte, error)

NewProxyGetRequestRecord 请求代理读取一个服务器的一个记录型对象属性(ProxyGetRequestRecord)的报文

func NewProxyGetResponseList

func NewProxyGetResponseList(termAddr string, pid byte, data ...*ProxyGetResponseListItem) ([]byte, error)

NewProxyGetResponseList 响应代理读取若干个服务器的若干个对象属性(ProxyGetResponseList)的报文

func NewProxyGetResponseRecord

func NewProxyGetResponseRecord(termAddr, serverAddr string, pid byte, record *dt.AResultRecord) ([]byte, error)

NewProxyGetResponseRecord 响应代理读取一个服务器的一个记录型对象属性(ProxyGetResponseRecord)的报文

func NewProxySetRequestList

func NewProxySetRequestList(termAddr string, timeout uint16, item ...*ProxySetRequestListItem) ([]byte, byte, error)

NewProxySetRequestList 请求代理设置若干个服务器的若干个对象属性(ProxySetRequestList)的报文

func NewProxySetResponseList

func NewProxySetResponseList(termAddr string, pid byte, item ...*ProxySetResponseListItem) ([]byte, error)

NewProxySetResponseList 响应代理设置若干个服务器的若干个对象属性(ProxySetResponseList)的报文

func NewProxySetThenGetRequestList

func NewProxySetThenGetRequestList(termAddr string, timeout uint16, item ...*ProxySetRequestListItem) ([]byte, byte, error)

NewProxySetThenGetRequestList 请求代理设置后读取若干个服务器的若干个对象属性(ProxySetThenGetRequestList)的报文

func NewProxySetThenGetResponseList

func NewProxySetThenGetResponseList(termAddr string, pid byte, item ...*ProxySetResponseListItem) ([]byte, error)

NewProxySetThenGetResponseList 响应代理设置后读取若干个服务器的若干个对象属性(ProxySetThenGetResponseList)的报文

func NewProxyTransCommandRequest

func NewProxyTransCommandRequest(termAddr string, oad [4]byte, comDCB *dt.COMDCB, frameTimeout uint16, byteTimeout uint16, cmd string) ([]byte, byte, error)

NewProxyTransCommandRequest 请求代理操作透明转发(ProxyTransCommandRequest)的报文

func NewProxyTransCommandResponseByDAR

func NewProxyTransCommandResponseByDAR(termAddr string, pid byte, oad [4]byte, dar byte) ([]byte, error)

NewProxyTransCommandResponseByDAR 响应代理操作透明转发命令(ProxyTransCommandResponse)的报文

func NewProxyTransCommandResponseByData

func NewProxyTransCommandResponseByData(termAddr string, pid byte, oad [4]byte, data string) ([]byte, error)

NewProxyTransCommandResponseByData 响应代理操作透明转发命令(ProxyTransCommandResponse)的报文

func NewReleaseNotification

func NewReleaseNotification(termAddr string, linkTime time.Time) (frame []byte, pid byte, err error)

NewReleaseNotification 构建一个断开应用连接通知的报文 termAddr 终端地址 linkTime 应用连接建立时间

func NewReleaseRequest

func NewReleaseRequest(termAddr string, unit byte, interval uint16) (frame []byte, pid byte, err error)

NewReleaseRequest 构建一个断开应用连接的报文 tremAddr 终端地址 unit 时间标签中TI的单位 interval 时间标签中TI中的间隔值

func NewReleaseResponse

func NewReleaseResponse(termAddr string, pid, result byte) ([]byte, error)

NewReleaseResponse 构建一个断开应用连接响应的报文 termAddr 终端地址 pid result 结果

func NewReportNotificationList

func NewReportNotificationList(termAddr string, normal ...*dt.AResultNormal) (frame []byte, pid byte, err error)

NewReportNotificationList 创建通知上报若干个对象属性(ReportNotificationList)的报文

func NewReportNotificationRecordList

func NewReportNotificationRecordList(termAddr string, record ...*dt.AResultRecord) (frame []byte, pid byte, err error)

NewReportNotificationRecordList 创建通知上报若干个记录型对象属性(ReportNotificationRecordList)的报文

func NewReportNotificationTransData

func NewReportNotificationTransData(termAddr string, oad [4]byte, str ...string) (frame []byte, pid byte, err error)

NewReportNotificationTransData 创建通知上报透明数据(ReportNotificationTransData)的报文

func NewReportResponseList

func NewReportResponseList(termAddr string, pid byte, oad ...[4]byte) ([]byte, error)

NewReportResponseList 构建一个响应上报若干个对象属性(ReportResponseList)的报文

func NewReportResponseRecordList

func NewReportResponseRecordList(termAddr string, pid byte, oad ...[4]byte) (frame []byte, err error)

NewReportResponseRecordList 创建一个响应上报若干个记录型对象属性(ReportResponseRecordList)的报文

func NewReportResponseTransData

func NewReportResponseTransData(termAddr string, pid byte) ([]byte, error)

NewReportResponseTransData 创建响应上报透明数据(ReportResponseTransData)的报文

func NewSecurityRequest

func NewSecurityRequest(termAddr string, dataUintType byte, dataUnit string, parity dt.Data) ([]byte, error)

func NewSecurityResponse

func NewSecurityResponse(termAddr string, dataUnitType byte, dataUnit dt.Data, mac *dt.MAC) ([]byte, error)

func NewSetRequestNormal

func NewSetRequestNormal(termAddr string, oad [4]byte, data dt.Data) (frame []byte, pid byte, err error)

NewSetRequestNormal 创建一个请求设置一个对象属性的报文

func NewSetRequestNormalList

func NewSetRequestNormalList(termAddr string, items ...*SetRequestItem) (frame []byte, pid byte, err error)

NewSetRequestNormalList 请求设置后若干个对象属性(NewSetRequestNormalList)的报文

func NewSetResponseNormal

func NewSetResponseNormal(termAddr string, oad [4]byte, dar byte, pid byte) (frame []byte, err error)

NewSetResponseNormal 创建设置一个对象属性的响应的报文

func NewSetResponseNormalList

func NewSetResponseNormalList(tremAddr string, pid byte, item ...*SetResponseItem) (frame []byte, err error)

NewSetResponseNormalList 响应设置若干个对象属性(SetResponseNormalList)的报文

func NewSetThenGetRequestNormalList

func NewSetThenGetRequestNormalList(termAddr string, items ...*SetRequestItem) (frame []byte, pid byte, err error)

func NewSetThenGetResponseNormalList

func NewSetThenGetResponseNormalList(tremAddr string, pid byte, item ...*SetResponseItem) (frame []byte, err error)

NewSetThenGetResponseNormalList 创建响应设置若干个对象属性以及读取若干个对象属性(SetThenGetResponseNormalList)的报文

Types

type APDU

type APDU struct {
	Pid          byte
	Data         APDUIssuer
	TimeTag      *dt.TimeTag
	FollowReport *dt.FollowReport
}

func NewAPDU

func NewAPDU(pid byte, data APDUIssuer, ti *dt.TimeTag, follow *dt.FollowReport) (*APDU, error)

type APDUCreateFunc

type APDUCreateFunc func() APDUIssuer

APDUCreateFunc 创建一个APDU

type APDUIssuer

type APDUIssuer interface {
	Decode(buf *bytes.Reader) error //解码
	Encode() ([]byte, error)        //编码
	ObtainBaseType() byte
	ObtainTypeBytes() []byte //获取链路用户数据标识
	ObtainType() string      //获取链路用户数据标识
	HasPid() bool            //是否包含,这个方法原本应该是不需要,但是编者遇到过一些自定义报文没有
	NeedFollowReport() bool  //报文后面是否有跟随上报信息域
	NeedTimeTag() bool       //报文后面是否有时间标签块
	// contains filtered or unexported methods
}

APDUIssuer apdu超类

type ActionRequest

type ActionRequest struct {
	// contains filtered or unexported fields
}

ActionRequest 请求操作(ACTION-Request)的数据类型

func NewActionRequestNormalAPDU

func NewActionRequestNormalAPDU(omd *dt.OMD, data dt.Data) *ActionRequest

NewActionRequestNormalAPDU 请求操作一个对象方法(ActionRequestNormal)的APDU

func NewActionRequestNormalListAPDU

func NewActionRequestNormalListAPDU(item ...*ActionRequestItem) *ActionRequest

NewActionRequestNormalListAPDU 请求操作若干个对象方法(ActionRequestNormalList)的APDU

func NewActionThenGetRequestNormalListAPDU

func NewActionThenGetRequestNormalListAPDU(item ...*ActionRequestItem) *ActionRequest

NewActionThenGetRequestNormalListAPDU 请求操作若干个对象方法后读取若干个对象属性(ActionThenGetRequestNormalList)的APDU

func (*ActionRequest) Decode

func (a *ActionRequest) Decode(buf *bytes.Reader) error

func (*ActionRequest) Encode

func (a *ActionRequest) Encode() ([]byte, error)

func (*ActionRequest) HasPid

func (a *ActionRequest) HasPid() bool

func (*ActionRequest) NeedFollowReport

func (a *ActionRequest) NeedFollowReport() bool

func (*ActionRequest) NeedTimeTag

func (a *ActionRequest) NeedTimeTag() bool

func (*ActionRequest) ObtainActionRequestNormal

func (a *ActionRequest) ObtainActionRequestNormal() (*ActionRequestItem, error)

ObtainActionRequestNormal 获取请求操作一个对象方法(ActionRequestNormal)的数据

func (*ActionRequest) ObtainActionRequestNormalList

func (a *ActionRequest) ObtainActionRequestNormalList() ([]*ActionRequestItem, error)

ObtainActionRequestNormalList 获取请求操作若干个对象方法(ActionRequestNormalList)的数据

func (*ActionRequest) ObtainActionThenGetRequestNormalList

func (a *ActionRequest) ObtainActionThenGetRequestNormalList() ([]*ActionRequestItem, error)

ObtainActionThenGetRequestNormalList 获取请求操作若干个对象方法后读取若干个对象属性(ActionThenGetRequestNormalList)的数据

func (*ActionRequest) ObtainBaseType

func (a *ActionRequest) ObtainBaseType() byte

func (*ActionRequest) ObtainType

func (a *ActionRequest) ObtainType() string

func (*ActionRequest) ObtainTypeBytes

func (a *ActionRequest) ObtainTypeBytes() []byte

type ActionRequestHandler

type ActionRequestHandler interface {
	MessageHandler
	// CustomActionRequestNormalHandle 收到请求操作一个对象方法的请求
	CustomActionRequestNormalHandle(addr string, omd *dt.OMD, data dt.Data, tag *dt.TimeTag, pid byte) *DLT698Protocol

	// DefaultActionRequestNormalHandle 收到请求操作一个对象方法的请求
	// 返回值:
	// dar 操作执行结果
	// result 操作返回数据
	DefaultActionRequestNormalHandle(addr string, omd *dt.OMD, data dt.Data, tag *dt.TimeTag, pid byte) (dar byte, result dt.Data)

	// CustomActionRequestNormalListHandle 请求操作若干个对象方法(ActionRequestNormalList)的请求
	CustomActionRequestNormalListHandle(addr string, items []*ActionRequestItem, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultActionRequestNormalListHandle(addr string, list []*ActionRequestItem, tag *dt.TimeTag, pid byte) []*ActionResponseItem

	// CustomActionThenGetRequestNormalListHandle 请求操作若干个对象方法后读取若干个对象属性(ActionThenGetRequestNormalList)的请求
	CustomActionThenGetRequestNormalListHandle(addr string, items []*ActionRequestItem, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultActionThenGetRequestNormalListHandle(addr string, list []*ActionRequestItem, tag *dt.TimeTag, pid byte) []*ActionResponseItem
}

type ActionRequestItem

type ActionRequestItem struct {
	// contains filtered or unexported fields
}

func NewActionRequestNormalItem

func NewActionRequestNormalItem(omd *dt.OMD, data dt.Data) *ActionRequestItem

NewActionRequestNormalItem 创建一个请求操作一个对象方法(ActionRequestNormal)的参数

func NewActionThenRequestNormalItem

func NewActionThenRequestNormalItem(omd *dt.OMD, data dt.Data, oad [4]byte, delay byte) *ActionRequestItem

NewActionThenRequestNormalItem 创建一个请求操作若干个对象方法后读取若干个对象属性(ActionThenGetRequestNormalList)的参数

func (*ActionRequestItem) ObtainActionRequestNormal

func (a *ActionRequestItem) ObtainActionRequestNormal() (omd *dt.OMD, data dt.Data)

ObtainActionRequestNormal 获取ActionRequestNormal的参数

func (*ActionRequestItem) ObtainActionThenGetRequestNormalList

func (a *ActionRequestItem) ObtainActionThenGetRequestNormalList() (omd *dt.OMD, data dt.Data, oad [4]byte, delay byte)

type ActionResponse

type ActionResponse struct {
	// contains filtered or unexported fields
}

ActionResponse 响应操作(ACTION-Response)的数据类型

func NewActionResponseNormalAPDU

func NewActionResponseNormalAPDU(omd *dt.OMD, dar byte, data dt.Data) *ActionResponse

NewActionResponseNormalAPDU 响应操作一个对象方法(ActionResponseNormal)的APDU

func NewActionResponseNormalListAPDU

func NewActionResponseNormalListAPDU(item ...*ActionResponseItem) *ActionResponse

NewActionResponseNormalListAPDU 响应操作若干个对象方法(ActionResponseNormalList)的APDU

func NewActionThenGetResponseNormalListAPDU

func NewActionThenGetResponseNormalListAPDU(item ...*ActionResponseItem) *ActionResponse

NewActionThenGetResponseNormalListAPDU 响应操作若干个对象方法后读取若干个属性(ActionThenGetResponseNormalList)的APDU

func (*ActionResponse) Decode

func (a *ActionResponse) Decode(buf *bytes.Reader) error

func (*ActionResponse) Encode

func (a *ActionResponse) Encode() ([]byte, error)

func (*ActionResponse) HasPid

func (a *ActionResponse) HasPid() bool

func (*ActionResponse) NeedFollowReport

func (a *ActionResponse) NeedFollowReport() bool

func (*ActionResponse) NeedTimeTag

func (a *ActionResponse) NeedTimeTag() bool

func (*ActionResponse) ObtainActionResponseNormal

func (a *ActionResponse) ObtainActionResponseNormal() (*ActionResponseItem, error)

ObtainActionResponseNormal 响应操作一个对象方法(ActionResponseNormal)的参数

func (*ActionResponse) ObtainActionResponseNormalList

func (a *ActionResponse) ObtainActionResponseNormalList() ([]*ActionResponseItem, error)

ObtainActionResponseNormalList 响应操作若干个对象方法(ActionResponseNormalList)的参数

func (*ActionResponse) ObtainActionThenGetResponseNormalList

func (a *ActionResponse) ObtainActionThenGetResponseNormalList() ([]*ActionResponseItem, error)

func (*ActionResponse) ObtainBaseType

func (a *ActionResponse) ObtainBaseType() byte

func (*ActionResponse) ObtainType

func (a *ActionResponse) ObtainType() string

func (*ActionResponse) ObtainTypeBytes

func (a *ActionResponse) ObtainTypeBytes() []byte

type ActionResponseHandler

type ActionResponseHandler interface {
	// ActionResponseNormalHandle 响应操作一个对象方法(ActionResponseNormal)的回复
	ActionResponseNormalHandle(addr string, omd *dt.OMD, dar byte, data dt.Data, report *dt.FollowReport, tag *dt.TimeTag, pid byte)
	// ActionResponseNormalListHandle 响应操作若干个对象方法(ActionResponseNormalList)的回复
	ActionResponseNormalListHandle(addr string, items []*ActionResponseItem, report *dt.FollowReport, tag *dt.TimeTag, pid byte)
	// ActionThenGetResponseNormalListHandle 响应操作若干个对象方法后读取若干个属性(ActionThenGetResponseNormalList)的回复
	ActionThenGetResponseNormalListHandle(addr string, items []*ActionResponseItem, report *dt.FollowReport, tag *dt.TimeTag, pid byte)
}

type ActionResponseItem

type ActionResponseItem struct {
	// contains filtered or unexported fields
}

func NewActionResponseNormalItem

func NewActionResponseNormalItem(omd *dt.OMD, dar byte, data dt.Data) *ActionResponseItem

NewActionResponseNormalItem 创建响应操作一个对象方法(ActionResponseNormal)的参数

func NewActionThenGetResponseNormalListItem

func NewActionThenGetResponseNormalListItem(omd *dt.OMD, dar byte, data dt.Data, normal *dt.AResultNormal) *ActionResponseItem

NewActionThenGetResponseNormalListItem 创建响应操作若干个对象方法后读取若干个属性(ActionThenGetResponseNormalList)的参数

func (*ActionResponseItem) ObtainActionResponseNormalItem

func (a *ActionResponseItem) ObtainActionResponseNormalItem() (omd *dt.OMD, dar byte, data dt.Data)

ObtainActionResponseNormalItem 获取响应操作一个对象方法(ActionResponseNormal)的参数

func (*ActionResponseItem) ObtainActionThenGetResponseNormalListItem

func (a *ActionResponseItem) ObtainActionThenGetResponseNormalListItem() (omd *dt.OMD, dar byte, data dt.Data, normal *dt.AResultNormal)

ObtainActionThenGetResponseNormalListItem 响应操作若干个对象方法后读取若干个属性(ActionThenGetResponseNormalList)的参数

type AddressRegion

type AddressRegion struct {
	AddressType   uint8  //地址类型
	LogicAddress  uint8  //逻辑地址
	AddressLength uint8  //地址长度 索引0
	Address       string //地址
	Ca            byte   //客户机地址
}

AddressRegion 地址域

func (*AddressRegion) ToString

func (a *AddressRegion) ToString() string

type ConnectRequest

type ConnectRequest struct {
	ExpectedVersion            uint16                   //期望的协议版本号
	ProtocolConformance        []byte                   //期望的协议一致性块
	FunctionConformance        []byte                   //期望的功能一致性块
	ClientSendMaxSize          uint16                   //客户机发送帧最大尺寸
	ClientReceiveMaxSize       uint16                   //客户机接收帧最大尺寸
	ClientReceiveMaxWindowSize uint8                    //客户机接收帧最大窗口尺寸
	ClientCanHandleMaxSize     uint16                   //客户机最大可处理帧尺寸
	ConnectTimeOut             uint32                   //期望的应用连接超时时间
	Auth                       *dt.ConnectMechanismInfo //认证请求对象
}

ConnectRequest 请求建立应用连接,CONNECT-Request

func NewConnectRequestAPDU

func NewConnectRequestAPDU(cmiType byte, items ...[]byte) (*ConnectRequest, error)

NewConnectRequestAPDU 创建一个请求建立应用连接的APDU cmiType 认证对象类型 items 对象参数,pwd 密文,客户机签名 请按顺序,但是不能同时传入pwd 密文,客户机签名,CmiType

func (*ConnectRequest) Decode

func (c *ConnectRequest) Decode(buf *bytes.Reader) error

func (*ConnectRequest) Encode

func (c *ConnectRequest) Encode() ([]byte, error)

func (*ConnectRequest) HasPid

func (c *ConnectRequest) HasPid() bool

func (*ConnectRequest) NeedFollowReport

func (c *ConnectRequest) NeedFollowReport() bool

func (*ConnectRequest) NeedTimeTag

func (c *ConnectRequest) NeedTimeTag() bool

func (*ConnectRequest) ObtainBaseType

func (c *ConnectRequest) ObtainBaseType() byte

func (*ConnectRequest) ObtainType

func (c *ConnectRequest) ObtainType() string

func (*ConnectRequest) ObtainTypeBytes

func (c *ConnectRequest) ObtainTypeBytes() []byte

type ConnectRequestHandler

type ConnectRequestHandler interface {
	MessageHandler

	// DefaultConnectRequestHandle 收到 建立应用连接响应(CONNECT-Response)
	// 参数:
	// addr 逻辑地址
	// req connectRequest
	// ti 时间信息域
	// 返回值:
	// vendorCode          厂商代码
	// softwareVersion     软件版本号
	// softwareVersionDate 软件版本日期
	// hardwareVersion     硬件版本号
	// hardwareVersionDate 硬件版本日期
	// vendorExtension     厂商扩展信息
	// protocolVersion     商定的协议版本号
	// result 		      认证结果
	DefaultConnectRequestHandle(addr string, req *ConnectRequest, ti *dt.TimeTag, pid byte) (vendorCode, softwareVersion, softwareVersionDate, hardwareVersion, hardwareVersionDate, vendorExtension string, protocolVersion uint16, result byte)

	CustomConnectRequestHandle(addr string, req *ConnectRequest, pid byte) *DLT698Protocol
}

ConnectRequestHandler 处理请求建立应用连接(CONNECT-Request)

type ConnectResponse

type ConnectResponse struct {
	VendorCode                 []byte //厂商代码
	SoftwareVersion            []byte //软件版本号
	SoftwareVersionDate        []byte //软件版本日期
	HardwareVersion            []byte //硬件版本号
	HardwareVersionDate        []byte //硬件版本日期
	VendorExtension            []byte //厂商扩展信息
	ProtocolVersion            uint16 //商定的协议版本号
	ProtocolConformance        []byte //期望的协议一致性块
	FunctionConformance        []byte //期望的功能一致性块
	ServerSendMaxSize          uint16 //服务器发送帧最大尺寸
	ServerReceiveMaxSize       uint16 //服务器接收帧最大尺寸
	ServerReceiveMaxWindowSize byte   //服务器接收帧最大窗口尺寸
	ServerCanHandleMaxSize     uint16 //服务器最大可处理帧尺寸
	ConnectTimeOut             uint32 //期望的应用连接超时时间
	ConnectResult              byte   //认证结果
	RN                         []byte //服务器随机数
	Signature                  []byte //服务器签名
}

ConnectResponse 建立应用连接响应,CONNECT-Response

func NewConnectResponseAPDU

func NewConnectResponseAPDU(vendorCode, softwareVersion, softwareVersionDate, hardwareVersion, hardwareVersionDate, vendorExtension string, protocolVersion uint16, result byte) *ConnectResponse

func (*ConnectResponse) Decode

func (c *ConnectResponse) Decode(buf *bytes.Reader) error

func (*ConnectResponse) Encode

func (c *ConnectResponse) Encode() ([]byte, error)

func (*ConnectResponse) HasPid

func (c *ConnectResponse) HasPid() bool

func (*ConnectResponse) NeedFollowReport

func (c *ConnectResponse) NeedFollowReport() bool

func (*ConnectResponse) NeedTimeTag

func (c *ConnectResponse) NeedTimeTag() bool

func (*ConnectResponse) ObtainBaseType

func (c *ConnectResponse) ObtainBaseType() byte

func (*ConnectResponse) ObtainType

func (c *ConnectResponse) ObtainType() string

func (*ConnectResponse) ObtainTypeBytes

func (c *ConnectResponse) ObtainTypeBytes() []byte

type ConnectResponseHandler

type ConnectResponseHandler interface {
	// ConnectResponseHandle 收到建立应用连接响应(CONNECT-Response)
	// 参数:
	// addr 逻辑地址
	// resp 收到建立应用连接响应
	// fr 跟随上报信息域
	// ti 时间标签域
	ConnectResponseHandle(addr string, resp *ConnectResponse, fr *dt.FollowReport, ti *dt.TimeTag, pid byte)
}

type ControlRegion

type ControlRegion struct {
	Dir      string //传输方向位: bit7=0 表示此帧是由客户机发出的;bit7=1 表示此帧是由服务器发出的
	Prm      string //启动标志位:bit6=0 表示此帧是由服务器发起的;bit6=1 表示此帧是由客户机发起的
	Framing  string //分帧标志
	Sc       string //扰码标志
	FuncCode string //功能码
}

ControlRegion 控制域

type DLT698Protocol

type DLT698Protocol struct {
	Control *ControlRegion //控制域
	Address *AddressRegion //地址域
	Apdu    *APDU
	// contains filtered or unexported fields
}

DLT698Protocol dlt698.45结构体

func NewConnectResponse

func NewConnectResponse(termAddr, vendorCode, softwareVersion, softwareVersionDate, hardwareVersion, hardwareVersionDate, vendorExtension string, protocolVersion uint16, result byte, pid byte) *DLT698Protocol

func NewDLT698Protocol

func NewDLT698Protocol(control *ControlRegion, addr *AddressRegion, apdu *APDU) (*DLT698Protocol, error)

NewDLT698Protocol 创建一个报文体

func NewLinkResponseByResult

func NewLinkResponseByResult(termAddr string, pid byte, requestTime time.Time, result byte) *DLT698Protocol

NewLinkResponseByResult 创建一个预连接响应 termAddr 终端地址 pid requestTime 请求时间

func (*DLT698Protocol) Decode

func (d *DLT698Protocol) Decode(frame []byte) error

Decode 解码

func (*DLT698Protocol) DecodeBuf

func (d *DLT698Protocol) DecodeBuf(buf *bufio.Reader) error

DecodeBuf 解码

func (*DLT698Protocol) DecodeStr

func (d *DLT698Protocol) DecodeStr(frame string) error

DecodeStr 解码

func (*DLT698Protocol) Encode

func (d *DLT698Protocol) Encode() ([]byte, error)

Encode 编码

func (*DLT698Protocol) ObtainSnap

func (d *DLT698Protocol) ObtainSnap() []byte

type DLT698TCPClient

type DLT698TCPClient struct {
	*Dlt698TCPDispatcher

	AutoConnect bool //自动重连,默认true
	// contains filtered or unexported fields
}

func NewDLT698TCPClient

func NewDLT698TCPClient(clientAddr string, serverIp string, serverPort int, connectTimeout, writeTimeout time.Duration) (*DLT698TCPClient, error)

NewDLT698TCPClient 新建一个DLT698的TCP客户端 clientAddr 客户端地址 serverIp 服务端IP serverPort 服务端端口号 connectTimeout 连接超时 writeTimeout 写超时

func (*DLT698TCPClient) Close

func (d *DLT698TCPClient) Close()

func (*DLT698TCPClient) Connect

func (d *DLT698TCPClient) Connect()

Connect 发起连接

func (*DLT698TCPClient) IsConnected

func (d *DLT698TCPClient) IsConnected() bool

func (*DLT698TCPClient) Send

func (d *DLT698TCPClient) Send(frame []byte) (int, error)

Send 发送

type Dlt698TCPDispatcher

type Dlt698TCPDispatcher struct {
	LinkBusHandler            LinkBusHandler             //连接状态通知和判定的回调
	LinkRequestHandle         LinkRequestHandler         //预连接请求(LINK-Request)的回调
	LinkResponseHandle        LinkResponseHandler        //预连接响应(LINK-Response)的回调
	ConnectRequestHandle      ConnectRequestHandler      //建立应用连接响应(CONNECT-Response)的回调
	ConnectResponseHandle     ConnectResponseHandler     //建立应用连接响应(CONNECT-Response)的回调
	ReleaseRequestHandle      ReleaseRequestHandler      //请求断开应用连接(RELEASE-Request)的回调
	ReleaseResponseHandle     ReleaseResponseHandler     //请求断开应用连接响应(RELEASE-Response)的回调
	ReleaseNotificationHandle ReleaseNotificationHandler //断开应用连接通知(RELEASE-Notification)的回调
	GetRequestHandle          GetRequestHandler          //请求读取(GET-Request)的回调
	GetResponseHandle         GetResponseHandler         //响应读取(GET-Response)的回调
	SetRequestHandle          SetRequestHandler          //设置请求(SET-Request)的回调
	SetResponseHandle         SetResponseHandler         //响应设置(SET-Response)的回调
	ActionRequestHandle       ActionRequestHandler       //请求操作一个对象方法(ActionRequestNormal)的回调
	ActionResponseHandle      ActionResponseHandler      //响应操作(ACTION-Response)的回调
	ReportNotificationHandle  ReportNotificationHandler  //通知上报(REPORT-Notification)的回调
	ReportResponseHandle      ReportResponseHandler      //响应上报(REPORT-Response)的回调
	ProxyRequestHandle        ProxyRequestHandler        //请求代理(PROXY-Request)的回调
	ProxyResponseHandle       ProxyResponseHandler       //响应代理(PROXY-Response)的回调
	SecurityRequestHandle     SecurityRequestHandler     //请求安全传输(SECURITY-Request)的回调
	SecurityResponseHandle    SecurityResponseHandler    //响应安全传输(SECURITY-Response)的回调
	ErrorResponseHandle       ErrorResponseHandler       //响应异常(ERROR-Response)的回调
	// contains filtered or unexported fields
}

Dlt698TCPDispatcher 分发器

type ErrorResponse

type ErrorResponse struct {
	Code byte
}

func (*ErrorResponse) Decode

func (e *ErrorResponse) Decode(buf *bytes.Reader) error

func (*ErrorResponse) Encode

func (e *ErrorResponse) Encode() ([]byte, error)

func (*ErrorResponse) HasPid

func (e *ErrorResponse) HasPid() bool

func (*ErrorResponse) NeedFollowReport

func (e *ErrorResponse) NeedFollowReport() bool

func (*ErrorResponse) NeedTimeTag

func (e *ErrorResponse) NeedTimeTag() bool

func (*ErrorResponse) ObtainBaseType

func (e *ErrorResponse) ObtainBaseType() byte

func (*ErrorResponse) ObtainType

func (e *ErrorResponse) ObtainType() string

func (*ErrorResponse) ObtainTypeBytes

func (e *ErrorResponse) ObtainTypeBytes() []byte

type ErrorResponseHandler

type ErrorResponseHandler interface {
	ErrorResponseHandle(addr string, code byte, pid byte)
}

type GetRequest

type GetRequest struct {
	// contains filtered or unexported fields
}

GetRequest 请求读取 GET-Request

func NewGetRequestMD5APDU

func NewGetRequestMD5APDU(oad [4]byte) *GetRequest

NewGetRequestMD5APDU 创建请求读取一个对象属性MD5值的apdu

func NewGetRequestNextAPDU

func NewGetRequestNextAPDU(nextNumber uint16) *GetRequest

NewGetRequestNextAPDU 创建请求读取分帧传输的下一帧的APDU

func NewGetRequestNormalAPDU

func NewGetRequestNormalAPDU(oad [4]byte) *GetRequest

NewGetRequestNormalAPDU 创建一个GetRequestNormal的APDU

func NewGetRequestNormalListAPDU

func NewGetRequestNormalListAPDU(oad ...[4]byte) (*GetRequest, error)

NewGetRequestNormalListAPDU 建一个GetRequestNormalList的apdu

func NewGetRequestRecordAPDU

func NewGetRequestRecordAPDU(gt *dt.GetRecord) (*GetRequest, error)

func NewGetRequestRecordListAPDU

func NewGetRequestRecordListAPDU(gt ...*dt.GetRecord) (*GetRequest, error)

NewGetRequestRecordListAPDU 创建若干请求读取一个记录型对象属性的APDU

func (*GetRequest) Decode

func (g *GetRequest) Decode(buf *bytes.Reader) error

func (*GetRequest) Encode

func (g *GetRequest) Encode() ([]byte, error)

func (*GetRequest) HasPid

func (g *GetRequest) HasPid() bool

func (*GetRequest) NeedFollowReport

func (g *GetRequest) NeedFollowReport() bool

func (*GetRequest) NeedTimeTag

func (g *GetRequest) NeedTimeTag() bool

func (*GetRequest) ObtainBaseType

func (g *GetRequest) ObtainBaseType() byte

func (*GetRequest) ObtainGetRequestMD5

func (g *GetRequest) ObtainGetRequestMD5() ([4]byte, error)

ObtainGetRequestMD5 获取读取一个对象属性MD5值

func (*GetRequest) ObtainGetRequestNext

func (g *GetRequest) ObtainGetRequestNext() (uint16, error)

ObtainGetRequestNext 获取请求读取分帧传输的下一帧

func (*GetRequest) ObtainGetRequestNormalListOAD

func (g *GetRequest) ObtainGetRequestNormalListOAD() ([][4]byte, error)

ObtainGetRequestNormalListOAD 获取请求读取若干个对象属性的OAD

func (*GetRequest) ObtainGetRequestNormalOAD

func (g *GetRequest) ObtainGetRequestNormalOAD() ([4]byte, error)

ObtainGetRequestNormalOAD 获取请求读取一个对象属性的OAD

func (*GetRequest) ObtainGetRequestRecord

func (g *GetRequest) ObtainGetRequestRecord() (*dt.GetRecord, error)

ObtainGetRequestRecord 获取一个记录型对象属性

func (*GetRequest) ObtainGetRequestRecordList

func (g *GetRequest) ObtainGetRequestRecordList() ([]*dt.GetRecord, error)

ObtainGetRequestRecordList 获取请求读取若干个记录型对象属性

func (*GetRequest) ObtainType

func (g *GetRequest) ObtainType() string

func (*GetRequest) ObtainTypeBytes

func (g *GetRequest) ObtainTypeBytes() []byte

type GetRequestHandler

type GetRequestHandler interface {
	MessageHandler

	// CustomGetRequestNormalHandle 收到请求读取一个对象属性(GetRequestNormal)
	// 参数:
	// addr 逻辑地址
	// oad
	// ti 时间标签域
	CustomGetRequestNormalHandle(addr string, oad [4]byte, ti *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultGetRequestNormalHandle(addr string, oad [4]byte, ti *dt.TimeTag, pid byte) dt.Data

	// CustomGetRequestNormalListHandle 收到请求读取若干个对象属性(GetRequestNormalList)
	// 参数:
	// addr 逻辑地址
	// oad
	// ti 时间标签域
	CustomGetRequestNormalListHandle(addr string, oad [][4]byte, ti *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultGetRequestNormalListHandle(addr string, oad [][4]byte, ti *dt.TimeTag, pid byte) []dt.Data

	// CustomGetRequestRecordHandle 收到请求读取一个记录型对象属性(GetRequestRecord)
	// 参数:
	// addr 逻辑地址
	// 对象属性描述符 OAD,
	// 记录行选择描述符 RSD,
	// 记录列选择描述符 RCSD
	CustomGetRequestRecordHandle(addr string, oad [4]byte, rsd *dt.RSD, rcsd *dt.RCSD, pid byte) *DLT698Protocol
	DefaultGetRequestRecordHandle(addr string, oad [4]byte, rsd *dt.RSD, rcsd *dt.RCSD, pid byte) *dt.AResultRecord

	// CustomGetRequestRecordListHandle 收到请求读取若干个记录型对象属性
	CustomGetRequestRecordListHandle(addr string, grs []*dt.GetRecord, ti *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultGetRequestRecordListHandle(addr string, grs []*dt.GetRecord, ti *dt.TimeTag, pid byte) []*dt.AResultRecord

	// CustomGetRequestNextHandle 收到请求读取分帧传输的下一帧
	CustomGetRequestNextHandle(addr string, next uint16, ti *dt.TimeTag, pid byte) *DLT698Protocol
	// DefaultGetRequestNextHandle
	// data 返回数据
	// endFrameFlag 末帧标志
	// frameIndex 分帧序号
	DefaultGetRequestNextHandle(addr string, next uint16, ti *dt.TimeTag, pid byte) (data any, endFrameFlag byte, frameIndex uint16)

	CustomGetRequestMD5Handle(addr string, oad [4]byte, ti *dt.TimeTag, pid byte) *DLT698Protocol
	// DefaultGetRequestMD5Handle md5 如果为空,则使用dar
	DefaultGetRequestMD5Handle(addr string, oad [4]byte, ti *dt.TimeTag, pid byte) (MD5 string, dar byte)
}

type GetResponse

type GetResponse struct {
	// contains filtered or unexported fields
}

GetResponse 响应读取 GET-Response

func NewGetResponseMD5APDU

func NewGetResponseMD5APDU(oad [4]byte, md5 string) *GetResponse

NewGetResponseMD5APDU 创建一个响应读取对象属性MD5值的APDU

func NewGetResponseMD5ByDarAPDU

func NewGetResponseMD5ByDarAPDU(oad [4]byte, dar byte) *GetResponse

NewGetResponseMD5ByDarAPDU 创建一个响应读取对象属性MD5值的错误报文的apdu

func NewGetResponseNextByAResultNormalAPDU

func NewGetResponseNextByAResultNormalAPDU(endFrameFlag byte, frameIndex uint16, arn ...*dt.AResultNormal) (*GetResponse, error)

NewGetResponseNextByAResultNormalAPDU 创建响应读取分帧传输的下一帧的A-ResultNormal的APDU

func NewGetResponseNextByAResultRecordAPDU

func NewGetResponseNextByAResultRecordAPDU(endFrameFlag byte, frameIndex uint16, arn ...*dt.AResultRecord) (*GetResponse, error)

NewGetResponseNextByAResultRecordAPDU 创建响应读取分帧传输的下一帧的A-ResultRecord的APDU endFrameFlag 末帧标志 frameIndex 分帧序号 arn

func NewGetResponseNextByDarAPDU

func NewGetResponseNextByDarAPDU(endFrameFlag byte, frameIndex uint16, dar byte) *GetResponse

NewGetResponseNextByDarAPDU 创建响应读取分帧传输的下一帧的错误报文的APDU endFrameFlag 末帧标志 frameIndex 分帧序号 dar 错误信息

func NewGetResponseNormalByDarAPDU

func NewGetResponseNormalByDarAPDU(oad [4]byte, dar byte) *GetResponse

NewGetResponseNormalByDarAPDU 建一个响应读取一个对象属性的报文, 返回错误数据 apdu

func NewGetResponseNormalByDataAPDU

func NewGetResponseNormalByDataAPDU(oad [4]byte, data dt.Data) (*GetResponse, error)

func NewGetResponseNormalListAPDU

func NewGetResponseNormalListAPDU(result ...*dt.AResultNormal) (*GetResponse, error)

NewGetResponseNormalListAPDU 创建响应读取若干个对象属性的APDU

func NewGetResponseRecordAPDU

func NewGetResponseRecordAPDU(record *dt.AResultRecord) (*GetResponse, error)

NewGetResponseRecordAPDU 创建响应读取一个记录型对象属性的报文的APDU

func NewGetResponseRecordListAPDU

func NewGetResponseRecordListAPDU(record ...*dt.AResultRecord) (*GetResponse, error)

NewGetResponseRecordListAPDU 创建一个响应读取若干个记录型对象属性的报文APDU

func (*GetResponse) Decode

func (g *GetResponse) Decode(buf *bytes.Reader) error

func (*GetResponse) Encode

func (g *GetResponse) Encode() ([]byte, error)

func (*GetResponse) HasPid

func (g *GetResponse) HasPid() bool

func (*GetResponse) NeedFollowReport

func (g *GetResponse) NeedFollowReport() bool

func (*GetResponse) NeedTimeTag

func (g *GetResponse) NeedTimeTag() bool

func (*GetResponse) ObtainBaseType

func (g *GetResponse) ObtainBaseType() byte

func (*GetResponse) ObtainGetResponseMD5

func (g *GetResponse) ObtainGetResponseMD5() (dar *dt.DAR, md5 string, err error)

func (*GetResponse) ObtainGetResponseNext

func (g *GetResponse) ObtainGetResponseNext() (endFrameFlag byte, frameIndex uint16, resultType byte, err error)

func (*GetResponse) ObtainGetResponseNextWithAResultNormal

func (g *GetResponse) ObtainGetResponseNextWithAResultNormal() (result []*dt.AResultNormal, err error)

func (*GetResponse) ObtainGetResponseNextWithAResultRecord

func (g *GetResponse) ObtainGetResponseNextWithAResultRecord() (result []*dt.AResultRecord, err error)

func (*GetResponse) ObtainGetResponseNextWithDAR

func (g *GetResponse) ObtainGetResponseNextWithDAR() (dar *dt.DAR, err error)

func (*GetResponse) ObtainGetResponseNormal

func (g *GetResponse) ObtainGetResponseNormal() (*dt.AResultNormal, error)

func (*GetResponse) ObtainGetResponseNormalList

func (g *GetResponse) ObtainGetResponseNormalList() ([]*dt.AResultNormal, error)

func (*GetResponse) ObtainGetResponseRecord

func (g *GetResponse) ObtainGetResponseRecord() (*dt.AResultRecord, error)

func (*GetResponse) ObtainGetResponseRecordList

func (g *GetResponse) ObtainGetResponseRecordList() ([]*dt.AResultRecord, error)

func (*GetResponse) ObtainType

func (g *GetResponse) ObtainType() string

func (*GetResponse) ObtainTypeBytes

func (g *GetResponse) ObtainTypeBytes() []byte

type GetResponseHandler

type GetResponseHandler interface {
	// GetResponseNormalHandle 收到响应读取一个对象属性(GetResponseNormal)的数据
	// addr
	// oad
	// data 有可能是正经数据,有可能是dar
	// report 跟随上报信息域
	// ti 时间标签域
	// pid
	GetResponseNormalHandle(addr string, oad [4]byte, data dt.Data, report *dt.FollowReport, ti *dt.TimeTag, pid byte)

	// GetResponseNormalListHandle 收到响应读取若干个对象属性(GetResponseNormalList)的数据
	// addr
	// list若干个对象属性及结果
	// report 跟随上报信息域
	// ti 时间标签域
	// pid
	GetResponseNormalListHandle(addr string, list []*dt.AResultNormal, report *dt.FollowReport, tag *dt.TimeTag, pid byte)

	// GetResponseRecordHandle 收到响应读取一个记录型对象属性
	// addr
	// oad
	// rcsd
	// data 有可能是正经数据,有可能是dar
	// report 跟随上报信息域
	// ti 时间标签域
	// pid
	GetResponseRecordHandle(addr string, oad [4]byte, rcsd *dt.RCSD, data dt.Data, report *dt.FollowReport, tag *dt.TimeTag, pid byte)

	GetResponseRecordListHandle(addr string, list []*dt.AResultRecord, report *dt.FollowReport, tag *dt.TimeTag, pid byte)

	// GetResponseNextHandle 收到响应读取分帧传输的下一帧
	// addr
	// endFlag 末帧标志
	// index 分帧序号
	// dar 错误信息,可能为nil
	// rns 对象属性 可能为nil
	// rrs 记录型对象属性 可能为nil
	// report 跟随上报信息域
	// ti 时间标签域
	// pid
	GetResponseNextHandle(addr string, endFlag byte, index uint16, dar *dt.DAR, rns []*dt.AResultNormal, rrs []*dt.AResultRecord, report *dt.FollowReport, tag *dt.TimeTag, pid byte)

	// GetResponseMD5Handle 收到响应读取对象属性MD5值(GetResponseMD5)的数据
	// addr
	// dar 错误信息,可能为nil
	// md5 可能为空
	// report 跟随上报信息域
	// ti 时间标签域
	// pid
	GetResponseMD5Handle(addr string, dar *dt.DAR, md5 string, report *dt.FollowReport, tag *dt.TimeTag, pid byte)
}

type LinkBusHandler

type LinkBusHandler interface {
	ConnectLoseHandle(err error)                      //连接失败的回调
	ConnectedHandle(localAddr string)                 //连接成功的回调
	CheckToReConnectHandle(err error) bool            //校验错误判定是否需要重连
	SendMsgRecordHandle(addr string, frame []byte)    //发送报文的记录回调
	ReceiveMsgRecordHandle(addr string, frame []byte) //发送报文的记录回调
	// BusinessErrorHandle 业务错误的回调
	// businessName 业务名称
	// addr 逻辑地址
	// err 错误类型
	// received 收到的报文
	// send 回复或发送的报文
	BusinessErrorHandle(businessName string, addr string, received, send []byte, err error)
}

LinkBusHandler 连接状态通知和判定的回调

type LinkRequest

type LinkRequest struct {
	LinkRequestType byte   //登录 (0),心跳 (1),退出登录 (2)
	CardiacCycle    uint16 //心跳周期
	RequestTime     *dt.DateTime
}

LinkRequest 预连接请求

func NewLinkRequestAPDU

func NewLinkRequestAPDU(linkRequestType byte, cardiacCycle uint16) *LinkRequest

NewLinkRequestAPDU 创建一个预连接请求的APDU

func (*LinkRequest) Decode

func (l *LinkRequest) Decode(buf *bytes.Reader) error

func (*LinkRequest) Encode

func (l *LinkRequest) Encode() ([]byte, error)

func (*LinkRequest) HasPid

func (l *LinkRequest) HasPid() bool

func (*LinkRequest) NeedFollowReport

func (l *LinkRequest) NeedFollowReport() bool

func (*LinkRequest) NeedTimeTag

func (l *LinkRequest) NeedTimeTag() bool

func (*LinkRequest) ObtainBaseType

func (l *LinkRequest) ObtainBaseType() byte

func (*LinkRequest) ObtainType

func (l *LinkRequest) ObtainType() string

func (*LinkRequest) ObtainTypeBytes

func (l *LinkRequest) ObtainTypeBytes() []byte

type LinkRequestHandler

type LinkRequestHandler interface {
	MessageHandler

	// DefaultLinkRequestHandle 收到预连接请求
	// 参数:
	// conn 客户端连接通道
	// addr 客户端逻辑地址
	// linkType 请求类型:0-登录,1-心跳,2-退出登录
	// heartBeatCycle 心跳周期, 单位:秒
	// requestTime 请求时间
	// 返回值:
	// clock 时钟是否可信
	// result 结果,0:成功,1:地址重复,2:非法设备,3:容量不足
	DefaultLinkRequestHandle(conn net.Conn, addr string, linkType byte, heartBeatCycle uint16, requestTime time.Time, pid byte) (clock bool, result byte)

	CustomLinkRequestHandle(conn net.Conn, addr string, linkType byte, heartBeatCycle uint16, requestTime time.Time, pid byte) *DLT698Protocol
}

LinkRequestHandler 处理预连接请求

type LinkResponse

type LinkResponse struct {
	Result       byte         //结果
	RequestTime  *dt.DateTime //请求时间
	ReceivedTime *dt.DateTime //收到时间
	ResponseTime *dt.DateTime //响应时间
}

func NewLinkResponseAPDU

func NewLinkResponseAPDU(requestTime time.Time, result byte) *LinkResponse

NewLinkResponseAPDU 创建一个预连接响应的APDU

func (*LinkResponse) ClockTrustedFlag

func (l *LinkResponse) ClockTrustedFlag() bool

ClockTrustedFlag 获取时钟可信标志——用于表示响应方的时钟是否可信 return true-可信,false-不可信

func (*LinkResponse) Decode

func (l *LinkResponse) Decode(buf *bytes.Reader) error

func (*LinkResponse) Encode

func (l *LinkResponse) Encode() ([]byte, error)

func (*LinkResponse) HasPid

func (l *LinkResponse) HasPid() bool

func (*LinkResponse) NeedFollowReport

func (l *LinkResponse) NeedFollowReport() bool

func (*LinkResponse) NeedTimeTag

func (l *LinkResponse) NeedTimeTag() bool

func (*LinkResponse) ObtainBaseType

func (l *LinkResponse) ObtainBaseType() byte

func (*LinkResponse) ObtainType

func (l *LinkResponse) ObtainType() string

func (*LinkResponse) ObtainTypeBytes

func (l *LinkResponse) ObtainTypeBytes() []byte

func (*LinkResponse) ResponseResult

func (l *LinkResponse) ResponseResult() byte

ResponseResult 获取bit0~bit2组成的结果

type LinkResponseHandler

type LinkResponseHandler interface {

	// LinkResponseHandle 收到预连接响应(LINK-Response)
	// addr 服务端逻辑地址
	// clock 时钟是否可信
	// result 结果,0:成功,1:地址重复,2:非法设备,3:容量不足
	// requestTime 请求时间
	// receivedTime 收到时间
	// responseTime 响应时间
	LinkResponseHandle(addr string, clock bool, result byte, requestTime time.Time, receivedTime time.Time, responseTime time.Time, pid byte)
}

LinkResponseHandler 处理预连接响应(LINK-Response)

type MessageHandler

type MessageHandler interface {
	// UseCustomHandleMethod 是否使用自定义方法
	// 如果返回false,就调用Default开头的方法;如果返回true,就使用Custom开头的方法
	UseCustomHandleMethod() bool
}

type ProxyActionRequestListAPDU

type ProxyActionRequestListAPDU struct {
	// contains filtered or unexported fields
}

ProxyActionRequestListAPDU 请求代理操作若干个服务器的若干个对象方法(ProxyActionRequestList)的数据类型

func (*ProxyActionRequestListAPDU) Decode

func (p *ProxyActionRequestListAPDU) Decode(buf *bytes.Reader) error

func (*ProxyActionRequestListAPDU) Encode

func (p *ProxyActionRequestListAPDU) Encode() ([]byte, error)

func (*ProxyActionRequestListAPDU) ObtainType

func (p *ProxyActionRequestListAPDU) ObtainType() byte

func (*ProxyActionRequestListAPDU) ObtainValue

func (p *ProxyActionRequestListAPDU) ObtainValue() (timeout uint16, data []*ProxyActionRequestListItem)

type ProxyActionRequestListItem

type ProxyActionRequestListItem struct {
	// contains filtered or unexported fields
}

func NewProxyActionRequestListItem

func NewProxyActionRequestListItem(serverAddr string, timeout uint16, item ...*ActionRequestItem) *ProxyActionRequestListItem

func (*ProxyActionRequestListItem) ObtainValue

func (p *ProxyActionRequestListItem) ObtainValue() (addr string, timeout uint16, data []*ActionRequestItem, err error)

type ProxyActionResponseListAPDU

type ProxyActionResponseListAPDU struct {
	// contains filtered or unexported fields
}

ProxyActionResponseListAPDU 响应代理操作若干个服务器的若干个对象方法(ProxyActionResponseList)的数据类型

func (*ProxyActionResponseListAPDU) Decode

func (*ProxyActionResponseListAPDU) Encode

func (p *ProxyActionResponseListAPDU) Encode() ([]byte, error)

func (*ProxyActionResponseListAPDU) ObtainType

func (p *ProxyActionResponseListAPDU) ObtainType() byte

func (*ProxyActionResponseListAPDU) ObtainValue

type ProxyActionResponseListItem

type ProxyActionResponseListItem struct {
	// contains filtered or unexported fields
}

func NewProxyActionResponseListItem

func NewProxyActionResponseListItem(tsa string, item ...*ActionResponseItem) *ProxyActionResponseListItem

func (*ProxyActionResponseListItem) ObtainValue

func (i *ProxyActionResponseListItem) ObtainValue() (serverAddr string, data []*ActionResponseItem, err error)

type ProxyGetRequestListAPDU

type ProxyGetRequestListAPDU struct {
	// contains filtered or unexported fields
}

ProxyGetRequestListAPDU 请求代理读取若干个服务器的若干个对象属性(ProxyGetRequestList)的数据类型

func (*ProxyGetRequestListAPDU) Decode

func (p *ProxyGetRequestListAPDU) Decode(buf *bytes.Reader) error

func (*ProxyGetRequestListAPDU) Encode

func (p *ProxyGetRequestListAPDU) Encode() ([]byte, error)

func (*ProxyGetRequestListAPDU) ObtainType

func (p *ProxyGetRequestListAPDU) ObtainType() byte

func (*ProxyGetRequestListAPDU) ObtainValue

func (p *ProxyGetRequestListAPDU) ObtainValue() (timeout uint16, items []*ProxyGetRequestListItem)

type ProxyGetRequestListItem

type ProxyGetRequestListItem struct {
	// contains filtered or unexported fields
}

func NewProxyGetRequestListItem

func NewProxyGetRequestListItem(tsa string, timeout uint16, oad ...[4]byte) *ProxyGetRequestListItem

func (*ProxyGetRequestListItem) ObtainValue

func (p *ProxyGetRequestListItem) ObtainValue() (addr string, timeout uint16, oads [][4]byte, err error)

ObtainValue 获取相关值

type ProxyGetRequestRecordAPDU

type ProxyGetRequestRecordAPDU struct {
	// contains filtered or unexported fields
}

ProxyGetRequestRecordAPDU 请求代理读取一个服务器的一个记录型对象属性(ProxyGetRequestRecord)的数据类型

func (*ProxyGetRequestRecordAPDU) Decode

func (p *ProxyGetRequestRecordAPDU) Decode(buf *bytes.Reader) error

func (*ProxyGetRequestRecordAPDU) Encode

func (p *ProxyGetRequestRecordAPDU) Encode() ([]byte, error)

func (*ProxyGetRequestRecordAPDU) ObtainType

func (p *ProxyGetRequestRecordAPDU) ObtainType() byte

func (*ProxyGetRequestRecordAPDU) ObtainValue

func (p *ProxyGetRequestRecordAPDU) ObtainValue() (timeout uint16, serverAddr string, oad [4]byte, rsd *dt.RSD, rcsd *dt.RCSD, err error)

type ProxyGetResponseListAPDU

type ProxyGetResponseListAPDU struct {
	// contains filtered or unexported fields
}

ProxyGetResponseListAPDU 响应代理读取若干个服务器的若干个对象属性(ProxyGetResponseList)的数据类型

func (*ProxyGetResponseListAPDU) Decode

func (p *ProxyGetResponseListAPDU) Decode(buf *bytes.Reader) error

func (*ProxyGetResponseListAPDU) Encode

func (p *ProxyGetResponseListAPDU) Encode() ([]byte, error)

func (*ProxyGetResponseListAPDU) ObtainType

func (p *ProxyGetResponseListAPDU) ObtainType() byte

func (*ProxyGetResponseListAPDU) ObtainValue

type ProxyGetResponseListItem

type ProxyGetResponseListItem struct {
	// contains filtered or unexported fields
}

func NewProxyGetResponseListItem

func NewProxyGetResponseListItem(serverAddr string, normal ...*dt.AResultNormal) *ProxyGetResponseListItem

func (*ProxyGetResponseListItem) Obtain

type ProxyGetResponseRecordAPDU

type ProxyGetResponseRecordAPDU struct {
	// contains filtered or unexported fields
}

ProxyGetResponseRecordAPDU 响应代理读取一个服务器的一个记录型对象属性(ProxyGetResponseRecord)的数据类型

func (*ProxyGetResponseRecordAPDU) Decode

func (p *ProxyGetResponseRecordAPDU) Decode(buf *bytes.Reader) error

func (*ProxyGetResponseRecordAPDU) Encode

func (p *ProxyGetResponseRecordAPDU) Encode() ([]byte, error)

func (*ProxyGetResponseRecordAPDU) ObtainType

func (p *ProxyGetResponseRecordAPDU) ObtainType() byte

func (*ProxyGetResponseRecordAPDU) ObtainValue

func (p *ProxyGetResponseRecordAPDU) ObtainValue() (tsa string, record *dt.AResultRecord, err error)

type ProxyRequest

type ProxyRequest struct {
	// contains filtered or unexported fields
}

ProxyRequest 请求代理(PROXY-Request)的数据类型

func NewProxyActionRequestListAPDU

func NewProxyActionRequestListAPDU(timeout uint16, item ...*ProxyActionRequestListItem) *ProxyRequest

NewProxyActionRequestListAPDU 请求代理操作若干个服务器的若干个对象方法(ProxyActionRequestList)的APDU

func NewProxyActionThenGetRequestListAPDU

func NewProxyActionThenGetRequestListAPDU(timeout uint16, item ...*ProxyActionRequestListItem) *ProxyRequest

NewProxyActionThenGetRequestListAPDU 请求代理操作后读取若干个服务器的若干个对象方法和属性(ProxyActionThenGetRequestList)的APDU

func NewProxyGetRequestListAPDU

func NewProxyGetRequestListAPDU(timeout uint16, item ...*ProxyGetRequestListItem) *ProxyRequest

NewProxyGetRequestListAPDU 请求代理读取若干个服务器的若干个对象属性(ProxyGetRequestList)的APDU

func NewProxyGetRequestRecordAPDU

func NewProxyGetRequestRecordAPDU(timeout uint16, serverAddr string, oad [4]byte, rsd *dt.RSD, rcsd *dt.RCSD) *ProxyRequest

NewProxyGetRequestRecordAPDU 请求代理读取一个服务器的一个记录型对象属性(ProxyGetRequestRecord)的APDU

func NewProxySetRequestListAPDU

func NewProxySetRequestListAPDU(timeout uint16, item ...*ProxySetRequestListItem) *ProxyRequest

NewProxySetRequestListAPDU 请求代理设置若干个服务器的若干个对象属性(ProxySetRequestList)的APDU

func NewProxySetThenGetRequestListAPDU

func NewProxySetThenGetRequestListAPDU(timeout uint16, item ...*ProxySetRequestListItem) *ProxyRequest

NewProxySetThenGetRequestListAPDU 请求代理设置后读取若干个服务器的若干个对象属性(ProxySetThenGetRequestList)的APDU

func NewProxyTransCommandRequestAPDU

func NewProxyTransCommandRequestAPDU(oad [4]byte, comDCB *dt.COMDCB, frameTimeout uint16, byteTimeout uint16, cmd string) *ProxyRequest

NewProxyTransCommandRequestAPDU 请求代理操作透明转发(ProxyTransCommandRequest)的APDU

func (*ProxyRequest) Decode

func (p *ProxyRequest) Decode(buf *bytes.Reader) error

func (*ProxyRequest) Encode

func (p *ProxyRequest) Encode() ([]byte, error)

func (*ProxyRequest) HasPid

func (p *ProxyRequest) HasPid() bool

func (*ProxyRequest) NeedFollowReport

func (p *ProxyRequest) NeedFollowReport() bool

func (*ProxyRequest) NeedTimeTag

func (p *ProxyRequest) NeedTimeTag() bool

func (*ProxyRequest) ObtaiProxySetThenGetRequestList

func (p *ProxyRequest) ObtaiProxySetThenGetRequestList() (timeout uint16, item []*ProxySetRequestListItem, err error)

ObtaiProxySetThenGetRequestList 请求代理设置后读取若干个服务器的若干个对象属性(ProxySetThenGetRequestList)的参数

func (*ProxyRequest) ObtainBaseType

func (p *ProxyRequest) ObtainBaseType() byte

func (*ProxyRequest) ObtainProxyActionRequestList

func (p *ProxyRequest) ObtainProxyActionRequestList() (timeout uint16, item []*ProxyActionRequestListItem, err error)

func (*ProxyRequest) ObtainProxyActionThenGetRequestList

func (p *ProxyRequest) ObtainProxyActionThenGetRequestList() (timeout uint16, item []*ProxyActionRequestListItem, err error)

ObtainProxyActionThenGetRequestList 获取请求代理操作后读取若干个服务器的若干个对象方法和属性(ProxyActionThenGetRequestList)的参数

func (*ProxyRequest) ObtainProxyGetRequestList

func (p *ProxyRequest) ObtainProxyGetRequestList() (timeout uint16, items []*ProxyGetRequestListItem, err error)

ObtainProxyGetRequestList 获取请求代理读取若干个服务器的若干个对象属性(ProxyGetRequestList)的参数

func (*ProxyRequest) ObtainProxyGetRequestRecord

func (p *ProxyRequest) ObtainProxyGetRequestRecord() (timeout uint16, serverAddr string, oad [4]byte, rsd *dt.RSD, rcsd *dt.RCSD, err error)

ObtainProxyGetRequestRecord 获取请求代理读取一个服务器的一个记录型对象属性(ProxyGetRequestRecord)的参数

func (*ProxyRequest) ObtainProxySetRequestList

func (p *ProxyRequest) ObtainProxySetRequestList() (timeout uint16, item []*ProxySetRequestListItem, err error)

ObtainProxySetRequestList 获取请求代理设置若干个服务器的若干个对象属性(ProxySetRequestList)的参数

func (*ProxyRequest) ObtainProxyTransCommandRequest

func (p *ProxyRequest) ObtainProxyTransCommandRequest() (oad [4]byte, comDCB *dt.COMDCB, frameTimeout uint16, byteTimeout uint16, cmd string, err error)

ObtainProxyTransCommandRequest 获取请求代理操作透明转发(ProxyTransCommandRequest)的参数

func (*ProxyRequest) ObtainType

func (p *ProxyRequest) ObtainType() string

func (*ProxyRequest) ObtainTypeBytes

func (p *ProxyRequest) ObtainTypeBytes() []byte

type ProxyRequestAPDU

type ProxyRequestAPDU interface {
	Decode(buf *bytes.Reader) error
	Encode() ([]byte, error)
	ObtainType() byte
}

type ProxyRequestHandler

type ProxyRequestHandler interface {
	MessageHandler
	// CustomProxyGetRequestListHandle 请求代理读取若干个服务器的若干个对象属性(ProxyGetRequestList)
	CustomProxyGetRequestListHandle(addr string, timeout uint16, items []*ProxyGetRequestListItem, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultProxyGetRequestListHandle(addr string, timeout uint16, items []*ProxyGetRequestListItem, tag *dt.TimeTag, pid byte) []*ProxyGetResponseListItem

	// CustomProxyGetRequestRecordHandle 请求代理读取一个服务器的一个记录型对象属性(ProxyGetRequestRecord)
	CustomProxyGetRequestRecordHandle(addr string, timeout uint16, tsa string, oad [4]byte, rsd *dt.RSD, rcsd *dt.RCSD, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultProxyGetRequestRecordHandle(addr string, timeout uint16, tsa string, oad [4]byte, rsd *dt.RSD, rcsd *dt.RCSD, tag *dt.TimeTag, pid byte) *dt.AResultRecord

	// CustomProxySetRequestListHandle 请求代理设置若干个服务器的若干个对象属性(ProxySetRequestList)
	CustomProxySetRequestListHandle(addr string, timeout uint16, items []*ProxySetRequestListItem, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultProxySetRequestListHandle(addr string, timeout uint16, items []*ProxySetRequestListItem, tag *dt.TimeTag, pid byte) []*ProxySetResponseListItem

	// CustomProxySetThenGetRequestListHandle 响应代理设置后读取若干个服务器的若干个对象属性(ProxySetThenGetResponseList)
	CustomProxySetThenGetRequestListHandle(addr string, timeout uint16, item []*ProxySetRequestListItem, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultProxySetThenGetRequestListHandle(addr string, timeout uint16, item []*ProxySetRequestListItem, tag *dt.TimeTag, pid byte) []*ProxySetResponseListItem

	// CustomProxyActionRequestListHandle 响应代理操作若干个服务器的若干个对象方法(ProxyActionResponseList)
	CustomProxyActionRequestListHandle(addr string, timeout uint16, items []*ProxyActionRequestListItem, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultProxyActionRequestListHandle(addr string, timeout uint16, items []*ProxyActionRequestListItem, tag *dt.TimeTag, pid byte) []*ProxyActionResponseListItem

	// CustomProxyActionThenGetRequestListHandle 请求代理操作后读取若干个服务器的若干个对象方法和属性(ProxyActionThenGetRequestList)
	CustomProxyActionThenGetRequestListHandle(addr string, timeout uint16, items []*ProxyActionRequestListItem, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultProxyActionThenGetRequestListHandle(addr string, timeout uint16, items []*ProxyActionRequestListItem, tag *dt.TimeTag, pid byte) []*ProxyActionResponseListItem

	// CustomProxyTransCommandRequestHandle 请求代理操作透明转发(ProxyTransCommandRequest)的数据类型
	CustomProxyTransCommandRequestHandle(addr string, oad [4]byte, comDCB *dt.COMDCB, frameTimeout uint16, byteTimeout uint16, cmd string, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultProxyTransCommandRequestHandle(addr string, oad [4]byte, comDCB *dt.COMDCB, frameTimeout uint16, byteTimeout uint16, cmd string, tag *dt.TimeTag, pid byte) dt.Data
}

type ProxyResponse

type ProxyResponse struct {
	// contains filtered or unexported fields
}

ProxyResponse 响应代理(PROXY-Response)的数据类型

func NewProxyActionResponseListAPDU

func NewProxyActionResponseListAPDU(item ...*ProxyActionResponseListItem) *ProxyResponse

NewProxyActionResponseListAPDU 响应代理操作若干个服务器的若干个对象方法(ProxyActionResponseList)的APDU

func NewProxyActionThenGetResponseListAPDU

func NewProxyActionThenGetResponseListAPDU(item ...*ProxyActionResponseListItem) *ProxyResponse

NewProxyActionThenGetResponseListAPDU 响应代理操作后读取若干个服务器的若干个对象方法和属性(ProxyActionThenGetResponseList)的APDU

func NewProxyGetResponseListAPDU

func NewProxyGetResponseListAPDU(data ...*ProxyGetResponseListItem) *ProxyResponse

NewProxyGetResponseListAPDU 响应代理读取若干个服务器的若干个对象属性(ProxyGetResponseList)的APDU

func NewProxyGetResponseRecordAPDU

func NewProxyGetResponseRecordAPDU(serverAddr string, record *dt.AResultRecord) *ProxyResponse

NewProxyGetResponseRecordAPDU 响应代理读取一个服务器的一个记录型对象属性(ProxyGetResponseRecord)的APDU

func NewProxySetResponseListAPDU

func NewProxySetResponseListAPDU(item ...*ProxySetResponseListItem) *ProxyResponse

NewProxySetResponseListAPDU 响应代理设置若干个服务器的若干个对象属性(ProxySetResponseList)的APDU

func NewProxySetThenGetResponseListAPDU

func NewProxySetThenGetResponseListAPDU(item ...*ProxySetResponseListItem) *ProxyResponse

NewProxySetThenGetResponseListAPDU 响应代理设置后读取若干个服务器的若干个对象属性(ProxySetThenGetResponseList)的APDU

func NewProxyTransCommandResponseAPDUByDAR

func NewProxyTransCommandResponseAPDUByDAR(oad [4]byte, dar byte) *ProxyResponse

NewProxyTransCommandResponseAPDUByDAR 响应代理操作透明转发命令(ProxyTransCommandResponse)的APDU

func NewProxyTransCommandResponseAPDUByData

func NewProxyTransCommandResponseAPDUByData(oad [4]byte, data string) *ProxyResponse

NewProxyTransCommandResponseAPDUByData 响应代理操作透明转发命令(ProxyTransCommandResponse)的APDU

func (*ProxyResponse) Decode

func (p *ProxyResponse) Decode(buf *bytes.Reader) error

func (*ProxyResponse) Encode

func (p *ProxyResponse) Encode() ([]byte, error)

func (*ProxyResponse) HasPid

func (p *ProxyResponse) HasPid() bool

func (*ProxyResponse) NeedFollowReport

func (p *ProxyResponse) NeedFollowReport() bool

func (*ProxyResponse) NeedTimeTag

func (p *ProxyResponse) NeedTimeTag() bool

func (*ProxyResponse) ObtainBaseType

func (p *ProxyResponse) ObtainBaseType() byte

func (*ProxyResponse) ObtainProxyActionResponseList

func (p *ProxyResponse) ObtainProxyActionResponseList() (item []*ProxyActionResponseListItem, err error)

func (*ProxyResponse) ObtainProxyActionThenGetResponseList

func (p *ProxyResponse) ObtainProxyActionThenGetResponseList() (item []*ProxyActionResponseListItem, err error)

func (*ProxyResponse) ObtainProxyGetResponseList

func (p *ProxyResponse) ObtainProxyGetResponseList() (data []*ProxyGetResponseListItem, err error)

func (*ProxyResponse) ObtainProxyGetResponseRecord

func (p *ProxyResponse) ObtainProxyGetResponseRecord() (serverAddr string, recoed *dt.AResultRecord, err error)

ObtainProxyGetResponseRecord 响应代理读取一个服务器的一个记录型对象属性(ProxyGetResponseRecord)的参数

func (*ProxyResponse) ObtainProxySetResponseList

func (p *ProxyResponse) ObtainProxySetResponseList() ([]*ProxySetResponseListItem, error)

ObtainProxySetResponseList 响应代理设置若干个服务器的若干个对象属性(ProxySetResponseList)的参数

func (*ProxyResponse) ObtainProxySetThenGetResponseList

func (p *ProxyResponse) ObtainProxySetThenGetResponseList() ([]*ProxySetResponseListItem, error)

ObtainProxySetThenGetResponseList 响应代理设置后读取若干个服务器的若干个对象属性(ProxySetThenGetResponseList)的参数

func (*ProxyResponse) ObtainProxyTransCommandResponse

func (p *ProxyResponse) ObtainProxyTransCommandResponse() (oad [4]byte, dar byte, data string, isDar bool, err error)

func (*ProxyResponse) ObtainType

func (p *ProxyResponse) ObtainType() string

func (*ProxyResponse) ObtainTypeBytes

func (p *ProxyResponse) ObtainTypeBytes() []byte

type ProxyResponseAPDU

type ProxyResponseAPDU interface {
	Decode(buf *bytes.Reader) error
	Encode() ([]byte, error)
	ObtainType() byte
}

func NewProxyResponseAPDU

func NewProxyResponseAPDU(proxyType byte) ProxyResponseAPDU

type ProxyResponseHandler

type ProxyResponseHandler interface {
	ProxyGetResponseListHandle(addr string, items []*ProxyGetResponseListItem, tag *dt.TimeTag, report *dt.FollowReport, pid byte)

	ProxyGetResponseRecordHandle(addr string, serverAddr string, record *dt.AResultRecord, tag *dt.TimeTag, report *dt.FollowReport, pid byte)

	ProxySetResponseListHandle(addr string, items []*ProxySetResponseListItem, tag *dt.TimeTag, report *dt.FollowReport, pid byte)

	ProxySetThenGetResponseListHandle(addr string, items []*ProxySetResponseListItem, tag *dt.TimeTag, report *dt.FollowReport, pid byte)

	ProxyActionResponseListHandle(addr string, item []*ProxyActionResponseListItem, tag *dt.TimeTag, report *dt.FollowReport, pid byte)
	ProxyActionThenGetResponseListHandle(addr string, item []*ProxyActionResponseListItem, tag *dt.TimeTag, report *dt.FollowReport, pid byte)
	ProxyTransCommandResponseHandle(addr string, oad [4]byte, isDarResult bool, dar2 byte, data string, tag *dt.TimeTag, report *dt.FollowReport, pid byte)
}

type ProxySetRequestListAPDU

type ProxySetRequestListAPDU struct {
	// contains filtered or unexported fields
}

ProxySetRequestListAPDU 请求代理设置若干个服务器的若干个对象属性(ProxySetRequestList)的数据类型

func (*ProxySetRequestListAPDU) Decode

func (p *ProxySetRequestListAPDU) Decode(buf *bytes.Reader) error

func (*ProxySetRequestListAPDU) Encode

func (p *ProxySetRequestListAPDU) Encode() ([]byte, error)

func (*ProxySetRequestListAPDU) ObtainType

func (p *ProxySetRequestListAPDU) ObtainType() byte

func (*ProxySetRequestListAPDU) ObtainValue

func (p *ProxySetRequestListAPDU) ObtainValue() (timeout uint16, data []*ProxySetRequestListItem)

type ProxySetRequestListItem

type ProxySetRequestListItem struct {
	// contains filtered or unexported fields
}

func NewProxySetRequestListItem

func NewProxySetRequestListItem(serverAddr string, timeout uint16, item ...*SetRequestItem) *ProxySetRequestListItem

func (*ProxySetRequestListItem) Decode

func (p *ProxySetRequestListItem) Decode(buf *bytes.Reader, flag bool) error

func (*ProxySetRequestListItem) Encode

func (p *ProxySetRequestListItem) Encode(flag bool) ([]byte, error)

func (*ProxySetRequestListItem) ObtainValue

func (p *ProxySetRequestListItem) ObtainValue() (addr string, timeout uint16, data []*SetRequestItem, err error)

type ProxySetResponseListAPDU

type ProxySetResponseListAPDU struct {
	// contains filtered or unexported fields
}

ProxySetResponseListAPDU 响应代理设置若干个服务器的若干个对象属性(ProxySetResponseList)的数据类型

func (*ProxySetResponseListAPDU) Decode

func (p *ProxySetResponseListAPDU) Decode(buf *bytes.Reader) error

func (*ProxySetResponseListAPDU) Encode

func (p *ProxySetResponseListAPDU) Encode() ([]byte, error)

func (*ProxySetResponseListAPDU) ObtainType

func (p *ProxySetResponseListAPDU) ObtainType() byte

func (*ProxySetResponseListAPDU) ObtainValue

type ProxySetResponseListItem

type ProxySetResponseListItem struct {
	// contains filtered or unexported fields
}

func NewProxySetResponseListItem

func NewProxySetResponseListItem(tsa string, item ...*SetResponseItem) *ProxySetResponseListItem

func (*ProxySetResponseListItem) ObtainValue

func (i *ProxySetResponseListItem) ObtainValue() (serverAddr string, data []*SetResponseItem, err error)

type ProxyTransCommandRequestAPDU

type ProxyTransCommandRequestAPDU struct {
	// contains filtered or unexported fields
}

ProxyTransCommandRequestAPDU 请求代理操作透明转发(ProxyTransCommandRequest)的数据类型

func (*ProxyTransCommandRequestAPDU) Decode

func (*ProxyTransCommandRequestAPDU) Encode

func (p *ProxyTransCommandRequestAPDU) Encode() ([]byte, error)

func (*ProxyTransCommandRequestAPDU) ObtainType

func (p *ProxyTransCommandRequestAPDU) ObtainType() byte

func (*ProxyTransCommandRequestAPDU) ObtainValue

func (p *ProxyTransCommandRequestAPDU) ObtainValue() (oad [4]byte, comDCB *dt.COMDCB, frameTimeout uint16, byteTimeout uint16, cmd string, err error)

type ProxyTransCommandResponseAPDU

type ProxyTransCommandResponseAPDU struct {
	// contains filtered or unexported fields
}

ProxyTransCommandResponseAPDU 响应代理操作透明转发命令(ProxyTransCommandResponse)的数据类型

func (*ProxyTransCommandResponseAPDU) Decode

func (*ProxyTransCommandResponseAPDU) Encode

func (p *ProxyTransCommandResponseAPDU) Encode() ([]byte, error)

func (*ProxyTransCommandResponseAPDU) IsDARResult

func (p *ProxyTransCommandResponseAPDU) IsDARResult() bool

func (*ProxyTransCommandResponseAPDU) ObtainType

func (p *ProxyTransCommandResponseAPDU) ObtainType() byte

func (*ProxyTransCommandResponseAPDU) ObtainValue

func (p *ProxyTransCommandResponseAPDU) ObtainValue() ([4]byte, byte, string, error)

type ReleaseNotification

type ReleaseNotification struct {
	LinkTime   *dt.DateTimeS
	ServerTime *dt.DateTimeS
}

ReleaseNotification 断开应用连接通知 RELEASE-Notification

func NewReleaseNotificationAPDU

func NewReleaseNotificationAPDU(linkTime time.Time) *ReleaseNotification

NewReleaseNotificationAPDU 构建一个断开应用连接通知的APDU

func (*ReleaseNotification) Decode

func (r *ReleaseNotification) Decode(buf *bytes.Reader) error

func (*ReleaseNotification) Encode

func (r *ReleaseNotification) Encode() ([]byte, error)

func (*ReleaseNotification) HasPid

func (r *ReleaseNotification) HasPid() bool

func (*ReleaseNotification) NeedFollowReport

func (r *ReleaseNotification) NeedFollowReport() bool

func (*ReleaseNotification) NeedTimeTag

func (r *ReleaseNotification) NeedTimeTag() bool

func (*ReleaseNotification) ObtainBaseType

func (r *ReleaseNotification) ObtainBaseType() byte

func (*ReleaseNotification) ObtainType

func (r *ReleaseNotification) ObtainType() string

func (*ReleaseNotification) ObtainTypeBytes

func (r *ReleaseNotification) ObtainTypeBytes() []byte

type ReleaseNotificationHandler

type ReleaseNotificationHandler interface {
	// ReleaseNotificationHandle 收到断开应用连接通知(RELEASE-Notification)
	// 参数:
	// addr 逻辑地址
	// linkTime 应用连接建立时间
	// serverTime 服务器当前时间
	// fr 跟随上报信息域
	// ti 时间标签域
	ReleaseNotificationHandle(addr string, linkTime, serverTime time.Time, fr *dt.FollowReport, ti *dt.TimeTag, pid byte)
}

type ReleaseRequest

type ReleaseRequest struct{}

ReleaseRequest 断开应用连接 RELEASE-Request

func NewReleaseRequestAPDU

func NewReleaseRequestAPDU() *ReleaseRequest

NewReleaseRequestAPDU 构建一个断开应用连接的APDU

func (*ReleaseRequest) Decode

func (r *ReleaseRequest) Decode(_ *bytes.Reader) error

func (*ReleaseRequest) Encode

func (r *ReleaseRequest) Encode() ([]byte, error)

func (*ReleaseRequest) HasPid

func (r *ReleaseRequest) HasPid() bool

func (*ReleaseRequest) NeedFollowReport

func (r *ReleaseRequest) NeedFollowReport() bool

func (*ReleaseRequest) NeedTimeTag

func (r *ReleaseRequest) NeedTimeTag() bool

func (*ReleaseRequest) ObtainBaseType

func (r *ReleaseRequest) ObtainBaseType() byte

func (*ReleaseRequest) ObtainType

func (r *ReleaseRequest) ObtainType() string

func (*ReleaseRequest) ObtainTypeBytes

func (r *ReleaseRequest) ObtainTypeBytes() []byte

type ReleaseRequestHandler

type ReleaseRequestHandler interface {
	// ReleaseRequestHandle 收到请求断开应用连接(RELEASE-Request)
	// 参数:
	// addr 逻辑地址
	// ti 时间标签域
	ReleaseRequestHandle(addr string, ti *dt.TimeTag, pid byte)
}

type ReleaseResponse

type ReleaseResponse struct {
	Result byte //结果
}

ReleaseResponse 断开应用连接响应 RELEASE-Response

func NewReleaseResponseAPDU

func NewReleaseResponseAPDU(result byte) *ReleaseResponse

NewReleaseResponseAPDU 构建一个断开应用连接响应的APDU

func (*ReleaseResponse) Decode

func (r *ReleaseResponse) Decode(buf *bytes.Reader) error

func (*ReleaseResponse) Encode

func (r *ReleaseResponse) Encode() ([]byte, error)

func (*ReleaseResponse) HasPid

func (r *ReleaseResponse) HasPid() bool

func (*ReleaseResponse) NeedFollowReport

func (r *ReleaseResponse) NeedFollowReport() bool

func (*ReleaseResponse) NeedTimeTag

func (r *ReleaseResponse) NeedTimeTag() bool

func (*ReleaseResponse) ObtainBaseType

func (r *ReleaseResponse) ObtainBaseType() byte

func (*ReleaseResponse) ObtainType

func (r *ReleaseResponse) ObtainType() string

func (*ReleaseResponse) ObtainTypeBytes

func (r *ReleaseResponse) ObtainTypeBytes() []byte

type ReleaseResponseHandler

type ReleaseResponseHandler interface {
	// ReleaseResponseHandle 收到断开应用连接响应 [131] RELEASE-Response
	// 参数:
	// addr 逻辑地址
	// result 响应结果
	// fr 跟随上报信息域
	// ti 时间标签域
	ReleaseResponseHandle(addr string, result byte, fr *dt.FollowReport, ti *dt.TimeTag, pid byte)
}

type ReportNotification

type ReportNotification struct {
	// contains filtered or unexported fields
}

ReportNotification 通知上报(REPORT-Notification)的数据类型

func NewReportNotificationListAPDU

func NewReportNotificationListAPDU(normal ...*dt.AResultNormal) *ReportNotification

NewReportNotificationListAPDU 创建通知上报若干个对象属性(ReportNotificationList)的APDU

func NewReportNotificationRecordListAPDU

func NewReportNotificationRecordListAPDU(record ...*dt.AResultRecord) *ReportNotification

NewReportNotificationRecordListAPDU 创建通知上报若干个记录型对象属性(ReportNotificationRecordList)的APDU

func NewReportNotificationTransDataAPDU

func NewReportNotificationTransDataAPDU(oad [4]byte, str ...string) *ReportNotification

NewReportNotificationTransDataAPDU 创建通知上报透明数据(ReportNotificationTransData)的APDU

func (*ReportNotification) Decode

func (r *ReportNotification) Decode(buf *bytes.Reader) error

func (*ReportNotification) Encode

func (r *ReportNotification) Encode() ([]byte, error)

func (*ReportNotification) HasPid

func (r *ReportNotification) HasPid() bool

func (*ReportNotification) NeedFollowReport

func (r *ReportNotification) NeedFollowReport() bool

func (*ReportNotification) NeedTimeTag

func (r *ReportNotification) NeedTimeTag() bool

func (*ReportNotification) ObtainBaseType

func (r *ReportNotification) ObtainBaseType() byte

func (*ReportNotification) ObtainReportNotificationList

func (r *ReportNotification) ObtainReportNotificationList() ([]*dt.AResultNormal, error)

ObtainReportNotificationList 获取通知上报若干个对象属性(ReportNotificationList)的数据

func (*ReportNotification) ObtainReportNotificationRecordList

func (r *ReportNotification) ObtainReportNotificationRecordList() ([]*dt.AResultRecord, error)

ObtainReportNotificationRecordList 获取通知上报若干个记录型对象属性(ReportNotificationRecordList)的数据

func (*ReportNotification) ObtainReportNotificationTransData

func (r *ReportNotification) ObtainReportNotificationTransData() ([]string, error)

ObtainReportNotificationTransData 获取通知上报透明数据(ReportNotificationTransData)的数据

func (*ReportNotification) ObtainType

func (r *ReportNotification) ObtainType() string

func (*ReportNotification) ObtainTypeBytes

func (r *ReportNotification) ObtainTypeBytes() []byte

type ReportNotificationHandler

type ReportNotificationHandler interface {
	// ReportNotificationListHandle 收到通知上报若干个对象属性(ReportNotificationList)的数据类型
	ReportNotificationListHandle(addr string, normals []*dt.AResultNormal, report *dt.FollowReport, tag *dt.TimeTag, pid byte)
	// ReportNotificationRecordListHandle 收到通知上报若干个记录型对象属性(ReportNotificationRecordList)的数据
	ReportNotificationRecordListHandle(addr string, normals []*dt.AResultRecord, report *dt.FollowReport, tag *dt.TimeTag, pid byte)
	// ReportNotificationTransDataHandle 收到通知上报透明数据(ReportNotificationTransData)的数据
	ReportNotificationTransDataHandle(addr string, through []string, report *dt.FollowReport, tag *dt.TimeTag, pid byte)
}

type ReportResponse

type ReportResponse struct {
	// contains filtered or unexported fields
}

ReportResponse 响应上报(REPORT-Response)的数据类型

func NewReportResponseListAPDU

func NewReportResponseListAPDU(oad ...[4]byte) *ReportResponse

NewReportResponseListAPDU 构建一个响应上报若干个对象属性(ReportResponseList)的APDU

func NewReportResponseRecordListAPDU

func NewReportResponseRecordListAPDU(oad ...[4]byte) *ReportResponse

NewReportResponseRecordListAPDU 创建一个响应上报若干个记录型对象属性(ReportResponseRecordList)的APDU

func NewReportResponseTransDataAPDU

func NewReportResponseTransDataAPDU() *ReportResponse

NewReportResponseTransDataAPDU 创建响应上报透明数据(ReportResponseTransData)的APDU

func (*ReportResponse) Decode

func (r *ReportResponse) Decode(buf *bytes.Reader) error

func (*ReportResponse) Encode

func (r *ReportResponse) Encode() ([]byte, error)

func (*ReportResponse) HasPid

func (r *ReportResponse) HasPid() bool

func (*ReportResponse) NeedFollowReport

func (r *ReportResponse) NeedFollowReport() bool

func (*ReportResponse) NeedTimeTag

func (r *ReportResponse) NeedTimeTag() bool

func (*ReportResponse) ObtainBaseType

func (r *ReportResponse) ObtainBaseType() byte

func (*ReportResponse) ObtainOAD

func (r *ReportResponse) ObtainOAD() ([][4]byte, error)

ObtainOAD 获取OAD

func (*ReportResponse) ObtainType

func (r *ReportResponse) ObtainType() string

func (*ReportResponse) ObtainTypeBytes

func (r *ReportResponse) ObtainTypeBytes() []byte

type ReportResponseHandler

type ReportResponseHandler interface {
	// ReportResponseListHandle 响应上报若干个对象属性(ReportResponseList)的数据类型
	ReportResponseListHandle(addr string, oads [][4]byte, tag *dt.TimeTag, pid byte)
	// ReportResponseRecordListHandle 响应上报若干个记录型对象属性(ReportResponseRecordList)的数据类型
	ReportResponseRecordListHandle(addr string, oads [][4]byte, tag *dt.TimeTag, pid byte)
	// ReportResponseTransDataHadnle 响应上报透明数据(ReportResponseTransData)的数据类型
	ReportResponseTransDataHadnle(addr string, tag *dt.TimeTag, pid byte)
}

type SecurityRequest

type SecurityRequest struct {
	// contains filtered or unexported fields
}

SecurityRequest 请求安全传输(SECURITY-Request)的数据类型

func NewSecurityRequestAPDU

func NewSecurityRequestAPDU(dataUintType byte, dataUnit string, parity dt.Data) (*SecurityRequest, error)

func (*SecurityRequest) Decode

func (s *SecurityRequest) Decode(buf *bytes.Reader) error

func (*SecurityRequest) Encode

func (s *SecurityRequest) Encode() ([]byte, error)

func (*SecurityRequest) HasPid

func (s *SecurityRequest) HasPid() bool

func (*SecurityRequest) NeedFollowReport

func (s *SecurityRequest) NeedFollowReport() bool

func (*SecurityRequest) NeedTimeTag

func (s *SecurityRequest) NeedTimeTag() bool

func (*SecurityRequest) ObtainBaseType

func (s *SecurityRequest) ObtainBaseType() byte

func (*SecurityRequest) ObtainDataUnit

func (s *SecurityRequest) ObtainDataUnit() (duType byte, du string, err error)

ObtainDataUnit 获取应用数据单元

func (*SecurityRequest) ObtainParity

func (s *SecurityRequest) ObtainParity() (parityType byte, parity dt.Data, err error)

ObtainParity 获取数据验证信息

func (*SecurityRequest) ObtainType

func (s *SecurityRequest) ObtainType() string

func (*SecurityRequest) ObtainTypeBytes

func (s *SecurityRequest) ObtainTypeBytes() []byte

type SecurityRequestHandler

type SecurityRequestHandler interface {
	SecurityRequestHandle(addr string, unitType byte, unit string, parityType byte, parity dt.Data) (dataUnitType byte, dataUnit dt.Data, mac *dt.MAC)
}

type SecurityResponse

type SecurityResponse struct {
	Mac *dt.MAC
	// contains filtered or unexported fields
}

SecurityResponse 响应安全传输(SECURITY-Response)的数据类型

func NewSecurityResponseAPDU

func NewSecurityResponseAPDU(dataUnitType byte, dataUnit dt.Data, mac *dt.MAC) *SecurityResponse

func (*SecurityResponse) Decode

func (s *SecurityResponse) Decode(buf *bytes.Reader) error

func (*SecurityResponse) Encode

func (s *SecurityResponse) Encode() ([]byte, error)

func (*SecurityResponse) HasPid

func (s *SecurityResponse) HasPid() bool

func (*SecurityResponse) NeedFollowReport

func (s *SecurityResponse) NeedFollowReport() bool

func (*SecurityResponse) NeedTimeTag

func (s *SecurityResponse) NeedTimeTag() bool

func (*SecurityResponse) ObtainBaseType

func (s *SecurityResponse) ObtainBaseType() byte

func (*SecurityResponse) ObtainType

func (s *SecurityResponse) ObtainType() string

func (*SecurityResponse) ObtainTypeBytes

func (s *SecurityResponse) ObtainTypeBytes() []byte

type SecurityResponseHandler

type SecurityResponseHandler interface {
	SecurityResponseHandle(addr string, unitType byte, unit dt.Data, mac *dt.MAC)
}

type SetRequest

type SetRequest struct {
	// contains filtered or unexported fields
}

SetRequest 设置请求SET-Request

func NewSetRequestNormalAPDU

func NewSetRequestNormalAPDU(oad [4]byte, data dt.Data) (*SetRequest, error)

NewSetRequestNormalAPDU 创建一个请求设置一个对象属性的APDU

func NewSetRequestNormalListAPDU

func NewSetRequestNormalListAPDU(items ...*SetRequestItem) (*SetRequest, error)

NewSetRequestNormalListAPDU 请求设置若干个对象属性(NewSetRequestNormalListAPDU)的APDU

func NewSetThenGetRequestNormalListAPDU

func NewSetThenGetRequestNormalListAPDU(items ...*SetRequestItem) (*SetRequest, error)

func (*SetRequest) Decode

func (s *SetRequest) Decode(buf *bytes.Reader) error

func (*SetRequest) Encode

func (s *SetRequest) Encode() ([]byte, error)

func (*SetRequest) HasPid

func (s *SetRequest) HasPid() bool

func (*SetRequest) NeedFollowReport

func (s *SetRequest) NeedFollowReport() bool

func (*SetRequest) NeedTimeTag

func (s *SetRequest) NeedTimeTag() bool

func (*SetRequest) ObtainBaseType

func (s *SetRequest) ObtainBaseType() byte

func (*SetRequest) ObtainSetRequestNormal

func (s *SetRequest) ObtainSetRequestNormal() (oad [4]byte, data dt.Data, err error)

ObtainSetRequestNormal 获取请求设置一个对象属性(SetRequestNormal)的数据

func (*SetRequest) ObtainSetRequestNormalList

func (s *SetRequest) ObtainSetRequestNormalList() ([]*SetRequestItem, error)

ObtainSetRequestNormalList 获取请求设置若干个对象属性(SetRequestNormalList)的数据

func (*SetRequest) ObtainSetThenGetRequestNormalList

func (s *SetRequest) ObtainSetThenGetRequestNormalList() ([]*SetRequestItem, error)

ObtainSetThenGetRequestNormalList 获取响应设置若干个对象属性以及读取若干个对象属性(SetThenGetResponseNormalList)的数据

func (*SetRequest) ObtainType

func (s *SetRequest) ObtainType() string

func (*SetRequest) ObtainTypeBytes

func (s *SetRequest) ObtainTypeBytes() []byte

type SetRequestHandler

type SetRequestHandler interface {
	MessageHandler
	// CustomSetRequestNormalHandle 收到请求设置一个对象属性(SetRequestNormal)的数据
	// addr
	// data
	// ti 时间标签域
	CustomSetRequestNormalHandle(addr string, oad [4]byte, data dt.Data, ti *dt.TimeTag, pid byte) *DLT698Protocol
	// DefaultSetRequestNormalHandle 收到请求设置一个对象属性(SetRequestNormal)的数据
	// 返回值为dar
	DefaultSetRequestNormalHandle(addr string, oad [4]byte, data dt.Data, ti *dt.TimeTag, pid byte) byte

	// CustomSetRequestNormalListHandle 收到请求设置若干个对象属性(SetRequestNormalList)的数据
	CustomSetRequestNormalListHandle(addr string, list []*SetRequestItem, tag *dt.TimeTag, pid byte) *DLT698Protocol

	// DefaultSetRequestNormalListHandle 收到请求设置若干个对象属性(SetRequestNormalList)的数据
	//返回值为dar集合,请保证顺序和oad一致
	DefaultSetRequestNormalListHandle(addr string, list []*SetRequestItem, tag *dt.TimeTag, pid byte) []byte

	// CustomSetThenGetRequestNormalListHandle 收到响应设置若干个对象属性以及读取若干个对象属性(SetThenGetResponseNormalList)的数据
	CustomSetThenGetRequestNormalListHandle(addr string, list []*SetRequestItem, tag *dt.TimeTag, pid byte) *DLT698Protocol
	DefaultSetThenGetRequestNormalListHandle(addr string, list []*SetRequestItem, tag *dt.TimeTag, pid byte) []*SetResponseItem
}

type SetRequestItem

type SetRequestItem struct {
	// contains filtered or unexported fields
}

func NewSetRequestNormalItem

func NewSetRequestNormalItem(oad [4]byte, data dt.Data) *SetRequestItem

NewSetRequestNormalItem 创建一个SetRequestNormal使用的设置参数

func NewSetThenGetRequestNormalItem

func NewSetThenGetRequestNormalItem(setOad [4]byte, data dt.Data, readOad [4]byte, delay byte) *SetRequestItem

NewSetThenGetRequestNormalItem 创建一个用于请求设置后读取若干个对象属性的一个数据结构 setOad 一个设置的对象属性 data 数据 readOad 一个读取的对象属性 delay 延时读取时间,单位:秒,0表示由服务器确定延时时间

func (*SetRequestItem) ObtainSetRequestNormal

func (s *SetRequestItem) ObtainSetRequestNormal() (oad [4]byte, data dt.Data)

ObtainSetRequestNormal 获取SetRequestNormal 或 SetRequestNormalList 的参数

func (*SetRequestItem) ObtainSetThenGetResponseNormalList

func (s *SetRequestItem) ObtainSetThenGetResponseNormalList() (setOad [4]byte, data dt.Data, readOad [4]byte, delay byte)

ObtainSetThenGetResponseNormalList 获取响应设置若干个对象属性以及读取若干个对象属性(SetThenGetResponseNormalList)的参数

type SetResponse

type SetResponse struct {
	// contains filtered or unexported fields
}

SetResponse 响应设置(SET-Response)

func NewSetResponseNormalAPDU

func NewSetResponseNormalAPDU(oad [4]byte, dar byte) *SetResponse

NewSetResponseNormalAPDU 创建设置一个对象属性的响应的APDU

func NewSetResponseNormalListAPDU

func NewSetResponseNormalListAPDU(item ...*SetResponseItem) *SetResponse

NewSetResponseNormalListAPDU 响应设置若干个对象属性(SetResponseNormalList)的APDU

func NewSetThenGetResponseNormalListAPDU

func NewSetThenGetResponseNormalListAPDU(item ...*SetResponseItem) *SetResponse

NewSetThenGetResponseNormalListAPDU 创建响应设置若干个对象属性以及读取若干个对象属性(SetThenGetResponseNormalList)的APDU

func (*SetResponse) Decode

func (s *SetResponse) Decode(buf *bytes.Reader) error

func (*SetResponse) Encode

func (s *SetResponse) Encode() ([]byte, error)

func (*SetResponse) HasPid

func (s *SetResponse) HasPid() bool

func (*SetResponse) NeedFollowReport

func (s *SetResponse) NeedFollowReport() bool

func (*SetResponse) NeedTimeTag

func (s *SetResponse) NeedTimeTag() bool

func (*SetResponse) ObtainBaseType

func (s *SetResponse) ObtainBaseType() byte

func (*SetResponse) ObtainSetResponseNormal

func (s *SetResponse) ObtainSetResponseNormal() (oad [4]byte, dar byte, err error)

ObtainSetResponseNormal 获取设置一个对象属性的响应的参数

func (*SetResponse) ObtainSetResponseNormalList

func (s *SetResponse) ObtainSetResponseNormalList() ([]*SetResponseItem, error)

ObtainSetResponseNormalList 获取响应设置若干个对象属性(SetResponseNormalList)的参数

func (*SetResponse) ObtainSetThenGetResponseNormalList

func (s *SetResponse) ObtainSetThenGetResponseNormalList() ([]*SetResponseItem, error)

func (*SetResponse) ObtainType

func (s *SetResponse) ObtainType() string

func (*SetResponse) ObtainTypeBytes

func (s *SetResponse) ObtainTypeBytes() []byte

type SetResponseHandler

type SetResponseHandler interface {
	SetResponseNormalHandle(addr string, oad [4]byte, dar byte, report *dt.FollowReport, tag *dt.TimeTag, pid byte)

	SetResponseNormalListHandle(addr string, list []*SetResponseItem, report *dt.FollowReport, tag *dt.TimeTag, pid byte)

	SetThenGetResponseNormalListHandle(addr string, list []*SetResponseItem, report *dt.FollowReport, tag *dt.TimeTag, pid byte)
}

type SetResponseItem

type SetResponseItem struct {
	// contains filtered or unexported fields
}

SetResponseItem setResponse的参数

func NewSetResponseItem

func NewSetResponseItem(oad [4]byte, dar byte, normal *dt.AResultNormal) *SetResponseItem

NewSetResponseItem 响应设置一个对象属性(SetResponseNormal)的数据

func (*SetResponseItem) ObtainSetResponseNormal

func (s *SetResponseItem) ObtainSetResponseNormal() (oad [4]byte, dar byte)

func (*SetResponseItem) ObtainSetThenGetResponseNormalList

func (s *SetResponseItem) ObtainSetThenGetResponseNormalList() (oad [4]byte, dar byte, normal *dt.AResultNormal)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址