0fee1b0dbe796d5c03abdc7b516de170331aed5b
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) 
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

13) #include "CallMgr.h"
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

14) #include "Directory.h"
15) #include "File.h"
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

16) #include "InStreamFile.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 "StreamMgr.h"
20) #include "StreamRecv.h"
21) 
22) namespace Blinker {
23) 
24) /**
25)  * @brief constructor
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

26)  * @param[in] callMgr callback manager
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

27)  * @param[in] streamMgr stream manager
28)  * @param[in] dirBase base directory
29)  */
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

30) Printer::Printer(CallMgr &callMgr, StreamMgr &streamMgr,
31)                  const Directory &dirBase):
32)   Module(callMgr, streamMgr, dirBase),
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

33)   m_fileInStream(dirBase.getFile("instream"), streamMgr)
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

34) {
Stefan Schuermans implemented specialized set...

Stefan Schuermans authored 12 years ago

35)   // set up
36)   m_fileInStream.setStreamRecv(this);
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

42)   // clean up
43)   m_fileInStream.setStreamRecv(NULL);
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

44) }
45) 
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

50)   if (m_fileInStream.checkModified())
51)     m_fileInStream.update();
Stefan Schuermans implemented base class for...

Stefan Schuermans authored 13 years ago

52) }
53) 
Stefan Schuermans implemented stream printer...

Stefan Schuermans authored 13 years ago

54) /**
55)  * @brief set current frame
Stefan Schuermans added stream name to stream...

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 13 years ago

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

Stefan Schuermans authored 12 years ago

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

Stefan Schuermans authored 12 years ago

70)   (void)stream; // unused