| 23 | ConfigManager config; |
| 24 | |
| 25 | class AirspySourceModule : public ModuleManager::Instance { |
| 26 | public: |
| 27 | AirspySourceModule(std::string name) { |
| 28 | this->name = name; |
| 29 | |
| 30 | airspy_init(); |
| 31 | |
| 32 | sampleRate = 10000000.0; |
| 33 | |
| 34 | handler.ctx = this; |
| 35 | handler.selectHandler = menuSelected; |
| 36 | handler.deselectHandler = menuDeselected; |
| 37 | handler.menuHandler = menuHandler; |
| 38 | handler.startHandler = start; |
| 39 | handler.stopHandler = stop; |
| 40 | handler.tuneHandler = tune; |
| 41 | handler.stream = &stream; |
| 42 | |
| 43 | refresh(); |
| 44 | if (sampleRateList.size() > 0) { |
| 45 | sampleRate = sampleRateList[0]; |
| 46 | } |
| 47 | |
| 48 | // Select device from config |
| 49 | config.acquire(); |
| 50 | std::string devSerial = config.conf["device"]; |
| 51 | config.release(); |
| 52 | selectByString(devSerial); |
| 53 | |
| 54 | sigpath::sourceManager.registerSource("Airspy", &handler); |
| 55 | } |
| 56 | |
| 57 | ~AirspySourceModule() { |
| 58 | stop(this); |
| 59 | sigpath::sourceManager.unregisterSource("Airspy"); |
| 60 | airspy_exit(); |
| 61 | } |
| 62 | |
| 63 | void postInit() {} |
| 64 | |
| 65 | void enable() { |
| 66 | enabled = true; |
| 67 | } |
| 68 | |
| 69 | void disable() { |
| 70 | enabled = false; |
| 71 | } |
| 72 | |
| 73 | bool isEnabled() { |
| 74 | return enabled; |
| 75 | } |
| 76 | |
| 77 | void refresh() { |
| 78 | devList.clear(); |
| 79 | devListTxt = ""; |
| 80 | |
| 81 | uint64_t serials[256]; |
| 82 | int n = airspy_list_devices(serials, 256); |
nothing calls this directly
no outgoing calls
no test coverage detected