-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add another page list to hold normal non-carousel pages which FileMon…
…itor has just added or updated. PacketMag now checks this list ahead of carousels and normal pages so that updates are transmitted immediately (with interrupted sequence flag set in header) The magazine priority is also ignored when it has waiting updated pages so IsReady returns true (equivalent to calling with force)
- Loading branch information
Showing
10 changed files
with
154 additions
and
21 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
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
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
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
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,61 @@ | ||
|
||
#include "updatedpages.h" | ||
|
||
using namespace vbit; | ||
|
||
UpdatedPages::UpdatedPages() | ||
{ | ||
_iter=_UpdatedPagesList.begin(); | ||
_page=nullptr; | ||
} | ||
|
||
UpdatedPages::~UpdatedPages() | ||
{ | ||
|
||
} | ||
|
||
void UpdatedPages::addPage(TTXPageStream* p) | ||
{ | ||
_UpdatedPagesList.push_front(p); | ||
} | ||
|
||
TTXPageStream* UpdatedPages::NextPage() | ||
{ | ||
if (_page == nullptr) | ||
{ | ||
_iter=_UpdatedPagesList.begin(); | ||
_page = *_iter; | ||
} | ||
else | ||
{ | ||
++_iter; | ||
_page = *_iter; | ||
} | ||
|
||
loop: | ||
if (_iter == _UpdatedPagesList.end()) | ||
{ | ||
_page = nullptr; | ||
} | ||
|
||
if (_page) | ||
{ | ||
/* remove pointers from this list if the pages are marked for deletion */ | ||
if (_page->GetStatusFlag()==TTXPageStream::MARKED && _page->GetUpdatedFlag()) // only remove it once | ||
{ | ||
std::cerr << "[UpdatedPages::NextPage] Deleted " << _page->GetSourcePage() << std::endl; | ||
_iter = _UpdatedPagesList.erase(_iter); | ||
_page->SetUpdatedFlag(false); | ||
if (!(_page->GetSpecialFlag() || _page->GetCarouselFlag() || _page->GetNormalFlag())) | ||
_page->SetState(TTXPageStream::GONE); // if we are last mark it gone. | ||
_page = *_iter; | ||
goto loop; // jump back to try for the next page | ||
} | ||
|
||
//std::cerr << "[UpdatedPages::NextPage] got updated page " << std::hex << _page->GetPageNumber() << std::endl; | ||
_iter = _UpdatedPagesList.erase(_iter); // remove page from this list after transmitting it | ||
_page->SetUpdatedFlag(false); | ||
} | ||
|
||
return _page; | ||
} |
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,38 @@ | ||
#ifndef _UPDATEDPAGES_H | ||
#define _UPDATEDPAGES_H | ||
|
||
#include <list> | ||
|
||
#include "ttxpagestream.h" | ||
|
||
// list of updated pages | ||
|
||
namespace vbit | ||
{ | ||
|
||
class UpdatedPages | ||
{ | ||
public: | ||
/** Default constructor */ | ||
UpdatedPages(); | ||
/** Default destructor */ | ||
virtual ~UpdatedPages(); | ||
|
||
TTXPageStream* NextPage(); | ||
|
||
void addPage(TTXPageStream* p); | ||
|
||
bool waiting(){ return _UpdatedPagesList.size() > 0; }; | ||
|
||
protected: | ||
|
||
private: | ||
std::list<TTXPageStream*> _UpdatedPagesList; | ||
std::list<TTXPageStream*>::iterator _iter; | ||
TTXPageStream* _page; | ||
|
||
}; | ||
|
||
} | ||
|
||
#endif // _UPDATEDPAGES_H |