EO3000I_API  2.6.1.0
 All Data Structures Functions Variables Enumerations Enumerator Groups Pages
Message management functions
Collaboration diagram for Message management functions:

Functions

RETURN_TYPE msg_send (MESSAGE_TYPE *pMessage, TEL_PARAM_TYPE *pParam)
RETURN_TYPE msg_receive (MESSAGE_TYPE *pMessage, TEL_PARAM_TYPE *pParam, TEL_RADIO_TYPE *rTel, TEL_PARAM_TYPE *pTel)
RETURN_TYPE msg_setParams (MESSAGE_PARAM *pParam)

Detailed Description

The message module allows to send longer radio message by using telegram chaining functionality.


Function Documentation

RETURN_TYPE msg_send ( MESSAGE_TYPE pMessage,
TEL_PARAM_TYPE pParam 
)

Sends a message via radio.

Parameters:
[in]pMessagePointer to the message to be sent
[in]pParamMessage transmission parameters
Returns:
OK The message has been sent correctly
OUT_OF_RANGE The message data length exceeds the maximal specified value (512 bytes)
Note:
This function is BLOCKING. It waits till all radio telegrams are placed in the radio buffers. To define the delay between radio telegrams use the msg_setParams() function.
Messages are splitted by the function into several telegrams - the telegram chaining functionality is applied as explain in Telegram chaining and messages. Telegrams are also sent by this function.

Example:

uint8 u8Buffer[128];
TEL_PARAM_TYPE pParam = { 0xFF, BROADCAST_ID };
MESSAGE_TYPE pMessage;
pMessage.u8Data = u8Buffer;
pMessage.u16MaxLength = sizeof(u8Buffer);
pMessage.u16Length = 10;
pMessage.u8Data[0] = ...;
u8Ret = msg_send(&pMessage, &pParam);
RETURN_TYPE msg_receive ( MESSAGE_TYPE pMessage,
TEL_PARAM_TYPE pParam,
TEL_RADIO_TYPE rTel,
TEL_PARAM_TYPE pTel 
)

Converts received chained radio telegrams to messages.

Parameters:
[out]pMessagePointer to the message created by the function
[out]pParamReceived telegrams parameters
[in]rTelReceived telegram structure
[in]pTelReceived telegram parameters
Returns:
OK Complete message has been received
NO_RX_TEL The incoming rTel was processed but the chained message is still not complete. Waiting for more telegrams.
NOT_VALID_TEL The incoming rTel was not processed.
OUT_OF_RANGE The message length exceeded the pMessage.u16MaxLength
Note:
Chained radio telegrams with RADIO_CHOICE_CDM or RADIO_CHOICE_SEC_TI choice are joined in a single message by this function.
To work correctly the function msg_receive() has to be called everytime that a radio telegram is received by the radio_getTelegram function.
pParam.p_rx.u32Dbm stores the value of the telegram with highest signal strength.
If a telegram belonging to the message arrives out of the time-out indicated in msg_setParams it will be discarded for the message and consider to belong to a new message. The function does not return a time-out value.

Example:

uint8 u8PacketBuffer[128];
uint8 u8MsgBuffer[128];
pPacket.u8DataBuffer = u8PacketBuffer;
msge.u8Data = u8MsgBuffer;
msge.u16MaxLength = sizeof(u8MsgBuffer);
mainInit();
while(1)
{
CLR_WDT();
memset(&rTel, 0x00, sizeof(rTel));
if ((radio_getTelegram(&rTel, &pTel) == OK) &&
(msg_receive(&msge, &pTel, &rTel, &pTel) == OK))
{
memcpy(&u8PacketBuffer[0], &msge.u8Choice, 1);
memcpy(&u8PacketBuffer[1], msge.u8Data, msge.u16Length);
memcpy(&u8PacketBuffer[1+msge.u16Length], &msge.u32SourceId, 4);
u8PacketBuffer[1+msge.u16Length+4] = 0x00; //Status
memcpy(&u8PacketBuffer[1+msge.u16Length+4+1], &pTel, sizeof(TEL_PARAM_TYPE) );
pPacket.u16DataLength = msge.u16Length + 6;
pPacket.u8OptionLength = sizeof(TEL_PARAM_TYPE);
pPacket.u8Type = PACKET_RADIO;
while (uart_sendPacket(&pPacket) != OK);
}
}
See also:
radio_getTelegram, msg_send
RETURN_TYPE msg_setParams ( MESSAGE_PARAM pParam)

Configure message module parameters.

Parameters:
[in]pParamPointer to the message-module parameters to set. See MESSAGE_PARAM
Returns:
OK Parameters set
Note:
The time-out for the reception of a complete message (function msg_receive) and the pause between telegrams when sending a message (function msg_send() are set with the help of this function.