Home | History | Annotate | Download | only in sl4a_lib
      1 #!/usr/bin/env python3.4
      2 #
      3 #   Copyright 2018 - The Android Open Source Project
      4 #
      5 #   Licensed under the Apache License, Version 2.0 (the "License");
      6 #   you may not use this file except in compliance with the License.
      7 #   You may obtain a copy of the License at
      8 #
      9 #       http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 #   Unless required by applicable law or agreed to in writing, software
     12 #   distributed under the License is distributed on an "AS IS" BASIS,
     13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 #   See the License for the specific language governing permissions and
     15 #   limitations under the License.
     16 
     17 
     18 class Sl4aPorts(object):
     19     """A container for the three ports needed for an SL4A connection.
     20 
     21     Attributes:
     22         client_port: The port on the host associated with the SL4A client
     23         forwarded_port: The port forwarded to the Android device.
     24         server_port: The port on the device associated with the SL4A server.
     25     """
     26 
     27     def __init__(self, client_port=0, forwarded_port=0, server_port=0):
     28         self.client_port = client_port
     29         self.forwarded_port = forwarded_port
     30         self.server_port = server_port
     31 
     32     def __str__(self):
     33         return '(%s, %s, %s)' % (self.client_port, self.forwarded_port,
     34                                  self.server_port)
     35