Documentation
¶
Overview ¶
Datalayer is used for configuration, parametrisation and diagnosis of control project.
*
- MIT License *
- Copyright (c) 2021-2024 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 ¶
- Constants
- Variables
- func DeleteBulk(b *Bulk)
- func DeleteClient(c *Client)
- func DeleteNotifyItemsPublish(l []*NotifyItemPublish)
- func DeleteProvider(p *Provider)
- func DeleteProviderNode(n *ProviderNode)
- func DeleteSystem(d *System)
- func DeleteVariant(v *Variant)
- type AllowedOperation
- type Bulk
- func (b *Bulk) Browse(addresses ...string) Result
- func (b *Bulk) BrowseAsync(cb ResponseBulkCallback, addresses ...string) Result
- func (b *Bulk) Create(args ...BulkCreateArg) Result
- func (b *Bulk) CreateAsync(cb ResponseBulkCallback, args ...BulkCreateArg) Result
- func (b *Bulk) Delete(addresses ...string) Result
- func (b *Bulk) DeleteAsync(cb ResponseBulkCallback, addresses ...string) Result
- func (b *Bulk) Metadata(addresses ...string) Result
- func (b *Bulk) MetadataAsync(cb ResponseBulkCallback, addresses ...string) Result
- func (b *Bulk) Read(args ...BulkReadArg) Result
- func (b *Bulk) ReadAsync(cb ResponseBulkCallback, args ...BulkReadArg) Result
- func (b *Bulk) Write(args ...BulkWriteArg) Result
- func (b *Bulk) WriteAsync(cb ResponseBulkCallback, args ...BulkWriteArg) Result
- type BulkCreateArg
- type BulkReadArg
- type BulkWriteArg
- type Client
- func (c *Client) Browse(address string) (Result, []string)
- func (c *Client) BrowseAsync(address string, onResponse ResponseCallback) Result
- func (c *Client) BrowseSync(address string) (Result, *Variant)
- func (c *Client) CreateAsync(address string, data *Variant, onResponse ResponseCallback) Result
- func (c *Client) CreateBulk() *Bulk
- func (c *Client) CreateSubscription(id string, subscriptionProperties SubscriptionProperties, ...) (*Subscription, Result)
- func (c *Client) CreateSync(address string, data *Variant) Result
- func (c *Client) DeleteSubscription(subscription *Subscription)
- func (c *Client) GetAuthToken() string
- func (c *Client) IsConnected() bool
- func (c *Client) Metadata(address string) (Result, *fbs.Metadata)
- func (c *Client) MetadataAsync(address string, onResponse ResponseCallback) Result
- func (c *Client) MetadataSync(address string) (Result, *Variant)
- func (c *Client) PingAsync(onResponse ResponseCallback) Result
- func (c *Client) PingSync() Result
- func (c *Client) ReadAsync(address string, data *Variant, onResponse ResponseCallback) Result
- func (c *Client) ReadJsonSync(cv *Converter, address string, indentStep int) (Result, []byte)
- func (c *Client) ReadJsonSyncArgs(cv *Converter, address string, indentStep int, data []byte) (Result, []byte)
- func (c *Client) ReadSync(address string) (Result, *Variant)
- func (c *Client) ReadSyncArgs(address string, args *Variant) Result
- func (c *Client) RemoveAsync(address string, onResponse ResponseCallback) Result
- func (c *Client) RemoveSync(address string) Result
- func (c *Client) SetAuthToken(token string)
- func (c *Client) SetTimeout(timeout TimeoutSetting, value uint) Result
- func (c *Client) WriteAsync(address string, data *Variant, onResponse ResponseCallback) Result
- func (c *Client) WriteJsonSync(cv *Converter, address string, json []byte) (Result, error)
- func (c *Client) WriteSync(address string, data *Variant) Result
- type Converter
- func (c *Converter) GenerateJsonComplex(data []byte, ty []byte, indentStep int) (Result, []byte)
- func (c *Converter) GenerateJsonSimple(data *Variant, indentStep int) (Result, []byte)
- func (c *Converter) GetSchema(schema Schema) (Result, []byte)
- func (c *Converter) ParseJsonComplex(json []byte, ty []byte) (Result, []byte, error)
- func (c *Converter) ParseJsonSimple(json []byte) (Result, *Variant, error)
- type Factory
- type MetaDataBuilder
- func (m *MetaDataBuilder) AddExtension(key string, val string) *MetaDataBuilder
- func (m *MetaDataBuilder) AddLocalizationDescription(id, txt string) *MetaDataBuilder
- func (m *MetaDataBuilder) AddLocalizationDisplayName(id, txt string) *MetaDataBuilder
- func (m *MetaDataBuilder) AddReference(r ReferenceType, t string) *MetaDataBuilder
- func (m *MetaDataBuilder) Build() *Variant
- func (m *MetaDataBuilder) DisplayFormat(df fbs.DisplayFormat) *MetaDataBuilder
- func (m *MetaDataBuilder) DisplayName(n string) *MetaDataBuilder
- func (m *MetaDataBuilder) NodeClass(nc fbs.NodeClass) *MetaDataBuilder
- func (m *MetaDataBuilder) Operations(a AllowedOperation) *MetaDataBuilder
- func (m *MetaDataBuilder) Unit(u string) *MetaDataBuilder
- type NotifyItem
- type NotifyItemPublish
- func (i *NotifyItemPublish) GetData() *Variant
- func (i *NotifyItemPublish) GetInfo() *Variant
- func (i *NotifyItemPublish) SetEventType(e string)
- func (i *NotifyItemPublish) SetNotifyType(n fbs.NotifyType)
- func (i *NotifyItemPublish) SetSequenceNumber(n uint64)
- func (i *NotifyItemPublish) SetSourceName(s string)
- func (i *NotifyItemPublish) SetTimestamp(t time.Time)
- type OnSubscription
- type Provider
- func (p *Provider) GetRegisteredNodePaths() (Result, []string)
- func (p *Provider) GetRegisteredType(address string) (Result, *Variant)
- func (p *Provider) GetRejectedNodePaths() (Result, []string)
- func (p *Provider) GetToken() *Variant
- func (p *Provider) IsConnected() bool
- func (p *Provider) PublishEvent(data, eventtype *Variant) Result
- func (p *Provider) RegisterNode(address string, node *ProviderNode) Result
- func (p *Provider) RegisterType(address string, pathname string) Result
- func (p *Provider) RegisterTypeVariant(address string, data *Variant) Result
- func (p *Provider) SetTimeoutNode(node *ProviderNode, timeoutMS uint) Result
- func (p *Provider) Start() Result
- func (p *Provider) Stop() Result
- func (p *Provider) UnregisterNode(address string) Result
- func (p *Provider) UnregisterType(address string) Result
- type ProviderNode
- type ProviderNodeCallback
- type ProviderNodeChannels
- type ProviderNodeEvent
- type ProviderNodeEventData
- type ProviderNodeSubscription
- type ProviderSubscription
- func (p *ProviderSubscription) GetNodes() []string
- func (p *ProviderSubscription) GetProps() *fbs.SubscriptionProperties
- func (p *ProviderSubscription) GetTimestamp() time.Time
- func (p *ProviderSubscription) GetUniqueId() uint64
- func (p *ProviderSubscription) Publish(status Result, items []*NotifyItemPublish) Result
- type ReferenceType
- type Response
- type ResponseBulkCallback
- type ResponseCallback
- type Result
- type Schema
- type Subscription
- type SubscriptionProperties
- type System
- type TimeoutSetting
- type Variant
- func (v *Variant) CheckConvert(ty VariantType) Result
- func (v *Variant) Copy(dest *Variant) Result
- func (v *Variant) GetArrayBool8() []bool
- func (v *Variant) GetArrayFloat32() []float32
- func (v *Variant) GetArrayFloat64() []float64
- func (v *Variant) GetArrayInt16() []int16
- func (v *Variant) GetArrayInt32() []int32
- func (v *Variant) GetArrayInt64() []int64
- func (v *Variant) GetArrayInt8() []int8
- func (v *Variant) GetArrayString() []string
- func (v *Variant) GetArrayTime() []time.Time
- func (v *Variant) GetArrayUint16() []uint16
- func (v *Variant) GetArrayUint32() []uint32
- func (v *Variant) GetArrayUint64() []uint64
- func (v *Variant) GetArrayUint8() []uint8
- func (v *Variant) GetBool8() bool
- func (v *Variant) GetCount() uint64
- func (v *Variant) GetData() unsafe.Pointer
- func (v *Variant) GetFlatbuffers() []byte
- func (v *Variant) GetFloat32() float32
- func (v *Variant) GetFloat64() float64
- func (v *Variant) GetInt16() int16
- func (v *Variant) GetInt32() int32
- func (v *Variant) GetInt64() int64
- func (v *Variant) GetInt8() int8
- func (v *Variant) GetSize() uint64
- func (v *Variant) GetString() string
- func (v *Variant) GetTime() time.Time
- func (v *Variant) GetType() VariantType
- func (v *Variant) GetUint16() uint16
- func (v *Variant) GetUint32() uint32
- func (v *Variant) GetUint64() uint64
- func (v *Variant) GetUint8() uint8
- func (v *Variant) SetArrayBool8(data []bool)
- func (v *Variant) SetArrayFloat32(data []float32)
- func (v *Variant) SetArrayFloat64(data []float64)
- func (v *Variant) SetArrayInt16(data []int16)
- func (v *Variant) SetArrayInt32(data []int32)
- func (v *Variant) SetArrayInt64(data []int64)
- func (v *Variant) SetArrayInt8(data []int8)
- func (v *Variant) SetArrayString(data []string)
- func (v *Variant) SetArrayTime(dfs []time.Time)
- func (v *Variant) SetArrayTimestamp(data []uint64)
- func (v *Variant) SetArrayUint16(data []uint16)
- func (v *Variant) SetArrayUint32(data []uint32)
- func (v *Variant) SetArrayUint64(data []uint64)
- func (v *Variant) SetArrayUint8(data []uint8)
- func (v *Variant) SetBool8(data bool)
- func (v *Variant) SetFlatbuffers(data []byte)
- func (v *Variant) SetFloat32(data float32)
- func (v *Variant) SetFloat64(data float64)
- func (v *Variant) SetInt16(data int16)
- func (v *Variant) SetInt32(data int32)
- func (v *Variant) SetInt64(data int64)
- func (v *Variant) SetInt8(data int8)
- func (v *Variant) SetString(data string)
- func (v *Variant) SetTime(df time.Time)
- func (v *Variant) SetTimestamp(ft uint64)
- func (v *Variant) SetUint16(data uint16)
- func (v *Variant) SetUint32(data uint32)
- func (v *Variant) SetUint64(data uint64)
- func (v *Variant) SetUint8(data uint8)
- type VariantType
Examples ¶
- Bulk.Browse
- Bulk.BrowseAsync
- Bulk.Create
- Bulk.CreateAsync
- Bulk.Delete
- Bulk.DeleteAsync
- Bulk.Metadata
- Bulk.MetadataAsync
- Bulk.Read
- Bulk.ReadAsync
- Bulk.Write
- Bulk.WriteAsync
- Client.Browse
- Client.BrowseSync
- Client.CreateSync
- Client.GetAuthToken
- Client.Metadata
- Client.MetadataSync
- Client.ReadJsonSync
- Client.ReadSync
- Client.ReadSyncArgs
- Client.RemoveSync
- Client.WriteJsonSync
- Client.WriteSync
- Converter.GenerateJsonComplex
- Converter.GenerateJsonSimple
- Converter.GetSchema
- Converter.ParseJsonSimple
- Factory.CreateClient
- Factory.CreateProvider
- MetaDataBuilder
- Provider.GetToken
- Provider.IsConnected
- Provider.RegisterNode
- Provider.RegisterType
- Provider.SetTimeoutNode
- Provider.Start
- Provider.Stop
- Provider.UnregisterNode
- Provider.UnregisterType
- Subscription.Subscribe
- Subscription.Unsubscribe
- System.Factory
- System.JSONConverter
- System.SetBfbsPath
- System.Start
- System.Stop
- Variant.CheckConvert
- Variant.Copy
- Variant.GetArrayBool8
- Variant.GetArrayFloat32
- Variant.GetArrayFloat64
- Variant.GetArrayInt16
- Variant.GetArrayInt32
- Variant.GetArrayInt8
- Variant.GetArrayString
- Variant.GetArrayUint16
- Variant.GetArrayUint32
- Variant.GetArrayUint8
- Variant.GetBool8
- Variant.GetFlatbuffers
- Variant.GetFloat32
- Variant.GetFloat64
- Variant.GetInt16
- Variant.GetInt32
- Variant.GetInt64
- Variant.GetInt8
- Variant.GetString
- Variant.GetUint16
- Variant.GetUint32
- Variant.GetUint64
- Variant.SetBool8
- Variant.SetFloat32
- Variant.SetFloat64
- Variant.SetInt16
- Variant.SetInt32
- Variant.SetInt8
- Variant.SetString
- Variant.SetUint16
- Variant.SetUint32
- Variant.SetUint8
Constants ¶
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 ¶
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 DeleteClient ¶
func DeleteClient(c *Client)
DeleteClient destructs the client. It destroys the client.
func DeleteNotifyItemsPublish ¶ added in v2.5.0
func DeleteNotifyItemsPublish(l []*NotifyItemPublish)
DeleteNotifyItemsPublish removes a lit of NotifyItemPublish. Parameter s is list of the NotifyItemPublish.
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.
Types ¶
type AllowedOperation ¶
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 ¶
type Bulk struct { Response []Response // contains filtered or unexported fields }
Structure for bulk Function calls are combined into a single call
func (*Bulk) Browse ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
Struct for BulkCreateArg Address for the request Data of the request
type BulkReadArg ¶
Struct for BulkReadArg Address for the request Argument of the request
type BulkWriteArg ¶
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 ¶
Browse returns all subnodes of address
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
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/v2/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 ¶
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 ¶
CreateSync creates an object. This function is synchronous. Parameter address is an address of the node to create object in. Parameter data is a data of the object, result of write. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
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/v2/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 ¶
IsConnected returns whether provider is connected. It returns the status of connection as <bool>.
func (*Client) 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/v2/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 ¶
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/v2/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 ¶
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 ¶
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/v2/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 ¶
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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
type MetaDataBuilder struct {
// contains filtered or unexported fields
}
MetaDataBuilder struct
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/pkg/datalayer" fbs "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
func NewMetaDataBuilder(operations AllowedOperation, desc string, descurl string) *MetaDataBuilder
NewMetaDataBuilder generates MetaDataBuilder instance Parameter operations are the allowed operations of the provider node Parameter desc is the description of the provider node and should not be empty ("") Parameter descurl is the URL of the description and should not be empty ("")
func (*MetaDataBuilder) AddExtension ¶
func (m *MetaDataBuilder) AddExtension(key string, val string) *MetaDataBuilder
AddExtension adds the extension
func (*MetaDataBuilder) AddLocalizationDescription ¶
func (m *MetaDataBuilder) AddLocalizationDescription(id, txt string) *MetaDataBuilder
AddLocalizationDescription adds localization of description
func (*MetaDataBuilder) AddLocalizationDisplayName ¶
func (m *MetaDataBuilder) AddLocalizationDisplayName(id, txt string) *MetaDataBuilder
AddLocalizationDisplayName adds localization of display name
func (*MetaDataBuilder) AddReference ¶
func (m *MetaDataBuilder) AddReference(r ReferenceType, t string) *MetaDataBuilder
AddReference adds the reference
func (*MetaDataBuilder) DisplayFormat ¶
func (m *MetaDataBuilder) DisplayFormat(df fbs.DisplayFormat) *MetaDataBuilder
DisplayFormat sets the display format
func (*MetaDataBuilder) DisplayName ¶
func (m *MetaDataBuilder) DisplayName(n string) *MetaDataBuilder
DisplayName sets the display name
func (*MetaDataBuilder) NodeClass ¶
func (m *MetaDataBuilder) NodeClass(nc fbs.NodeClass) *MetaDataBuilder
NodeClass sets the node class
func (*MetaDataBuilder) Operations ¶
func (m *MetaDataBuilder) Operations(a AllowedOperation) *MetaDataBuilder
Operations set the allowed operations
func (*MetaDataBuilder) Unit ¶
func (m *MetaDataBuilder) Unit(u string) *MetaDataBuilder
Unit sets the unit
type NotifyItem ¶
type NotifyItemPublish ¶ added in v2.5.0
type NotifyItemPublish struct {
// contains filtered or unexported fields
}
NotifyItemPublish interface for publish subscription items.
func NewNotifyItemPublish ¶ added in v2.5.0
func NewNotifyItemPublish(address string) *NotifyItemPublish
NewNotifyItemPublish creates a NotifyItemPublish Parameter address is the address of the provider node.
func (*NotifyItemPublish) GetData ¶ added in v2.5.0
func (i *NotifyItemPublish) GetData() *Variant
GetData gets the data of the notify item. It returns the variant.
func (*NotifyItemPublish) GetInfo ¶ added in v2.5.0
func (i *NotifyItemPublish) GetInfo() *Variant
GetInfo gets the info of the notify item. containing notify_info.fbs (address, timestamp, type, ...). It returns the variant
func (*NotifyItemPublish) SetEventType ¶ added in v2.5.0
func (i *NotifyItemPublish) SetEventType(e string)
SetEventType sets eventtype of the notify_info.fbs.
func (*NotifyItemPublish) SetNotifyType ¶ added in v2.5.0
func (i *NotifyItemPublish) SetNotifyType(n fbs.NotifyType)
SetNotifyType sets the NotifyType of the notify_info.fbs.
func (*NotifyItemPublish) SetSequenceNumber ¶ added in v2.5.0
func (i *NotifyItemPublish) SetSequenceNumber(n uint64)
SetSequenceNumber sets sequence number of the notify_info.fbs.
func (*NotifyItemPublish) SetSourceName ¶ added in v2.5.0
func (i *NotifyItemPublish) SetSourceName(s string)
SetSequenceNumber sets source name of the notify_info.fbs.
func (*NotifyItemPublish) SetTimestamp ¶ added in v2.5.0
func (i *NotifyItemPublish) SetTimestamp(t time.Time)
SetTimestamp sets a time.Time value since January 1, 1970 UTC of the notify_info.fbs.
type OnSubscription ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider interface to manage provider nodes.
func (*Provider) GetRegisteredNodePaths ¶ added in v2.5.0
GetRegisteredNodePaths return the current registered node paths. It returns the status of function call and list of registered node paths.
func (*Provider) GetRegisteredType ¶ added in v2.5.0
GetRegisteredType get the variant of a registered type Parameter address is address of the type to get type (no wildcards allowed). It returns the status of function call and variant to stored type (Result, Variant).
func (*Provider) GetRejectedNodePaths ¶ added in v2.5.0
GetRejectedNodePaths return the current rejected node paths. It returns the status of function call and list of rejected node paths.
func (*Provider) GetToken ¶
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/v2/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 ¶
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/v2/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) PublishEvent ¶ added in v2.5.0
PublishEvent publishes an event Parameter data is the payload data of the event. Has to match the type, that is given in the notifyInfo. Parameter eventtype contains additional info about the event with type event_info.fbs. It returns the status of function call.
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
Start starts the provider. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
Stop stops the provider. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
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/v2/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 ¶
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/v2/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 NewProviderNodeSub ¶ added in v2.5.0
func NewProviderNodeSub() *ProviderNode
NewProviderNodeSub initializes the provider node and support the OnSubscribe and OnUnsubscribe interface.
func (*ProviderNode) Channels ¶
func (n *ProviderNode) Channels() *ProviderNodeChannels
Channels get all channels. It returns all channels.
type ProviderNodeCallback ¶
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 OnSubscribe chan ProviderNodeSubscription OnUnsubscribe chan ProviderNodeSubscription 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 ProviderNodeSubscription ¶ added in v2.5.0
type ProviderNodeSubscription struct { Address string Subsciption *ProviderSubscription }
ProviderNodeSubscription event
type ProviderSubscription ¶ added in v2.5.0
type ProviderSubscription struct {
// contains filtered or unexported fields
}
ProviderSubscription interface to manage subscription.
func (*ProviderSubscription) GetNodes ¶ added in v2.5.0
func (p *ProviderSubscription) GetNodes() []string
GetNodes gets the list of address nodes of a subscription
func (*ProviderSubscription) GetProps ¶ added in v2.5.0
func (p *ProviderSubscription) GetProps() *fbs.SubscriptionProperties
GetProps gets the properties of a subscription
func (*ProviderSubscription) GetTimestamp ¶ added in v2.5.0
func (p *ProviderSubscription) GetTimestamp() time.Time
GetTimestamp is a wrapper function for C.DLR_SubscriptionGetTimestamp
func (*ProviderSubscription) GetUniqueId ¶ added in v2.5.0
func (p *ProviderSubscription) GetUniqueId() uint64
GetUniqueId unambiguous identification of the subscription
func (*ProviderSubscription) Publish ¶ added in v2.5.0
func (p *ProviderSubscription) Publish(status Result, items []*NotifyItemPublish) Result
Publish publishes new data for this subscription Parameter status of notification. On failure subscription is canceled for all items. Parameter items list of the notification items.
type ReferenceType ¶
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 ResponseBulkCallback ¶
type ResponseBulkCallback = func([]Response)
ResponseBulkCallback function type
type ResponseCallback ¶
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 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 ResultPaymentRequired Result = C.DL_SEC_PAYMENT_REQUIRED // PAYMENT REQUIRED )
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/v2/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/v2/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 RateLimit uint32 }
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 ¶
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 ¶
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/v2/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 ¶
JSONConverter system. It returns a converter between JSON and a Variant.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 (*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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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) GetArrayInt8 ¶
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/v2/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 ¶
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/v2/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 ¶
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 ¶
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/v2/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 ¶
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/v2/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 ¶
GetArrayUint64 function
func (*Variant) GetArrayUint8 ¶
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/v2/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 ¶
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/v2/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 ¶
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 ¶
GetData takes the pointer to the data of the variant instance. It returns the array of bytes.
func (*Variant) GetFlatbuffers ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
GetSize gets the size of the type in bytes. It returns the size of the type in bytes.
func (*Variant) GetString ¶
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/v2/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 ¶
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 ¶
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/v2/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 ¶
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/v2/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 ¶
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/v2/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 ¶
GetUint8 returns the value of the variant as a uint8 (auto convert if possible) otherwise 0. It returns [0, 255]
func (*Variant) SetArrayFloat32 ¶
SetArrayFloat32 function
func (*Variant) SetArrayFloat64 ¶
SetArrayFloat64 function
func (*Variant) SetArrayInt16 ¶
SetArrayInt16 function
func (*Variant) SetArrayInt32 ¶
SetArrayInt32 function
func (*Variant) SetArrayInt64 ¶
SetArrayInt64 function
func (*Variant) SetArrayString ¶
SetArrayString function
func (*Variant) SetArrayTime ¶
SetArrayTime sets an array of time.Time value since January 1, 1970 UTC It returns the status of function call.
func (*Variant) SetArrayTimestamp ¶
SetArrayTimestamp function
func (*Variant) SetArrayUint16 ¶
SetArrayUint16 function
func (*Variant) SetArrayUint32 ¶
SetArrayUint32 function
func (*Variant) SetArrayUint64 ¶
SetArrayUint64 function
func (*Variant) SetArrayUint8 ¶
SetArrayUint8 function
func (*Variant) SetBool8 ¶
SetBool8 sets a bool value. It returns the status of function call.
Example ¶
Set Methods ------------------------------------
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
SetFlatbuffers function
func (*Variant) SetFloat32 ¶
SetFloat32 sets a float value. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
SetFloat64 sets a double value. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
SetInt16 sets a int16 value. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
SetInt32 sets a int32 value. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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) SetInt8 ¶
SetInt8 sets a int8 value. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
SetString sets a string. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
SetTime sets a time.Time value since January 1, 1970 UTC It returns the status of function call.
func (*Variant) SetTimestamp ¶
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 ¶
SetUint16 sets a uint16 value. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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 ¶
SetUint32 sets a uint32 value. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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) SetUint8 ¶
SetUint8 sets a uint8 value. It returns the status of function call.
Example ¶
package main import ( "github.com/boschrexroth/ctrlx-datalayer-golang/v2/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
Source Files
¶
- bfbsfs_vfsdata.go
- bulk.go
- client.go
- converter.go
- doc.go
- factory.go
- metadatabuilder.go
- nodeHandler.go
- notifyResponseHandler.go
- notifyitem.go
- notifyitempublish.go
- provider.go
- providerNode.go
- providerSubscription.go
- responseBulkHandler.go
- responseHandler.go
- result.go
- subscription.go
- subscriptionproperties.go
- subscriptionpropertiesconverter.go
- system.go
- variant.go
- variant_64_linux.go