baf52dacd8003c3ac6d43bfef7073aae9e871e3b
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

1) /* Blinker
2)    Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org>
3)    Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
4)    a blinkenarea.org project */
5) 
6) #include <iostream>
7) #include <stdlib.h>
8) #include <string>
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

9) #include <string.h>
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

10) 
11) #include <BlinkenLib/BlinkenFrame.h>
12) 
13) #include "Directory.h"
14) #include "File.h"
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

15) #include "InStreamFile.h"
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

16) #include "Mgrs.h"
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

17) #include "Module.h"
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

18) #include "Printer.h"
19) #include "StreamRecv.h"
20) 
21) namespace Blinker {
22) 
23) /**
24)  * @brief constructor
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

25)  * @param[in] mgrs managers
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

26)  * @param[in] dirBase base directory
27)  */
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

28) Printer::Printer(Mgrs &mgrs,
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

29)                  const Directory &dirBase):
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

30)   Module(mgrs, dirBase),
31)   m_fileInStream(dirBase.getFile("instream"), mgrs.m_streamMgr)
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

32) {
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

33)   // set up
34)   m_fileInStream.setStreamRecv(this);
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

35) }
36) 
37) /// virtual destructor
38) Printer::~Printer()
39) {
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

40)   // clean up
41)   m_fileInStream.setStreamRecv(NULL);
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

42) }
43) 
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

44) /// check for update of configuration
45) void Printer::updateConfig()
46) {
Stefan Schuermans implemented automatic check...

Stefan Schuermans authored 13 years ago

47)   // input stream name file was modified -> re-get input stream
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

48)   if (m_fileInStream.checkModified())
49)     m_fileInStream.update();
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

50) }
51) 
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

52) /**
53)  * @brief set current frame
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

54)  * @param[in] stream stream name
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

55)  * @param[in] pFrame current frame (NULL for none)
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

56)  */
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

57) void Printer::setFrame(const std::string &stream, stBlinkenFrame *pFrame)
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

58) {
Stefan Schuermans merged frame processing wit...

Stefan Schuermans authored 12 years ago

59)   if (pFrame) {
60)     char *str = BlinkenFrameToString(pFrame);
61)     for (int i = strlen(str) - 2; i >= 0 && str[i] != '\n'; --i)
62)       str[i] = 0; // remove last line (delay)
63)     std::cout << "frame" << std::endl << str;
64)     free(str);
65)   } else {
66)     std::cout << "no frame" << std::endl;
67)   }
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

68)   (void)stream; // unused