Logo Search packages:      
Sourcecode: kmess version File versions

msnwebcamconnection.h

/***************************************************************************
                          msnwebcamconnection.h -  description
                             -------------------
    begin                : Sun 08 31 2008
    copyright            : (C) 2008 by Diederik van der Boor
    email                : "vdboor" --at-- "codingdomain.com"
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef MSNWEBCAMCONNECTION_H
#define MSNWEBCAMCONNECTION_H

#include "directconnectionbase.h"

#include <QByteArray>
#include <QBuffer>


class MimeMessage;



/**
 * A connection used to transfer webcam video frames between two end-hosts.
 * This connection can be established during a P2PApplication invitation.
 *
 * @author Diederik van der Boor
 * @ingroup NetworkExtra
 */
00038 class MsnWebcamConnection : public DirectConnectionBase
{
  Q_OBJECT

  public:
    // The constructor
                           MsnWebcamConnection(const QString &contactHandle, uint recipientId, uint sessionId);
    // The destructor
    virtual               ~MsnWebcamConnection();

    // Send the preamble packet preceeding all other packets
    bool                   initialize();
    // Return the contact handle
    const QString&         getContactHandle() const;
    // Send the message to the contact
    bool                   sendMessage(const QByteArray &message);
    // Mark the remote host as authorized (make it a public method)
    using                  DirectConnectionBase::setAuthorized;

  private slots: // Protected slots
    // This is called when data is received from the socket.
    void                   slotSocketDataReceived();

  private:   // private properties
    enum ReceiveMode
    {
      MODE_AUTHENTICATION
    , MODE_HEADER
    , MODE_V_FRAME
    };

    // The buffer for the incoming p2p messages.
    QBuffer                buffer_;
    // The other contact we're connected with
    QString                contactHandle_;
    // Whether the first message is received
    bool                   firstMessage_;
    // The current receive mode
    ReceiveMode            receiveMode_;
    // The recipient ID to authenticate the connection.
    uint                   recipientId_;
    // Set when only partial data was received
    quint64                remainingBlockBytes_;
    // The session ID to authenticate the connection.
    uint                   sessionId_;

  signals:
    // Signal that a full message block was received.
    void                   messageReceived(const QByteArray &message);
};


#endif

Generated by  Doxygen 1.6.0   Back to index