Thanks a lot, davidashraf. for pointing in the right direction. I am a newbie in ZigBee development please bear with me.
I am sending some data string "Hellow Zigbee!" from a coordinator as a broadcast on cluster id 0x0008 as below.
uint8 u8TransactionSequenceNumber;
ZPS_tsNwkNib *thisNib;
thisNib = ZPS_psNwkNibGetHandle(ZPS_pvAplZdoGetNwkHandle());
PDUM_thAPduInstance hAPduInst;
hAPduInst = PDUM_hAPduAllocateAPduInstance(apduZDP);
uint16 u16Offset = 0;
uint16 i;
u16Offset = 0;
uint8 buffer[] = "Hello Zigbee!";
for (i = 0;i< strlen(buffer);i++) {
u16Offset += PDUM_u16APduInstanceWriteNBO(hAPduInst, u16Offset,"b", buffer[i]);
DBG_vPrintf(TRUE,"%c", buffer[i]);
}
PDUM_eAPduInstanceSetPayloadSize(hAPduInst, u16Offset);
DBG_vPrintf(TRUE,"\nSize : %d\nSending : \n",PDUM_u16APduInstanceGetPayloadSize(hAPduInst));
if (hAPduInst == PDUM_INVALID_HANDLE){
DBG_vPrintf(TRUE,"PDUM_INVALID_HANDLE\n");
}
else {
DBG_vPrintf(TRUE,"PDUM_VALID_HANDLE\n");
ZPS_teStatus eStatus;
ZPS_teAplAfSecurityMode eSecurityMode = (ZPS_E_APL_AF_SECURE_NWK);
eStatus = ZPS_eAplAfBroadcastDataReq(hAPduInst,
0x0008,
0x01,
0x0B,
ZPS_E_BROADCAST_ALL,
eSecurityMode,
0,
&u8TransactionSequenceNumber
);
if(eStatus != ZPS_E_SUCCESS){
PDUM_eAPduFreeAPduInstance(hAPduInst);
}
}
I plan to receive this broadcast message on the other ZigBee device which is a Dimmable Light 0x0008 that is developed using the source code example of Dimmable Light in the HA demo (JN-AN-1189-ZigBee-HA-Demo).
I am trying to catch these messages in there but I am unable to even get an indication of a broadcast message there. I couldn't find any example or help else where. Can you please help me out with the code snippet or any instructions to achieve my goal.
If I am correct I need to catch the incoming broadcast messages in the function below. That means that when a Broadcast message is sent it should print the Debug messages and pass the event to sCallbackEvent.
OS_TASK(ZCL_Task)
{
ZPS_tsAfEvent sStackEvent;
tsZCL_CallBackEvent sCallBackEvent;
sCallBackEvent.pZPSevent = &sStackEvent;
DBG_vPrintf(TRACE_ZCL, "\nZCL_Task event11:%d",sStackEvent.eType);
sStackEvent.eType = ZPS_EVENT_NONE;
if ( OS_eCollectMessage(APP_msgZpsEvents_ZCL, &sStackEvent) == OS_E_OK)
{
DBG_vPrintf(TRACE_ZCL, "\nZCL_Task hh event:%d",sStackEvent.eType);
sCallBackEvent.eEventType = E_ZCL_CBET_ZIGBEE_EVENT;
vZCL_EventHandler(&sCallBackEvent);
}
}
and then I can get it in the following function
PRIVATE void APP_ZCL_cbGeneralCallback(tsZCL_CallBackEvent *psEvent)
{
switch (psEvent->eEventType)
{
case E_ZCL_CBET_UNHANDLED_EVENT:
DBG_vPrintf(TRACE_ZCL, "\nEVT: Unhandled Event\r\n");
break;
case E_ZCL_CBET_READ_ATTRIBUTES_RESPONSE:
DBG_vPrintf(TRACE_ZCL, "\nEVT: Read attributes response");
break;
case E_ZCL_CBET_READ_REQUEST:
DBG_vPrintf(TRACE_ZCL, "\nEVT: Read request");
break;
case E_ZCL_CBET_DEFAULT_RESPONSE:
DBG_vPrintf(TRACE_ZCL, "\nEVT: Default response");
break;
case E_ZCL_CBET_ERROR:
DBG_vPrintf(TRACE_ZCL, "\nEVT: Error");
break;
case E_ZCL_CBET_TIMER:
DBG_vPrintf(TRACE_ZCL, "\nEVT: Timer");
break;
case E_ZCL_CBET_ZIGBEE_EVENT:
DBG_vPrintf(TRACE_ZCL, "\nEVT: ZigBee");
break;
case E_ZCL_CBET_CLUSTER_CUSTOM:
DBG_vPrintf(TRACE_ZCL, "\nEP EVT: Custom");
break;
default:
DBG_vPrintf(TRACE_ZCL, "\nInvalid event type");
break;
}
}
I would be really thankful for help and support in this regard.