datalayer

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Datalayer is used for configuration, parametrisation and diagnosis of control project.

*

  • MIT License *
  • Copyright (c) 2021-2022 Bosch Rexroth AG *
  • Permission is hereby granted, free of charge, to any person obtaining a copy
  • of this software and associated documentation files (the "Software"), to deal
  • in the Software without restriction, including without limitation the rights
  • to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  • copies of the Software, and to permit persons to whom the Software is
  • furnished to do so, subject to the following conditions: *
  • The above copyright notice and this permission notice shall be included in all
  • copies or substantial portions of the Software. *
  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  • IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  • FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  • AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  • LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  • OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  • SOFTWARE.

Index

Examples

Constants

View Source
const (
	// timeout to check whether to broker is still active when client is idle
	TimeoutSettingIdle = C.DLR_TIMEOUT_SETTING_IDLE
	// timeout to wait for a response for a request - it timeout exceeds request will be aborted with DL_TIMEOUT
	TimeoutSettingPing = C.DLR_TIMEOUT_SETTING_PING
	// timeout a reconnect attempt will be done if client looses connection to broker
	TimeoutSettingReconnect = C.DLR_TIMEOUT_SETTING_RECONNECT
)

TimeoutSetting enum definition

Variables

View Source
var EnumNamesReferenceType = map[ReferenceType]string{
	ReferenceTypeRead:     "readType",
	ReferenceTypeReadIn:   "readInType",
	ReferenceTypeReadOut:  "readOutType",
	ReferenceTypeWrite:    "writeType",
	ReferenceTypeWriteIn:  "writeInType",
	ReferenceTypeWriteOut: "writeOutType",
	ReferenceTypeCreate:   "createType",
	ReferenceTypeUses:     "uses",
	ReferenceTypeHasSave:  "hasSave",
}

EnumNamesReferenceType enum defintion

Functions

func DeleteBulk added in v1.2.0

func DeleteBulk(b *Bulk)

DeleteBulk destructs the bulk. It destroys the bulk.

func DeleteClient

func DeleteClient(c *Client)

DeleteClient destructs the client. It destroys the client.

func DeleteProvider

func DeleteProvider(p *Provider)

DeleteProvider deletes the provider instance.

func DeleteProviderNode

func DeleteProviderNode(n *ProviderNode)

DeleteProviderNode destructs the provider node.

func DeleteSystem

func DeleteSystem(d *System)

DeleteSystem removes a ctrlX Data Layer system. Parameter d is a system.

func DeleteVariant

func DeleteVariant(v *Variant)

DeleteVariant destroys the variant instance.

Types

type AllowedOperation added in v1.1.0

type AllowedOperation uint

AllowedOperation enum

const (
	AllowedOperationNone   AllowedOperation = 0x00000
	AllowedOperationRead   AllowedOperation = 0x00001
	AllowedOperationWrite  AllowedOperation = 0x00010
	AllowedOperationCreate AllowedOperation = 0x00100
	AllowedOperationDelete AllowedOperation = 0x01000
	AllowedOperationBrowse AllowedOperation = 0x10000
	AllowedOperationAll    AllowedOperation = AllowedOperationRead | AllowedOperationWrite | AllowedOperationCreate | AllowedOperationDelete | AllowedOperationBrowse
)

AllowedOperation enum defintion

type Bulk added in v1.2.0

type Bulk struct {
	Response []Response
	// contains filtered or unexported fields
}

Structure for bulk Function calls are combined into a single call

func (*Bulk) Browse added in v1.2.0

func (b *Bulk) Browse(addresses ...string) Result

Browse browses nodes using a bulk operation. This function is synchronous. Parameter addresses is a list of node addresses It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	r := bulk.Browse("address of the node1", "address of the node2")
	if r != datalayer.ResultOk {
		return
	}
	for key, _ := range bulk.Response {
		println(bulk.Response[key].Result)
		data := bulk.Response[key].Data
		for _, v := range data.GetArrayString() {
			println(v)
		}
	}
}
Output:

func (*Bulk) BrowseAsync added in v1.2.0

func (b *Bulk) BrowseAsync(cb ResponseBulkCallback, addresses ...string) Result

BrowseAsync browses nodes using a bulk operation. This function is asynchronous. Parameter cb is the callback of response Parameter addresses is a list of node addresses It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	//callback function
	rc := func(resps []datalayer.Response) {
	}

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	r := bulk.BrowseAsync(rc, "address of the node1", "address of the node2")
	if r != datalayer.ResultOk {
		return
	}
	// waiting for callback
}
Output:

func (*Bulk) Create added in v1.2.0

func (b *Bulk) Create(args ...BulkCreateArg) Result

Create creates nodes using a bulk operation. This function is synchronous. Parameter args is a list of create arguments It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	args := []datalayer.BulkCreateArg{}

	v1 := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v1)
	v1.SetFloat32(32.45678)
	args = append(args, datalayer.BulkCreateArg{Address: "address of the node1", Data: v1})

	v2 := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v2)
	v2.SetFloat64(64.56789)
	args = append(args, datalayer.BulkCreateArg{Address: "address of the node2", Data: v2})

	r := bulk.Create(args...)
	if r != datalayer.ResultOk {
		return
	}
	for key, _ := range bulk.Response {
		println(bulk.Response[key].Result)
	}
}
Output:

func (*Bulk) CreateAsync added in v1.2.0

func (b *Bulk) CreateAsync(cb ResponseBulkCallback, args ...BulkCreateArg) Result

CreateAsync creates nodes using a bulk operation. This function is asynchronous. Parameter cb is the callback of response Parameter args is a list of create arguments It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	//callback function
	rc := func(resps []datalayer.Response) {
	}

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	args := []datalayer.BulkCreateArg{}

	v1 := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v1)
	v1.SetFloat32(32.45678)
	args = append(args, datalayer.BulkCreateArg{Address: "address of the node1", Data: v1})

	v2 := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v2)
	v2.SetFloat64(64.56789)
	args = append(args, datalayer.BulkCreateArg{Address: "address of the node2", Data: v2})

	r := bulk.CreateAsync(rc, args...)
	if r != datalayer.ResultOk {
		return
	}
	// waiting for callback
}
Output:

func (*Bulk) Delete added in v1.2.0

func (b *Bulk) Delete(addresses ...string) Result

Delete deletes nodes using a bulk operation. This function is synchronous. Parameter addresses is a list of node addresses It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	r := bulk.Delete("address of the node1", "address of the node2")
	if r != datalayer.ResultOk {
		return
	}
	for key, _ := range bulk.Response {
		println(bulk.Response[key].Result)
	}
}
Output:

func (*Bulk) DeleteAsync added in v1.2.0

func (b *Bulk) DeleteAsync(cb ResponseBulkCallback, addresses ...string) Result

DeleteAsync deletes nodes using a bulk operation. This function is asynchronous. Parameter cb is the callback of response Parameter addresses is a list of node addresses It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	//callback function
	rc := func(resps []datalayer.Response) {
	}

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	r := bulk.DeleteAsync(rc, "address of the node1", "address of the node2")
	if r != datalayer.ResultOk {
		return
	}
	// waiting for callback
}
Output:

func (*Bulk) Metadata added in v1.2.0

func (b *Bulk) Metadata(addresses ...string) Result

Metadata reads metadata of nodes using a bulk operation. This function is synchronous. Parameter addresses is a list of node addresses It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	r := bulk.Metadata("address of the node1", "address of the node2")
	if r != datalayer.ResultOk {
		return
	}
	for key, _ := range bulk.Response {
		println(bulk.Response[key].Result)
	}
}
Output:

func (*Bulk) MetadataAsync added in v1.2.0

func (b *Bulk) MetadataAsync(cb ResponseBulkCallback, addresses ...string) Result

MetadataAsync reads metadata of nodes using a bulk operation. This function is asynchronous. Parameter cb is the callback of response Parameter addresses is a list of node addresses It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	//callback function
	rc := func(resps []datalayer.Response) {
	}

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	r := bulk.MetadataAsync(rc, "address of the node1", "address of the node2")
	if r != datalayer.ResultOk {
		return
	}
	// waiting for callback
}
Output:

func (*Bulk) Read added in v1.2.0

func (b *Bulk) Read(args ...BulkReadArg) Result

Read read values using a bulk operation. This function is synchronous. Parameter args is a list of read arguments It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	r := bulk.Read(datalayer.BulkReadArg{Address: "address of the node1", Argument: nil}, datalayer.BulkReadArg{Address: "address of the node2"})
	if r != datalayer.ResultOk {
		return
	}
	for key, _ := range bulk.Response {
		println(bulk.Response[key].Result)
	}
}
Output:

func (*Bulk) ReadAsync added in v1.2.0

func (b *Bulk) ReadAsync(cb ResponseBulkCallback, args ...BulkReadArg) Result

ReadAsync reads values using a bulk operation. This function is asynchronous. Parameter cb is the callback of response Parameter args is a list of read arguments It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	//callback function
	rc := func(resps []datalayer.Response) {
	}

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	r := bulk.ReadAsync(rc, datalayer.BulkReadArg{Address: "address of the node1", Argument: nil}, datalayer.BulkReadArg{Address: "address of the node2"})
	if r != datalayer.ResultOk {
		return
	}
	// waiting for callback
}
Output:

func (*Bulk) Write added in v1.2.0

func (b *Bulk) Write(args ...BulkWriteArg) Result

Write writes nodes using a bulk operation. This function is synchronous. Parameter args is a list of write arguments It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	args := []datalayer.BulkWriteArg{}

	v1 := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v1)
	v1.SetFloat32(32.45678)
	args = append(args, datalayer.BulkWriteArg{Address: "address of the node1", Data: v1})

	v2 := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v2)
	v2.SetFloat64(64.56789)
	args = append(args, datalayer.BulkWriteArg{Address: "address of the node2", Data: v2})

	r := bulk.Write(args...)
	if r != datalayer.ResultOk {
		return
	}
	for key, _ := range bulk.Response {
		println(bulk.Response[key].Result)
	}
}
Output:

func (*Bulk) WriteAsync added in v1.2.0

func (b *Bulk) WriteAsync(cb ResponseBulkCallback, args ...BulkWriteArg) Result

WriteAsync deletes nodes using a bulk operation. This function is asynchronous. Parameter cb is the callback of response Parameter args is a list of write arguments It returns the status of function call

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	//callback function
	rc := func(resps []datalayer.Response) {
	}

	bulk := c.CreateBulk()
	defer datalayer.DeleteBulk(bulk)

	args := []datalayer.BulkWriteArg{}

	v1 := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v1)
	v1.SetFloat32(32.45678)
	args = append(args, datalayer.BulkWriteArg{Address: "address of the node1", Data: v1})

	v2 := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v2)
	v2.SetFloat64(64.56789)
	args = append(args, datalayer.BulkWriteArg{Address: "address of the node2", Data: v2})

	r := bulk.WriteAsync(rc, args...)
	if r != datalayer.ResultOk {
		return
	}
	// waiting for callback
}
Output:

type BulkCreateArg added in v1.2.0

type BulkCreateArg struct {
	Address string
	Data    *Variant
}

Struct for BulkCreateArg Address for the request Data of the request

type BulkReadArg added in v1.2.0

type BulkReadArg struct {
	Address  string
	Argument *Variant
}

Struct for BulkReadArg Address for the request Argument of the request

type BulkWriteArg added in v1.2.0

type BulkWriteArg struct {
	Address string
	Data    *Variant
}

Struct for BulkWriteArg Address for the request Data of the request

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an interface for the accessing of data from the system.

func (*Client) Browse

func (c *Client) Browse(address string) (Result, []string)

Browse returns all subnodes of address

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Browse returns all subnodes of address
	c.Browse("address of the node")
}
Output:

func (*Client) BrowseAsync

func (c *Client) BrowseAsync(address string, onResponse ResponseCallback) Result

BrowseAsync searches an object. This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function. Parameter address is an address of the node to browse. Parameter callback is a callback to call when function is finished. Parameter userdata will be returned in callback as a user data. You can use this userdata to identify your request. It returns the status of function call.

func (*Client) BrowseSync

func (c *Client) BrowseSync(address string) (Result, *Variant)

BrowseSync searches an object. This function is synchronous. Parameter address is an address of the node to browse. It returns the status of function call or a tuple (Result, Variant). It returns the children of the node. Data will be provided as Variant array of strings.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// BrowseSync searches a node
	c.BrowseSync("address of the node")
}
Output:

func (*Client) CreateAsync

func (c *Client) CreateAsync(address string, data *Variant, onResponse ResponseCallback) Result

CreateAsync creates an object. This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function. Parameter address is an address of the node to create object in. Parameter data is a data of the object. Parameter callback is a callback to call when function is finished. Parameter userdata will be returned in callback as a user data. You can use this userdata to identify your request. It returns the status of function call.

func (*Client) CreateBulk added in v1.2.0

func (c *Client) CreateBulk() *Bulk

CreateBulk creates a ctrlX Data Layer bulk

func (*Client) CreateSubscription

func (c *Client) CreateSubscription(id string, subscriptionProperties SubscriptionProperties, onSubscription OnSubscription) (*Subscription, Result)

CreateSubscription creates a subscription as configured in the subscriptionProperties, which returns value to the onSubscription callback. It returns the status of function call.

func (*Client) CreateSync

func (c *Client) CreateSync(address string, data *Variant) Result

CreateSync creates an object. This function is synchronous. Parameter address is an address of the node to create object in. Parameter variant is a data of the object. It returns the status of function call or a variant result of write or a tuple (Result, Variant).

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Create and destroy the variant
	v := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v)

	// CreateSync creates an object
	c.CreateSync("address of the node", v)
}
Output:

func (*Client) DeleteSubscription

func (c *Client) DeleteSubscription(subscription *Subscription)

DeleteSubscription deletes a subscription.

func (*Client) GetAuthToken

func (c *Client) GetAuthToken() string

GetAuthToken returns persistent security access token for authentication. It returns the security access token for authentication as <string>.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Get persistent security access token for authentication
	c.GetAuthToken()
}
Output:

func (*Client) IsConnected

func (c *Client) IsConnected() bool

IsConnected returns whether provider is connected. It returns the status of connection as <bool>.

func (*Client) Metadata

func (c *Client) Metadata(address string) (Result, *fbs.Metadata)

Metadata reads metadata of an object. This function is synchronous. Parameter address is an address of the node to read metadata of. It returns the status of function call or a tuple (Result, Variant) or a metadata of the node. Data will be provided as Variant flatbuffers with metadata.fbs data type.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Read metadata of a node
	c.Metadata("address of the node")
}
Output:

func (*Client) MetadataAsync

func (c *Client) MetadataAsync(address string, onResponse ResponseCallback) Result

MetadataAsync reads metadata of an object. This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function. Parameter address is an address of the node to read metadata. Paremeter callback is a callback to call when function is finished. Parmeter userdata will be returned in callback as a user data. You can use this userdata to identify your request. It returns the status of function call.

func (*Client) MetadataSync

func (c *Client) MetadataSync(address string) (Result, *Variant)

MetadataSync reads a metadata of an object. This function is synchronous. Parameter address is an address of the node to read metadata of. It returns the status of function call or tuple (Result, Variant) or a metadata of the node. Data will be provided as Variant flatbuffers with metadata.fbs data type.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Read metadata of an object
	c.MetadataSync("address of the node")
}
Output:

func (*Client) PingAsync

func (c *Client) PingAsync(onResponse ResponseCallback) Result

PingAsync pings the next hop. This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Parameter callback is a callback to call when function is finished. Parameter userdata will be returned in callback as a user data. You can use this userdata to identify your request. It returns the status of hte function call.

func (*Client) PingSync

func (c *Client) PingSync() Result

PingSync pings the next hop. This function is synchronous. It returns the status of function call.

func (*Client) ReadAsync

func (c *Client) ReadAsync(address string, data *Variant, onResponse ResponseCallback) Result

ReadAsync reads an object. This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function. Parameter address is an address of the node to read. Parameter callback is a callback to call when function is finished. Parameter userdata will be returned in callback as a user data. You can use this userdata to identify your request. It returns the status of function call.

func (*Client) ReadJsonSync

func (c *Client) ReadJsonSync(cv *Converter, address string, indentStep int) (Result, []byte)

This function reads a values as a JSON string. Parameter converter is reference to the converter (see System json_converter()). Parameter address is an address of the node to read. Parameter indentStep is an indentation length for json string. It returns the status of function and generated JSON

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Initialize the converter
	cv := s.JSONConverter()

	// Read a values as a JSON string
	c.ReadJsonSync(cv, "address of the node", 2)
}
Output:

func (*Client) ReadJsonSyncArgs added in v1.2.0

func (c *Client) ReadJsonSyncArgs(cv *Converter, address string, indentStep int, data []byte) (Result, []byte)

This function reads a values as a JSON string. Parameter converter is reference to the converter (see System json_converter()). Parameter address is an address of the node to read. Parameter indentStep is an indentation length for json string. Parameter json generated JSON as array of bytes (string) It returns the status of function and generated JSON

func (*Client) ReadSync

func (c *Client) ReadSync(address string) (Result, *Variant)

ReadSync reads an object. This function is synchronous. Parameter address is an address of the node to read. It returns the status of function call or a data of the node or a tuple (Result, Variant).

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Read an object
	c.ReadSync("address of the node")
}
Output:

func (*Client) ReadSyncArgs

func (c *Client) ReadSyncArgs(address string, args *Variant) Result

ReadSync reads an object. This function is synchronous. Paramater address is an address of the node to read. Parameter args reads arguments data of the node. It returns the status of function call or a data of the node or a tuple (Result, Variant).

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Create and destroy the variant
	v := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v)

	// Read an object
	c.ReadSyncArgs("address of the node", v)
}
Output:

func (*Client) RemoveAsync

func (c *Client) RemoveAsync(address string, onResponse ResponseCallback) Result

RemoveAsync removes an object. This function is asynchronous. It will return immediately. Callback will be called if function call is finished. Result data may be provided in callback function. Parameters address is an address of the node to remove. Parameters callback is a callback to call when function is finished. Parameters userdata will be returned in callback as a user data. You can use this userdata to identify your request. It returns the status of function call.

func (*Client) RemoveSync

func (c *Client) RemoveSync(address string) Result

RemoveSync removes an object. This function is synchronous. Parameter address is an address of the node to remove. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Remove the client
	c.RemoveSync("")
}
Output:

func (*Client) SetAuthToken

func (c *Client) SetAuthToken(token string)

SetAuthToken sets persistent security access token for authentication as JWT payload. Parameter token is a security access &token for authentication.

func (*Client) SetTimeout

func (c *Client) SetTimeout(timeout TimeoutSetting, value uint) Result

SetTimeout sets a client timeout value. Parameter timeout is a timeout to set. Parameter value is a value to set. It returns the status of function call.

func (*Client) WriteAsync

func (c *Client) WriteAsync(address string, data *Variant, onResponse ResponseCallback) Result

WriteAsync writes an object. This function is synchronous: It will wait for the answer. Parameter address is an address of the node to write. Parameter data is a data of the object. Parameter callback is a callback to call when function is finished. Parameter userdata will be returned in callback as a user data. You can use this userdata to identify your request. It returns the status of function call.

func (*Client) WriteJsonSync

func (c *Client) WriteJsonSync(cv *Converter, address string, json []byte) (Result, error)

This function writes a JSON value. Parameter converter is a reference to the converter (see System json_converter()). Parameter address is an address of the node to write. Parameter json is a JSON value to write. It returns the status of function and error Error object.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Initialize the converter
	cv := s.JSONConverter()

	// Write a JSON value
	c.ReadJsonSync(cv, "address of the node", 2)
}
Output:

func (*Client) WriteSync

func (c *Client) WriteSync(address string, data *Variant) Result

WriteSync writes an object. This function is synchronous. Parameter address an address of the node to write. Parameter variant ia a new data of the node. It returns the status of function call or a result of write or a tuple Result, Variant).

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	// Create and destroy the variant
	v := datalayer.NewVariant()
	defer datalayer.DeleteVariant(v)

	// Write an object
	c.WriteSync("address of the node", v)
}
Output:

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter class

func (*Converter) GenerateJsonComplex

func (c *Converter) GenerateJsonComplex(data []byte, ty []byte, indentStep int) (Result, []byte)

GenerateJsonComplex generates a JSON string out of a Variant with a complex type (flatbuffers) and the metadata of this data. Parameter data is an array of bytes that contains data of complex data type (flatbuffers). If data is empty (VariantType::UNKNOWN) type is converted to json schema. Parameter type is an array of bytes that contains type of data (Variant with flatbuffers BFBS) Parameter indentStep is a indentation length for json string. It returns generated JSON as a string.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Create a converter
	c := s.JSONConverter()

	r, m := c.GetSchema(datalayer.SchemaMemory)
	fmt.Print(r)
	r, rs := c.GetSchema(datalayer.SchemaReflection)
	r, st := c.GenerateJsonComplex(m, rs, -1)
	r, d, err := c.ParseJsonComplex(st, rs)
	fmt.Print(r, d, err)
}
Output:

func (*Converter) GenerateJsonSimple

func (c *Converter) GenerateJsonSimple(data *Variant, indentStep int) (Result, []byte)

GenerateJsonSimple generates a JSON string out of a Variant with a simple data type. Parameter data is a Variant that contains data with simple data type. Parameter indentStep is an indentation length for json string. It returns generated JSON as a string.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Create a converter
	c := s.JSONConverter()

	// Create and destroy a variant
	i := datalayer.NewVariant()
	defer datalayer.DeleteVariant(i)
	i.SetString("someText")

	// Generate a a JSON string
	r, st := c.GenerateJsonSimple(i, -1)
	fmt.Print(r, st)
}
Output:

func (*Converter) GetSchema

func (c *Converter) GetSchema(schema Schema) (Result, []byte)

GetSchema returns the type (schema). Parameter schema is a requested schema. It returns a result status of the function, data which contains the type (schema).

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Create a converter
	c := s.JSONConverter()

	r, m := c.GetSchema(datalayer.SchemaMemory)
	fmt.Print(r, m)
}
Output:

func (*Converter) ParseJsonComplex

func (c *Converter) ParseJsonComplex(json []byte, ty []byte) (Result, []byte, error)

ParseJsonComplex generates a Variant out of a JSON string containing the (complex) data. Parameter json is an array of bytes containing a json string. Parameter type (ty) is an array of bytes that contains type of data (Variant with bfbs flatbuffer content). It returns a result status of the function, data (array of byte) which contains the data, error Error as error object.

func (*Converter) ParseJsonSimple

func (c *Converter) ParseJsonSimple(json []byte) (Result, *Variant, error)

ParseJsonSimple generates a Variant out of a JSON string containing the (simple) data. Parameter json is an array of bytes as a json string. It returns a result status of the function, data string which contains the data, error Error object.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Create a converter
	c := s.JSONConverter()

	// Create and destroy a variant
	i := datalayer.NewVariant()
	defer datalayer.DeleteVariant(i)
	i.SetString("someText")

	// Generate a JSON string
	r, st := c.GenerateJsonSimple(i, -1)
	fmt.Print(r)

	// Parse a string
	r, o, err := c.ParseJsonSimple(st)
	fmt.Print(r, o, err)
}
Output:

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory class

func (*Factory) CreateClient

func (f *Factory) CreateClient(remote string) *Client

CreateClient creates a client for accessing data of the system. Parameter remote is an address of the ctrlX Data Layer. It returns the client.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Create a factory
	f := s.Factory()

	// Create and destroy a client
	c := f.CreateClient("name")
	defer datalayer.DeleteClient(c)
}
Output:

func (*Factory) CreateProvider

func (f *Factory) CreateProvider(remote string) *Provider

CreateProvider creates a provider to provide data to the ctrlX Data Layer. Parameter remote is an address of the ctrlX Data Layer. It returns the provider.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Create a factory
	f := s.Factory()

	// Create and destroy a provider
	p := f.CreateProvider("")
	defer datalayer.DeleteProvider(p)
}
Output:

type MetaDataBuilder added in v1.1.0

type MetaDataBuilder struct {
	// contains filtered or unexported fields
}

MetaDataBuilder struct

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
	fbs "github.com/boschrexroth/ctrlx-datalayer-golang/pkg/fbs/comm/datalayer"
)

func main() {
	m := datalayer.NewMetaDataBuilder(datalayer.AllowedOperationRead|datalayer.AllowedOperationWrite, "simple description", "")
	m.DisplayName("myexample").NodeClass(fbs.NodeClassVariable)

	m.AddReference(datalayer.ReferenceTypeWrite, "type/myexample/write")
	m.AddReference(datalayer.ReferenceTypeRead, "type/myexample/read")

	m.AddExtension("key", "value")

	v := m.Build()
	defer datalayer.DeleteVariant(v)
}
Output:

func NewMetaDataBuilder added in v1.1.0

func NewMetaDataBuilder(a AllowedOperation, desc string, descurl string) *MetaDataBuilder

NewMetaDataBuilder generates MetaDataBuilder instance

func (*MetaDataBuilder) AddExtension added in v1.1.0

func (m *MetaDataBuilder) AddExtension(key string, val string) *MetaDataBuilder

AddExtension adds the extension

func (*MetaDataBuilder) AddReference added in v1.1.0

func (m *MetaDataBuilder) AddReference(r ReferenceType, t string) *MetaDataBuilder

AddReference adds the reference

func (*MetaDataBuilder) Build added in v1.1.0

func (m *MetaDataBuilder) Build() *Variant

Build this instance

func (*MetaDataBuilder) DisplayFormat added in v1.1.0

func (m *MetaDataBuilder) DisplayFormat(df fbs.DisplayFormat) *MetaDataBuilder

DisplayFormat sets the display format

func (*MetaDataBuilder) DisplayName added in v1.1.0

func (m *MetaDataBuilder) DisplayName(n string) *MetaDataBuilder

DisplayName sets the display name

func (*MetaDataBuilder) NodeClass added in v1.1.0

func (m *MetaDataBuilder) NodeClass(nc fbs.NodeClass) *MetaDataBuilder

NodeClass sets the node class

func (*MetaDataBuilder) Operations added in v1.1.0

Operations set the allowed operations

func (*MetaDataBuilder) Unit added in v1.1.0

Unit sets the unit

type NotifyItem

type NotifyItem struct {
	Data Variant
	Info Variant
}

type OnSubscription

type OnSubscription func(result Result, items map[string]Variant)

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider interface to manage provider nodes.

func (*Provider) GetToken

func (p *Provider) GetToken() *Variant

GetToken returns the current token of the current request.You can call this function during your onRead, onWrite, ... methods of your ProviderNodes. If there is no current request the method return an empty token. It returns the current token.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Start the provider
	p.Start()

	// Initialize and destroy the variant
	v := p.GetToken()
	defer datalayer.DeleteVariant(v)
}
Output:

func (*Provider) IsConnected

func (p *Provider) IsConnected() bool

IsConnected returns whether provider is connected or not. It returns the status of the connection.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Check the connection
	p.Start()
	p.IsConnected()
}
Output:

func (*Provider) RegisterNode

func (p *Provider) RegisterNode(address string, node *ProviderNode) Result

RegisterNode registers a node to the ctrlX Data Layer. Parameter address is an address of the node to register (wildcards allowed). Parameter node ia a node to register. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Initialize and destroy the node
	n := datalayer.NewProviderNode()
	defer datalayer.DeleteProviderNode(n)

	// Register the node
	p.RegisterNode("address", n)
}
Output:

func (*Provider) RegisterType

func (p *Provider) RegisterType(address string, pathname string) Result

RegisterType registers a type to the ctrlX Data Layer. Parameter address is an address of the node to register (no wildcards allowed). Parameter pathname is a path to flatbuffer bfbs. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Register the node
	p.RegisterType("address", "path")

}
Output:

func (*Provider) RegisterTypeVariant

func (p *Provider) RegisterTypeVariant(address string, data *Variant) Result

RegisterTypeVariant registers a type to the ctrlX Data Layer. Parameter address is an address of the node to register (no wildcards allowed). Parameter data is a variant which contains the flatbuffer bfbs. It returns the status of function call.

func (*Provider) SetTimeoutNode

func (p *Provider) SetTimeoutNode(node *ProviderNode, timeoutMS uint) Result

SetTimeoutNode sets timeout for a node for asynchron requests (default value is 1000ms). Parameter node is a node to set timeout. Parameter timeoutMS is a timeout in milliseconds for this node. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Initialize and destroy the node
	n := datalayer.NewProviderNode()
	defer datalayer.DeleteProviderNode(n)

	// Set timeout for the node
	p.RegisterNode("address", n)
	p.SetTimeoutNode(n, 1000)
	p.UnregisterNode("address")
}
Output:

func (*Provider) Start

func (p *Provider) Start() Result

Start starts the provider. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Start the provider
	p.Start()
}
Output:

func (*Provider) Stop

func (p *Provider) Stop() Result

Stop stops the provider. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Start the provider
	p.Start()
	p.Stop()
}
Output:

func (*Provider) UnregisterNode

func (p *Provider) UnregisterNode(address string) Result

UnregisterNode unregisters a node from the ctrlX Data Layer. Parameter address is an address of the node to unregister (wildcards allowed). Parameter node ia a node to register. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Initialize and destroy the node
	n := datalayer.NewProviderNode()
	defer datalayer.DeleteProviderNode(n)

	// Register and unregister the node
	p.RegisterNode("address", n)
	p.UnregisterNode("address")
}
Output:

func (*Provider) UnregisterType

func (p *Provider) UnregisterType(address string) Result

UnregisterType unregisters a node to the ctrlX Data Layer. Parameter address is an address of the node to unregister (wildcards allowed). It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the system
	s := datalayer.NewSystem("")
	defer datalayer.DeleteSystem(s)

	// Initialize and destroy the provider
	p := s.Factory().CreateProvider("providerAddress")
	defer datalayer.DeleteProvider(p)

	// Unregisters the node
	p.UnregisterType("address")
}
Output:

type ProviderNode

type ProviderNode struct {
	// contains filtered or unexported fields
}

ProviderNode interface for providing data to the system.

func NewProviderNode

func NewProviderNode() *ProviderNode

NewProviderNode initializes the provider node.

func (*ProviderNode) Channels

func (n *ProviderNode) Channels() *ProviderNodeChannels

Channels get all channels. It returns all channels.

type ProviderNodeCallback

type ProviderNodeCallback = func(result Result, data *Variant)

ProviderNodeCallback function

type ProviderNodeChannels

type ProviderNodeChannels struct {
	OnCreate   chan ProviderNodeEventData
	OnRemove   chan ProviderNodeEvent
	OnBrowse   chan ProviderNodeEvent
	OnRead     chan ProviderNodeEventData
	OnWrite    chan ProviderNodeEventData
	OnMetadata chan ProviderNodeEvent
	Done       chan bool
}

ProviderNodeChannels sets the struct.

type ProviderNodeEvent

type ProviderNodeEvent struct {
	Address  string
	Callback ProviderNodeCallback
}

ProviderNodeEvent event

type ProviderNodeEventData

type ProviderNodeEventData struct {
	Address  string
	Data     *Variant
	Callback ProviderNodeCallback
}

ProviderNodeEventData event

type ReferenceType added in v1.1.0

type ReferenceType uint8

ReferenceType enum

const (
	ReferenceTypeRead     ReferenceType = 0
	ReferenceTypeReadIn   ReferenceType = 1
	ReferenceTypeReadOut  ReferenceType = 2
	ReferenceTypeWrite    ReferenceType = 3
	ReferenceTypeWriteIn  ReferenceType = 4
	ReferenceTypeWriteOut ReferenceType = 5
	ReferenceTypeCreate   ReferenceType = 6
	ReferenceTypeUses     ReferenceType = 7
	ReferenceTypeHasSave  ReferenceType = 8
)

ReferenceType enum defintion

type Response added in v1.2.0

type Response struct {
	Address string
	Data    *Variant
	Time    time.Time
	Result  Result
}

Structure for bulk response

type ResponseBulkCallback added in v1.2.0

type ResponseBulkCallback = func([]Response)

ResponseBulkCallback function type

type ResponseCallback

type ResponseCallback = func(result Result, v *Variant)

ResponseCallback function type

type Result

type Result C.DLR_RESULT

Result ulong

const (
	ResultOk          Result = C.DL_OK            //  FUNCTION CALL SUCCEEDED
	ResultOkNoContent Result = C.DL_OK_NO_CONTENT //  FUNCTION CALL SUCCEEDED WITH NO CONTENT
	ResultFailed      Result = C.DL_FAILED        //  ONLY ALLOWED FOR TEMPORARY USE - DEFINE MATCHING ERROR CODE

	ResultInvalidAddress       Result = C.DL_INVALID_ADDRESS        //  ADDRESS NOT FOUND, ADDRESS INVALID (BROWSE OF THIS NODE NOT POSSIBLE, WRITE -> ADDRESS NOT VALID)
	ResultUnsupported          Result = C.DL_UNSUPPORTED            //  FUNCTION NOT IMPLEMENTED
	ResultOutOfMemory          Result = C.DL_OUT_OF_MEMORY          //  OUT OF MEMORY OR RESOURCES (RAM, SOCKETS, HANDLES, DISK SPACE ...).
	ResultLimitMin             Result = C.DL_LIMIT_MIN              //  THE MINIMUM OF A LIMITATION IS EXCEEDED.
	ResultLimitMax             Result = C.DL_LIMIT_MAX              //  THE MAXIMUM OF A LIMITATION IS EXCEEDED.
	ResultTypeMismatch         Result = C.DL_TYPE_MISMATCH          //  WRONG FLATBUFFER TYPE, WRONG DATA TYPE
	ResultSizeMismatch         Result = C.DL_SIZE_MISMATCH          //  SIZE MISMATCH, PRESENT SIZE DOESN'T MATCH REQUESTED SIZE.
	ResultInvalidFloatingpoint Result = C.DL_INVALID_FLOATINGPOINT  //  INVALID FLOATING POINT NUMBER.
	ResultInvalidHandle        Result = C.DL_INVALID_HANDLE         //  INVALID HANDLE ARGUMENT OR NULL POINTER ARGUMENT.
	ResultInvalidOperationMode Result = C.DL_INVALID_OPERATION_MODE //  NOT ACCESSIBLE DUE TO INVALID OPERATION MODE (WRITE NOT POSSIBLE)
	ResultInvalidConfiguration Result = C.DL_INVALID_CONFIGURATION  //  MISMATCH OF THIS VALUE WITH OTHER CONFIGURED VALUES
	ResultInvalidValue         Result = C.DL_INVALID_VALUE          //  INVALID VALUE
	ResultSubmoduleFailure     Result = C.DL_SUBMODULE_FAILURE      //  ERROR IN SUBMODULE
	ResultTimeout              Result = C.DL_TIMEOUT                //  REQUEST TIMEOUT
	ResultAlreadyExists        Result = C.DL_ALREADY_EXISTS         //  CREATE: RESOURCE ALREADY EXISTS
	ResultCreationFailed       Result = C.DL_CREATION_FAILED        //  ERROR DURING CREATION
	ResultVersionMismatch      Result = C.DL_VERSION_MISMATCH       //  VERSION CONFLICT
	ResultDeprecated           Result = C.DL_DEPRECATED             //  DEPRECATED - FUNCTION NOT LONGER SUPPORTED
	ResultPermissionDenied     Result = C.DL_PERMISSION_DENIED      //  REQUEST DECLINED DUE TO MISSING PERMISSION RIGHTS
	ResultNotInitialized       Result = C.DL_NOT_INITIALIZED        //  OBJECT NOT INITIALIZED YET
	ResultMissingArgument      Result = C.DL_MISSING_ARGUMENT       //  MISSING ARGUMENT (EG. MISSING ARGUMENT IN fbs)
	ResultTooManyArguments     Result = C.DL_TOO_MANY_ARGUMENTS     //  TO MANY ARGUMENT
	ResultResourceUnavailable  Result = C.DL_RESOURCE_UNAVAILABLE   //  RESOURCE UNAVAILABLE
	ResultCommunicationError   Result = C.DL_COMMUNICATION_ERROR    //  LOW LEVEL COMMUNICATION ERROR OCCURRED
	ResultTooManyOperations    Result = C.DL_TOO_MANY_OPERATIONS    //  REQUEST CAN'T BE HANDLED DUE TO TOO MANY OPERATIONS
	ResultWouldBlock           Result = C.DL_WOULD_BLOCK            //  REQUEST WOULD BLOCK, YOU HAVE CALLED A SYNCHRONOUS FUNCTION IN A CALLBACK FROM A ASYNCHRONOUS FUNCTION

	ResultCommProtocolError Result = C.DL_COMM_PROTOCOL_ERROR //  INTERNAL PROTOCOL ERROR
	ResultCommInvalidHeader Result = C.DL_COMM_INVALID_HEADER //  INTERNAL HEADER MISMATCH

	ResultClientNotConnected Result = C.DL_CLIENT_NOT_CONNECTED //  CLIENT NOT CONNECTED

	ResultRtNotopen          Result = C.DL_RT_NOTOPEN          //  NOT OPEN
	ResultRtInvalidobject    Result = C.DL_RT_INVALIDOBJECT    //  INVALID OBJECT
	ResultRtWrongrevison     Result = C.DL_RT_WRONGREVISON     //  WRONG MEMORY REVISION
	ResultRtNovaliddata      Result = C.DL_RT_NOVALIDDATA      //  NO VALID DATA
	ResultRtMemorylocked     Result = C.DL_RT_MEMORYLOCKED     //  MEMORY ALREADY LOCKED
	ResultRtInvalidmemorymap Result = C.DL_RT_INVALIDMEMORYMAP //  INVALID MEMORY MAP
	ResultRtInvalidRetain    Result = C.DL_RT_INVALID_RETAIN   //  INVALID MEMORY MAP
	ResultRtInternalError    Result = C.DL_RT_INTERNAL_ERROR   //  INTERNAL RT ERROR

	ResultSecNotoken             Result = C.DL_SEC_NOTOKEN             //  NO TOKEN FOUND
	ResultSecInvalidsession      Result = C.DL_SEC_INVALIDSESSION      //  TOKEN NOT VALID (SESSION NOT FOUND)
	ResultSecInvalidtokencontent Result = C.DL_SEC_INVALIDTOKENCONTENT //  TOKEN HAS WRONG CONTENT
	ResultSecUnauthorized        Result = C.DL_SEC_UNAUTHORIZED        //  UNAUTHORIZED
	ResultPaymentRequired        Result = C.DL_SEC_PAYMENT_REQUIRED    //  PAYMENT REQUIRED
)

func (Result) String

func (r Result) String() string

type Schema

type Schema C.enum_DLR_SCHEMA

Schema enum

const (
	SchemaMetadata   Schema = C.DLR_SCHEMA_METADATA
	SchemaReflection Schema = C.DLR_SCHEMA_REFLECTION
	SchemaMemory     Schema = C.DLR_SCHEMA_MEMORY
	SchemaMemoryMap  Schema = C.DLR_SCHEMA_MEMORY_MAP
	SchemaToken      Schema = C.DLR_SCHEMA_TOKEN
	SchemaProblem    Schema = C.DLR_SCHEMA_PROBLEM
	SchemaDiagnosis  Schema = C.DLR_SCHEMA_DIAGNOSIS
)

Schema enum definition

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

Subscription holds a subscription.

func (*Subscription) Addresses

func (s *Subscription) Addresses() []string

Addresses are all currently subscribed addresses. It returns all subscribed adresses.

func (*Subscription) Id

func (s *Subscription) Id() string

Id of the subscription. It returns the Id.

func (*Subscription) Subscribe

func (s *Subscription) Subscribe(addresses ...string) Result

Subscribe registers to all passed addresses. Parameter addresses is a string of addresses. It returns the result.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	//callback function
	onSubscribe := func(result datalayer.Result, items map[string]datalayer.Variant) {
	}
	// Create subscription
	p := datalayer.DefaultSubscriptionProperties()
	s, _ := c.CreateSubscription("mySub", p, onSubscribe)

	//Subscribe to the address
	s.Subscribe("address")
}
Output:

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe(addresses ...string) Result

Unsubscribe unregisters all passed addresses. Parameter addresses is a string of addresses. It returns the result.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize and destroy the client
	var c *datalayer.Client
	defer datalayer.DeleteClient(c)

	//callback function
	onSubscribe := func(result datalayer.Result, items map[string]datalayer.Variant) {
	}

	// Create subscription
	p := datalayer.DefaultSubscriptionProperties()
	s, _ := c.CreateSubscription("mySub", p, onSubscribe)

	//Subscribe and unsubscribe the address
	s.Subscribe("address")
	s.Unsubscribe("address")

}
Output:

type SubscriptionProperties

type SubscriptionProperties struct {
	Id                    string
	KeepaliveInterval     uint32
	PublishInterval       uint32
	ErrorInterval         uint32
	SamplingInterval      uint64
	QueueSize             uint32
	QueueBehaviour        fbs.QueueBehaviour
	DeadBandValue         float32
	DataChangeTrigger     fbs.DataChangeTrigger
	BrowseListChange      bool
	MetaDataChange        bool
	CountingSubscriptions bool
}

SubscriptionProperties struct

func DefaultSubscriptionProperties

func DefaultSubscriptionProperties() SubscriptionProperties

DefaultSubscriptionProperties returns all default subscription properties.

func (SubscriptionProperties) BuildJson

func (s SubscriptionProperties) BuildJson() ([]byte, error)

BuildJson constructs the Json file with default subscription properties. It returns the encoded JSON.

type System

type System struct {
	// contains filtered or unexported fields
}

System class

func NewSystem

func NewSystem(ipcPath string) *System

NewSystem creates a ctrlX Data Layer system. Parameter ipcPath is a path for interprocess communication - use null pointer for automatic detection. It returns a ctrlX Data Layer system.

func (*System) Factory

func (d *System) Factory() *Factory

Factory system. It returns the factory to create clients and provider for the ctrlX Data Layer.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the system
	s := datalayer.NewSystem("")
	// Destroy the system
	defer datalayer.DeleteSystem(s)

	// Create a factory
	s.Factory()
}
Output:

func (*System) JSONConverter

func (d *System) JSONConverter() *Converter

JSONConverter system. It returns a converter between JSON and a Variant.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the system
	s := datalayer.NewSystem("")
	// Destroy the system
	defer datalayer.DeleteSystem(s)

	// Create a converter
	s.JSONConverter()
}
Output:

func (*System) SetBfbsPath

func (d *System) SetBfbsPath(path string)

SetBfbsPath sets the base path to bfbs files. Parameter path is a base path to bfbs files.S

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the system
	s := datalayer.NewSystem("")
	// Destroy the system
	defer datalayer.DeleteSystem(s)

	// Set the base path to bfbs files
	s.SetBfbsPath("somePath")
}
Output:

func (*System) Start

func (d *System) Start(boStartBroker bool)

Start runs a ctrlX Data Layer system. Parameter boStartBroker uses true to start a local broker. Use false to connect to an existing ctrlX Data Layer system e.g. the integrated ctrlX Data Layer system within the Automationcore.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the system
	s := datalayer.NewSystem("")
	// Destroy the system
	defer datalayer.DeleteSystem(s)

	//Run a dalayer system
	s.Start(true)
}
Output:

func (*System) Stop

func (d *System) Stop(boForceProviderStop bool)

Stop breaks a ctrlX Data Layer system. Parameter boForceProviderStop forces stop off all created providers for this ctrlX Data Layer system.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the system
	s := datalayer.NewSystem("")
	// Destroy the system
	defer datalayer.DeleteSystem(s)

	// Run and stop a dalayer system
	s.Start(true)
	s.Stop(true)
}
Output:

type TimeoutSetting

type TimeoutSetting C.enum_DLR_TIMEOUT_SETTING

TimeoutSetting gets the settings of the different timeout values.

type Variant

type Variant struct {
	// contains filtered or unexported fields
}

Variant is a container for a many types of data.

func NewVariant

func NewVariant() *Variant

NewVariant generates the variant instance.

func (*Variant) CheckConvert

func (v *Variant) CheckConvert(ty VariantType) Result

CheckConvert checks whether the variant can be converted to another type. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()

	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	// Convert the variant to another type.
	r := v.CheckConvert(datalayer.VariantTypeBool8)
	if r != datalayer.ResultOk {
		return
	}
}
Output:

func (*Variant) Copy

func (v *Variant) Copy(dest *Variant) Result

Copy copies the content of a variant to another variant. It returns the status of function call or the copy of variant or a tuple.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize two variants and set values
	v := datalayer.NewVariant()
	val := datalayer.NewVariant()

	// Destroy variants instance.
	defer datalayer.DeleteVariant(v)
	defer datalayer.DeleteVariant(val)

	// Copy the content of a variant to another variant.
	v.SetBool8(true)
	v.Copy(val)
}
Output:

func (*Variant) GetArrayBool8

func (v *Variant) GetArrayBool8() []bool

GetArrayBool8 returns the array of int8 if the type is a array of int8 otherwise null. It returns the array of bool8.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayBool8([]bool{true, false})

	// Return the array of int8 if the type is a array of int8 otherwise null.
	r := v.GetArrayBool8()
	fmt.Print(r)
}
Output:

func (*Variant) GetArrayFloat32

func (v *Variant) GetArrayFloat32() []float32

GetArrayFloat32 returns the array of float if the type is a array of float otherwise null. It returns the array of float32.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayFloat32([]float32{1})

	// Return the array of float if the type is a array of float otherwise null.
	r := v.GetArrayFloat32()
	fmt.Print(r)

}
Output:

func (*Variant) GetArrayFloat64

func (v *Variant) GetArrayFloat64() []float64

GetArrayFloat64 returns the array of double if the type is a array of double otherwise null. It returns the array of float64.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayFloat64([]float64{1})

	// Return the array of double if the type is a array of double otherwise null.
	r := v.GetArrayFloat64()
	fmt.Print(r)
}
Output:

func (*Variant) GetArrayInt16

func (v *Variant) GetArrayInt16() []int16

GetArrayInt16 returns the array of int16 if the type is a array of int16 otherwise null. It returns the array of int16.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayInt16([]int16{1, 2, 3})

	// Return the array of int16 if the type is a array of int16 otherwise null.
	r := v.GetArrayInt16()
	fmt.Print(r)
}
Output:

func (*Variant) GetArrayInt32

func (v *Variant) GetArrayInt32() []int32

GetArrayInt32 returns the array of int32 if the type is a array of int32 otherwise null. It returns the array of int32.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayInt32([]int32{1})

	// Return the array of int32 if the type is a array of int32 otherwise null.
	r := v.GetArrayInt32()
	fmt.Print(r)
}
Output:

func (*Variant) GetArrayInt64

func (v *Variant) GetArrayInt64() []int64

GetArrayInt64 function

func (*Variant) GetArrayInt8

func (v *Variant) GetArrayInt8() []int8

GetArrayInt8 returns the array of int8 if the type is a array of int8 otherwise null. It returns the array of int8.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayInt8([]int8{1})

	// Return the array of int8 if the type is a array of int8 otherwise null.
	r := v.GetArrayInt8()
	fmt.Print(r)
}
Output:

func (*Variant) GetArrayString

func (v *Variant) GetArrayString() []string

GetArrayString returns the the type of the variant. It returns the array of strings.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayString([]string{"some", "string"})

	// Return the type of the variant.
	r := v.GetArrayString()
	fmt.Print(r)
}
Output:

func (*Variant) GetArrayTime added in v1.1.0

func (v *Variant) GetArrayTime() []time.Time

GetArrayTime returns the value of the variant as an array of time.Time since January 1, 1970 UTC. It returns >= January 1, 1970 UTC

func (*Variant) GetArrayUint16

func (v *Variant) GetArrayUint16() []uint16

GetArrayUint16 returns the array of uint16 if the type is a array of uint16 otherwise null. It returns the array of uint16.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayUint16([]uint16{1})

	// Return the array of uint16 if the type is a array of uint16 otherwise null.
	r := v.GetArrayUint16()
	fmt.Print(r)
}
Output:

func (*Variant) GetArrayUint32

func (v *Variant) GetArrayUint32() []uint32

GetArrayUint32 returns the array of uint32 if the type is a array of uint32 otherwise null. It returns the array of uint32.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayUint32([]uint32{1})

	// Return the array of uint32 if the type is a array of uint32 otherwise null.
	r := v.GetArrayUint32()
	fmt.Print(r)
}
Output:

func (*Variant) GetArrayUint64

func (v *Variant) GetArrayUint64() []uint64

GetArrayUint64 function

func (*Variant) GetArrayUint8

func (v *Variant) GetArrayUint8() []uint8

GetArrayUint8 returns the array of uint8 if the type is a array of uint8 otherwise null. It returns the array of uint8.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetArrayUint8([]uint8{1})

	// Return the array of uint8 if the type is a array of uint8 otherwise null.
	r := v.GetArrayUint8()
	fmt.Print(r)
}
Output:

func (*Variant) GetBool8

func (v *Variant) GetBool8() bool

GetBool8 returns the value of the variant as a bool (auto convert if possible) otherwise 0. It returns [True, False]

Example

Get Methods ------------------------------------

package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetBool8(true)

	// GetBool8 returns the value of the variant as a bool
	r := v.GetBool8()
	fmt.Print(r)
}
Output:

func (*Variant) GetCount

func (v *Variant) GetCount() uint64

GetCount returns the count of elements in the variant (scalar data types = 1, array = count of elements in array). It returns the count of a type.

func (*Variant) GetData

func (v *Variant) GetData() unsafe.Pointer

GetData takes the pointer to the data of the variant instance. It returns the array of bytes.

func (*Variant) GetFlatbuffers

func (v *Variant) GetFlatbuffers() []byte

GetFlatbuffers returns the flatbuffers if the type is a flatbuffers otherwise null. It returns the flatbuffer (bytearray).

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetFlatbuffers([]byte{})

	// Return the flatbuffers if the type is a flatbuffers otherwise null.
	r := v.GetFlatbuffers()
	fmt.Print(r)
}
Output:

func (*Variant) GetFloat32

func (v *Variant) GetFloat32() float32

GetFloat32 returns the value of the variant as a float (auto convert if possible) otherwise 0. It returns [1.2E-38, 3.4E+3]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetFloat32(1.5)

	// Return the value of the variant as a float
	r := v.GetFloat32()
	fmt.Print(r)
}
Output:

func (*Variant) GetFloat64

func (v *Variant) GetFloat64() float64

GetFloat64 returns the value of the variant as a double (auto convert if possible) otherwise 0. It returns [2.3E-308, 1.7E+308]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetFloat64(1.5)

	// Return the value of the variant as a double
	r := v.GetFloat64()
	fmt.Print(r)
}
Output:

func (*Variant) GetInt16

func (v *Variant) GetInt16() int16

GetInt16 returns the value of the variant as a int16 (auto convert if possible) otherwise 0. It returns [-32768, 32767]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetInt16(-32768)

	// Return the value of the variant as a int16
	r := v.GetInt16()
	fmt.Print(r)
}
Output:

func (*Variant) GetInt32

func (v *Variant) GetInt32() int32

GetInt32 returns the value of the variant as a int32 (auto convert if possible) otherwise 0. It returns [-2.147.483.648, 2.147.483.647]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetInt32(-2147483648)

	// Return the value of the variant as a int32
	r := v.GetInt32()
	fmt.Print(r)
}
Output:

func (*Variant) GetInt64

func (v *Variant) GetInt64() int64

GetInt64 returns the value of the variant as a int64 (auto convert if possible) otherwise 0. It returns [-9.223.372.036.854.775.808, 9.223.372.036.854.775.807]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetInt64(-1)

	// Return the value of the variant as a int64
	r := v.GetInt64()
	fmt.Print(r)
}
Output:

func (*Variant) GetInt8

func (v *Variant) GetInt8() int8

GetInt8 returns the value of the variant as a int8 (auto convert if possible) otherwise 0. It returns [-128, 127]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()

	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetInt8(-128)

	// Return the value of the variant as a int8
	r := v.GetInt8()
	fmt.Print(r)
}
Output:

func (*Variant) GetSize

func (v *Variant) GetSize() uint64

GetSize gets the size of the type in bytes. It returns the size of the type in bytes.

func (*Variant) GetString

func (v *Variant) GetString() string

GetString returns the array of bool8 if the type is a array of bool otherwise null. It returns the string.

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetString("someString")

	// Return the value of the variant as a
	r := v.GetString()
	fmt.Print(r)
}
Output:

func (*Variant) GetTime added in v1.1.0

func (v *Variant) GetTime() time.Time

GetTime returns the value of the variant as a time.Time since January 1, 1970 UTC. It returns >= January 1, 1970 UTC

func (*Variant) GetType

func (v *Variant) GetType() VariantType

GetType returns the type of the variant instance. It returns the variant type.

func (*Variant) GetUint16

func (v *Variant) GetUint16() uint16

GetUint16 returns the value of the variant as a uint16 (auto convert if possible) otherwise 0. It returns [0, 65.535]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetUint16(65535)

	// Return the value of the variant as a uint16
	r := v.GetUint16()
	fmt.Print(r)
}
Output:

func (*Variant) GetUint32

func (v *Variant) GetUint32() uint32

GetUint32 returns the value of the variant as a Uint32 (auto convert if possible) otherwise 0. It returns [0, 4.294.967.295]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetUint32(4294967295)

	// Return the value of the variant as a Uint32
	r := v.GetUint32()
	fmt.Print(r)
}
Output:

func (*Variant) GetUint64

func (v *Variant) GetUint64() uint64

GetUint64 returns the value of the variant as a uint64 (auto convert if possible) otherwise 0. It returns [0, 18446744073709551615]

Example
package main

import (
	"fmt"

	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant and set the value
	v := datalayer.NewVariant()
	// Destroy the variant instance.
	defer datalayer.DeleteVariant(v)

	v.SetUint64(1)

	// Return the value of the variant as a uint64
	r := v.GetUint64()
	fmt.Print(r)
}
Output:

func (*Variant) GetUint8

func (v *Variant) GetUint8() uint8

GetUint8 returns the value of the variant as a uint8 (auto convert if possible) otherwise 0. It returns [0, 255]

func (*Variant) SetArrayBool8

func (v *Variant) SetArrayBool8(data []bool)

SetArrayBool8 function

func (*Variant) SetArrayFloat32

func (v *Variant) SetArrayFloat32(data []float32)

SetArrayFloat32 function

func (*Variant) SetArrayFloat64

func (v *Variant) SetArrayFloat64(data []float64)

SetArrayFloat64 function

func (*Variant) SetArrayInt16

func (v *Variant) SetArrayInt16(data []int16)

SetArrayInt16 function

func (*Variant) SetArrayInt32

func (v *Variant) SetArrayInt32(data []int32)

SetArrayInt32 function

func (*Variant) SetArrayInt64

func (v *Variant) SetArrayInt64(data []int64)

SetArrayInt64 function

func (*Variant) SetArrayInt8

func (v *Variant) SetArrayInt8(data []int8)

SetArrayInt8 function

func (*Variant) SetArrayString

func (v *Variant) SetArrayString(data []string)

SetArrayString function

func (*Variant) SetArrayTime added in v1.1.0

func (v *Variant) SetArrayTime(dfs []time.Time)

SetArrayTime sets an array of time.Time value since January 1, 1970 UTC It returns the status of function call.

func (*Variant) SetArrayTimestamp added in v1.1.0

func (v *Variant) SetArrayTimestamp(data []uint64)

SetArrayTimestamp function

func (*Variant) SetArrayUint16

func (v *Variant) SetArrayUint16(data []uint16)

SetArrayUint16 function

func (*Variant) SetArrayUint32

func (v *Variant) SetArrayUint32(data []uint32)

SetArrayUint32 function

func (*Variant) SetArrayUint64

func (v *Variant) SetArrayUint64(data []uint64)

SetArrayUint64 function

func (*Variant) SetArrayUint8

func (v *Variant) SetArrayUint8(data []uint8)

SetArrayUint8 function

func (*Variant) SetBool8

func (v *Variant) SetBool8(data bool)

SetBool8 sets a bool value. It returns the status of function call.

Example

Set Methods ------------------------------------

package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetBool8 sets a bool[True, False] value.
	v.SetBool8(true)
}
Output:

func (*Variant) SetFlatbuffers

func (v *Variant) SetFlatbuffers(data []byte)

SetFlatbuffers function

func (*Variant) SetFloat32

func (v *Variant) SetFloat32(data float32)

SetFloat32 sets a float value. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetFloat32 sets a float[1.2E-38, 3.4E+3] value.
	v.SetFloat32(1.5)
}
Output:

func (*Variant) SetFloat64

func (v *Variant) SetFloat64(data float64)

SetFloat64 sets a double value. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetFloat64 sets a double[2.3E-308, 1.7E+308] value.
	v.SetFloat64(1.5)
}
Output:

func (*Variant) SetInt16

func (v *Variant) SetInt16(data int16)

SetInt16 sets a int16 value. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetUint8 sets a uint8[0, 65.535] value.
	v.SetInt16(-24239)
}
Output:

func (*Variant) SetInt32

func (v *Variant) SetInt32(data int32)

SetInt32 sets a int32 value. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetInt32 sets a int32[-2.147.483.648, 2.147.483.647] value.
	v.SetInt32(-2147483648)
}
Output:

func (*Variant) SetInt64

func (v *Variant) SetInt64(data int64)

SetInt64 function

func (*Variant) SetInt8

func (v *Variant) SetInt8(data int8)

SetInt8 sets a int8 value. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetInt8 sets a int8[-128, 127] value.
	v.SetInt8(-128)
}
Output:

func (*Variant) SetString

func (v *Variant) SetString(data string)

SetString sets a string. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	//SetString sets a string.
	v.SetString("someString")
}
Output:

func (*Variant) SetTime added in v1.1.0

func (v *Variant) SetTime(df time.Time)

SetTime sets a time.Time value since January 1, 1970 UTC It returns the status of function call.

func (*Variant) SetTimestamp added in v1.1.0

func (v *Variant) SetTimestamp(ft uint64)

SetTimestamp sets a timestamp value as (FILETIME) 64 bit 100ns since 1.1.1601 (UTC) It returns the status of function call.

func (*Variant) SetUint16

func (v *Variant) SetUint16(data uint16)

SetUint16 sets a uint16 value. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetUint16 sets a uint16[0, 65.535] value.
	v.SetUint16(65535)
}
Output:

func (*Variant) SetUint32

func (v *Variant) SetUint32(data uint32)

SetUint32 sets a uint32 value. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetUint32 sets a uint32[0, 4.294.967.295] value.
	v.SetUint32(4294967295)
}
Output:

func (*Variant) SetUint64

func (v *Variant) SetUint64(data uint64)

SetUint64 function

func (*Variant) SetUint8

func (v *Variant) SetUint8(data uint8)

SetUint8 sets a uint8 value. It returns the status of function call.

Example
package main

import (
	"github.com/boschrexroth/ctrlx-datalayer-golang/pkg/datalayer"
)

func main() {
	// Initialize the variant
	v := datalayer.NewVariant()

	// DeleteVariant destroys the variant instance.
	defer datalayer.DeleteVariant(v)

	// SetUint8 sets a uint8[0, 255] value.
	v.SetUint8(145)
}
Output:

type VariantType

type VariantType C.enum_DLR_VARIANT_TYPE

VariantType enum

const (
	VariantTypeUnknown   VariantType = C.DLR_VARIANT_TYPE_UNKNOWN
	VariantTypeBool8     VariantType = C.DLR_VARIANT_TYPE_BOOL8
	VariantTypeInt8      VariantType = C.DLR_VARIANT_TYPE_INT8
	VariantTypeUint8     VariantType = C.DLR_VARIANT_TYPE_UINT8
	VariantTypeInt16     VariantType = C.DLR_VARIANT_TYPE_INT16
	VariantTypeUint16    VariantType = C.DLR_VARIANT_TYPE_UINT16
	VariantTypeInt32     VariantType = C.DLR_VARIANT_TYPE_INT32
	VariantTypeUint32    VariantType = C.DLR_VARIANT_TYPE_UINT32
	VariantTypeInt64     VariantType = C.DLR_VARIANT_TYPE_INT64
	VariantTypeUint64    VariantType = C.DLR_VARIANT_TYPE_UINT64
	VariantTypeFloat32   VariantType = C.DLR_VARIANT_TYPE_FLOAT32
	VariantTypeFloat64   VariantType = C.DLR_VARIANT_TYPE_FLOAT64
	VariantTypeString    VariantType = C.DLR_VARIANT_TYPE_STRING
	VariantTypeTimestamp VariantType = C.DLR_VARIANT_TIMESTAMP

	VariantTypeArrayBool8     VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_BOOL8
	VariantTypeArrayInt8      VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_INT8
	VariantTypeArrayUint8     VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_UINT8
	VariantTypeArrayInt16     VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_INT16
	VariantTypeArrayUint16    VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_UINT16
	VariantTypeArrayInt32     VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_INT32
	VariantTypeArrayUint32    VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_UINT32
	VariantTypeArrayInt64     VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_INT64
	VariantTypeArrayUint64    VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_UINT64
	VariantTypeArrayFloat32   VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_FLOAT32
	VariantTypeArrayFloat64   VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_FLOAT64
	VariantTypeArrayString    VariantType = C.DLR_VARIANT_TYPE_ARRAY_OF_STRING
	VariantTypeArrayTimestamp VariantType = C.DLR_VARIANT_ARRAY_OF_TIMESTAMP

	VariantTypeRaw         VariantType = C.DLR_VARIANT_TYPE_RAW
	VariantTypeFlatbuffers VariantType = C.DLR_VARIANT_TYPE_FLATBUFFERS
)

VariantType enum definition

Directories

Path Synopsis
Package headers
Package headers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL