Giter Site home page Giter Site logo

go-dlt645's Introduction

go dlt645(通过串口解析DLT/645协议(目前只支持07规约)可以很方便地与edgex foundry结合起来)

Supported formats

  • dlt645 Serial

Installation

Use go get.

    go get github.com/themeyic/go-dlt645

Then import the dlt645 package into your own code.

    import dlt "github.com/themeyic/go-dlt645"

Example

	调用ClientProvider的构造函数,返回结构体指针
	p := dlt.NewClientProvider()
	//windows 下面就是 com开头的,比如说 com3
	//mac OS/linux/unix  下面就是 /dev/下面的,比如说 dev/tty.usbserial-14320
	p.Address = "com3"
	p.BaudRate = 2400
	p.DataBits = 8
	p.Parity = "E"
	p.StopBits = 1
	p.Timeout = 100 * time.Millisecond

	client := dltcon.NewClient(p)
	client.LogMode(true)
	err := client.Start()
	if err != nil {
		fmt.Println("start err,", err)
		return
	}
	//MeterNumber是表号 005223440001
	//DataMarker是数据标识别 02010300
	test := &dlt.Dlt645ConfigClient{"005223440001", "02010300"}
	for {
		value, err := test.SendMessageToSerial(client)
		if err != nil {
			fmt.Println("readHoldErr,", err)
		} else {
			fmt.Printf("%#v\n", value)
		}
		time.Sleep(time.Second * 3)
	}

go-dlt645's People

Contributors

themeyic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.