Skip to content

devhub is a RESTful service that abstracts the protocols udp, tcp, vxi, modbus

License

Notifications You must be signed in to change notification settings

wactbprot/devhub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devhub


devhub is a RESTful service that abstracts the protocols:

to read out measurement devices. It

shell commands. Requests are POSTed via http in json format. Measurement data is returned in json format. devhub acts as a stub and returns predefined responses. The repository contains instructions to build a standalone version that runs on BSD, Linux, MacOS and Windows. devhub can be configured to use elasticsearch (els) as a log database.

Table of Contents

Features

  • Supported protocols:
    • UDP
    • TCP
    • VXI11
    • MODBUS
      • :ReadHoldingRegisters
      • :ReadInputRegisters
      • :ReadCoils
      • :ReadDiscreteInputs
      • :writeSingleRegister
    • EXECUTE
  • endpoints:
    • / (production)
    • /echo
    • /version
    • /stub
      • first
      • last
      • rand
  • :Value: "IDN?" or :Value: ["PR1?" "<ENQ>"]
  • pre-processing
    • javascript
    • python3
    • clojure
  • post-processing
    • javascript
    • python3
    • clojure
  • Searchable logs (elasticsearch, kibana)
  • linux, windows and macOS support

Data flow

request-response

Code documentation

The devhub documentation is build on push events with github actions.

Install instructions

See install instructions.

production endpoint

special endpoints

For convenience set:

H="Content-Type: application/json"
URL=http://localhost:9009/

stub [POST /stub]

devhub allows the configuration of predefined responses depending on the POSTed TaskName. These responses are stored in the resources/stub-response.edn file.

The default configuration for the stub endpoint is:

:stub {
     :mode :rand
     ;; ...
}

Examples for stub endpoint are:

No TaskName means :missing is selected in resources/stub-response.edn.

curl -H "$H" -d '{"Wait": 100 , "Repeat":10}' -X POST http://localhost:9009/stub --noproxy "*"

returns:

{
  "req-id": "1654439253784",
  "Repeat": 10,
  "stub": true,
  "_x": [
    "MEAS 23.1 C",
    "2e-3 Pa",
    "DCR +1.98779E-4",
    "MEAS 23.1 C",
    "foo",
    "MEAS 23.1 C",
    "#<;;:_-",
    "#<;;:_-",
    "123",
    "foo"
  ],
  "Value": [
    "no-value"
  ],
  "_t_start": [
    "1654439253784",
    "1654439253885",
    "1654439253985",
    "1654439254086",
    "1654439254186",
    "1654439254287",
    "1654439254387",
    "1654439254488",
    "1654439254588",
    "1654439254688"
  ],
  "Wait": 100,
  "select": "missing",
  "_t_stop": [
    "1654439253784",
    "1654439253885",
    "1654439253985",
    "1654439254086",
    "1654439254186",
    "1654439254287",
    "1654439254387",
    "1654439254488",
    "1654439254588",
    "1654439254689"
  ]
}

after 10x100ms=1s.

D = '{"TaskName":"IM540-read_out", "Wait":1 , "Repeat":10}'
curl -H "$H" -d "$D" -X POST http://localhost:9009/stub

version

Returns the current devhub version.

curl http://localhost:9009/version

## =>
## {"version":"0.6.375"}

whereby the last number gives the amount of commits on current branch.

echo

You get your request echoed.

curl -H "$H" -d '{"TaskName": "echo-test"}' -X POST http://localhost:9009/echo

## =>
## {"TaskName": "echo-test"}

notes

export JAVA_TOOL_OPTIONS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2

Next up

About

devhub is a RESTful service that abstracts the protocols udp, tcp, vxi, modbus

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published