1087bff6497bc6dbbad3f79c2626b663c181fe74
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 whitespace fix

Stefan Schuermans authored 12 years ago

28) Printer::Printer(Mgrs &mgrs, const Directory &dirBase):
Stefan Schuermans put all managers in one str...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

31) {
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

67)   (void)stream; // unused