Contributor
28Mar2006,14:01   #11
sharmila's Avatar
Thanks for telling me my mistake.but the problem remains like that.

ptrFunc = sendNotifier;

ITAPI_SendSMS (pMe->pITapi, "1234567890", "Hello World",0,ptrFunc,retVal );
DBGPRINTF("aaaa----%s",(char*)retVal);

Inside sendNotifier
Code: cpp
static void sendNotifier(void* user,int status)
{
    DBGPRINTF("inside function sendNotifier--%d",status);
                switch(status)
    {
        case AEEMOSMS_ERR_NO_ERR:
            STRCPY((char*)user,"Message send sucessesfully");
            break;
           
        case AEEMOSMS_ERR_OUTOF_RESOURCES:
            STRCPY((char*)user,"Device is temporarily out of resources.");
            break;
           
        case AEEMOSMS_ERR_NETWORK_NOT_READY:
            STRCPY((char*)user,"Network is not reachable or ready for device to communicate.");
            break;
           
        case AEEMOSMS_ERR_TRANSPORT_TEMP:
            STRCPY((char*)user,"Network temporarily refused message. Application may retry.");
            break;
           
        case AEEMOSMS_ERR_TRANSPORT_PERM:
            STRCPY((char*)user,"Network rejected the message.");
            break;
           
        case AEEMOSMS_ERR_INTERNAL:
            STRCPY((char*)user,"An internal error occured.");
            break;
           
        default:
            STRCPY((char*)user,"Unknown ERROR");
    }
   
    DBGPRINTF("end of fun.--%s",(char*)user);
}
This is the code.When I am executing this one
first DBGPRINTF("aaaa----%s",(char*)retVal); is executing and then
DBGPRINTF("end of fun.--%s",(char*)user); is executing and so I am not getting any data into retVal.what should i do.
Team Leader
28Mar2006,14:52   #12
coderzone's Avatar
This is probably because ITAPI_SendSMS function calls the procedure and does not wait until the procedure has processed the message. It returns immediately.
Contributor
28Mar2006,15:35   #13
sharmila's Avatar
ok.Thank you.
In general, how can we write a code like that.
Team Leader
29Mar2006,12:36   #14
coderzone's Avatar
Quote:
Originally Posted by sharmila
ok.Thank you.
In general, how can we write a code like that.
What type of code.
Contributor
29Mar2006,12:47   #15
sharmila's Avatar
Quote:
Originally Posted by coderzone
This is probably because ITAPI_SendSMS function calls the procedure and does not wait until the procedure has processed the message. It returns immediately.
How is it possible.Is there any extra code for that.
Team Leader
29Mar2006,20:14   #16
coderzone's Avatar
Quote:
Originally Posted by sharmila
How is it possible.Is there any extra code for that.
Probably some other API. Something like SendMessage and PostMessage API's
Contributor
31Mar2006,12:57   #17
sharmila's Avatar
Hi,
I am not asking about API's.In C as far as I know when a function is calling another function,after executing the called function only the remaining part of calling will execute.How can it execute without wainting for the called one.
Code: C
void fun2();
main()
{
       printf("aaa");
       fun2();
       printf("bbb");
}
void fun2()
{
    printf("fff");
}
o/p:aaafffbbb
i.e after executing fun2() the remaining part of fun1() is executing.It is waiting till fun() completes.But ITAPI_SendSMS is not waiting.
So, for the above prog. if we want o/p like aaabbbfff what we have to do?
Go4Expert Founder
31Mar2006,14:13   #18
shabbir's Avatar
This is not a simple function call. Its a Message passing and as coderzone said messgae can be sent via 2 methods. One which waits for the message to end and other returns immediately.
Contributor
31Mar2006,14:34   #19
sharmila's Avatar
Hi,
Thank you.i.e first I have to study about inter-process communication.I think then I will came to know how is it happening.Thank you coderzone for your great help.Thank you shabbir.
Team Leader
31Mar2006,22:08   #20
coderzone's Avatar
Its my pleasure.