File: findservicebytype.py

package info (click to toggle)
robotraconteur 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 101,380 kB
  • sloc: cpp: 1,149,268; cs: 87,653; java: 58,127; python: 26,897; ansic: 356; sh: 152; makefile: 90; xml: 51
file content (37 lines) | stat: -rw-r--r-- 822 bytes parent folder | download
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
from RobotRaconteur.Client import *
import sys
import time


def main():
    rrtype = sys.argv[1]
    transports = sys.argv[2].split(",")

    time.sleep(6)

    ret = RRN.FindServiceByType(rrtype, transports)

    for r in ret:
        print_ServiceInfo2(r)

    def printret(ret):
        for r in ret:
            print_ServiceInfo2(r)
    RRN.AsyncFindServiceByType(rrtype, transports, printret, 1)

    time.sleep(2)


def print_ServiceInfo2(s):
    print("Name: " + s.Name)
    print("RootObjectType: " + s.RootObjectType)
    print("RootObjectImplements: " + str(s.RootObjectImplements))
    print("ConnectionURL: " + str(s.ConnectionURL))
    print("Attributes: " + str(s.Attributes))
    print("NodeID: " + str(s.NodeID))
    print("NodeName: " + s.NodeName)
    print("")


if __name__ == "__main__":
    main()