⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.h

📁 网络电话(VOIP)软件Pchone 1、按照OpenH323库中readme.txt说明编译OpenH323库 2、再用VC编译PCPhone代码
💻 H
📖 第 1 页 / 共 2 页
字号:
      MainWindow * mainWindow
    );

    // overrides from H323Connection
    AnswerCallResponse OnAnswerCall(const PString &, const H323SignalPDU &, H323SignalPDU &);
    BOOL OnAlerting(const H323SignalPDU &, const PString &);
    void OnUserInputString(const PString &);

  protected:
    OpenPhoneEndPoint & myEndpoint;
    MainWindow * mainWindow;
};


///////////////////////////////////////////////////////

class VideoDevice;

class VideoWindow : public PFloatingDialog
{
  PCLASSINFO(VideoWindow, PFloatingDialog);
 
  public:
    VideoWindow(PInteractor * parent, VideoDevice * device, BOOL local);
    ~VideoWindow();

    void SetVideoSize(int _width, int _height);
    BOOL WriteLineSegment(int x, int y, unsigned len, const BYTE * data);

    virtual void OnCancel();

  protected:
    virtual void OnClose();
    virtual void OnRedraw(PCanvas &);

    void Shutdown();

    VideoDevice * device;
    BOOL          localVideo;
    PDrawCanvas * canvas;
    PPixelImage   image;
    PPixelImage   raster;
    PMutex        mutex;
}; 


///////////////////////////////////////////////////////

class VideoDevice : public H323VideoDevice
{
  PCLASSINFO(VideoDevice, H323VideoDevice);
 
  public:
    VideoDevice(MainWindow * mainWindow, BOOL local, const PString & title, BOOL flip);
    ~VideoDevice();

    virtual BOOL SetFrameSize(unsigned width, unsigned height);

  protected:
    BOOL WriteLineSegment(int x, int y, unsigned len, const BYTE * data);

    VideoWindow * window;
    BOOL          windowOpen;
    BOOL          flip;

  friend class VideoWindow;
}; 


///////////////////////////////////////////////////////

class VUMeter : public PInteractor
{
  PCLASSINFO(VUMeter, PInteractor);
 
  public:
    VUMeter(
      PInteractor * parent,       // Parent interactor
      unsigned maxLevel = 32767,
      BOOL logScale = FALSE
    );

    void SetMaximumLevel(
      unsigned level
    );

    void SetMarkerLevel(
      unsigned level
    );

    void SetCurrentLevel(
      unsigned level
    );

  protected:
    virtual unsigned ScaleLevel(unsigned level);

    virtual void OnRedraw(PCanvas &);

    BOOL     logarithmic;
    unsigned maximumLevel;

    unsigned markerPosition;  // These are always log scaled.
    unsigned currentPosition;
};


///////////////////////////////////////////////////////

class MainWindow : public PTopLevelWindow
{
  PCLASSINFO(MainWindow, PTopLevelWindow)
  
  public:
    MainWindow(PArgList & args);
    ~MainWindow();

    PDECLARE_COMMAND_ENABLE("MakeCall",    MainWindow, CallCmd, CanMakeCall);
    PDECLARE_COMMAND_ENABLE("HangupCall",  MainWindow, HangupCmd, CanHangupCall);
    PDECLARE_COMMAND_ENABLE("AcceptCall",  MainWindow, AcceptCallCmd, CanAcceptCall);
    PDECLARE_COMMAND_ENABLE("RefuseCall",  MainWindow, RefuseCallCmd, CanRefuseCall);
    PDECLARE_COMMAND_ENABLE("TransferCall",MainWindow, TransferCmd, CanTransferCall);
    PDECLARE_COMMAND_ENABLE("HoldCall",    MainWindow, HoldCmd, CanHoldCall);
    PDECLARE_COMMAND_ENABLE("IntrudeCall", MainWindow, IntrudeCmd, CanIntrudeCall);

   // PDECLARE_NOTIFIER(PMenuItem, MainWindow, UserInputCmd);

    PDECLARE_COMMAND_ENABLE("ShowStats",   MainWindow, ShowStatsCmd, CanShowStats);
    PDECLARE_COMMAND_ENABLE("MuteMicrophone", MainWindow, MuteMicrophoneCmd, CanMuteMicrophone);
    PDECLARE_COMMAND_ENABLE("MuteSpeaker", MainWindow, MuteSpeakerCmd, CanMuteSpeaker);
    PDECLARE_COMMAND_ENABLE("RecordMedia", MainWindow, RecordMediaCmd, CanRecordMedia);
    PDECLARE_COMMAND_ENABLE("StopRecording", MainWindow, StopRecordingCmd, CanStopRecording);

    PDECLARE_COMMAND("ExitCmd", MainWindow, ExitCmd);

    PDECLARE_COMMAND("SpeedDialOptions",  MainWindow, SpeedDialOptionsCmd);
    PDECLARE_COMMAND("GeneralOptions",    MainWindow, GeneralOptionsCmd);
    PDECLARE_COMMAND("NetworkingOptions", MainWindow, NetworkingOptionsCmd);
    PDECLARE_COMMAND("ForwardingOptions", MainWindow, ForwardingOptionsCmd);
    PDECLARE_COMMAND_ENABLE("GatekeeperOptions", MainWindow, GatekeeperOptionsCmd, CanSetGatekeeper);
    PDECLARE_COMMAND("AudioDeviceOptions",MainWindow, AudioDeviceOptionsCmd);
    PDECLARE_COMMAND("AudioCodecOptions", MainWindow, AudioCodecOptionsCmd);
    PDECLARE_COMMAND("VideoOptions",      MainWindow, VideoOptionsCmd);
#if PTRACING
    PDECLARE_COMMAND("TraceOptions",      MainWindow, TraceOptionsCmd);
#endif

    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnCallButton);
    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnIntrudeButton);
    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnAnswerButton);
    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnRefuseButton);
    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnHangUpButton);
    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnSpeakerButton);
    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnTransferButton);
    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnHoldButton);
    PDECLARE_NOTIFIER(PTextButton, MainWindow, OnSpeedDialButton);
    PDECLARE_NOTIFIER(PCheckBox, MainWindow, OnSpeakerEnable);
    PDECLARE_NOTIFIER(PCheckBox, MainWindow, OnMicrophoneEnable);
    PDECLARE_NOTIFIER(PHorizontalScrollBar, MainWindow, OnSpeakerVolume);
    PDECLARE_NOTIFIER(PHorizontalScrollBar, MainWindow, OnMicrophoneVolume);

    void OutputStatus(PRESOURCE_ID strId, ...);

    virtual BOOL AllowClose(BOOL closingAll);
    virtual void OnClose();
    virtual void OnResize(const PDim & newSize, ResizeType type);

    BOOL OnAnswerCall(const H323Connection & connection);
    BOOL OnConnectionForwarded(const PString &);
    void OnConnectionEstablished(const PString & token, const PString & party);
    void OnConnectionCleared(const H323Connection & connection);
    void OnLogicalChannel(const H323Channel & channel, unsigned txStrID, unsigned rxStrID);
    void OnHandsetLifted(OpalLineInterfaceDevice & lid);
    void OnHandsetReturned(OpalLineInterfaceDevice & lid);
    void SendUserInput(char tone);

    enum CallMode {
      IdleCallMode,
      MakingCallMode,
      HangingUpMode,
      IncomingCallWait,
      IncomingLineCall,
      Active323CallMode,
      ActiveLineCallMode,
      NoGatekeeperMode,
      ApplicationShuttingDown,
      IncomingCallIntrusion
    };
    CallMode GetCallMode() const { return currentCallMode; }
    void SetCallMode(CallMode mode);

    StatisticsDlg * statisticsDialog;


  private:
    void AddSpeedDialButtons();
    BOOL SpeedDial(const PString & key);
    BOOL MakeCall(const PString & address, const PString & gateway);
    BOOL IntrudeCall(const PString & address, const PString & gateway, unsigned capabilityLevel);
    void AnswerCall(BOOL accept);

    OpenPhoneEndPoint endpoint;

    // User interface variables
 //   MainMenu *  myMainMenu;
    PStringListBox * statusWindow;
    PTextButton * makeCallButton;
    PTextButton * answerButton;
    PTextButton * refuseButton;
    PTextButton * hangUpButton;
    PTextButton * transferButton;
    PTextButton * holdButton;
    PTextButton * intrudeCallButton;

    PTextButton * speakerButton;
    PCheckBox * speakerEnable;
    PHorizontalScrollBar * speakerVolume;
    VUMeter * speakerVU;

    PCheckBox * microphoneEnable;
    PHorizontalScrollBar * microphoneVolume;
    VUMeter * microphoneVU;

    PInteractorList speedDialButtons;

    PTimer ringSoundTimer;
    PDECLARE_NOTIFIER(PTimer, MainWindow, OnRingSoundAgain);

    PString       noAnswerForwardParty;
    PTimeInterval noAnswerTime;
    PTimer        noAnswerTimer;
    PDECLARE_NOTIFIER(PTimer, MainWindow, OnNoAnswerTimeout);

    PTimer vuTimer;
    PDECLARE_NOTIFIER(PTimer, MainWindow, OnUpdateVU);

    // Configuration variables
    BOOL    autoAnswer;
    PINDEX  maxRecentCalls;
    PString ringSoundFile;

    // State variables
    CallMode currentCallMode;
    PMutex   callModeMutex;
    PString  currentCallToken;
    BOOL     speakerphoneSwitch;

    OpalRtpToWavFile * recorder;

#if PTRACING
    BOOL OpenTraceFile(PConfig & config);
    PTextFile * myTraceFile;
#endif
};


///////////////////////////////////////////////////////

#ifdef TESTING_T120
class MyT120Protocol : public OpalT120Protocol
{
    PCLASSINFO(MyT120Protocol, OpalT120Protocol);
  public:
    MyT120Protocol() { }
};
#endif

    
///////////////////////////////////////////////////////

#ifdef TESTING_T38
class MyT38Protocol : public OpalT38Protocol
{
    PCLASSINFO(MyT38Protocol, OpalT38Protocol);
  public:
    MyT38Protocol() { }
};
#endif


///////////////////////////////////////////////////////

class OpenPhone : public PApplication
{
  PCLASSINFO(OpenPhone, PApplication)

  public:
    OpenPhone();
    void Main();
    void OnAbout();
};


#endif  // _OpenPhone_MAIN_H


// End of File ///////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -