Updated ChangeLog
[barry.git] / src / j_message.cc
blob90b5fae666d7e4d1d291ee0f556952df97b166e8
1 ///
2 /// \file j_message.cc
3 /// JDWP USB message implementation
4 ///
6 /*
7 Copyright (C) 2009, Nicolas VIVIEN
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #include "j_message.h"
23 #include "debug.h"
24 #include "data.h"
27 namespace Barry { namespace JDWP {
30 JDWMessage::JDWMessage(int socket)
31 : m_socket(socket)
36 JDWMessage::~JDWMessage()
41 void JDWMessage::RawSend(Data &send, int timeout)
43 bool ret = m_jdwp.Write(m_socket, send, timeout);
45 if (ret)
46 barryverbose("JDWMessage::RawSend: Socket ID " << m_socket
47 << "\nSent:\n" << send);
51 bool JDWMessage::RawReceive(Data &receive, int timeout)
53 bool ret;
55 ret = m_jdwp.Read(m_socket, receive, timeout);
57 if (ret)
58 barryverbose("JDWMessage::RawReceive: Socket ID " << m_socket
59 << "\nReceived:\n" << receive);
61 return ret;
65 void JDWMessage::Send(Data &send, int timeout)
67 RawSend(send, timeout);
71 void JDWMessage::Send(Data &send, Data &receive, int timeout)
73 RawSend(send, timeout);
74 RawReceive(receive, timeout);
78 bool JDWMessage::Receive(Data &receive, int timeout)
80 return RawReceive(receive, timeout);
83 }} // namespace Barry::JDWP