Documentation
¶
Index ¶
- Constants
- Variables
- func DataAddRef(this unsafe.Pointer) uintptr
- func DataOnCancelComplete(this unsafe.Pointer, dwTransid uint32, hGroup uint32) uintptr
- func DataOnDataChange(this unsafe.Pointer, dwTransid uint32, hGroup uint32, hrMasterquality int32, ...) uintptr
- func DataOnReadComplete(this unsafe.Pointer, dwTransid uint32, hGroup uint32, hrMasterquality int32, ...) uintptr
- func DataOnWriteComplete(this unsafe.Pointer, dwTransid uint32, hGroup uint32, hrMastererr int32, ...) uintptr
- func DataQueryInterface(this unsafe.Pointer, iid *windows.GUID, punk *unsafe.Pointer) uintptr
- func DataRelease(this unsafe.Pointer) uintptr
- func NewOPCWrapperError(info string, err error) error
- func ShutdownAddRef(this unsafe.Pointer) uintptr
- func ShutdownQueryInterface(this unsafe.Pointer, iid *windows.GUID, punk *unsafe.Pointer) uintptr
- func ShutdownRelease(this unsafe.Pointer) uintptr
- func ShutdownRequest(this *com.IUnknown, pReason *uint16) uintptr
- type CCancelCompleteCallBackData
- type CDataChangeCallBackData
- type CReadCompleteCallBackData
- type CWriteCompleteCallBackData
- type CancelCompleteCallBackData
- type DataChangeCallBackData
- type DataEventReceiver
- type DataEventReceiverVtbl
- type OPCBrowser
- func (b *OPCBrowser) GetAccessRights() uint32
- func (b *OPCBrowser) GetCount() int
- func (b *OPCBrowser) GetCurrentPosition() (string, error)
- func (b *OPCBrowser) GetDataType() uint16
- func (b *OPCBrowser) GetFilter() string
- func (b *OPCBrowser) GetItemID(leaf string) (string, error)
- func (b *OPCBrowser) GetOrganization() (com.OPCNAMESPACETYPE, error)
- func (b *OPCBrowser) Item(index int) (string, error)
- func (b *OPCBrowser) MoveDown(name string) error
- func (b *OPCBrowser) MoveTo(branches []string) error
- func (b *OPCBrowser) MoveToRoot()
- func (b *OPCBrowser) MoveUp() error
- func (b *OPCBrowser) Release()
- func (b *OPCBrowser) SetAccessRights(accessRights uint32) error
- func (b *OPCBrowser) SetDataType(dataType uint16)
- func (b *OPCBrowser) SetFilter(filter string)
- func (b *OPCBrowser) ShowBranches() error
- func (b *OPCBrowser) ShowLeafs(flat bool) error
- type OPCError
- type OPCGroup
- func (g *OPCGroup) AsyncCancel(cancelID uint32) error
- func (g *OPCGroup) AsyncRead(serverHandles []uint32, clientTransactionID uint32) (cancelID uint32, errs []error, err error)
- func (g *OPCGroup) AsyncRefresh(source com.OPCDATASOURCE, clientTransactionID uint32) (cancelID uint32, err error)
- func (g *OPCGroup) AsyncWrite(serverHandles []uint32, values []interface{}, clientTransactionID uint32) (cancelID uint32, errs []error, err error)
- func (g *OPCGroup) GetClientHandle() uint32
- func (g *OPCGroup) GetDeadband() (float32, error)
- func (g *OPCGroup) GetIsActive() bool
- func (g *OPCGroup) GetLocaleID() (uint32, error)
- func (g *OPCGroup) GetName() string
- func (g *OPCGroup) GetParent() *OPCGroups
- func (g *OPCGroup) GetServerHandle() uint32
- func (g *OPCGroup) GetTimeBias() (int32, error)
- func (g *OPCGroup) GetUpdateRate() (uint32, error)
- func (g *OPCGroup) OPCItems() *OPCItems
- func (g *OPCGroup) RegisterCancelComplete(ch chan *CancelCompleteCallBackData) error
- func (g *OPCGroup) RegisterDataChange(ch chan *DataChangeCallBackData) error
- func (g *OPCGroup) RegisterReadComplete(ch chan *ReadCompleteCallBackData) error
- func (g *OPCGroup) RegisterWriteComplete(ch chan *WriteCompleteCallBackData) error
- func (g *OPCGroup) Release()
- func (g *OPCGroup) SetClientHandle(clientHandle uint32) error
- func (g *OPCGroup) SetDeadband(deadband float32) error
- func (g *OPCGroup) SetIsActive(isActive bool) error
- func (g *OPCGroup) SetLocaleID(id uint32) error
- func (g *OPCGroup) SetName(name string) error
- func (g *OPCGroup) SetTimeBias(timeBias int32) error
- func (g *OPCGroup) SetUpdateRate(updateRate uint32) error
- func (g *OPCGroup) SyncRead(source com.OPCDATASOURCE, serverHandles []uint32) ([]*com.ItemState, []error, error)
- func (g *OPCGroup) SyncWrite(serverHandles []uint32, values []interface{}) ([]error, error)
- type OPCGroups
- func (gs *OPCGroups) Add(szName string) (*OPCGroup, error)
- func (gs *OPCGroups) GetCount() int
- func (gs *OPCGroups) GetDefaultGroupDeadband() float32
- func (gs *OPCGroups) GetDefaultGroupIsActive() bool
- func (gs *OPCGroups) GetDefaultGroupLocaleID() uint32
- func (gs *OPCGroups) GetDefaultGroupTimeBias() int32
- func (gs *OPCGroups) GetDefaultGroupUpdateRate() uint32
- func (gs *OPCGroups) GetOPCGroup(serverHandle uint32) (*OPCGroup, error)
- func (gs *OPCGroups) GetOPCGroupByName(name string) (*OPCGroup, error)
- func (gs *OPCGroups) GetParent() *OPCServer
- func (gs *OPCGroups) Item(index int32) (*OPCGroup, error)
- func (gs *OPCGroups) ItemByName(name string) (*OPCGroup, error)
- func (gs *OPCGroups) Release() error
- func (gs *OPCGroups) Remove(serverHandle uint32) error
- func (gs *OPCGroups) RemoveAll() error
- func (gs *OPCGroups) RemoveByName(name string) error
- func (gs *OPCGroups) SetDefaultGroupDeadband(defaultDeadband float32)
- func (gs *OPCGroups) SetDefaultGroupIsActive(defaultActive bool)
- func (gs *OPCGroups) SetDefaultGroupLocaleID(defaultLocaleID uint32)
- func (gs *OPCGroups) SetDefaultGroupTimeBias(defaultGroupTimeBias int32)
- func (gs *OPCGroups) SetDefaultGroupUpdateRate(defaultGroupUpdateRate uint32)
- type OPCItem
- func (i *OPCItem) GetAccessPath() string
- func (i *OPCItem) GetAccessRights() uint32
- func (i *OPCItem) GetCanonicalDataType() com.VT
- func (i *OPCItem) GetClientHandle() uint32
- func (i *OPCItem) GetEUInfo() (interface{}, error)
- func (i *OPCItem) GetEUType() (int, error)
- func (i *OPCItem) GetIsActive() bool
- func (i *OPCItem) GetItemID() string
- func (i *OPCItem) GetParent() *OPCItems
- func (i *OPCItem) GetQuality() uint16
- func (i *OPCItem) GetRequestedDataType() com.VT
- func (i *OPCItem) GetServerHandle() uint32
- func (i *OPCItem) GetTimestamp() time.Time
- func (i *OPCItem) GetValue() interface{}
- func (i *OPCItem) Read(source com.OPCDATASOURCE) (interface{}, uint16, time.Time, error)
- func (i *OPCItem) Release()
- func (i *OPCItem) SetClientHandle(clientHandle uint32) error
- func (i *OPCItem) SetIsActive(isActive bool) error
- func (i *OPCItem) SetRequestedDataType(requestedDataType com.VT) error
- func (i *OPCItem) Write(value interface{}) error
- type OPCItems
- func (is *OPCItems) AddItem(tag string) (*OPCItem, error)
- func (is *OPCItems) AddItems(tags []string) ([]*OPCItem, []error, error)
- func (is *OPCItems) GetCount() int
- func (is *OPCItems) GetDefaultAccessPath() string
- func (is *OPCItems) GetDefaultActive() bool
- func (is *OPCItems) GetDefaultRequestedDataType() com.VT
- func (is *OPCItems) GetOPCItem(serverHandle uint32) (*OPCItem, error)
- func (is *OPCItems) GetParent() *OPCGroup
- func (is *OPCItems) Item(index int32) (*OPCItem, error)
- func (is *OPCItems) ItemByName(name string) (*OPCItem, error)
- func (is *OPCItems) Release()
- func (is *OPCItems) Remove(serverHandles []uint32)
- func (is *OPCItems) SetActive(serverHandles []uint32, active bool) []error
- func (is *OPCItems) SetClientHandles(serverHandles []uint32, clientHandles []uint32) []error
- func (is *OPCItems) SetDataTypes(serverHandles []uint32, requestedDataTypes []com.VT) []error
- func (is *OPCItems) SetDefaultAccessPath(defaultAccessPath string)
- func (is *OPCItems) SetDefaultActive(defaultActive bool)
- func (is *OPCItems) SetDefaultRequestedDataType(defaultRequestedDataType com.VT)
- func (is *OPCItems) Validate(tags []string, requestedDataTypes *[]com.VT, accessPaths *[]string) ([]error, error)
- type OPCServer
- func (s *OPCServer) CreateBrowser() (*OPCBrowser, error)
- func (s *OPCServer) Disconnect() error
- func (s *OPCServer) GetBandwidth() (uint32, error)
- func (s *OPCServer) GetBuildNumber() (uint16, error)
- func (s *OPCServer) GetClientName() string
- func (s *OPCServer) GetCurrentTime() (time.Time, error)
- func (s *OPCServer) GetErrorString(errorCode int32) (string, error)
- func (s *OPCServer) GetItemProperties(itemID string, propertyIDs []uint32) (data []interface{}, itemErrors []error, err error)
- func (s *OPCServer) GetLastUpdateTime() (time.Time, error)
- func (s *OPCServer) GetLocaleID() (uint32, error)
- func (s *OPCServer) GetMajorVersion() (uint16, error)
- func (s *OPCServer) GetMinorVersion() (uint16, error)
- func (s *OPCServer) GetOPCGroups() *OPCGroups
- func (s *OPCServer) GetServerName() string
- func (s *OPCServer) GetServerNode() string
- func (s *OPCServer) GetServerState() (com.OPCServerState, error)
- func (s *OPCServer) GetStartTime() (time.Time, error)
- func (s *OPCServer) GetVendorInfo() (string, error)
- func (s *OPCServer) LookupItemIDs(itemID string, propertyIDs []uint32) ([]string, []error, error)
- func (s *OPCServer) QueryAvailableLocaleIDs() ([]uint32, error)
- func (s *OPCServer) QueryAvailableProperties(itemID string) (pPropertyIDs []uint32, ppDescriptions []string, ppvtDataTypes []uint16, ...)
- func (s *OPCServer) RegisterServerShutDown(ch chan string) error
- func (s *OPCServer) SetClientName(clientName string) error
- func (s *OPCServer) SetLocaleID(localeID uint32) error
- type OPCWrapperError
- type PropertyDescription
- type ReadCompleteCallBackData
- type ServerInfo
- type ShutdownEventReceiver
- type ShutdownEventReceiverVtbl
- type WriteCompleteCallBackData
Examples ¶
Constants ¶
const ( // OPC_READABLE indicates that the item is readable. OPC_READABLE uint32 = 0x1 // OPC_WRITEABLE indicates that the item is writable. OPC_WRITEABLE = 0x2 )
const ( // OPC_DS_CACHE indicates that the data should be read from the cache. OPC_DS_CACHE com.OPCDATASOURCE = 1 // OPC_DS_DEVICE indicates that the data should be read from the device. OPC_DS_DEVICE com.OPCDATASOURCE = OPC_DS_CACHE + 1 )
const ( // OPC_NS_HIERARCHIAL indicates that the address space is hierarchical. OPC_NS_HIERARCHIAL com.OPCNAMESPACETYPE = 1 // OPC_NS_FLAT indicates that the address space is flat. OPC_NS_FLAT com.OPCNAMESPACETYPE = OPC_NS_HIERARCHIAL + 1 )
const ( // OPC_STATUS_RUNNING indicates that the server is running. OPC_STATUS_RUNNING com.OPCServerState = 1 // OPC_STATUS_FAILED indicates that the server has failed. OPC_STATUS_FAILED = OPC_STATUS_RUNNING + 1 // OPC_STATUS_NOCONFIG indicates that the server is not configured. OPC_STATUS_NOCONFIG = OPC_STATUS_FAILED + 1 // OPC_STATUS_SUSPENDED indicates that the server is suspended. OPC_STATUS_SUSPENDED = OPC_STATUS_NOCONFIG + 1 // OPC_STATUS_TEST indicates that the server is in test mode. OPC_STATUS_TEST = OPC_STATUS_SUSPENDED + 1 // OPC_STATUS_COMM_FAULT indicates that the server has a communication fault. OPC_STATUS_COMM_FAULT = OPC_STATUS_TEST + 1 )
const ( // OPC_BROWSE_UP indicates browsing up. OPC_BROWSE_UP com.OPCBROWSEDIRECTION = 1 // OPC_BROWSE_DOWN indicates browsing down. OPC_BROWSE_DOWN com.OPCBROWSEDIRECTION = OPC_BROWSE_UP + 1 // OPC_BROWSE_TO indicates browsing to a specific position. OPC_BROWSE_TO com.OPCBROWSEDIRECTION = OPC_BROWSE_DOWN + 1 )
const ( // OPC_BRANCH indicates browsing branches. OPC_BRANCH com.OPCBROWSETYPE = 1 // OPC_LEAF indicates browsing leaves. OPC_LEAF com.OPCBROWSETYPE = OPC_BRANCH + 1 // OPC_FLAT indicates browsing flat. OPC_FLAT com.OPCBROWSETYPE = OPC_LEAF + 1 )
const ( // OPC_ENUM_PRIVATE_CONNECTIONS indicates private connections. OPC_ENUM_PRIVATE_CONNECTIONS = 1 // OPC_ENUM_PUBLIC_CONNECTIONS indicates public connections. OPC_ENUM_PUBLIC_CONNECTIONS = OPC_ENUM_PRIVATE_CONNECTIONS + 1 // OPC_ENUM_ALL_CONNECTIONS indicates all connections. OPC_ENUM_ALL_CONNECTIONS = OPC_ENUM_PUBLIC_CONNECTIONS + 1 // OPC_ENUM_PRIVATE indicates private enumerations. OPC_ENUM_PRIVATE = OPC_ENUM_ALL_CONNECTIONS + 1 // OPC_ENUM_PUBLIC indicates public enumerations. OPC_ENUM_PUBLIC = OPC_ENUM_PRIVATE + 1 // OPC_ENUM_ALL indicates all enumerations. OPC_ENUM_ALL = OPC_ENUM_PUBLIC + 1 )
Variables ¶
var ( OPCInvalidHandle = uint32(0xC0040001) OPCBadType = uint32(0xC0040004) OPCPublic = uint32(0xC0040005) OPCBadRights = uint32(0xC0040006) OPCUnknownItemID = uint32(0xC0040007) OPCInvalidItemID = uint32(0xC0040008) OPCInvalidFilter = uint32(0xC0040009) OPCUnknownPath = uint32(0xC004000A) OPCRange = uint32(0xC004000B) OPCDuplicateName = uint32(0xC004000C) OPCUnsupportedRate = uint32(0x0004000D) OPCClamp = uint32(0x0004000E) OPCInuse = uint32(0x0004000F) OPCInvalidConfig = uint32(0xC0040010) OPCNotFound = uint32(0xC0040011) OPCInvalidPID = uint32(0xC0040203) )
var IID_CATID_OPCDAServer10 = windows.GUID{ Data1: 0x63D5F430, Data2: 0xCFE4, Data3: 0x11d1, Data4: [8]byte{0xB2, 0xC8, 0x00, 0x60, 0x08, 0x3B, 0xA1, 0xFB}, }
IID_CATID_OPCDAServer10 is the CATID for OPC DA 1.0 servers.
var IID_CATID_OPCDAServer20 = windows.GUID{ Data1: 0x63D5F432, Data2: 0xCFE4, Data3: 0x11d1, Data4: [8]byte{0xB2, 0xC8, 0x00, 0x60, 0x08, 0x3B, 0xA1, 0xFB}, }
IID_CATID_OPCDAServer20 is the CATID for OPC DA 2.0 servers.
var IID_IOPCDataCallback = windows.GUID{ Data1: 0x39c13a70, Data2: 0x011e, Data3: 0x11d0, Data4: [8]byte{0x96, 0x75, 0x00, 0x20, 0xaf, 0xd8, 0xad, 0xb3}, }
IID_IOPCDataCallback is the GUID for the IOPCDataCallback interface.
var IID_IOPCShutdown = windows.GUID{ Data1: 0xF31DFDE1, Data2: 0x07B6, Data3: 0x11d2, Data4: [8]byte{0xB2, 0xD8, 0x00, 0x60, 0x08, 0x3B, 0xA1, 0xFB}, }
IID_IOPCShutdown is the GUID for the IOPCShutdown interface.
Functions ¶
func DataAddRef ¶
DataAddRef handles the AddRef COM method.
func DataOnCancelComplete ¶
DataOnCancelComplete handles the OnCancelComplete COM callback.
func DataOnDataChange ¶
func DataOnDataChange(this unsafe.Pointer, dwTransid uint32, hGroup uint32, hrMasterquality int32, hrMastererror int32, dwCount uint32, phClientItems unsafe.Pointer, pvValues unsafe.Pointer, pwQualities unsafe.Pointer, pftTimeStamps unsafe.Pointer, pErrors unsafe.Pointer) uintptr
DataOnDataChange handles the OnDataChange COM callback.
func DataOnReadComplete ¶
func DataOnReadComplete(this unsafe.Pointer, dwTransid uint32, hGroup uint32, hrMasterquality int32, hrMastererror int32, dwCount uint32, phClientItems unsafe.Pointer, pvValues unsafe.Pointer, pwQualities unsafe.Pointer, pftTimeStamps unsafe.Pointer, pErrors unsafe.Pointer) uintptr
DataOnReadComplete handles the OnReadComplete COM callback.
func DataOnWriteComplete ¶
func DataOnWriteComplete(this unsafe.Pointer, dwTransid uint32, hGroup uint32, hrMastererr int32, dwCount uint32, pClienthandles unsafe.Pointer, pErrors unsafe.Pointer) uintptr
DataOnWriteComplete handles the OnWriteComplete COM callback.
func DataQueryInterface ¶
DataQueryInterface handles the QueryInterface COM method.
func DataRelease ¶
DataRelease handles the Release COM method.
func NewOPCWrapperError ¶
func ShutdownAddRef ¶
func ShutdownQueryInterface ¶
func ShutdownRelease ¶
Types ¶
type CCancelCompleteCallBackData ¶
CCancelCompleteCallBackData holds data for the OnCancelComplete event.
type CDataChangeCallBackData ¶
type CDataChangeCallBackData struct {
TransID uint32
GroupHandle uint32
MasterQuality int32
MasterErr int32
ItemClientHandles []uint32
Values []interface{}
Qualities []uint16
TimeStamps []time.Time
Errors []int32
}
CDataChangeCallBackData holds data for the OnDataChange event.
type CReadCompleteCallBackData ¶
type CReadCompleteCallBackData struct {
TransID uint32
GroupHandle uint32
MasterQuality int32
MasterErr int32
ItemClientHandles []uint32
Values []interface{}
Qualities []uint16
TimeStamps []time.Time
Errors []int32
}
CReadCompleteCallBackData holds data for the OnReadComplete event.
type CWriteCompleteCallBackData ¶
type CWriteCompleteCallBackData struct {
TransID uint32
GroupHandle uint32
MasterErr int32
ItemClientHandles []uint32
Errors []int32
}
CWriteCompleteCallBackData holds data for the OnWriteComplete event.
type DataChangeCallBackData ¶
type DataEventReceiver ¶
type DataEventReceiver struct {
// contains filtered or unexported fields
}
DataEventReceiver handles COM callbacks for data events.
func NewDataEventReceiver ¶
func NewDataEventReceiver( dataChangeReceiver chan *CDataChangeCallBackData, readCompleteReceiver chan *CReadCompleteCallBackData, writeCompleteReceiver chan *CWriteCompleteCallBackData, cancelCompleteReceiver chan *CCancelCompleteCallBackData, ) *DataEventReceiver
NewDataEventReceiver creates a new DataEventReceiver.
type DataEventReceiverVtbl ¶
type DataEventReceiverVtbl struct {
// contains filtered or unexported fields
}
DataEventReceiverVtbl defines the VTable for the DataEventReceiver COM object.
type OPCBrowser ¶
type OPCBrowser struct {
// contains filtered or unexported fields
}
OPCBrowser represents a browser for OPC item IDs.
func NewOPCBrowser ¶
func NewOPCBrowser(parent *OPCServer) (*OPCBrowser, error)
NewOPCBrowser creates a new OPCBrowser instance.
func (*OPCBrowser) GetAccessRights ¶
func (b *OPCBrowser) GetAccessRights() uint32
GetAccessRights returns the requested access rights that apply to the ShowLeafs methods.
func (*OPCBrowser) GetCount ¶
func (b *OPCBrowser) GetCount() int
GetCount returns the number of items in the collection.
func (*OPCBrowser) GetCurrentPosition ¶
func (b *OPCBrowser) GetCurrentPosition() (string, error)
GetCurrentPosition returns the current position in the tree.
func (*OPCBrowser) GetDataType ¶
func (b *OPCBrowser) GetDataType() uint16
GetDataType returns the requested data type that applies to ShowLeafs methods. This property defaults to com.VT_EMPTY, which means that any data type is acceptable.
func (*OPCBrowser) GetFilter ¶
func (b *OPCBrowser) GetFilter() string
GetFilter returns the filter that applies to ShowBranches and ShowLeafs methods.
func (*OPCBrowser) GetItemID ¶
func (b *OPCBrowser) GetItemID(leaf string) (string, error)
GetItemID gives a name and returns a valid ItemID that can be passed to OPCItems Add method.
func (*OPCBrowser) GetOrganization ¶
func (b *OPCBrowser) GetOrganization() (com.OPCNAMESPACETYPE, error)
GetOrganization returns either OPCHierarchical or OPCFlat.
func (*OPCBrowser) Item ¶
func (b *OPCBrowser) Item(index int) (string, error)
Item returns the name of the item at the specified index. index is 0-based.
func (*OPCBrowser) MoveDown ¶
func (b *OPCBrowser) MoveDown(name string) error
MoveDown moves down into this branch.
func (*OPCBrowser) MoveTo ¶
func (b *OPCBrowser) MoveTo(branches []string) error
MoveTo moves to an absolute position.
func (*OPCBrowser) MoveToRoot ¶
func (b *OPCBrowser) MoveToRoot()
MoveToRoot moves up to the first level in the tree.
func (*OPCBrowser) MoveUp ¶
func (b *OPCBrowser) MoveUp() error
MoveUp moves up one level in the tree.
func (*OPCBrowser) SetAccessRights ¶
func (b *OPCBrowser) SetAccessRights(accessRights uint32) error
SetAccessRights sets the requested access rights that apply to the ShowLeafs methods.
func (*OPCBrowser) SetDataType ¶
func (b *OPCBrowser) SetDataType(dataType uint16)
SetDataType sets the requested data type that applies to ShowLeafs methods.
func (*OPCBrowser) SetFilter ¶
func (b *OPCBrowser) SetFilter(filter string)
SetFilter sets the filter that applies to ShowBranches and ShowLeafs methods.
func (*OPCBrowser) ShowBranches ¶
func (b *OPCBrowser) ShowBranches() error
ShowBranches fills the collection with names of the branches at the current browse position.
func (*OPCBrowser) ShowLeafs ¶
func (b *OPCBrowser) ShowLeafs(flat bool) error
ShowLeafs fills the collection with the names of the leafs at the current browse position.
Example (Mock) ¶
// Initialize browser with mock address space
mock := newMockBrowserProvider()
browser := newOPCBrowserWithProvider(mock, nil)
// Navigate to Folder1
browser.MoveDown("Folder1")
// Show leafs in Folder1
browser.ShowLeafs(false)
count := browser.GetCount()
for i := 0; i < count; i++ {
name, _ := browser.Item(i)
fmt.Println("Leaf:", name)
}
// Get fully qualified ItemID
itemID, _ := browser.GetItemID("Item1")
fmt.Println("ItemID:", itemID)
Output: Leaf: Item1 Leaf: Item2 ItemID: Folder1.Item1
type OPCGroup ¶
type OPCGroup struct {
// contains filtered or unexported fields
}
OPCGroup represents a group of OPC items.
func NewOPCGroup ¶
func NewOPCGroup( opcGroups *OPCGroups, iUnknown *com.IUnknown, clientGroupHandle uint32, serverGroupHandle uint32, groupName string, revisedUpdateRate uint32, ) (*OPCGroup, error)
NewOPCGroup creates a new OPCGroup instance.
func (*OPCGroup) AsyncCancel ¶
AsyncCancel Request that the server cancel an outstanding transaction. An AsyncCancelComplete event will occur indicating whether or not the cancel succeeded.
func (*OPCGroup) AsyncRead ¶
func (g *OPCGroup) AsyncRead( serverHandles []uint32, clientTransactionID uint32, ) (cancelID uint32, errs []error, err error)
AsyncRead Read one or more items in a group. The results are returned via the AsyncReadComplete event associated with the OPCGroup object.
func (*OPCGroup) AsyncRefresh ¶
func (g *OPCGroup) AsyncRefresh( source com.OPCDATASOURCE, clientTransactionID uint32, ) (cancelID uint32, err error)
AsyncRefresh Generate an event for all active items in the group (whether they have changed or not). Inactive items are not included in the callback. The results are returned via the DataChange event associated with the OPCGroup object.
func (*OPCGroup) AsyncWrite ¶
func (g *OPCGroup) AsyncWrite( serverHandles []uint32, values []interface{}, clientTransactionID uint32, ) (cancelID uint32, errs []error, err error)
AsyncWrite Write one or more items in a group. The results are returned via the AsyncWriteComplete event associated with the OPCGroup object.
func (*OPCGroup) GetClientHandle ¶
GetClientHandle returns the client handle associated with the group.
func (*OPCGroup) GetDeadband ¶
GetDeadband returns the deadband for the group. A deadband is expressed as percent of full scale (legal values 0 to 100).
func (*OPCGroup) GetIsActive ¶
GetIsActive returns whether the group is active.
func (*OPCGroup) GetLocaleID ¶
GetLocaleID returns the locale identifier for the group.
func (*OPCGroup) GetServerHandle ¶
GetServerHandle returns the server assigned handle for the group.
func (*OPCGroup) GetTimeBias ¶
GetTimeBias returns the time bias for the group. This property provides the information needed to convert the time stamp on the data back to the local time of the device.
func (*OPCGroup) GetUpdateRate ¶
GetUpdateRate returns the update rate for the group. The fastest rate at which data change events may be fired. A slow process might cause data changes to fire at less than this rate, but they will never exceed this rate. Rate is in milliseconds. This property’s default depends on the value set in the OPCGroups Collection. Assigning a value to this property is a “request” for a new update rate. The server may not support that rate, so reading the property may result in a different rate (the server will use the closest rate it does support).
func (*OPCGroup) RegisterCancelComplete ¶
func (g *OPCGroup) RegisterCancelComplete(ch chan *CancelCompleteCallBackData) error
RegisterCancelComplete Register to receive cancel complete events
func (*OPCGroup) RegisterDataChange ¶
func (g *OPCGroup) RegisterDataChange(ch chan *DataChangeCallBackData) error
RegisterDataChange Register to receive data change events
func (*OPCGroup) RegisterReadComplete ¶
func (g *OPCGroup) RegisterReadComplete(ch chan *ReadCompleteCallBackData) error
RegisterReadComplete Register to receive read complete events
func (*OPCGroup) RegisterWriteComplete ¶
func (g *OPCGroup) RegisterWriteComplete(ch chan *WriteCompleteCallBackData) error
RegisterWriteComplete Register to receive write complete events
func (*OPCGroup) Release ¶
func (g *OPCGroup) Release()
Release Releases the resources used by the group
func (*OPCGroup) SetClientHandle ¶
SetClientHandle sets the client handle associated with the group.
func (*OPCGroup) SetDeadband ¶
SetDeadband sets the deadband for the group.
func (*OPCGroup) SetIsActive ¶
SetIsActive sets whether the group is active.
func (*OPCGroup) SetLocaleID ¶
SetLocaleID sets the locale identifier for the group.
func (*OPCGroup) SetTimeBias ¶
SetTimeBias sets the time bias for the group.
func (*OPCGroup) SetUpdateRate ¶
SetUpdateRate sets the update rate for the group.
type OPCGroups ¶
func NewOPCGroups ¶
func (*OPCGroups) GetDefaultGroupDeadband ¶
GetDefaultGroupDeadband get the default deadband for OPCGroups created using Groups.Add
func (*OPCGroups) GetDefaultGroupIsActive ¶
GetDefaultGroupIsActive get the default active state for OPCGroups created using Groups.Add
func (*OPCGroups) GetDefaultGroupLocaleID ¶
GetDefaultGroupLocaleID get the default locale for OPCGroups created using Groups.Add.
func (*OPCGroups) GetDefaultGroupTimeBias ¶
GetDefaultGroupTimeBias get the default time bias for OPCGroups created using Groups.Add.
func (*OPCGroups) GetDefaultGroupUpdateRate ¶
GetDefaultGroupUpdateRate get the default update rate (in milliseconds) for OPCGroups created using Groups.Add
func (*OPCGroups) GetOPCGroup ¶
GetOPCGroup Returns an OPCGroup by server handle
func (*OPCGroups) GetOPCGroupByName ¶
GetOPCGroupByName Returns an OPCGroup by name
func (*OPCGroups) Item ¶
Item Returns an OPCGroup by ItemSpecifier. ItemSpecifier is the name or 0-based index into the collection
func (*OPCGroups) ItemByName ¶
ItemByName Returns an OPCGroup by name
func (*OPCGroups) Release ¶
Release Releases the resources used by the collection and the items it contains.
func (*OPCGroups) RemoveByName ¶
RemoveByName Removes an OPCGroup from the collection by name
func (*OPCGroups) SetDefaultGroupDeadband ¶
SetDefaultGroupDeadband set the default deadband for OPCGroups created using Groups.Add
func (*OPCGroups) SetDefaultGroupIsActive ¶
SetDefaultGroupIsActive set the default active state for OPCGroups created using Groups.Add
func (*OPCGroups) SetDefaultGroupLocaleID ¶
SetDefaultGroupLocaleID set the default locale for OPCGroups created using Groups.Add.
func (*OPCGroups) SetDefaultGroupTimeBias ¶
SetDefaultGroupTimeBias set the default time bias for OPCGroups created using Groups.Add.
func (*OPCGroups) SetDefaultGroupUpdateRate ¶
SetDefaultGroupUpdateRate set the default update rate (in milliseconds) for OPCGroups created using Groups.Add
type OPCItem ¶
OPCItem represents a single OPC item.
func NewOPCItem ¶
func NewOPCItem( parent *OPCItems, tag string, result com.TagOPCITEMRESULTStruct, clientHandle uint32, accessPath string, isActive bool, ) *OPCItem
NewOPCItem creates a new OPCItem instance (internal constructor).
func (*OPCItem) GetAccessPath ¶
GetAccessPath returns the access path for the item.
func (*OPCItem) GetAccessRights ¶
GetAccessRights returns the access rights for the item.
func (*OPCItem) GetCanonicalDataType ¶
GetCanonicalDataType returns the canonical data type for the item.
func (*OPCItem) GetClientHandle ¶
GetClientHandle returns the client handle for the item.
func (*OPCItem) GetIsActive ¶
GetIsActive returns the active state for the item.
func (*OPCItem) GetQuality ¶
GetQuality returns the latest quality read from the server.
func (*OPCItem) GetRequestedDataType ¶
GetRequestedDataType returns the requested data type for the item.
func (*OPCItem) GetServerHandle ¶
GetServerHandle returns the server handle for the item.
func (*OPCItem) GetTimestamp ¶
GetTimestamp returns the latest timestamp read from the server.
func (*OPCItem) GetValue ¶
func (i *OPCItem) GetValue() interface{}
GetValue returns the latest value read from the server.
func (*OPCItem) SetClientHandle ¶
SetClientHandle sets the client handle for the item.
func (*OPCItem) SetIsActive ¶
SetIsActive sets the active state for the item.
func (*OPCItem) SetRequestedDataType ¶
SetRequestedDataType sets the requested data type for the item.
type OPCItems ¶
OPCItems represents a collection of OPC items.
func NewOPCItems ¶
NewOPCItems creates a new OPCItems instance.
func (*OPCItems) GetDefaultAccessPath ¶
GetDefaultAccessPath returns the default AccessPath that will be used in calls to Add.
func (*OPCItems) GetDefaultActive ¶
GetDefaultActive returns the default active state for OPCItems created using Items.Add.
func (*OPCItems) GetDefaultRequestedDataType ¶
GetDefaultRequestedDataType returns the requested data type that will be used in calls to Add.
func (*OPCItems) GetOPCItem ¶
GetOPCItem returns the OPCItem by serverHandle.
func (*OPCItems) ItemByName ¶
ItemByName returns the item by name.
func (*OPCItems) Release ¶
func (is *OPCItems) Release()
Release releases the OPCItems collection and all associated resources.
func (*OPCItems) SetActive ¶
SetActive allows activation and deactivation of individual OPCItems in the OPCItems collection.
func (*OPCItems) SetClientHandles ¶
SetClientHandles changes the client handles for one or more items in the collection.
func (*OPCItems) SetDataTypes ¶
SetDataTypes changes the requested data type for one or more items in the collection.
func (*OPCItems) SetDefaultAccessPath ¶
SetDefaultAccessPath sets the default AccessPath that will be used in calls to Add.
func (*OPCItems) SetDefaultActive ¶
SetDefaultActive sets the default active state for OPCItems created using Items.Add.
func (*OPCItems) SetDefaultRequestedDataType ¶
SetDefaultRequestedDataType sets the requested data type that will be used in calls to Add.
type OPCServer ¶
type OPCServer struct {
Name string // Name is the ProgID of the server.
Node string // Node is the network node name where the server resides.
// contains filtered or unexported fields
}
OPCServer represents a connection to an OPC DA server.
func Connect ¶
Connect establishes a connection to the OPC server. It returns an OPCServer instance and an error if connection fails.
Example (Error) ¶
// Attempt to connect to a non-existent server
_, err := Connect("NonExistent.ProgID.1", "localhost")
if err != nil {
fmt.Println("Caught expected connection error")
}
Output: Caught expected connection error
func (*OPCServer) CreateBrowser ¶
func (s *OPCServer) CreateBrowser() (*OPCBrowser, error)
CreateBrowser creates an OPCBrowser object.
Example (Error) ¶
// Attempt to create a browser from a nil server
var server *OPCServer
_, err := server.CreateBrowser()
if err != nil {
fmt.Println("Caught expected browser creation error")
}
Output: Caught expected browser creation error
func (*OPCServer) Disconnect ¶
Disconnect disconnects from the OPC server.
func (*OPCServer) GetBandwidth ¶
GetBandwidth returns the bandwidth of the server.
func (*OPCServer) GetBuildNumber ¶
GetBuildNumber returns the build number of the server.
func (*OPCServer) GetClientName ¶
GetClientName returns the client name of the client.
func (*OPCServer) GetCurrentTime ¶
GetCurrentTime returns the current time from the server.
func (*OPCServer) GetErrorString ¶
GetErrorString converts an error number to a readable string.
func (*OPCServer) GetItemProperties ¶
func (s *OPCServer) GetItemProperties(itemID string, propertyIDs []uint32) (data []interface{}, itemErrors []error, err error)
GetItemProperties returns a list of the current data values for the passed ID codes.
func (*OPCServer) GetLastUpdateTime ¶
GetLastUpdateTime returns the last update time from the server.
func (*OPCServer) GetLocaleID ¶
GetLocaleID returns the current locale ID.
func (*OPCServer) GetMajorVersion ¶
GetMajorVersion returns the major part of the server version number.
func (*OPCServer) GetMinorVersion ¶
GetMinorVersion returns the minor part of the server version number.
func (*OPCServer) GetOPCGroups ¶
GetOPCGroups returns the collection of OPCGroup objects.
func (*OPCServer) GetServerName ¶
GetServerName returns the server name of the server that the client connected to via Connect().
func (*OPCServer) GetServerNode ¶
GetServerNode returns the node name of the server that the client connected to via Connect().
func (*OPCServer) GetServerState ¶
func (s *OPCServer) GetServerState() (com.OPCServerState, error)
GetServerState returns the server's state.
func (*OPCServer) GetStartTime ¶
GetStartTime returns the time the server started running.
func (*OPCServer) GetVendorInfo ¶
GetVendorInfo returns the vendor information string for the server.
func (*OPCServer) LookupItemIDs ¶
LookupItemIDs returns a list of ItemIDs (if available) for each of the passed ID codes. have not tested because simulator return error
func (*OPCServer) QueryAvailableLocaleIDs ¶
QueryAvailableLocaleIDs returns the available LocaleIDs for this server/client session.
func (*OPCServer) QueryAvailableProperties ¶
func (s *OPCServer) QueryAvailableProperties(itemID string) (pPropertyIDs []uint32, ppDescriptions []string, ppvtDataTypes []uint16, err error)
QueryAvailableProperties returns a list of ID codes and Descriptions for the available properties for this ItemID.
func (*OPCServer) RegisterServerShutDown ¶
RegisterServerShutDown registers server shut down event.
func (*OPCServer) SetClientName ¶
SetClientName sets the client name of the client.
func (*OPCServer) SetLocaleID ¶
SetLocaleID sets the locale ID.
type OPCWrapperError ¶
func (*OPCWrapperError) Error ¶
func (e *OPCWrapperError) Error() string
func (*OPCWrapperError) Unwrap ¶
func (e *OPCWrapperError) Unwrap() error
type PropertyDescription ¶
type PropertyDescription struct {
PropertyID int32
Description string
DataType int16
AccessRights int16
}
PropertyDescription describes an OPC item property.
type ServerInfo ¶
type ServerInfo struct {
ProgID string // ProgID is the Program ID of the server.
ClsStr string // ClsStr is the CLSID string representation.
VerIndProgID string // VerIndProgID is the Version Independent ProgID.
ClsID *windows.GUID // ClsID is the unique Class ID of the server.
}
ServerInfo contains information about an OPC DA server.
func GetOPCServers ¶
func GetOPCServers(node string) ([]*ServerInfo, error)
GetOPCServers enumerates available OPC servers on a node. It employs a fallback strategy: IOPCServerList2 (V2) -> IOPCServerList (V1) -> Registry.
type ShutdownEventReceiver ¶
type ShutdownEventReceiver struct {
// contains filtered or unexported fields
}
func NewShutdownEventReceiver ¶
func NewShutdownEventReceiver() *ShutdownEventReceiver
func (*ShutdownEventReceiver) AddReceiver ¶
func (er *ShutdownEventReceiver) AddReceiver(ch chan string)
type ShutdownEventReceiverVtbl ¶
type ShutdownEventReceiverVtbl struct {
// contains filtered or unexported fields
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
asyncread
command
|
|
|
asyncwrite
command
|
|
|
browse
command
|
|
|
read
command
|
|
|
serverlist
command
|
|
|
subscribe
command
|
|
|
write
command
|