poll merge squash
This commit is contained in:
parent
308a0486b6
commit
40bee90610
21 changed files with 2753 additions and 261 deletions
79
src/cont/contsessionclasses.cpp
Normal file
79
src/cont/contsessionclasses.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
#include "contsessionclasses.h"
|
||||
#include "backsessionclasses.h"
|
||||
|
||||
SessionHandler::SessionHandler(EndpointHandler* eph, Session* session, size_t idx) {
|
||||
this->eph = eph;
|
||||
this->idx = idx;
|
||||
this->session = session;
|
||||
|
||||
this->svi.mainVolume = session->getVolume(AudioChannel::CHANNEL_MAIN);
|
||||
this->svi.muted = session->getMute();
|
||||
this->svi.caller = osh->getGuid();
|
||||
|
||||
ssc = new SessionStateCallback(this);
|
||||
this->session->setStateCallback(ssc);
|
||||
}
|
||||
|
||||
void SessionHandler::setVolume(NGuid guid, int channel, int value){
|
||||
if (channel == AudioChannel::CHANNEL_MAIN)
|
||||
session->setVolume(guid, channel, (float)value / 100);
|
||||
else session->setVolume(guid, channel, (float)value / 100);
|
||||
}
|
||||
|
||||
float SessionHandler::getVolume(int channel){
|
||||
return session->getVolume(channel);
|
||||
}
|
||||
|
||||
void SessionHandler::setMute(NGuid guid, bool muted){
|
||||
session->setMute(guid, muted);
|
||||
}
|
||||
|
||||
std::wstring SessionHandler::getName(){
|
||||
return session->getName();
|
||||
}
|
||||
|
||||
bool SessionHandler::getMute(){
|
||||
return session->getMute();
|
||||
}
|
||||
|
||||
void SessionHandler::setFrontIndex(uint64_t frontIdx) {
|
||||
this->frontIdx = frontIdx;
|
||||
}
|
||||
|
||||
uint64_t SessionHandler::getFrontIndex() {
|
||||
return frontIdx;
|
||||
}
|
||||
|
||||
SessionVolumeInfo* SessionHandler::getVolumeInfo() {
|
||||
return &svi;
|
||||
}
|
||||
|
||||
SessionState SessionHandler::getState() {
|
||||
return session->getState();
|
||||
}
|
||||
|
||||
void SessionHandler::setState(SessionState state) {
|
||||
session->setState(state);
|
||||
}
|
||||
|
||||
void SessionHandler::reviseSessionShowing(SessionState state) {
|
||||
SessionState currentState = this->getState();
|
||||
switch (currentState) {
|
||||
case SessionState::ACTIVE:
|
||||
case SessionState::INACTIVE:
|
||||
if (state == SessionState::EXPIRED) {
|
||||
eph->removeSessionFromFront(this);
|
||||
}
|
||||
break;
|
||||
case SessionState::EXPIRED:
|
||||
if (state == SessionState::ACTIVE || INACTIVE) {
|
||||
eph->sendSessionToFront(this);
|
||||
}
|
||||
break;
|
||||
case SessionState::DISCONNECTED:
|
||||
if (frontIdx != INT_MAX)
|
||||
eph->removeSessionFromFront(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue