Return<void> Device::getMicMute(getMicMute_cb _hidl_cb) { bool mute = false; Result retval = analyzeStatus("get_mic_mute", mDevice->get_mic_mute(mDevice, &mute)); _hidl_cb(retval, mute); return Void(); }
Return<void> Device::openInputStream(int32_t ioHandle, const DeviceAddress& device, const AudioConfig& config, AudioInputFlag flags, AudioSource source, openInputStream_cb _hidl_cb) { audio_config_t halConfig; HidlUtils::audioConfigToHal(config, &halConfig); audio_stream_in_t* halStream; ALOGV( "open_input_stream handle: %d devices: %x flags: %#x " "srate: %d format %#x channels %x address %s source %d", ioHandle, static_cast<audio_devices_t>(device.device), static_cast<audio_input_flags_t>(flags), halConfig.sample_rate, halConfig.format, halConfig.channel_mask, deviceAddressToHal(device).c_str(), static_cast<audio_source_t>(source)); int status = mDevice->open_input_stream( mDevice, ioHandle, static_cast<audio_devices_t>(device.device), &halConfig, &halStream, static_cast<audio_input_flags_t>(flags), deviceAddressToHal(device).c_str(), static_cast<audio_source_t>(source)); ALOGV("open_input_stream status %d stream %p", status, halStream); sp<IStreamIn> streamIn; if (status == OK) { streamIn = new StreamIn(this, halStream); } AudioConfig suggestedConfig; HidlUtils::audioConfigFromHal(halConfig, &suggestedConfig); _hidl_cb(analyzeStatus("open_input_stream", status), streamIn, suggestedConfig); return Void(); }
Return<Result> Device::setMasterMute(bool mute) { Result retval(Result::NOT_SUPPORTED); if (mDevice->set_master_mute != NULL) { retval = analyzeStatus("set_master_mute", mDevice->set_master_mute(mDevice, mute)); } return retval; }
Return<Result> Device::releaseAudioPatch(int32_t patch) { if (version() >= AUDIO_DEVICE_API_VERSION_3_0) { return analyzeStatus( "release_audio_patch", mDevice->release_audio_patch( mDevice, static_cast<audio_patch_handle_t>(patch))); } return Result::NOT_SUPPORTED; }
Return<Result> Device::setAudioPortConfig(const AudioPortConfig& config) { if (version() >= AUDIO_DEVICE_API_VERSION_3_0) { struct audio_port_config halPortConfig; HidlUtils::audioPortConfigToHal(config, &halPortConfig); return analyzeStatus( "set_audio_port_config", mDevice->set_audio_port_config(mDevice, &halPortConfig)); } return Result::NOT_SUPPORTED; }
Return<void> Device::getMasterMute(getMasterMute_cb _hidl_cb) { Result retval(Result::NOT_SUPPORTED); bool mute = false; if (mDevice->get_master_mute != NULL) { retval = analyzeStatus("get_master_mute", mDevice->get_master_mute(mDevice, &mute)); } _hidl_cb(retval, mute); return Void(); }
Return<void> Device::getMasterVolume(getMasterVolume_cb _hidl_cb) { Result retval(Result::NOT_SUPPORTED); float volume = 0; if (mDevice->get_master_volume != NULL) { retval = analyzeStatus("get_master_volume", mDevice->get_master_volume(mDevice, &volume)); } _hidl_cb(retval, volume); return Void(); }
Return<Result> Device::setMasterVolume(float volume) { if (mDevice->set_master_volume == NULL) { return Result::NOT_SUPPORTED; } if (!isGainNormalized(volume)) { ALOGW("Can not set a master volume (%f) outside [0,1]", volume); return Result::INVALID_ARGUMENTS; } return analyzeStatus("set_master_volume", mDevice->set_master_volume(mDevice, volume)); }
Return<void> Device::getAudioPort(const AudioPort& port, getAudioPort_cb _hidl_cb) { audio_port halPort; HidlUtils::audioPortToHal(port, &halPort); Result retval = analyzeStatus("get_audio_port", mDevice->get_audio_port(mDevice, &halPort)); AudioPort resultPort = port; if (retval == Result::OK) { HidlUtils::audioPortFromHal(halPort, &resultPort); } _hidl_cb(retval, resultPort); return Void(); }
Return<void> Device::createAudioPatch(const hidl_vec<AudioPortConfig>& sources, const hidl_vec<AudioPortConfig>& sinks, createAudioPatch_cb _hidl_cb) { Result retval(Result::NOT_SUPPORTED); AudioPatchHandle patch = 0; if (version() >= AUDIO_DEVICE_API_VERSION_3_0) { std::unique_ptr<audio_port_config[]> halSources( HidlUtils::audioPortConfigsToHal(sources)); std::unique_ptr<audio_port_config[]> halSinks( HidlUtils::audioPortConfigsToHal(sinks)); audio_patch_handle_t halPatch = AUDIO_PATCH_HANDLE_NONE; retval = analyzeStatus( "create_audio_patch", mDevice->create_audio_patch(mDevice, sources.size(), &halSources[0], sinks.size(), &halSinks[0], &halPatch)); if (retval == Result::OK) { patch = static_cast<AudioPatchHandle>(halPatch); } } _hidl_cb(retval, patch); return Void(); }
// Methods from ::android::hardware::audio::V2_0::IDevice follow. Return<Result> Device::initCheck() { return analyzeStatus("init_check", mDevice->init_check(mDevice)); }
Return<void> Device::debugDump(const hidl_handle& fd) { if (fd.getNativeHandle() != nullptr && fd->numFds == 1) { analyzeStatus("dump", mDevice->dump(mDevice, fd->data[0])); } return Void(); }
Return<Result> Device::setMicMute(bool mute) { return analyzeStatus("set_mic_mute", mDevice->set_mic_mute(mDevice, mute)); }
void SiteCopyFolder::slotFinished(int exitCode, QProcess::ExitStatus exitStatus) { qDebug() << " * SiteCopy process finished with status" << exitCode; if( exitCode == -1 ) { qDebug() << "Configuration Error, stop processing."; SyncResult res( SyncResult::Error ); res.setErrorString( tr("Sitecopy configuration problem, check $HOME/.sitecopyrc")); incrementErrorCount(); emit( syncFinished( res )); } if( exitCode > 1 ) { // error has happened. QString out( _lastOutput ); SyncResult res( SyncResult::Error ); res.setErrorString( out ); qDebug() << "An error happened: " << out; incrementErrorCount(); emit syncFinished( res ); return; } if( _NextStep == Sync ) { startSiteCopy( "--sync", Finish ); // sync local with cloud data. } else if( _NextStep == Update ) { startSiteCopy( "--update", Finish ); // update from owncloud } else if( _NextStep == Finish ) { qDebug() << "Finished!"; emit syncFinished( SyncResult(SyncResult::Success) ); // mLocalChangesSeen = false; } else if( _NextStep == Status ) { startSiteCopy( "--fetch", FlatList ); } else if( _NextStep == FlatList ) { startSiteCopy( "--flatlist", ExecuteStatus ); } else if( _NextStep == ExecuteStatus ) { if( exitCode == 1 ) { qDebug() << "Exit-Code: Sync Needed!"; analyzeStatus(); if( _ChangesHash.contains("deleted") && _pathListEmpty ) { // problem: Files were added on the cloud. If we say update, // the new files are going to be deleted. Lets warn the user. qDebug() << "!!!! Better not call update, changes happened on the cloud!"; SyncResult res( SyncResult::Disabled ); res.setErrorString( tr("The ownCloud changed. Disabling syncing for security reasons.")); res.setSyncChanges( _ChangesHash ); setSyncEnabled( false ); emit syncFinished( res ); } else { startSiteCopy( "--update", Status ); } } else if( exitCode == 0 ) { qDebug() << "No update needed, remote is in sync."; SyncResult res( SyncResult::Success ); // store the analyze results into the sync result data structure. res.setSyncChanges( _ChangesHash ); // No update needed emit syncFinished( res ); } else { qDebug() << "Got an unknown exit code " << exitCode; emit syncFinished( SyncResult( SyncResult::Error ) ); } } _lastOutput.clear(); }