//
//  The contents of this file are subject to the Mozilla Public License
//  Version 1.0 (the "License"); you may not use this file except in
//  compliance with the License. You may obtain a copy of the License at
//  http://www.mozilla.org/MPL/
// 
//  Software distributed under the License is distributed on an "AS IS"
//  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
//  the License for the specific language governing rights and limitations
//  under the License.
// 
//  The Original Code is CPhone, a cross platform voip gui.
//
//  The Initial Developer of the Original Code is Derek Smithies.
//
//  Copyright (C) 2002 Indranet Technologies Ltd, 
//                                  http://www.indranet-technologies.com
//  All Rights Reserved.
//
//  Contributor(s): _______________


/*
 *
 * $Log: cpendpoint.h,v $
 * Revision 1.7  2004/04/23 05:09:59  dereksmithies
 * Fixes so it works with latest openh323 lib, and not lock X display.
 *
 * Revision 1.6  2004/04/14 07:25:19  dereksmithies
 * Updates, so it compiles on windows XP. Big Thanks to Francisco Huerta
 *
 * Revision 1.5  2003/08/26 04:48:02  dereksmithies
 * Fixes to get statistics working right, add icons, add ok,cancel,apply buttons
 *
 * Revision 1.4  2003/05/20 03:32:28  dereksmithies
 * Better handling of ixj handset states, and call progress states.
 *
 * Revision 1.3  2003/04/04 04:37:49  dereksmithies
 * Major upgrade.
 * Ixj & microtelco support added. Fix threading issues.
 *
 * Revision 1.2  2002/11/27 23:52:48  dereksmithies
 * Changes to make compatible with current openh323 library code.
 *
 * Revision 1.1.1.1  2002/05/12 22:55:02  dereksmithies
 * Initial release.
 *
 *
 *
 */

#ifndef _CPhone_CPENDPOINT_H
#define _CPhone_CPENDPOINT_H

#include <ptlib.h>
#include <h323.h>
#include <qevent.h> 
#include "options.h"
#include "main.h"


#ifdef HAS_IXJ
#include <ixjlid.h>
#endif


class MainUi;
class ConnectOptions;
class AudioProperties;
class AudioOptions;
class VideoOptions;
class CpEndPoint;
class QtVideoDevice;
class CpVideoChannel;
class Settings;
#ifdef HAS_IXJ
class LidHandlerThread;
#endif

/////////////////////////////
#ifdef HAS_IXJ

class LidHandlerThread: public PThread
{
    PCLASSINFO(LidHandlerThread, PThread);
  public:
    LidHandlerThread();
    ~LidHandlerThread();

    BOOL SetEchoCancellation(PINDEX i);
    BOOL SetPhoneDevice(PString deviceName);
    BOOL SetPlayVolume(PINDEX i);
    BOOL SetRecordVolume(PINDEX i);

    PString GetDeviceName();

    void AddIxjCapabilities(H323Capabilities &caps);
    void TerminateThread();
    void RingPhone(BOOL isOn = TRUE);
    
    void Main();

    OpalIxJDevice lid;

    void StartRunning() { startFlag.Signal(); }

  protected:
    void PlayTone(OpalLineInterfaceDevice::CallProgressTones newTone);
    void StopTone();
     
	PSyncPoint         startFlag;
    
    PMutex             lidNameMutex;
    PSyncPoint         exitFlag;
    PString            lidName;
    PString            remoteFullAddress;

    BOOL               playingTone;
    BOOL               oldIsOffHook;
};

#endif


#if 0
class CpEndPoint : public H323EndPoint
{
    PCLASSINFO(CpEndPoint, H323EndPoint);
    CpEndPoint();
    ~CpEndPoint();
};
#endif

class CpVideoChannel : public PVideoChannel
{
  PCLASSINFO(CpVideoChannel, PVideoChannel);

 public:
  CpVideoChannel();

  ~CpVideoChannel();

   BOOL Close();

   void AttachVideoPlayer(PVideoOutputDevice *player, BOOL keepCurrent);

   void RemoveVideoImage();
};


#endif // _CPhone_CPENDPOINT_H


syntax highlighted by Code2HTML, v. 0.9.1