Skip to content

Added Planar power controller#153

Merged
ppodhajski merged 5 commits intoBlueBrain:masterfrom
ppodhajski:feature/powerController
May 18, 2017
Merged

Added Planar power controller#153
ppodhajski merged 5 commits intoBlueBrain:masterfrom
ppodhajski:feature/powerController

Conversation

@ppodhajski
Copy link
Copy Markdown
Contributor

No description provided.

@ppodhajski ppodhajski force-pushed the feature/powerController branch 2 times, most recently from d4ab5e5 to db099ca Compare May 17, 2017 09:36
Comment thread tide/core/types.h Outdated
/**
* The power state of Planar displays.
*/
enum class screenState
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScreenState

Comment thread tide/master/LoggingUtility.cpp Outdated
++_windowCounter;
}

void LoggingUtility::powerStateChanged(screenState state)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const ScreenState state

Comment thread tide/master/MasterApplication.cpp Outdated
if (_planarController->getState() == screenState::OFF)
if (!_planarController->powerOn())
put_flog(LOG_INFO,
"Could not power on the screens"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Could not power on the screens by " << and don't forget to add a space before "

Comment thread tide/master/rest/RestLogger.cpp Outdated
{
if (state == screenState::ON)
return "ON";
else if (state == screenState::OFF)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else not needed - should be a switch normally

Comment thread tide/master/PlanarController.h Outdated
bool powerOn();

signals:
void powerStateChanged(screenState state);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing doxygen

#include <QSerialPort>
#include <QTimer>

class PlanarController : public QObject
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing class doxygen

Comment thread tide/master/PlanarController.cpp Outdated
_serial.write("OPA1DISPLAY.POWER=ON\r");
return _serial.waitForBytesWritten(serialTimeout);
}
else
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else not needed, there is a return above. You could also format it with an early out:
if(!_serial.isOpen())
{
put_flog(...);
return false;
}
_serial.write("OPA1DISPLAY.POWER=ON\r");
return _serial.waitForBytesWritten(serialTimeout);

But is the isOpen() test still needed now that you added a throw in the constructor?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not at all, I wanted to discuss which one we choose.

@ppodhajski ppodhajski force-pushed the feature/powerController branch from 0772032 to 2cc752c Compare May 17, 2017 12:06
@ppodhajski ppodhajski force-pushed the feature/powerController branch from 2cc752c to d36d612 Compare May 17, 2017 12:17
@ppodhajski ppodhajski force-pushed the feature/powerController branch from 4f12bdd to e8c2a2b Compare May 17, 2017 12:59
return "UNDEF";
case ScreenState::UNDEF:
return "UNDEF";
default:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can combine the default and ScreenState::UNDEF cases

Comment thread tide/master/PlanarController.cpp Outdated
QString output(_serial.readLine());
output = output.trimmed();
screenState previousState = _powered;
ScreenState previousState = _powered;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename _powered to _state?

Comment thread tide/master/MasterApplication.cpp Outdated
put_flog(LOG_INFO,
"Could not power on the screens"
"touching the wall");
if (_planarControllerEnabled)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for an extra _planarControllerEnabled variable, you can just check if(_planarController)

Comment thread tide/master/MasterApplication.cpp Outdated
if (!_planarController->powerOff())
if (_planarController->powerOff())
{
DisplayGroupController controller(*_displayGroup.get());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no .get() on smart ptrs!! also can be on a single line: DisplayGroupController(*_displayGroup).hidePanels();

@rdumusc rdumusc self-assigned this May 18, 2017
@ppodhajski ppodhajski merged commit f5776b0 into BlueBrain:master May 18, 2017
@ppodhajski ppodhajski deleted the feature/powerController branch September 6, 2017 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants