Hai,
i am using Thermoostat application, I need to create a task event loop in Zstack application , i tried to add a task, but Pf handler in the OSAL_THEMOSTATSAMPLE file, i have added event loop function and a task init , but handler is not calling task event loop function. Below con tains my code please assist me if i am wrong.
void osalInitTasks( void )
{
uint8 taskID = 0;
tasksEvents = (uint16 *)osal_mem_alloc( sizeof( uint16 ) * tasksCnt);
osal_memset( tasksEvents, 0, (sizeof( uint16 ) * tasksCnt));
macTaskInit( taskID++ );
nwk_init( taskID++ );
Hal_Init( taskID++ );
#if defined( MT_TASK )
MT_TaskInit( taskID++ );
#endif
//Uart_Hal_Init();
APS_Init( taskID++ );
#if defined ( ZIGBEE_FRAGMENTATION )
APSF_Init( taskID++ );
#endif
ZDApp_Init( taskID++ );
#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
ZDNwkMgr_Init( taskID++ );
#endif
zcl_Init( taskID++ );
zclSampleThermostat_Init( taskID++ );
GWIF_INIT( taskID ); // my event loop task .
}
// The order in this table must be identical to the task initialization calls below in osalInitTask.
const pTaskEventHandlerFn tasksArr[] = {
macEventLoop,
nwk_event_loop,
Hal_ProcessEvent,
#if defined( MT_TASK )
MT_ProcessEvent,
#endif
APS_event_loop,
#if defined ( ZIGBEE_FRAGMENTATION )
APSF_ProcessEvent,
#endif
ZDApp_event_loop,
#if defined ( ZIGBEE_FREQ_AGILITY ) || defined ( ZIGBEE_PANID_CONFLICT )
ZDNwkMgr_event_loop,
#endif
zcl_event_loop,
zclSampleThermostat_event_loop,
GWIF_zcTask // my event loop task .
};
UINT16 GWIF_zcTask (byte u8task_id, UINT16 u16events)
{
uint32 u32Status;
UINT8 *pu8Packet;
UINT32 u32PacketLength;
UINT8 u8CmdID;
UINT8 u8ResponseStatus;
s32Status = SUCCESS;
u8ResponseStatus = 0;
u8CmdID = 0;
while (1)
{
s32Status = zcCmdRspReceive(&pu8Packet,&u32PacketLength);
if (SUCCESS (s32Status))
{
u8CmdID = pu8Packet [0];
}
switch ( u8CmdID )
{
case HANDSHAKE_CMD_ID:
{
zcHandshakeCmdRspHandler( u8ResponseStatus );
break;
}
case SENSOR_CMD_ID:
{
zcSensorReportCmdRspHandler ( pu8Packet, u32PacketLength);
break;
}
}
}
return s32Status;
}
my task is to read the pack from uart.