# Path: rtlsdr_scanner/constants.py
# SAMPLE_RATE = 2e6


import datetime
import json
import math
import os
import pkg_resources
import socket
import sys
import time
import serial.tools.list_ports
from math import radians, sin, cos, asin, sqrt
from threading import Thread
from rtlsdr_scanner.constants import SAMPLE_RATE
        return (textFreq, textLevel)
    if textFreq:
        return textFreq
    if textLevel:
        return textLevel

    return None


def format_time(timeStamp, withDate=False):
    if timeStamp <= 1:
        return 'Unknown'

    if withDate:
        return time.strftime('%c', time.localtime(timeStamp))

    return time.strftime('%H:%M:%S', time.localtime(timeStamp))


def format_iso_time(timeStamp):
    dt = datetime.datetime.utcfromtimestamp(timeStamp)
    return dt.isoformat() + 'Z'


def get_serial_ports():
    ports = [port[0] for port in serial.tools.list_ports.comports()]
    if len(ports) == 0:
        if os.name == 'nt':
            ports.append('COM1')
        else:

# Path: rtlsdr_scanner/constants.py
# SAMPLE_RATE = 2e6


# Path: rtlsdr_scanner/misc.py
import datetime
import json
import math
import os
import pkg_resources
import socket
import sys
import time
import serial.tools.list_ports
from math import radians, sin, cos, asin, sqrt
from threading import Thread
from rtlsdr_scanner.constants import SAMPLE_RATE

        return (textFreq, textLevel)
    if textFreq:
        return textFreq
    if textLevel:
        return textLevel

    return None


def format_time(timeStamp, withDate=False):
    if timeStamp <= 1:
        return 'Unknown'

    if withDate:
        return time.strftime('%c', time.localtime(timeStamp))

    return time.strftime('%H:%M:%S', time.localtime(timeStamp))


def format_iso_time(timeStamp):
    dt = datetime.datetime.utcfromtimestamp(timeStamp)
    return dt.isoformat() + 'Z'


def get_serial_ports():
    ports = [port[0] for port in serial.tools.list_ports.comports()]
    if len(ports) == 0:
        if os.name == 'nt':
            ports.append('COM1')
        else:

            ports.append('/dev/ttyS0')