i use this function to dial number on treo 650

static Boolean cccDialNumber(char *number, char *extra, Boolean autoExtra)
{
    PhoneAppLaunchCmdExtendedDialType *phonedial;
    PhoneAppLaunchCmdDialType *phonedialsimple;
    Err err;
    UInt32 creator;
    UInt16 card;
    LocalID id;
    DmSearchStateType sstate;
    Boolean ok;

    ok=false;

    //we must find phone application
    creator=hsFileCPhone2;

err=DmGetNextDatabaseByTypeCreator(true,&sstate,'appl',hsFileCPhone2,true,&card,&id);
    if(err==dmErrCantFind)
    {
        //v2 version not found so lets look for v1
        creator=hsFileCPhone;

err=DmGetNextDatabaseByTypeCreator(true,&sstate,'appl',hsFileCPhone,true,&card,&id);
    }
                
    if(!err)
    {
        //we will launch application with special launch code
        //so we must prepare data for this launchcode
        if(extra && extra[0])
        {
        phonedial=(PhoneAppLaunchCmdExtendedDialType
*)MemPtrNew(sizeof(PhoneAppLaunchCmdExtendedDialType));
        if(phonedial)
        {
                        
MemSet(phonedial,sizeof(PhoneAppLaunchCmdExtendedDialType),0);

                        phonedial->version=1;
                        phonedial->confirm=false;

                        phonedial->number=(char *)MemPtrNew(StrLen(number)+1);
                        StrCopy(phonedial->number,number);
                        MemPtrSetOwner(phonedial->number,0);
                        
                        phonedial->extraDigits=(char 
*)MemPtrNew(StrLen(extra)+1);
                        StrCopy(phonedial->extraDigits,extra);
                        MemPtrSetOwner(phonedial->extraDigits,0);
                        
                        phonedial->autoExtraDigits=autoExtra;

                        MemPtrSetOwner(phonedial,0);
                        
                        //everything is ready, so actually its time to call 
phone and finish it
                        
err=SysUIAppSwitch(card,id,phoneAppLaunchCmdExtendedDial,phonedial);
                        if(!err)
                            ok=true;
            }   
        }
        else
        {
            phonedialsimple=(PhoneAppLaunchCmdDialType
*)MemPtrNew(sizeof(PhoneAppLaunchCmdDialType));
            if(phonedialsimple)
            {
                MemSet(phonedialsimple,sizeof(PhoneAppLaunchCmdDialType),0);
                phonedialsimple->version=1;
                phonedialsimple->confirm=false;
                phonedialsimple->number=(char *)MemPtrNew(StrLen(number)+1);
                StrCopy(phonedialsimple->number,number);
                MemPtrSetOwner(phonedialsimple->number,0);
                MemPtrSetOwner(phonedialsimple,0);
                //everything is ready, so actually its time to call phone and 
finish it
                
err=SysUIAppSwitch(card,id,phoneAppLaunchCmdDial,phonedialsimple);
                if(!err)
                    ok=true;
            }   
        }
    }   
    return(ok);
}

if no extra digits are set dialing uses phoneAppLaunchCmdDial and it works

if extra digits are set it should use phoneAppLaunchCmdExtendedDial.
sysuiappswitch is succesfull but instead of dialing number it immediately
returns to my application

in header file there is note to phoneAppLaunchCmdExtendedDial that
/** Extension to phoneAppLaunchCmdDial. It has autoExtra digits field
    This is ARM only launch code, meaning if you are calling from a 68k code
    needs to deal with endianess and byte swapping*/

so i started to experiment with byteswapping
- if i byteswap all pointers including pointer to structure i get crash
  memorymgr.c, Line:3844, ptr is handle

- if i byteswap only pointers inside of structure then it behaves the same, it
returns immediately to my application

- if i byteswap everything - pointers inside, adress of structure and launchcode
 then my application closes and treo resets. simulator crashes without any
message, only windows say that it happened in emul68k.dll. in fact it seems that
this result i get everytime when launchcode is byteswapped and rest doesn't 
matter


so i think i run out of possibilities. any idea what may go wrong? i am
developing application for someone whoe really wants this feature :-(

memorymgr.c, Line:3844, ptr is handle


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

Reply via email to