-
Notifications
You must be signed in to change notification settings - Fork 2
/
board.go
81 lines (65 loc) · 1.97 KB
/
board.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package multicam
// #include <multicam.h>
// #include <stdlib.h>
import "C"
import "unsafe"
const UninitializedBoard = 0
type Board struct {
h Handle
index int
}
// NewBoard creates a new Multicam Board.
func NewBoard() *Board {
return &Board{}
}
// BoardForHandle returns a Multicam Board for an existing Handle.
func BoardForHandle(h Handle) *Board {
return &Board{h: h}
}
// BoardForIndex returns a Multicam Board for a specific DriverIndex.
func BoardForIndex(index int) *Board {
brd := BoardForHandle(DefaultBoardHandle + Handle(index))
brd.index = index
return brd
}
// Delete deletes an existing MultiCam Board object. Just here for consistency, no need to actually "delete" a board.
func (b *Board) Delete() error {
return nil
}
// CreateChannel creates a new Channel for this Board.
func (b *Board) CreateChannel() (*Channel, error) {
ch := NewChannel()
err := ch.Create()
if err != nil {
return nil, err
}
// Link the channel to the board
if err := ch.SetParamInt(DriverIndexParam, b.index); err != nil {
return nil, err
}
return ch, nil
}
// SetParamStr sets a parameter string value for this Board.
func (b *Board) SetParamStr(id ParamID, val string) error {
return SetParamStr(b.h, id, val)
}
// GetParamStr gets a parameter string value for this Board.
func (b *Board) GetParamStr(id ParamID) (string, error) {
return GetParamStr(b.h, id)
}
// SetParamInt sets a parameter int value for this Board.
func (b *Board) SetParamInt(id ParamID, val int) error {
return SetParamInt(b.h, id, val)
}
// GetParamInt gets a parameter int value for this Board.
func (b *Board) GetParamInt(id ParamID) (int, error) {
return GetParamInt(b.h, id)
}
// SetParamPtr sets a parameter pointer value for this Board.
func (b *Board) SetParamPtr(id ParamID, val unsafe.Pointer) error {
return SetParamPtr(b.h, id, val)
}
// GetParamPtr gets a parameter pointer value for this Board.
func (b *Board) GetParamPtr(id ParamID) (unsafe.Pointer, error) {
return GetParamPtr(b.h, id)
}