sdbpacketutils.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2013 Jarek Pelczar <jpelczar@gmail.com>
  4. **
  5. ** This file is part of Qt Creator.
  6. **
  7. ** Commercial License Usage
  8. ** Licensees holding valid commercial Qt licenses may use this file in
  9. ** accordance with the commercial license agreement provided with the
  10. ** Software or, alternatively, in accordance with the terms contained in
  11. ** a written agreement between you and Digia. For licensing terms and
  12. ** conditions see http://qt.digia.com/licensing. For further information
  13. ** use the contact form at http://qt.digia.com/contact-us.
  14. **
  15. ** GNU Lesser General Public License Usage
  16. ** Alternatively, this file may be used under the terms of the GNU Lesser
  17. ** General Public License version 2.1 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.LGPL included in the
  19. ** packaging of this file. Please review the following information to
  20. ** ensure the GNU Lesser General Public License version 2.1 requirements
  21. ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
  22. **
  23. ** In addition, as a special exception, Digia gives you certain additional
  24. ** rights. These rights are described in the Digia Qt LGPL Exception
  25. ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
  26. **
  27. ****************************************************************************/
  28. #ifndef TIZENUTILS_SDBPACKETUTILS_H
  29. #define TIZENUTILS_SDBPACKETUTILS_H
  30. #include "tizenutils_global.h"
  31. #include <QString>
  32. #include <QIODevice>
  33. namespace Tizen {
  34. class TIZENUTILS_EXPORT SdbResponse
  35. {
  36. public:
  37. SdbResponse() :
  38. okay(false),
  39. length_read(0)
  40. {
  41. }
  42. bool okay;
  43. QString message;
  44. int length_read;
  45. };
  46. class TIZENUTILS_EXPORT SdbPacketUtils
  47. {
  48. public:
  49. static QByteArray makeRequest(const QString& string);
  50. static QByteArray makeRequest(const QByteArray& string);
  51. static bool parseResponse(const QByteArray& source, bool readDiagnosticString, SdbResponse& response);
  52. static bool parseResponse(QIODevice * source, bool readDiagnosticString, SdbResponse& response);
  53. static QByteArray makeCreateForwardMessage(QString deviceSerial, int localPort, int remotePort);
  54. static QByteArray makeDeleteForwardMessage(QString deviceSerial, int localPort, int remotePort);
  55. static QByteArray makeInitializeDeviceMessage(QString deviceSerial);
  56. };
  57. } // namespace Tizen
  58. #endif // TIZENUTILS_SDBPACKETUTILS_H