void setWirelessModuleEnableState(IMessenger messenger, SetWirelessModuleEnableState msg) throws MessengerException { for (ModuleRecord record : msg.getModuleRecords()) { final IWirelessSniffingModule sniffingModule = modulesByName.get(record.getName()); if (sniffingModule == null) { final String error = "No wireless sniffing module found with name " + record.getName(); daemon.getLogger().warning(error); messenger.respondError(msg, error); return; } setModuleEnabled(sniffingModule, record.isEnabled()); messenger.respondOk(msg); } }
void requestModuleInformation(IMessenger messenger, RequestWirelessModuleInformation msg) throws MessengerException { final List<ModuleRecord> modules = new ArrayList<ModuleRecord>(); for (IWirelessSniffingModule m : wirelessModules) { modules.add(new ModuleRecord(m.getName(), isWirelessModuleEnabled(m))); } messenger.emitMessage(msg.createResponse(modules)); }