コード例 #1
0
    def __init__(self):
        self.full_system_text = get_raspberry_pi_model()
        self.band_width_message = "Available Bandwidth:\n  Unknown Mbps"
        if self.full_system_text == "Raspberry Pi 3 Model B Plus":
            self.band_width_message = "Available Bandwidth:\n  up to 299 Mbps"
        elif self.full_system_text == "Raspberry Pi 4 Model B":
            self.band_width_message = "Available Bandwidth:\n  up to 999 Mbps"

        try:
            os.system("raspi-config nonint do_spi 0")
            primary_logger.debug("Enabled SPI for WaveShare 2.7 E-Paper")
        except Exception as error:
            primary_logger.error("Error Enabling SPI for WaveShare 2.7 E-Paper: " + str(error))

        self.display_in_use = False

        # GPIO key to Pin #s
        self.key1 = 5
        self.key2 = 6
        self.key3 = 13
        self.key4 = 19
        self.rpi_gpio_import = __import__('RPi.GPIO', fromlist=["setmode", "BCM", "setup",
                                                                "IN", "PUD_UP", "input"])
        self.epd2in7_import = __import__("supported_hardware.drivers.waveshare.epd2in7",
                                         fromlist=["EPD", "EPD_WIDTH", "EPD_HEIGHT"])
        self.esp = self.epd2in7_import.EPD()
        self.esp.init()

        self.rpi_gpio_import.setmode(self.rpi_gpio_import.BCM)

        self.rpi_gpio_import.setup(self.key1, self.rpi_gpio_import.IN, pull_up_down=self.rpi_gpio_import.PUD_UP)
        self.rpi_gpio_import.setup(self.key2, self.rpi_gpio_import.IN, pull_up_down=self.rpi_gpio_import.PUD_UP)
        self.rpi_gpio_import.setup(self.key3, self.rpi_gpio_import.IN, pull_up_down=self.rpi_gpio_import.PUD_UP)
        self.rpi_gpio_import.setup(self.key4, self.rpi_gpio_import.IN, pull_up_down=self.rpi_gpio_import.PUD_UP)
コード例 #2
0
    def __init__(self):
        self.app_version = "1.4.0"
        self.full_system_text = get_raspberry_pi_model()
        primary_logger.debug("Running on " + str(self.full_system_text))
        primary_logger.info("Test Results Saving to: " +
                            file_locations.location_save_report_folder)
        self.running_on_rpi = False
        if self.full_system_text[:12] == "Raspberry Pi":
            self.running_on_rpi = True

        self.mtr_running = False
        self.iperf_running = False

        self.is_iperf_server = 1
        self.iperf_port = "9000"
        self.iperf_run_options = "-O 1"
        self.mtr_run_count = "10"
        self.remote_tester_ip = "8.8.8.8"

        self.schedule_run_on_boot = 1
        self.schedule_run_every_minutes_enabled = 0
        self.schedule_run_every_minutes = 0

        self.schedule_run_once_enabled = 0
        self.schedule_run_once_at_time = ""

        self.local_ethernet_dhcp = 1
        self.local_ethernet_adapter_name = "eth0"
        self.local_ethernet_ip = ""
        self.local_ethernet_subnet = ""
        self.local_ethernet_gateway = ""
        self.local_ethernet_dns1 = ""
        self.local_ethernet_dns2 = ""

        self.local_wireless_dhcp = 1
        self.local_wireless_adapter_name = "wlan0"
        self.local_wireless_ip = ""
        self.local_wireless_subnet = ""
        self.local_wireless_gateway = ""
        self.local_wireless_dns1 = ""
        self.local_wireless_dns2 = ""

        self.wifi_country_code = ""
        self.wifi_ssid = ""
        self.wifi_security_type = ""
        self.wifi_pass_key = ""

        self.installed_interactive_hw = {"WaveShare27": 0}
        self.using_dummy_access = False
        self.button_function_level = 0

        self.load_config_from_file()
        self.load_installed_hardware_from_file()
        self.load_dhcpcd_conf_from_file()
        self.load_wpa_supplicant_wifi()
コード例 #3
0
    def __init__(self):
        self.app_version = "1.2.8"
        self.full_system_text = get_raspberry_pi_model()
        print("\nRunning on " + str(self.full_system_text))
        self.running_on_rpi = False
        if self.full_system_text[:12] == "Raspberry Pi":
            self.running_on_rpi = True

        self.tests_running = False
        self.is_iperf_server = 1
        self.iperf_port = "9000"
        self.mtr_run_count = "10"
        self.remote_tester_ip = "8.8.8.8"

        self.local_ethernet_dhcp = 1
        self.local_ethernet_adapter_name = "eth0"
        self.local_ethernet_ip = ""
        self.local_ethernet_subnet = ""
        self.local_ethernet_gateway = ""
        self.local_ethernet_dns1 = ""
        self.local_ethernet_dns2 = ""

        self.local_wireless_dhcp = 1
        self.local_wireless_adapter_name = "wlan0"
        self.local_wireless_ip = ""
        self.local_wireless_subnet = ""
        self.local_wireless_gateway = ""
        self.local_wireless_dns1 = ""
        self.local_wireless_dns2 = ""

        self.wifi_country_code = ""
        self.wifi_ssid = ""
        self.wifi_security_type = ""
        self.wifi_pass_key = ""

        self.installed_interactive_hw = {"WaveShare27": 0}
        self.using_dummy_access = False
        self.button_function_level = 0

        self.load_config_from_file()
        self.load_installed_hardware_from_file()
        self.load_dhcpcd_conf_from_file()
        self.load_wpa_supplicant_wifi()
コード例 #4
0
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
"""
import re
from operations_modules import app_variables
from operations_modules.app_generic_functions import get_raspberry_pi_model

full_system_text = get_raspberry_pi_model()
running_on_rpi = False
if full_system_text[:12] == "Raspberry Pi":
    running_on_rpi = True


def get_wifi_country_code():
    if running_on_rpi:
        wifi_config_lines = app_variables.wpa_supplicant_file_content.strip(
        ).split("\n")
        for line in wifi_config_lines:
            line_stripped = line.strip()
            if line_stripped[:8] == "country=":
                return line_stripped[8:]
    return ""