Distributed cognitive radio architecture with automatic frequency switching