-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample_test.go
38 lines (33 loc) · 878 Bytes
/
example_test.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
package qiloop_test
import (
"github.com/lugu/qiloop"
"github.com/lugu/qiloop/bus/services"
)
// This example llustrates how to make a method call to a remote
// object. It uses the specialized proxy of the text to speech
// service.
func Example_basic() {
// imports the following packages:
// "github.com/lugu/qiloop"
// "github.com/lugu/qiloop/bus/services"
// Create a new session.
session, err := qiloop.NewSession(
"tcp://localhost:9559", // Service directory URL
"", // user
"", // token
)
if err != nil {
panic(err)
}
defer session.Terminate()
// Obtain a proxy to the service
textToSpeech, err := services.ALTextToSpeech(session)
if err != nil {
panic(err)
}
// Remote procedure call: call the method "say" of the service.
err = textToSpeech.Say("Hi there !")
if err != nil {
panic(err)
}
}