Skip to content

Commit

Permalink
Merge pull request #2 from boschrexroth/feature/update1.18
Browse files Browse the repository at this point in the history
Feature/update1.18
  • Loading branch information
Johannes Albrecht committed Dec 9, 2022
2 parents a4ce95a + a2bd334 commit ff8cfa1
Show file tree
Hide file tree
Showing 208 changed files with 20,154 additions and 389 deletions.
26 changes: 23 additions & 3 deletions .env
@@ -1,4 +1,24 @@
# !!! not commit this file !!!
#replace '-' with ip address for your tests
# This file provides the setting of environment variables used for tests.
# It's content is read at the beginning of the test.
# If the values are not "-" the according environment variable is set with the configured value.
# If the environment variable was already set it will be overwritten.
#
# !!! Do not commit local changes of this file !!!
#

# CTRLX_ADDRESS - the IP address of the ctrlX uses for tests.
# Replace "-" with ...
# "192.168.1.1" if you use a ctrlX CORE virtual in Network Adapter mode (or ctrlX CORE with default IP address)
# "10.0.2.2" if you develop in an App Builder Environment (QEMU VM) and your ctrlX CORE virtual is running in Port Forwarding mode
# else enter the IP address of your ctrlX CORE e.g. "192.168.178.100"
CTRLX_ADDRESS="-"
CTRLX_TIMEOUT="-"

# CTRLX_SSL_PORT - the SSL port to be used to communicate with your ctrlX CORE.
# Replace "-" e.g. with 8443 if you use a ctrlX CORE virtual with Port Forwarding 8443:443
CTRLX_SSL_PORT="-"

# CTRLX_TIMEOUT - the connection timeout in ms.
# Set "30000" to be able to debug without timeouts.
CTRLX_TIMEOUT="-"

ALLDATA_PROVIDER="-"
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Expand Up @@ -24,29 +24,29 @@ jobs:
sudo apt-get update
sudo apt-get install -y libsystemd-dev libzmq3-dev
sudo apt install pkg-config
wget https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/1.16.0/ctrlx-datalayer-1.8.6.deb
sudo apt-get install -y -f ./ctrlx-datalayer-1.8.6.deb
wget https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/1.18.0/ctrlx-datalayer-1.9.1.deb
sudo apt-get install -y -f ./ctrlx-datalayer-1.9.1.deb
- name: Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18

- name: Test
run: |
go mod download
go mod vendor
go mod tidy
go test -race -short -count=1 -mod=vendor ./test/datalayer
go test -race -short -count=1 -mod=vendor ./test/datalayer ./test/sseclient ./test/token
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Run go test
run: |
ls -lah
go mod download
go mod vendor
go test -race -short -count=1 -mod=vendor ./test/datalayer
go test -race -short -count=1 -mod=vendor ./test/datalayer ./test/sseclient ./test/token
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -11,4 +11,4 @@ artifact.zip
.idea
.github
*-xx.zip
vendor
vendor
19 changes: 14 additions & 5 deletions Makefile
@@ -1,14 +1,15 @@
PROJECT_NAME := "ctrlx-datalayer-golang"
PKG := "github.com/boschrexroth/$(PROJECT_NAME)"
PKG_LIST := ./pkg/datalayer
TST_LIST := ./test/datalayer
PKG_LIST := ./pkg/datalayer ./pkg/sseclient ./pkg/token
COV_PKG_LIST := ./pkg/datalayer,./pkg/sseclient,./pkg/token
TST_LIST := ./test/datalayer ./test/sseclient ./test/token
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
BUILD := build/public/$(GOOS)_$(GOARCH)

DATALAYER_DEB_VERSION := 1.16.0
DATALAYER_DEB_FILE_VERSION := 1.8.6
DATALAYER_DEB_VERSION := 1.18.0
DATALAYER_DEB_FILE_VERSION := 1.9.1

.PHONY: all go-dep apt-dep lint vet test test-coverage build clean

Expand All @@ -34,8 +35,16 @@ vet: ## Run go vet
test: ## Run unittests
@go test -race -short -count=1 -mod=vendor $(TST_LIST)

memprofile: ## Run memory profiler
@go test -race -short -count=1 -mod=vendor $(TST_LIST) -memprofile mem.pprof -memprofilerate 1
@go tool pprof -http=:8080 mem.pprof

cpuprofile: ## Run cpu profiler
@go test -race -short -count=1 -mod=vendor $(TST_LIST) -cpuprofile cpu.pprof
@go tool pprof -http=:8080 cpu.pprof

testcover: ## Run unittests with coverage
@go test -race -short -count=1 -mod=vendor -coverpkg=$(PKG_LIST) -coverprofile=coverage.out -covermode=atomic $(TST_LIST)
@go test -race -short -count=1 -mod=vendor -coverpkg=$(COV_PKG_LIST) -coverprofile=coverage.out -covermode=atomic $(TST_LIST)

build: go-dep ## Build the samples
@CGO_ENABLED=1 go build -mod=vendor -o $(BUILD)/datalayer ./cmd/datalayer
Expand Down
31 changes: 26 additions & 5 deletions README.md
@@ -1,9 +1,30 @@
# ctrlX Data Layer client and provider library for golang

This project provides ctrlX Data Layer access via Golang.
It wraps the original ctrlX Data Layer written in C++.
This project provides:

1. ctrlX Data Layer access via Golang

Documentation and examples you can find here [ctrlX Software Development Kit](https://boschrexroth.github.io/ctrlx-automation-sdk/) and [GoDoc ](https://pkg.go.dev/github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer).
It wraps the original ctrlX Data Layer written in C++.

You can find documentation and examples here [ctrlX Software Development Kit](https://boschrexroth.github.io/ctrlx-automation-sdk/) and [GoDoc](https://pkg.go.dev/github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer).

2. Server-Sent Events(SSE) Client

Server-Sent Events is HTTP/HTTP2 common standard, the SSE server pushes the update to the client, the client receives automatic updates via HTTP connection.

ctrlX Data Layer provides a SSE Server, which makes the data on the Data Layer accessible to the web application.

The SSE client library can be used to connect to the SSE Server of the ctrlX Data Layer running on the ctrlX Device. It is possible to subscribe to nodes on the server and the server will automatically send new updates on value changes.

You can find documentation here [GoDoc](https://pkg.go.dev/github.com/boschrexroth/ctrlx-datalayer-golang/pkg/sseclient)

3. Token handling

JSON Web Token is used for authentification in ctrlX Core.

The token library can be used to get token from ctrlX Core and later on check if the token is still valid.

You can find documentation here [GoDoc](https://pkg.go.dev/github.com/boschrexroth/ctrlx-datalayer-golang/pkg/token)

## Status

Expand All @@ -23,8 +44,8 @@ sudo apt-get install libsystemd-dev libsystemd-dev:arm64 libzmq3-dev libzmq3-dev
Check the current [ctrlx Data Layer](https://github.com/boschrexroth/ctrlx-automation-sdk/releases) debian package, download and install this, see example.

```bash
wget https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/1.16.0/ctrlx-datalayer-1.8.6.deb
sudo dpkg -i ctrlx-datalayer-1.8.6.deb
wget https://github.com/boschrexroth/ctrlx-automation-sdk/releases/download/1.18.0/ctrlx-datalayer-1.9.1.deb
sudo dpkg -i ctrlx-datalayer-1.9.1.deb
```

### Integrate in you project
Expand Down

0 comments on commit ff8cfa1

Please sign in to comment.