• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Base class interface for base station emulators."""
6
7# This is essentially all documentation; no code (other than raise
8# NotImplementedError()) should go here."""
9
10import air_state_verifier
11import cellular
12
13
14class BaseStationInterface(object):
15    """A generic base station emulator."""
16    def Start(self):
17        raise NotImplementedError()
18
19    def Stop(self):
20        raise NotImplementedError()
21
22    def GetAirStateVerifier(self):
23        return air_state_verifier.AirStateVerifierPermissive(self)
24
25    def SetBsIpV4(self, ip1, ip2):
26        """Sets base station IPv4 addresses."""
27        raise NotImplementedError()
28
29    def SetBsNetmaskV4(self, netmask):
30        """Sets base station netmask."""
31        raise NotImplementedError()
32
33    def SetFrequencyBand(self, band):
34        """Sets the frequency used by the BS.  BS must be stopped.
35
36        Arguments:
37            band: A band number, from the UMTS bands summarized at
38                  http://en.wikipedia.org/wiki/UMTS_frequency_bands
39                  Use band 5 for 800MHz C2k/EV-DO,  2 for 1900MHz C2k/EV-DO
40        """
41        raise NotImplementedError()
42
43    def SetPlmn(self, mcc, mnc):
44        """Sets the mobile country and network codes.  BS must be stopped."""
45        raise NotImplementedError()
46
47    def SetPower(self, dbm):
48        """Sets the output power of the base station.
49
50        Arguments:
51            dbm: Power, in dBm.  See class Power for useful constants.
52        """
53        raise NotImplementedError()
54
55    def SetUeDnsV4(self, dns1, dns2):
56        """Set the DNS values provided to the UE.  Emulator must be stopped.
57        """
58        raise NotImplementedError()
59
60    def SetUeIpV4(self, ip1, ip2=None):
61        """Set the IP addresses provided to the UE.  Emulator must be stopped.
62
63        Arguments:
64            ip1: IP address, as a dotted-quad string.
65            ip2: Secondary IP address.  Not set if not supplied.
66        """
67        raise NotImplementedError()
68
69    def GetUeDataStatus(self):
70        """Gets the data call status of the UE."""
71        raise NotImplementedError()
72
73    def PrepareForStatusChange(self):
74        """Prepare for a future call to WaitForStatusChange.
75
76        There's a race in WaitForStatusChange; if we tell the modem to
77        connect, it might connect before we get around to calling
78        PrepareForStatusChange.
79
80        As a special case for 8960, this tells the instrument to make the
81        next GetUeStatus call block on a status change.
82        """
83        raise NotImplementedError()
84
85    def WaitForStatusChange(self,
86                            interested=None,
87                            timeout=cellular.DEFAULT_TIMEOUT):
88        """When UE status changes (to a value in interested), return the value.
89
90        Arguments:
91            interested: if non-None, only transitions to these states will
92                        cause a return
93            timeout: in seconds.
94        """
95        raise NotImplementedError()
96
97    def WaitForSmsReceive(self,
98                          timeout=cellular.DEFAULT_TIMEOUT):
99        """Return received SMS is received from the UE.
100
101        Arguments:
102            timeout: in seconds.
103        """
104        raise NotImplementedError()
105
106    def SendSms(self,
107                message,
108                o_address=cellular.SmsAddress('8960'),
109                dcs=0xf0):
110        """Sends the supplied SMS message."""
111        raise NotImplementedError()
112
113