This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Maximum number of OSAL Application Events

Other Parts Discussed in Thread: Z-STACK

Hi,

Can anyone confirm that it is possible to have only 8 bit weighted application OSAL events due to uint8 event?

From OSAL.h

typedef struct
{
uint8 event;
uint8 status;
} osal_event_hdr_t;

I have nearly used up 8 events and will have to resort to passing parameters to a generic method if this is the case. Seems odd given that the example code lists the bit weighted definitions as hex 16-bit, for example:

// Application Events
#define SAMPLETHERMOSTAT_IDENTIFY_TIMEOUT_EVT     	  0x0001
#define SAMPLETHERMOSTAT_POLL_CONTROL_TIMEOUT_EVT     0x0002
#define SAMPLETHERMOSTAT_EZMODE_TIMEOUT_EVT           0x0004
#define SAMPLETHERMOSTAT_EZMODE_NEXTSTATE_EVT         0x0008
#define SAMPLETHERMOSTAT_MAIN_SCREEN_EVT              0x0010

Using Home 1.2.1

Thanks,

Andy

  • You should can use 16 events.
  • Hi Yikai,

    Ah ha, that's great news, but how does this work with unit8? I am going to try a 16-bit event and will verify your answer shortly as I am sure you are right- I just don't understand how. (Is my OSAL.h an old version may be left over before I upgraded?)

    Andy
  • The system event use uint16 tasksEvents not osal_event_hdr_t.
  • Hi,

    I am a bit confused.

    Here is what I have working currently (this is copied from the way the coordinator.c examples work):

    1) As per normal TI examples, in [Coordinator.c] ProcessEvent() I receive a message packet: afIncomingMSGPacket_t *MSGpkt;

    2) Then 

    switch ( MSGpkt->hdr.event )
    {
    case AF_INCOMING_MSG_CMD:

    3) then I call 

    MessageMSGCB( MSGpkt );

    4) This function then switches based on the clusterId:

      switch ( inMsg->clusterId )
      {

    all normal stuff so far...

    5) I then use osal_msg_send() to send another OSAL application the message and an event. To do this I have created a struct which holds an OSAL event header, and a pointer to the incoming message:

    typedef struct _tag_my_osal_msg
    {
      	osal_event_hdr_t 		hdr;
    	afIncomingMSGPacket_t		*msg_ptr;
    
    } my_osal_msg;

    6) The other OSAL application then processes the message under the correct event in the same way Coordinator.c examples do. But the event is only uint8 for osal_event_hdr_t.

    So going from your previous answer, I should be sending the OSAL event in a different way. The only other way would be to not use osal_event_hdr_t. and for my other application events to be the same as:

    if ( events & SYS_EVENT_MSG )

    but this deviates from the way the coordinator.c examples work. 

    My understanding was that SYS_EVENT_MSG separate system messages, messages from another application or lower level, from those local osal_start_timerEx() events.

    It would be a great help to clear this up for me.

    Regards,

    Andy

  • osal_event_hdr_t is for Global System Messages, e.g. ZDO_XX, AF_XXX, and ZCL_XXX. If you want to create an application event, you should use uint16 bit flag.
  • You can also refer to Z-Stack Home Developer's Guide.pdf for some information.