#include "media.h"
+#ifdef DEBUG
#include <iostream>
+#endif
Media::Media(key_t key) throw (std::runtime_error)
{
void Media::transmit(const Frame& frame)
{
- std::cout << "tx -> msgtype = " << *(((int*)&frame)+1) << "\n";
+#ifdef DEBUG
+ std::cout << "Media::transmit(msgtype/mac = " << *(((int*)&frame)+1)
+ << ", size = " << frame.size() << ", data = " << frame.data() << ")\n";
+#endif
+ // HACK ASQUEROSO para pasarle por encima a la vtable... :-O~
if (msgsnd(que_id, ((int*)&frame)+1, frame.size(), 0) == -1)
throw std::runtime_error("Error al poner en la cola");
}
void Media::receive(Frame& frame)
{
- std::cout << "rx -> msgtype = " << *(((int*)&frame)+1) << "\n";
+ // HACK ASQUEROSO para pasarle por encima a la vtable... :-O~
if (msgrcv(que_id, ((int*)&frame)+1, frame.size(), frame.mac(), 0) == -1)
throw std::runtime_error("Error al sacar de la cola");
+#ifdef DEBUG
+ std::cout << "Media::receive(msgtype/mac = " << *(((int*)&frame)+1)
+ << ", size = " << frame.size() << ", data = " << frame.data() << ")\n";
+#endif
}
// vim: set et sw=4 sts=4 :