Hi all.
I'm developin an app where I find and select BT devices to which I later
send files using Exchange Manager's APIs. However after calling ExgMgr my
app is not able to return to the launcher, it gets stuck after calling
FrmCloseAllForms()
My guess is that I'm leaving something in memory to be freed and is causing
me that problem altough I can't see what's the problem
I call the exchange manager trough a function after pressing a button send
in the mainform. I'm placing here the code which is causing the problem in
order to see if anyone understands what I don't. Thx in advance for any
help. Do not pay attention to the quality of the code :)
Ricardo
In MainFormHandleEvent :
case MainSendButton:
if (DeviceSelec && FileSelec && validDevice){
SendFile();
MemPtrFree(sendName);
MemPtrFree(dBName);
sendName=NULL;
dBName = NULL;
}
else if (!DeviceSelec || !validDevice) {
MyPrintF(gResultsForm, gResultsField,"\nPlease Select a Device");
}
else if (!FileSelec) {
MyPrintF(gResultsForm, gResultsField,"\nPlease Select a File");
}
handled = true;
break;
static void SendFile(){
Err err;
//ExgSocketType exgSocket;
UInt32 sendNameSize=0;
UInt32 btFullURLSize;
btFullURLSize =
sizeof(StrCat(mySendScheme,"/xx:xx:xx:xx:xx:xx/"));//defines the maximum
size of the URL used for sending, excluding the filename
MemSet(&exgSocket,sizeof(exgSocket),0);
sendNameSize = sizeof(dBName);
sendName = (Char *) MemPtrNew(btFullURLSize+sendNameSize);//allocates the
memory necessary to indicate the the sending scheme, device to send to and
filename
ConvertBdAddrToStr(&gBdAddr[gSelectedBdAddr],gBtLibRefNum, gBdAddrStr);
StrCopy(sendName,mySendScheme);
StrCat(sendName,"/");
StrCat(sendName,(Char *)gBdAddrStr);
StrCat(sendName,"/");
StrCat (sendName,dBName);
exgSocket.name = sendName;
//FrmCustomAlert(Debug,"sendName -> ",sendName,"");
err = ExgPut(&exgSocket);
if (err == 0){
err = ExgDBWrite(WriteProc, &exgSocket, NULL, dBIDNo, dBCardNo);
ExgDisconnect(&exgSocket,err);
}
else FrmCustomAlert(Debug,"erro ",ConvertBtErrToString(err),"");
}�
static Err AppStop(void)
{
UInt16 i;
// Deallocate globals
for (i = 0; i < gDiscoveredBdAddr; i++) {
if (BDevs[i].friendlyName) {
MemPtrFree(BDevs[i].friendlyName);
}
}
if (BDevs) {
MemPtrFree(BDevs);
BDevs = NULL;
gDiscoveredBdAddr = 0;
}
CloseBT();
FrmCloseAllForms();
return errNone;
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/