Skip to content

Commit

Permalink
Create a second page list for each magazine to hold any "special" pag…
Browse files Browse the repository at this point in the history
…es which need to be transmitted on particular schedule (GPOP, POP, GDRCS, DRCS, MOT, and MIP pages).

Currently these pages are just taken out of the main sequence and never get transmitted.
Has a bug where if the page file gets modified and changed from a special page to a normal page or vice versa the page is now stuck in the wrong page list.
  • Loading branch information
ZXGuesser committed Sep 16, 2017
1 parent bcb656d commit ff2d3bd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions filemonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void FileMonitor::run()
// We need a mutex or semaphore to lock out this page while we do that
// lock
p->LoadPage(name); // What if this fails? We can see the bool. What to do ?
//TODO: If this was a normal page and is now a special page or vice versa we have loaded it into the wrong pagelist! FIX ME!
p->SetModifiedTime(attrib.st_mtime);
// unlock

Expand Down
18 changes: 14 additions & 4 deletions pagelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ int PageList::LoadPageList(std::string filepath)
q->GetPageCount(); // Use for the side effect of renumbering the subcodes

int mag=(q->GetPageNumber() >> 16) & 0x7;
_pageList[mag].push_back(*q); // This copies. But we can't copy a mutex
PageFunction func = q->GetPageFunction();
if (func == GPOP || func == POP || func == GDRCS || func == DRCS || func == MOT || func == MIP){
_pageList[mag+8].push_back(*q); // put page in separate pageList for "special" pages
} else {
_pageList[mag].push_back(*q); // This copies. But we can't copy a mutex
}
}
}
}
Expand Down Expand Up @@ -87,8 +92,13 @@ int PageList::LoadPageList(std::string filepath)

void PageList::AddPage(TTXPageStream* page)
{
int mag=(page->GetPageNumber() >> 16) & 0x7;
_pageList[mag].push_back(*page);
int mag=(page->GetPageNumber() >> 16) & 0x7;
PageFunction func = page->GetPageFunction();
if (func == GPOP || func == POP || func == GDRCS || func == DRCS || func == MOT || func == MIP){
_pageList[mag+8].push_back(*page); // put page into separate pageList for "special" pages
} else {
_pageList[mag].push_back(*page); // put page into the normal page sequence
}
}


Expand All @@ -97,7 +107,7 @@ TTXPageStream* PageList::Locate(std::string filename)
{
// This is called from the FileMonitor thread
// std::cerr << "[PageList::Locate] *** TODO *** " << filename << std::endl;
for (int mag=0;mag<8;mag++)
for (int mag=0;mag<16;mag++) // check both sets of page lists as it might be one of the special pages
{
//for (auto p : _pageList[mag])
for (std::list<TTXPageStream>::iterator p=_pageList[mag].begin();p!=_pageList[mag].end();++p)
Expand Down
2 changes: 1 addition & 1 deletion pagelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class PageList

private:
Configure* _configure; // The configuration object
std::list<TTXPageStream> _pageList[8]; /// The list of Pages in this service. One list per magazine
std::list<TTXPageStream> _pageList[16]; /// The list of Pages in this service. Two lists per magazine (normal pages in lists 0-7, enhancement and magazine inventory and organisation table pages in 8-15)
vbit::Mag* _mag[8];

// iterators through selected pages. (use the same iterator for D command and MD, L etc.)
Expand Down

0 comments on commit ff2d3bd

Please sign in to comment.