Add support of Jabra headsets via the hidapi library.

This commit is contained in:
Ghislain MARY 2025-12-17 17:01:23 +01:00
parent 0cf3938dc3
commit befa4a2635
4 changed files with 80 additions and 4 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2024 Belledonne Communications SARL.
* Copyright (c) 2010-2026 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -28,6 +28,8 @@
#include "tool/Utils.hpp"
#include "tool/thread/SafeConnection.hpp"
#include <QQuickWindow>
DEFINE_ABSTRACT_OBJECT(CallCore)
/***********************************************************************/
@ -449,6 +451,44 @@ void CallCore::setSelf(QSharedPointer<CallCore> me) {
setVideoStats(videoStats);
}
});
mCallModelConnection->makeConnectToModel(&CallModel::headsetAnswerCallRequested, [this]() {
mCallModelConnection->invokeToCore([this]() {
const auto callList = App::getInstance()->getCallList();
const auto currentPendingCall = callList->getFirstIncommingPendingCall();
if (!currentPendingCall.isNull()) {
const auto gui = new CallGui(currentPendingCall);
Utils::openCallsWindow(gui);
currentPendingCall->lAccept(false);
}
});
});
mCallModelConnection->makeConnectToModel(&CallModel::headsetEndCallRequested, [this]() {
mCallModelConnection->invokeToCore([this]() {
const auto window = Utils::getOrCreateCallsWindow();
window->setProperty("callTerminatedByUser", true);
lTerminate();
});
});
mCallModelConnection->makeConnectToModel(&CallModel::headsetHoldCallRequested, [this]() {
mCallModelConnection->invokeToCore([this]() { lSetPaused(true); });
});
mCallModelConnection->makeConnectToModel(&CallModel::headsetMicrophoneMuteToggled, [this](bool mute) {
mCallModelConnection->invokeToCore([this, mute]() { lSetMicrophoneMuted(mute); });
});
mCallModelConnection->makeConnectToModel(&CallModel::headsetRejectCallRequested, [this]() {
mCallModelConnection->invokeToCore([this]() {
const auto callList = App::getInstance()->getCallList();
const auto currentPendingCall = callList->getFirstIncommingPendingCall();
if (!currentPendingCall.isNull()) {
currentPendingCall->lDecline();
}
});
});
mCallModelConnection->makeConnectToModel(&CallModel::headsetResumeCallRequested, [this]() {
mCallModelConnection->invokeToCore([this]() { lSetPaused(false); });
});
if (mShouldFindRemoteFriend) findRemoteFriend(me);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2024 Belledonne Communications SARL.
* Copyright (c) 2010-2026 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -529,3 +529,27 @@ void CallModel::onRemoteRecording(const std::shared_ptr<linphone::Call> &call, b
void CallModel::onAuthenticationTokenVerified(const std::shared_ptr<linphone::Call> &call, bool verified) {
emit authenticationTokenVerified(call, verified);
}
void CallModel::onHeadsetAnswerCallRequested(const std::shared_ptr<linphone::Call> &call) {
emit headsetAnswerCallRequested();
}
void CallModel::onHeadsetEndCallRequested(const std::shared_ptr<linphone::Call> &call) {
emit headsetEndCallRequested();
}
void CallModel::onHeadsetHoldCallRequested(const std::shared_ptr<linphone::Call> &call) {
emit headsetHoldCallRequested();
}
void CallModel::onHeadsetMicrophoneMuteToggled(const std::shared_ptr<linphone::Call> &call, bool mute) {
emit headsetMicrophoneMuteToggled(mute);
}
void CallModel::onHeadsetRejectCallRequested(const std::shared_ptr<linphone::Call> &call) {
emit headsetRejectCallRequested();
}
void CallModel::onHeadsetResumeCallRequested(const std::shared_ptr<linphone::Call> &call) {
emit headsetResumeCallRequested();
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2024 Belledonne Communications SARL.
* Copyright (c) 2010-2026 Belledonne Communications SARL.
*
* This file is part of linphone-desktop
* (see https://www.linphone.org).
@ -156,6 +156,12 @@ private:
const std::shared_ptr<linphone::AudioDevice> &audioDevice) override;
virtual void onRemoteRecording(const std::shared_ptr<linphone::Call> &call, bool recording) override;
virtual void onAuthenticationTokenVerified(const std::shared_ptr<linphone::Call> &call, bool verified) override;
virtual void onHeadsetAnswerCallRequested(const std::shared_ptr<linphone::Call> &call) override;
virtual void onHeadsetEndCallRequested(const std::shared_ptr<linphone::Call> &call) override;
virtual void onHeadsetHoldCallRequested(const std::shared_ptr<linphone::Call> &call) override;
virtual void onHeadsetMicrophoneMuteToggled(const std::shared_ptr<linphone::Call> &call, bool mute) override;
virtual void onHeadsetRejectCallRequested(const std::shared_ptr<linphone::Call> &call) override;
virtual void onHeadsetResumeCallRequested(const std::shared_ptr<linphone::Call> &call) override;
signals:
void dtmfReceived(const std::shared_ptr<linphone::Call> &call, int dtmf);
@ -185,6 +191,12 @@ signals:
const std::shared_ptr<linphone::AudioDevice> &audioDevice);
void remoteRecording(const std::shared_ptr<linphone::Call> &call, bool recording);
void authenticationTokenVerified(const std::shared_ptr<linphone::Call> &call, bool verified);
void headsetAnswerCallRequested();
void headsetEndCallRequested();
void headsetHoldCallRequested();
void headsetMicrophoneMuteToggled(bool mute);
void headsetRejectCallRequested();
void headsetResumeCallRequested();
};
#endif

@ -1 +1 @@
Subproject commit 48f6fdf27e0810b5b0011aa02d41b95da0ae6a56
Subproject commit dc5d0d260cc5db90dc4d7dcb49780a12aaada33b