1 /** Aesalon, a tool to visualize program behaviour in real time.
2 Copyright (C) 2009-2011, Aesalon development team.
4 Aesalon is distributed under the terms of the GNU GPLv3. See
5 the included file LICENSE for more information.
7 @file src/monitor/ZoneReader.cpp
10 #include "monitor/ZoneReader.h"
11 #include "shm/PacketHeader.h"
12 #include "util/MessageSystem.h"
16 ZoneReader::ZoneReader(SHMReader
*shmReader
) : m_shmReader(shmReader
) {
20 ZoneReader::~ZoneReader() {
24 void ZoneReader::run() {
28 void *ZoneReader::run(void *voidInstance
) {
29 Message(Debug
, "Beginning ZoneReader loop . . .");
30 ZoneReader
*instance
= static_cast<ZoneReader
*>(voidInstance
);
31 SHMReader
*reader
= instance
->m_shmReader
;
32 SHMReader::ReadBroker broker
;
35 reader
->waitForPacket();
36 int32_t zone
= reader
->zoneWithData();
39 SHM::PacketHeader
*packetHeader
;
40 broker
.setupRequest(zone
, sizeof(SHM::PacketHeader
));
41 reader
->processRequest(broker
);
42 packetHeader
= static_cast<SHM::PacketHeader
*>(broker
.data());
45 broker
.setupRequest(zone
, packetHeader
->packetSize
);
46 reader
->processRequest(broker
);
47 packetData
= static_cast<uint8_t *>(broker
.data());
49 Message(Log
, "Recieved packet from module " << packetHeader
->moduleID
<< ", size " << packetHeader
->packetSize
);
52 Message(Debug
, "Ending ZoneReader loop . . .");
57 } // namespace Monitor