Hi @TonyRivera0514 ,
The source of measurement can be easily done through the APS layer using the source address information of the incoming APS message.
Actually when the reporting is done, the client (ZC) can catch the APSDE-DATA structure that contains informations including the src address using the callback defined at the initialization as follow :
/**
* @brief report
* @param cluster,dataind,attribute,datatype,datapayload,datalength
* @retval None
*/
static void APP_ZIGBEE_Temp_meas_client_report(struct ZbZclClusterT *clusterPtr,
struct ZbApsdeDataIndT *dataIndPtr,
uint16_t attributeId,
enum ZclDataTypeT dataType,
const uint8_t *in_payload,
uint16_t in_len)
{
int attrLen;
uint16_t attr_val;
int16_t temp_cur;
float temp_val;
char text[32];
aPwmLedGsData_TypeDef aPwmLedGsData;
attrLen = ZbZclAttrParseLength(dataType, in_payload, dataIndPtr->asduLength, 0);
if (attrLen < 0)
{
APP_DBG("[TEMP MEAS] Report error length 0");
APP_ZIgbee_Error_Cnt++;
APP_Zigbee_Display_ErrorCnt();
return;
}
if (attrLen > (int)in_len)
{
APP_DBG("[TEMP MEAS] Report error length >");
APP_ZIgbee_Error_Cnt++;
APP_Zigbee_Display_ErrorCnt();
return;
}
if (dataIndPtr->src.endpoint!= SW1_ENDPOINT)
{
APP_DBG("[TEMP MEAS] Report error wrong endpoint");
APP_ZIgbee_Error_Cnt++;
APP_Zigbee_Display_ErrorCnt();
return;
}
switch(attributeId)
{
case ZCL_TEMP_MEAS_ATTR_MEAS_VAL:
attr_val= pletoh16(in_payload);
temp_cur = (int16_t)attr_val;
APP_DBG("[From 0x%016llx] - [TEMP MEAS] %d C",dataIndPtr->src.extAddr,temp_cur/100);
temp_val = (float) temp_cur/100;
sprintf(text,"Rep.Rem T:%.1f C",temp_val);
UTIL_LCD_ClearStringLine(3);
UTIL_LCD_DisplayStringAt(0, LINE(3), (uint8_t *)text, CENTER_MODE);
BSP_LCD_Refresh(0);
aPwmLedGsData[PWM_LED_RED] = PWM_LED_GSDATA_OFF;
aPwmLedGsData[PWM_LED_GREEN] = PWM_LED_GSDATA_OFF;
aPwmLedGsData[PWM_LED_BLUE] = PWM_LED_GSDATA_7_0;
LED_Toggle(aPwmLedGsData);
break;
default:
APP_DBG("[From 0x%016llx] - Reported another attribute 0x%04X",dataIndPtr->src.extAddr,attributeId);
APP_DBG("");
break;
}
} /* APP_ZIGBEE_temp_meas_client_report */
Best regards,
Ouadi