Git Product home page Git Product logo

mtconnect-go's Introduction

mtconnect-go

mtconnect-go is a Go language library that provides an efficient way to work with the MTConnect standard. This library facilitates the generation of Go code from the XML Schema provided by various versions of MTConnect, enabling developers to easily integrate MTConnect data streams into their Go applications.

Features

  • Version-Specific Packages: mtconnect-go includes prepared packages for each version of the MTConnect standard, ensuring compatibility and ease of use across different versions.
  • Go Structs for XML Unmarshalling: All types are defined as Go structs, allowing for straightforward XML unmarshalling. This feature makes it simple to work with MTConnect data in Go applications.

Generate Codes

make codegen VERSION=2.1

Usage

To use mtconnect-go, simply import the package corresponding to the version of the MTConnect standard you are working with. Below is an example demonstrating how to use the library with the MTConnect v2.2 schema:

import (
  "encoding/xml"
  "net/http"
  "io"
  "github.com/innomic/mtconnect-go/schema/v2.2/mtstreams"
)

func main() {
    resp, err := http.Get("https://mtconnect.trakhound.com/current")
    if err != nil {
        // handle error
    }
    defer resp.Body.Close()

    respBodyBytes, err := io.ReadAll(resp.Body)
    if err != nil {
        // handle error
    }

    var unmarshalled mtstreams.MTConnectStreamsType
    err = xml.Unmarshal(respBodyBytes, &unmarshalled)
    if err != nil {
        // handle error
    }

    // Use unmarshalled data
}

Example Struct

Here is an example of a struct representing the MTConnectStreamsType, which can be unmarshalled from XML:

type MTConnectStreamsType struct {
    Header  *HeaderType  `xml:"Header"`
    Streams *StreamsType `xml:"Streams"`
}

Roadmap

  • Client SDK Development: Future plans include the development of a client SDK to streamline the process of connecting to MTConnect agents and retrieving data.
  • Adapter SDK Development: An adapter SDK is also on the roadmap, which will assist in the creation of MTConnect adapters for various types of equipment and data sources.

Contributing

Contributions to mtconnect-go are highly welcome! Whether it's improving the code, adding new features, or enhancing documentation, your input is valuable. Please feel free to fork the repository, make changes, and submit pull requests.

License

The XML schema is owned by MTConnect Institute.

mtconnect-go is licensed under the Apache License, Version 2.0, consistent with MTConnect schema's licensing.

Links

mtconnect-go's People

Contributors

civilizeddev avatar

Stargazers

 avatar  avatar  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.