• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3#   Copyright 2021 - 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
17import os
18from acts_contrib.test_utils.gnss.GnssBlankingBase import GnssBlankingBase
19from acts_contrib.test_utils.gnss.dut_log_test_utils import get_gpstool_logs
20from acts_contrib.test_utils.gnss.gnss_test_utils import excute_eecoexer_function
21
22
23class GnssHsSenTest(GnssBlankingBase):
24    """ LAB GNSS Cellular coex hot start sensitivity search"""
25
26    def __init__(self, controllers):
27        super().__init__(controllers)
28        self.gnss_simulator_power_level = -130
29        self.sa_sensitivity = -150
30        self.gnss_pwr_lvl_offset = 5
31
32    def gnss_hot_start_sensitivity_search_base(self, cellular_enable=False):
33        """
34        Perform GNSS hot start sensitivity search.
35
36        Args:
37                cellular_enable: argument to identify if Tx cellular signal is required or not.
38                Type, bool.
39                Default, False.
40        """
41        # Get parameters from user_params.
42        first_wait = self.user_params.get('first_wait', 300)
43        wait_between_pwr = self.user_params.get('wait_between_pwr', 60)
44        gnss_pwr_sweep = self.user_params.get('gnss_pwr_sweep')
45        gnss_init_pwr = gnss_pwr_sweep.get('init')
46        self.gnss_simulator_power_level = gnss_init_pwr[0]
47        self.sa_sensitivity = gnss_init_pwr[1]
48        self.gnss_pwr_lvl_offset = gnss_init_pwr[2]
49        gnss_pwr_fine_sweep = gnss_pwr_sweep.get('fine_sweep')
50        ttft_iteration = self.user_params.get('ttff_iteration', 25)
51
52        # Start the test item with gnss_init_power_setting.
53        if self.gnss_init_power_setting(first_wait):
54            self.log.info('Successfully set the GNSS power level to %d' %
55                          self.sa_sensitivity)
56            # Create gnss log folders for init and cellular sweep
57            gnss_init_log_dir = os.path.join(self.gnss_log_path, 'GNSS_init')
58
59            # Pull all exist GPStool logs into GNSS_init folder
60            get_gpstool_logs(self.dut, gnss_init_log_dir, False)
61
62            if cellular_enable:
63                self.log.info('Start cellular coexistence test.')
64                # Set cellular Tx power level.
65                eecoex_cmd = self.eecoex_func.format('Infinity')
66                eecoex_cmd_file_str = eecoex_cmd.replace(',', '_')
67                excute_eecoexer_function(self.dut, eecoex_cmd)
68            else:
69                self.log.info('Start stand alone test.')
70                eecoex_cmd_file_str = 'Stand_alone'
71
72            for i, gnss_pwr in enumerate(gnss_pwr_fine_sweep):
73                self.log.info('Start fine GNSS power level sweep part %d' %
74                              (i + 1))
75                sweep_start = gnss_pwr[0]
76                sweep_stop = gnss_pwr[1]
77                sweep_offset = gnss_pwr[2]
78                self.log.info(
79                    'The GNSS simulator (start, stop, offset): (%.1f, %.1f, %.1f)'
80                    % (sweep_start, sweep_stop, sweep_offset))
81                result, sensitivity = self.hot_start_gnss_power_sweep(
82                    sweep_start, sweep_stop, sweep_offset, wait_between_pwr,
83                    ttft_iteration, True, eecoex_cmd_file_str)
84                if not result:
85                    break
86            self.log.info('The sensitivity level is: %.1f' % sensitivity)
87
88    def test_hot_start_sensitivity_search(self):
89        """
90        GNSS hot start stand alone sensitivity search.
91        """
92        self.gnss_hot_start_sensitivity_search_base(False)
93
94    def test_hot_start_sensitivity_search_gsm850(self):
95        """
96        GNSS hot start GSM850 Ch190 coexistence sensitivity search.
97        """
98        self.eecoex_func = 'CELLR,2,850,190,1,1,{}'
99        self.log.info('Running GSM850 and GNSS coexistence sensitivity search.')
100        self.gnss_hot_start_sensitivity_search_base(True)
101
102    def test_hot_start_sensitivity_search_gsm900(self):
103        """
104        GNSS hot start GSM900 Ch20 coexistence sensitivity search.
105        """
106        self.eecoex_func = 'CELLR,2,900,20,1,1,{}'
107        self.log.info('Running GSM900 and GNSS coexistence sensitivity search.')
108        self.gnss_hot_start_sensitivity_search_base(True)
109
110    def test_hot_start_sensitivity_search_gsm1800(self):
111        """
112        GNSS hot start GSM1800 Ch699 coexistence sensitivity search.
113        """
114        self.eecoex_func = 'CELLR,2,1800,699,1,1,{}'
115        self.log.info(
116            'Running GSM1800 and GNSS coexistence sensitivity search.')
117        self.gnss_hot_start_sensitivity_search_base(True)
118
119    def test_hot_start_sensitivity_search_gsm1900(self):
120        """
121        GNSS hot start GSM1900 Ch661 coexistence sensitivity search.
122        """
123        self.eecoex_func = 'CELLR,2,1900,661,1,1,{}'
124        self.log.info(
125            'Running GSM1900 and GNSS coexistence sensitivity search.')
126        self.gnss_hot_start_sensitivity_search_base(True)
127
128    def test_hot_start_sensitivity_search_lte_b38(self):
129        """
130        GNSS hot start LTE B38 Ch38000 coexistence sensitivity search.
131        """
132        self.eecoex_func = 'CELLR,5,38,38000,true,PRIMARY,{},10MHz,0,12'
133        self.log.info(
134            'Running LTE B38 and GNSS coexistence sensitivity search.')
135        self.gnss_hot_start_sensitivity_search_base(True)
136
137    def test_hot_start_sensitivity_search_lte_b39(self):
138        """
139        GNSS hot start LTE B39 Ch38450 coexistence sensitivity search.
140        """
141        self.eecoex_func = 'CELLR,5,39,38450,true,PRIMARY,{},10MHz,0,12'
142        self.log.info(
143            'Running LTE B38 and GNSS coexistence sensitivity search.')
144        self.gnss_hot_start_sensitivity_search_base(True)
145
146    def test_hot_start_sensitivity_search_lte_b40(self):
147        """
148        GNSS hot start LTE B40 Ch39150 coexistence sensitivity search.
149        """
150        self.eecoex_func = 'CELLR,5,40,39150,true,PRIMARY,{},10MHz,0,12'
151        self.log.info(
152            'Running LTE B38 and GNSS coexistence sensitivity search.')
153        self.gnss_hot_start_sensitivity_search_base(True)
154
155    def test_hot_start_sensitivity_search_lte_b41(self):
156        """
157        GNSS hot start LTE B41 Ch40620 coexistence sensitivity search.
158        """
159        self.eecoex_func = 'CELLR,5,41,40620,true,PRIMARY,{},10MHz,0,12'
160        self.log.info(
161            'Running LTE B41 and GNSS coexistence sensitivity search.')
162        self.gnss_hot_start_sensitivity_search_base(True)
163
164    def test_hot_start_sensitivity_search_lte_b42(self):
165        """
166        GNSS hot start LTE B42 Ch42590 coexistence sensitivity search.
167        """
168        self.eecoex_func = 'CELLR,5,42,42590,true,PRIMARY,{},10MHz,0,12'
169        self.log.info(
170            'Running LTE B42 and GNSS coexistence sensitivity search.')
171        self.gnss_hot_start_sensitivity_search_base(True)
172
173    def test_hot_start_sensitivity_search_lte_b48(self):
174        """
175        GNSS hot start LTE B48 Ch55990 coexistence sensitivity search.
176        """
177        self.eecoex_func = 'CELLR,5,48,55990,true,PRIMARY,{},10MHz,0,12'
178        self.log.info(
179            'Running LTE B48 and GNSS coexistence sensitivity search.')
180        self.gnss_hot_start_sensitivity_search_base(True)
181