Giter Site home page Giter Site logo

lib-secs2-hsms-go's Introduction

lib-secs2-hsms-go

An SECS-II/HSMS library written in go.

Users might need some knowledge on Go, SEMI Standards, and SECS Message Language (SML) to use this library.

Usage

  1. Install the library

    go get github.com/wolimst/lib-secs2-hsms-go
  2. Import the packages and use them

    Example: using the SECS-II parser

    import (
        "github.com/wolimst/lib-secs2-hsms-go/pkg/ast"
        "github.com/wolimst/lib-secs2-hsms-go/pkg/parser/sml"
    )
    
    func main() {
        messages, errors, warnings := sml.Parse("S1F1 W\n.")
        // ...
    }

Features

  1. Object representation of SECS-II/HSMS Message
  2. SML Parser
  3. HSMS Parser

Object representation of SECS-II/HSMS Message

SECS-II/HSMS messages can be represented using the objects implemented in this library.

The message and data item objects are implemented as following structure.
Multi-byte string data type such as JIS-8 is not supported currently.

HSMSMessage (Interface)
├── DataMessage
└── ControlMessage

ItemNode (Interface)
├── ASCIINode
├── BinaryNode
├── BooleanNode
├── FloatNode
├── IntNode
├── ListNode
└── UintNode

SML Parser

Parse SML format input string into DataMessage object.

Additional SML syntax

This library extends the default SML syntax, and support following additional syntax.
These additional syntax are optional; the default syntax can be parsed as well.

  1. Message direction (H->E, H<-E or H<->E) can be specified after the wait bit.

    Example:

    S1F1 W H->E
    .
    
  2. Message name can be specified after the message direction, or the wait bit if the message direction is not specified.
    Message name can be any unicode characters except the whitespace characters.

    Example:

    S1F1 W H->E AreYouThere?
    .
    
  3. Line comment
    Any text between // and the end of the line is ignored by the parser. // in ASCII quoted string is not a comment.

    Example:

    S1F13 W // This is comment
    <L[2]
      <A MDLN>
      <A "1.0.0 // This is not a comment">
    >
    .
    
  4. Arbitrary data item size

    Example:

    S5F11 W
    <L[4]
      <A[32] TIMESTAMP>  // size should be exactly 32 (SML default syntax)
      <A[5..20] EXID>    // size should be in range of 5..20 (SML default syntax)
      <A[..5] EXTYPE>    // size lower limit is 0, upper limit is 5
      <A[5..] EXMESSAGE> // size lower limit is 5, upper limit is not specified
    >
    .    
    

HSMS Parser

Parse HSMS byte sequence into DataMessage or ControlMessage object.

Example:
byte sequence 00 00 00 0A FF FF 00 00 00 05 FF FF FF FF will be parsed to a ControlMessage that represent linktest.req.

lib-secs2-hsms-go's People

Contributors

wolimst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lib-secs2-hsms-go's Issues

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.