Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

# Licensed under the MIT license 

# http://opensource.org/licenses/mit-license.php 

 

# Copyright 2006-2008, Frank Scholz <coherence@beebits.net> 

 

 

class ConnectionManagerClient: 

 

    def __init__(self, service): 

        self.service = service 

        self.namespace = service.get_type() 

        self.url = service.get_control_url() 

        self.service.client = self 

        self.service.subscribe() 

 

    # def __del__(self): 

    #    #print "ConnectionManagerClient deleted" 

    #    pass 

 

    def connection_manager_id(self): 

        return "%s/%s" % (self.service.device.get_id(), self.service.get_id()) 

 

    def remove(self): 

        self.service.remove() 

        self.service = None 

        self.namespace = None 

        self.url = None 

        del self 

 

    def subscribe_for_variable(self, var_name, callback, signal=False): 

        self.service.subscribe_for_variable(var_name, instance=0, 

                                            callback=callback, signal=signal) 

 

    def get_protocol_info(self): 

        action = self.service.get_action('GetProtocolInfo') 

        return action.call() 

 

    def prepare_for_connection(self, remote_protocol_info, 

                               peer_connection_manager, peer_connection_id, 

                               direction): 

        action = self.service.get_action('PrepareForConnection') 

        if action:  # optional 

            return action.call(RemoteProtocolInfo=remote_protocol_info, 

                               PeerConnectionManager=peer_connection_manager, 

                               PeerConnectionID=peer_connection_id, 

                               Direction=direction) 

        return None 

 

    def connection_complete(self, connection_id): 

        action = self.service.get_action('ConnectionComplete') 

        if action:  # optional 

            return action.call(ConnectionID=connection_id) 

        return None 

 

    def get_current_connection_ids(self): 

        action = self.service.get_action('GetCurrentConnectionIDs') 

        return action.call() 

 

    def get_current_connection_info(self, connection_id): 

        action = self.service.get_action('GetCurrentConnectionInfo') 

        return action.call(ConnectionID=connection_id)