converting pjsua to mfc application: static function problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I am converting the pjsua application given in the pj-project as an MFC
application. I am facing the following problem

?cannot convert from 'void (__thiscall Phone::* )(pjsua_acc_id)' to 'void
(__cdecl *)(pjsua_acc_id)' There is no context in which this conversion is
possible?

Here is the my code. I am writing using Visual studio 2005

/*********** PhoneDlg.h************/
#include <pjsua-lib/pjsua.h>
Phone:: public CDialog
{
?
void on_reg_state(pjsua_acc_id acc_id);
?.
}
/************ PhoneDlg.cpp ***********/
#include "PhoneDlg.h"
void Phone:: on_reg_state(pjsua_acc_id acc_id)
{
pjsua_acc_info info;
CString reg_status;

pjsua_acc_get_info(acc_id,&info);
reg_status=info.status_text.ptr;

/** Now update the registration status on Phone?s main dialog edit control,
m_userinfo is the edit control value variable on Phone?s main dialog ******/

m_userinfo=reg_status;   // m_userinfo is the CString value variable for the
edit-control box
UpdateData(false);
}

BOOL Phone:: OnInitDialog()
{
????????????????
pjsua_config cfg; //pjsua_config is a struct
??????????????
cfg.cb.on_reg_state = &Phone:: on_reg_state;
---------------------------
?????????????????.
}


if I declare the "on_reg_state" as a static function, the UpdateData(false)
gives error as it cannot access the members of the class Phone. And if I
dont call the "UpdateData(false)", the edit control box is not updated. If I
declare the "on_reg_state" as a global function, then I can not update the
status on the dialog. This problem is with other callback functions
on_incoming_call,
on_media_state as well.

The Soft Phone is working perfect except this update problem.[?]

I am badly stuck in this, please help


ahong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090402/34e73665/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 100 bytes
Desc: not available
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090402/34e73665/attachment.gif>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux