0
sharmila's Avatar, Join Date: Mar 2006
Contributor
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.
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
This is probably because ITAPI_SendSMS function calls the procedure and does not wait until the procedure has processed the message. It returns immediately.
0
sharmila's Avatar, Join Date: Mar 2006
Contributor
ok.Thank you.
In general, how can we write a code like that.
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
Quote:
Originally Posted by sharmila
ok.Thank you.
In general, how can we write a code like that.
What type of code.
0
sharmila's Avatar, Join Date: Mar 2006
Contributor
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.
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
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
0
sharmila's Avatar, Join Date: Mar 2006
Contributor
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?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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.
0
sharmila's Avatar, Join Date: Mar 2006
Contributor
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.
0
coderzone's Avatar, Join Date: Jul 2004
Team Leader
Its my pleasure.