PDA

View Full Version : RIL_INITILIZE in CLASSes (How to implement?)


ballrock2
6th January 2004, 02:20 PM
Hi,

I'm using the the RIL_Initialize-Call from the stril.zip.
(The programm works well - thank you for your great work!!! ;o)

Now I'd tried to implement the RIL in an own project with more Classes and now, there's a problem:

I've got a class KKsmsIn. doRIL, resultCallback, notifyCallback (KKsmsIn::doRil a.s.o.) are implemented as public (tried also private). Whenn I trie to compile the programm then line

RIL_Initialize(1, resultCallback, notifyCallback...

generates an error: Cannot vonvert parameter 2 from 'void (unsingned long...' to 'void (__cdecl *)(insigned long...'

I'd implemented the RIL.h and RIL.lib, If I mark the resultCallback the description is 'void __cdecl resultCallback(...'

Pse help, think it's a little sign or command which is missing,
but I work since 12 hours on this line and have no idea, how the solution could be :-(

Greetings from hannovre,
andreas

PS: And now I'm going to donate some money ;o)
-> is there a chance do donate without a creditcard? *hope*

aleho
8th January 2004, 05:32 PM
it is part of my code :

CRadio g_radio;

//////////////////////////////////////////////////////////////////////
// Callback functions
//////////////////////////////////////////////////////////////////////
void CALLBACK NotifyCallback(DWORD dwCode, const void *lpData, DWORD cbData, DWORD dwParam)
{
g_radio.OnNotifyCallback(dwCode, lpData, cbData, dwParam);
}

void CALLBACK ResultCallback(DWORD dwCode, HRESULT hrCmdID, const void *lpData, DWORD cbData, DWORD dwParam)
{
g_radio.OnResultCallback(dwCode, hrCmdID, lpData, cbData, dwParam);
}

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CRadio::CRadio()
{
dwParam = 0x55AA55AA;
dwNotificationClasses = 0xFF0000;
}

CRadio::~CRadio()
{

}

bool CRadio::InitializeRIL()
{
HRESULT result;
result = RIL_Initialize(1, ResultCallback, NotifyCallback, dwNotificationClasses, dwParam, &hRil);
return hRil!=NULL;
}


void CRadio::OnNotifyCallback(DWORD dwCode, const void *lpData, DWORD cbData, DWORD dwParam)
{
// ...
}

void CRadio::OnResultCallback(DWORD dwCode, HRESULT hrCmdID, const void *lpData, DWORD cbData, DWORD dwParam)
{
// ...
}

ballrock2
12th January 2004, 01:06 AM
It works! Many thanks :D

Greetings from hannovre and anymore good speed,
andreas :-)

itsme
12th January 2004, 01:17 AM
you can do without the global variable, if you pas 'this' for the dwParam in RIL_Initialize, and then cast the dwParam in notify and result back to CRadio*.