Hi,

I'm trying to call a remote module. The module is called correctly, but the parameter is not being sent back.

Here's the conduit code:

                  char sParam[4];
                  char sRes[4];// = (char*)VM_CALL(xmalloc)(8);
                  CCallModuleParams Params;
                  int32 lDummy;
                  xmemzero(&Params, sizeof(Params));
                  xstrcpy(sParam, "OOO");
                  xstrcpy(sRes, "www");
                  Params.m_dwCreatorID = 'SWhv';
                  Params.m_dwTypeID = 'appl';
                  Params.m_wActionCode = 1;   //just a test
                  Params.m_dwParamSize = 4;
                  Params.m_pParam = sParam;
                  Params.m_dwResultBufSize =  4;
                  Params.m_pResultBuf= sRes;
                  SyncCallDeviceApplication(0);
                  lDummy = SyncCallRemoteModule(&Params);
                  alert("Result Ret %d - ´%s´",(int)lDummy, 
sRes);//Params.m_pParam);//

And here's the code of the Palm:

static UInt32 handleConduitCommands(MemPtr cmdPBP, UInt16 launchFlags)
{
       SysAppLaunchCmdHandleSyncCallAppType *theCommandPtr;
    DlkCallAppReplyParamType theReplyParams;
    CharPtr theReplyBuffer = "SUC";

    // Cast the cmdPBP to a SysAppLaunchCmdHandleSyncCallAppType
    // pointer so that we can work with it.
    theCommandPtr = (SysAppLaunchCmdHandleSyncCallAppType*)cmdPBP;

    // Do whatever work is necessary here.  If you set the m_wActionCode
    // field in your CCallModuleParams class on the desktop, then you
    // can handle that code by looking at the action field of theCommandPtr
    // (i.e.)  if (theCommandPtr->action == 1)

    // Create the reply to send back to the desktop

    // First clear out all the fields.  This is necessary so that the reserved
    // fields are set to NULL.
    MemSet( &theReplyParams, sizeof(DlkCallAppReplyParamType), 0 );

    // Set the size of the reply.  This is required.
    theReplyParams.pbSize = sizeof(DlkCallAppReplyParamType);

    // Set the result code.  Normally this will be set to zero unless you want
    // to send an error code back to the desktop.
    theReplyParams.dwResultCode = 0;

    // Fill in the reply buffer and buffer length
    theReplyParams.resultP = theReplyBuffer;
    theReplyParams.dwResultSize = StrLen(theReplyBuffer) + 1;

    // Fill in the DL reference pointer.  This is required.
    theReplyParams.dlRefP = theCommandPtr->dlRefP;

    // Set the handled field to true.  This is required to let the desktop
    // know that the sysAppLaunchCmdHandleSyncCallApp was handled.  If you
    // don't set this to true, the call to SyncCallRemoteModule will return
    // SYNCERR_UNKNOWN_REQUEST.
    theCommandPtr->handled = true;

    // Finally, set the replyErr field by passing the reply parameters to
    // DlkControl.  This is required for the DLServer to properly handle the
    // reply request.
    theCommandPtr->replyErr = DlkControl 
(dlkCtlSendCallAppReply,&theReplyParams, NULL);
   tone(1000,1000);
   return 0;
}

DWord PilotMain(UInt16 launchCode, MemPtr cmdline, Word launchFlags)
{

   debug("bbb\n ");
   if (launchCode == sysAppLaunchCmdHandleSyncCallApp)
       return handleConduitCommands(cmdline, launchFlags);
   return 0;
}

I'm sure that the module is called because i issue a tone, but the module is not receiving properly the action code (theCommandPtr->action is not 1) and the caller is receiving nothing, it prints (in win32):

Result Ret 0 - ''

I'm testing on a winxp machine with CDK 6.0.1 and a Zire 22.

Please help

Regards

    guich

--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to