forked from mdre77/vdr-plugin-vnsiserver
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- All VDR interaction is done in a separate thread by processing ICommand objects - Created class VNSISpocket reading in a separate thread - Minor refactoring - Streamer: Automatically retuning in case of "no data"
- Loading branch information
Showing
30 changed files
with
1,499 additions
and
681 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* ICommand.h | ||
* | ||
* Created on: 26.12.2020 | ||
* Author: mdrechsler | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "tools.h" | ||
|
||
class ICommandVisitor; | ||
|
||
class ICommand | ||
{ | ||
public: | ||
/** | ||
* Execute a command | ||
*/ | ||
virtual void | ||
execute( ICommandVisitor& ) = 0; | ||
|
||
|
||
VNSI_INTERFACE( ICommand ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* ICommandProcessor.h | ||
* | ||
* Created on: 26.12.2020 | ||
* Author: mdrechsler | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <chrono> | ||
|
||
#include "tools.h" | ||
|
||
class ICommand; | ||
|
||
class ICommandProcessor | ||
{ | ||
public: | ||
/** | ||
* Process a command | ||
* | ||
* @param [in] command The command to process | ||
*/ | ||
virtual bool | ||
process( const ICommand& command, | ||
const std::chrono::milliseconds& timeout ) = 0; | ||
|
||
|
||
VNSI_INTERFACE( ICommandProcessor ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* CommandQueue.h | ||
* | ||
* Created on: 26.12.2020 | ||
* Author: mdrechsler | ||
*/ | ||
#include <chrono> | ||
|
||
#include "tools.h" | ||
|
||
#pragma once | ||
|
||
VNSI_DECLARE_POINTER( ICommand ); | ||
|
||
class ICommandQueue | ||
{ | ||
public: | ||
virtual void | ||
enqueue( const ICommandSharedPtr& command ) = 0; | ||
|
||
|
||
VNSI_INTERFACE( ICommandQueue ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* ICommandVisitor.h | ||
* | ||
* Created on: 26.12.2020 | ||
* Author: mdrechsler | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "tools.h" | ||
|
||
class cRequestPacket; | ||
class SocketError; | ||
class StatusRecording; | ||
class StatusOsdStatusMessage; | ||
class StatusChannelChange; | ||
class StatusChannelsChange; | ||
class StatusRecordingsChange; | ||
class StatusSignalTimerChange; | ||
class StatusEpgChange; | ||
|
||
|
||
class ICommandVisitor | ||
{ | ||
public: | ||
virtual void | ||
visit( SocketError& command ) = 0; | ||
|
||
virtual void | ||
visit( cRequestPacket& command ) = 0; | ||
|
||
virtual void | ||
visit( StatusRecording& command ) = 0; | ||
|
||
virtual void | ||
visit( StatusOsdStatusMessage& command ) = 0; | ||
|
||
virtual void | ||
visit( StatusChannelChange& command ) = 0; | ||
|
||
virtual void | ||
visit( StatusChannelsChange& command ) = 0; | ||
|
||
virtual void | ||
visit( StatusRecordingsChange& command ) = 0; | ||
|
||
virtual void | ||
visit( StatusSignalTimerChange& command ) = 0; | ||
|
||
virtual void | ||
visit( StatusEpgChange& command ) = 0; | ||
|
||
VNSI_INTERFACE( ICommandVisitor ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* ISocket.h | ||
* | ||
* Created on: 26.12.2020 | ||
* Author: mdrechsler | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "tools.h" | ||
|
||
class ISocket | ||
{ | ||
public: | ||
virtual void | ||
Shutdown() = 0; | ||
|
||
virtual void | ||
lock() = 0; | ||
|
||
virtual void | ||
unlock() = 0; | ||
|
||
virtual void | ||
Invalidate() = 0; | ||
|
||
virtual int | ||
GetHandle() const = 0; | ||
|
||
virtual ssize_t | ||
read( void* buffer, | ||
size_t size, | ||
int timeout_ms = -1 ) = 0; | ||
|
||
virtual ssize_t | ||
write( const void* buffer, | ||
size_t size, | ||
int timeout_ms = -1, | ||
bool more_data = false ) = 0; | ||
|
||
VNSI_INTERFACE( ISocket ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* StatusCommans.c | ||
* | ||
* Created on: 26.12.2020 | ||
* Author: mdrechsler | ||
*/ | ||
|
||
#include "StatusCommands.h" | ||
|
||
#include "ICommandVisitor.h" | ||
|
||
void | ||
SocketError::execute( ICommandVisitor& visitor ) | ||
{ | ||
visitor.visit(*this); | ||
} | ||
|
||
StatusRecording::StatusRecording( int deviceIndex, | ||
const std::string& name, | ||
const std::string& fileName, | ||
bool on ) | ||
: mDeviceIndex( deviceIndex ) | ||
, mName( name ) | ||
, mFileName( fileName ) | ||
, mOn( on ) | ||
{ | ||
} | ||
|
||
int | ||
StatusRecording::getDeviceIndex() const | ||
{ | ||
return mDeviceIndex; | ||
} | ||
|
||
const std::string& | ||
StatusRecording::getName() const | ||
{ | ||
return mName; | ||
} | ||
|
||
const std::string& | ||
StatusRecording::getFileName() const | ||
{ | ||
return mFileName; | ||
} | ||
|
||
bool | ||
StatusRecording::isOn() const | ||
{ | ||
return mOn; | ||
} | ||
|
||
void | ||
StatusRecording::execute( ICommandVisitor& visitor ) | ||
{ | ||
visitor.visit( *this ); | ||
} | ||
|
||
StatusOsdStatusMessage::StatusOsdStatusMessage( const std::string& message ) | ||
: mMessage( message ) | ||
{ | ||
} | ||
|
||
std::string | ||
StatusOsdStatusMessage::getMessage() const | ||
{ | ||
return mMessage; | ||
} | ||
|
||
void | ||
StatusOsdStatusMessage::execute( ICommandVisitor& visitor ) | ||
{ | ||
visitor.visit( *this ); | ||
} | ||
|
||
StatusChannelChange::StatusChannelChange( const cChannel& channel ) | ||
: mChannel( channel ) | ||
{ | ||
} | ||
|
||
const cChannel& | ||
StatusChannelChange::getChannel() const | ||
{ | ||
return mChannel; | ||
} | ||
|
||
void | ||
StatusChannelChange::execute( ICommandVisitor& visitor ) | ||
{ | ||
visitor.visit(*this); | ||
} | ||
|
||
void | ||
StatusChannelsChange::execute( ICommandVisitor& visitor ) | ||
{ | ||
visitor.visit(*this); | ||
} | ||
|
||
void | ||
StatusRecordingsChange::execute( ICommandVisitor& visitor ) | ||
{ | ||
visitor.visit(*this); | ||
} | ||
|
||
void | ||
StatusSignalTimerChange::execute( ICommandVisitor& visitor ) | ||
{ | ||
visitor.visit(*this); | ||
} | ||
|
||
void | ||
StatusEpgChange::execute( ICommandVisitor& visitor ) | ||
{ | ||
visitor.visit(*this); | ||
} |
Oops, something went wrong.