# -*- coding: utf-8 -*-

import os

import osmosdr

from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import gr, blocks
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes

class FileSink(self):
    """
    FileSink class to create I/Q sample binary dump files.
    """
    def __init__(self, dump_file, samp_rate, capture_time, device):
        self.file_path = dump_file
        self.sample_rate = samp_rate
        self.freq = freq
        self.capture_time = capture_time
        self.capture_device = device

    def needed_disc_space(self):
        """
        Calculate needed disc space for dump.
        """
        pass

    def capture(self):
        """
        Capture samples to dump file.
        """
        pass

    def _dump_file_writable(self):
        """
        Check permissions for specified file dump path.
        """
        if os.path.exists(self.pathfile):
            return os.access(self.file_path, os.W_OK)
        elif os.access(os.path.dirname(self.file_path), os.W_OK) and \
                os.access(self.file_path, os.W_OK):
            return True
        else:
            return False

    def get_file_path(self):
        return self.file_path

    def get_samp_rate(self):
        return samp_rate

    def get_capture_time(self):
        return self.capture_time

    def get_capture_device(self):
        return self.get_capture_device