-
Notifications
You must be signed in to change notification settings - Fork 1
/
posture_proxy.go
147 lines (132 loc) · 4.43 KB
/
posture_proxy.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Package proxy contains a generated proxy
// .
package proxy
import (
"context"
"fmt"
bus "github.com/lugu/qiloop/bus"
)
// ALRobotPostureProxy represents a proxy object to the service
type ALRobotPostureProxy interface {
GetPostureFamily() (string, error)
GoToPosture(postureName string, maxSpeedFraction float32) (bool, error)
ApplyPosture(postureName string, maxSpeedFraction float32) (bool, error)
StopMove() error
GetPostureList() ([]string, error)
GetPostureFamilyList() ([]string, error)
SetMaxTryNumber(pMaxTryNumber int32) error
GetPosture() (string, error)
// Generic methods shared by all objectsProxy
bus.ObjectProxy
// WithContext can be used cancellation and timeout
WithContext(ctx context.Context) ALRobotPostureProxy
}
// proxyALRobotPosture implements ALRobotPostureProxy
type proxyALRobotPosture struct {
bus.ObjectProxy
session bus.Session
}
// MakeALRobotPosture returns a specialized proxy.
func MakeALRobotPosture(sess bus.Session, proxy bus.Proxy) ALRobotPostureProxy {
return &proxyALRobotPosture{bus.MakeObject(proxy), sess}
}
// ALRobotPosture returns a proxy to a remote service
func ALRobotPosture(session bus.Session) (ALRobotPostureProxy, error) {
proxy, err := session.Proxy("ALRobotPosture", 1)
if err != nil {
return nil, fmt.Errorf("contact service: %s", err)
}
return MakeALRobotPosture(session, proxy), nil
}
// WithContext bound future calls to the context deadline and cancellation
func (p *proxyALRobotPosture) WithContext(ctx context.Context) ALRobotPostureProxy {
return MakeALRobotPosture(p.session, p.Proxy().WithContext(ctx))
}
// GetPostureFamily calls the remote procedure
func (p *proxyALRobotPosture) GetPostureFamily() (string, error) {
var ret string
args := bus.NewParams("()")
resp := bus.NewResponse("s", &ret)
err := p.Proxy().Call2("getPostureFamily", args, resp)
if err != nil {
return ret, fmt.Errorf("call getPostureFamily failed: %s", err)
}
return ret, nil
}
// GoToPosture calls the remote procedure
func (p *proxyALRobotPosture) GoToPosture(postureName string, maxSpeedFraction float32) (bool, error) {
var ret bool
args := bus.NewParams("(sf)", postureName, maxSpeedFraction)
resp := bus.NewResponse("b", &ret)
err := p.Proxy().Call2("goToPosture", args, resp)
if err != nil {
return ret, fmt.Errorf("call goToPosture failed: %s", err)
}
return ret, nil
}
// ApplyPosture calls the remote procedure
func (p *proxyALRobotPosture) ApplyPosture(postureName string, maxSpeedFraction float32) (bool, error) {
var ret bool
args := bus.NewParams("(sf)", postureName, maxSpeedFraction)
resp := bus.NewResponse("b", &ret)
err := p.Proxy().Call2("applyPosture", args, resp)
if err != nil {
return ret, fmt.Errorf("call applyPosture failed: %s", err)
}
return ret, nil
}
// StopMove calls the remote procedure
func (p *proxyALRobotPosture) StopMove() error {
var ret struct{}
args := bus.NewParams("()")
resp := bus.NewResponse("v", &ret)
err := p.Proxy().Call2("stopMove", args, resp)
if err != nil {
return fmt.Errorf("call stopMove failed: %s", err)
}
return nil
}
// GetPostureList calls the remote procedure
func (p *proxyALRobotPosture) GetPostureList() ([]string, error) {
var ret []string
args := bus.NewParams("()")
resp := bus.NewResponse("[s]", &ret)
err := p.Proxy().Call2("getPostureList", args, resp)
if err != nil {
return ret, fmt.Errorf("call getPostureList failed: %s", err)
}
return ret, nil
}
// GetPostureFamilyList calls the remote procedure
func (p *proxyALRobotPosture) GetPostureFamilyList() ([]string, error) {
var ret []string
args := bus.NewParams("()")
resp := bus.NewResponse("[s]", &ret)
err := p.Proxy().Call2("getPostureFamilyList", args, resp)
if err != nil {
return ret, fmt.Errorf("call getPostureFamilyList failed: %s", err)
}
return ret, nil
}
// SetMaxTryNumber calls the remote procedure
func (p *proxyALRobotPosture) SetMaxTryNumber(pMaxTryNumber int32) error {
var ret struct{}
args := bus.NewParams("(i)", pMaxTryNumber)
resp := bus.NewResponse("v", &ret)
err := p.Proxy().Call2("setMaxTryNumber", args, resp)
if err != nil {
return fmt.Errorf("call setMaxTryNumber failed: %s", err)
}
return nil
}
// GetPosture calls the remote procedure
func (p *proxyALRobotPosture) GetPosture() (string, error) {
var ret string
args := bus.NewParams("()")
resp := bus.NewResponse("s", &ret)
err := p.Proxy().Call2("getPosture", args, resp)
if err != nil {
return ret, fmt.Errorf("call getPosture failed: %s", err)
}
return ret, nil
}