The receive event will only be run once it has received the type of message it is listening for, and that type is specified in the application configuration file.
So in your Configuration file you would have:
components ApplicationNameP as App, ActiveMessageC;
components new AMSenderC(HELLOMSG) as HELLOMsgSender;
components new AMSenderC(VIOSINMSG) as VIOSINMsgSender;
App.RadioSendHello -> HELLOMsgSender;
App.RadioReceiveHello -> ActiveMessageC.Receive[HELLOMSG];
App.RadioSendViosin -> VIOSINMsgSender;
App.RadioReceiveViosin -> ActiveMessageC.Receive[VIOSINMSG];
In your header you would have:
enum
{
HELLOMSG = 1,
VIOSINMSG = 2,
} ;
and in you application file you would have:
uses interface AMSend as RadioSendHello;
uses interface Receive as RadioReceiveHello;
uses interface AMSend as RadioSendViosin;
uses interface Receive as RadioReceiveViosin;
you can then use the relevant event handlers to process the packets as they come in.