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.

Sending sensor report

Hi,

  My sensor is giving a 12 bytes of ASCii value. What should i do, if i want to send to router? Because i am using zcl_SendReportCmd, in that the attrid Data is only 8 byte i can store. Whether i need to change in zstack. If i do so. My program memory will get increase. Is their any alternate method to do so?

  • You can't send ASCII data by zcl_SendReportCmd. I would suggest you to use AF_DataRequet to send this proprietary message format.

  • Thank you very much Mr.Chen. I am having some doubts in this API.

    1)Here also buffer size is uint8, is is possible to send 12-17 bytes at a time

    2)Transid is Zero and what will be the Option, i need to give?

  • I can able send a AF_DataRequest in the End device, Even i am able to receive in ZC,  osal_msg_receive but i am not able get in AF_INCOMING_MSG_CMD. Is any thing i need to register?

  • I am getting in event AF_DATA_CONFIRM_CMD instead of AF_INCOMING_MSG_CMD in Coordinator. Is this correct.

  • No, you should receive AF_INCOMING_MSG_CMD.

  • But it fails to receive in AF_INCOMING_MSG_CMD.

    AF_DataRequest( &zclTemp_DstAddr, &zclTemp_epDesc,
    ZCL_CLUSTER_ID_MS_TEMPERATURE_MEASUREMENT,
    (byte)osal_strlen(zclTemp) + 1,
    (byte *)&zclTemp,
    &zcl_TransID,
    AF_DISCV_ROUTE, AF_DEFAULT_RADIUS );

    where

    zclTemp_epDesc.endPoint = 18;
    zclTemp_epDesc.task_id = &zclTemp_TaskID;
    zclTemp_epDesc.simpleDesc
    = (SimpleDescriptionFormat_t *)&zclTemp_SimpleDesc;
    zclTemp_epDesc.latencyReq = noLatencyReqs;

    and 

    zcl_TransID = 0

    Following things receving in ZC after sending this af_DataReq

    Event = 0xFD

    Cluster = 0x0B

    Did i done any mistake

  • Mr.Chen, Please can you help me to fix this issue, it's looking strange for me. Though it's simple API. Why it is receiving the event as 0xFD instead of 0x1A  

    And if i check with cluster id it is giving 0x0B instead of 0x0402

  • 1. Please use packet to have a check if your message is sent correctly.

    2. Since you use proprietary format, I would suggest you to use a proprietary cluster ID too.

  • Yes i have check a packet sniffer it is sending correctly and ZC also respoding, but the event and packet mismatch after receiving in ZC. Here my log i am sending the data every 5 sec. 5807.af.psd

  • I am sending the number as ASCII is 6 4 3 1 7 7 4 6 8 1 5.

    Senario 1:

    I have used generic App as coordinator, It is receiving in event  in AF_INCOMING_MSG_CMD, Data of ASCII as junk. In End device i used osal_memcpy(ascii_buffer, raw_buffer, 11). In the AF_DataRequest i am sending ascii_buffer.

    Senario 2:

    With Same as Coordinator. i am giving ascii_buffer = "Hello World" in the end device. It is Correctly printing hello world . Whether AF_DataRequest won't work more than a byte?

    Senario 3:

    With my Coordiantor  It is receiving in event  in AF_DATA_CONFIRM_CMD. Data of ASCII as junk. In End device i used osal_memcpy(ascii_buffer, raw_buffer, 11). In the AF_DataRequest i am sending ascii_buffer.

    Senario 4:

    With my Coordiantor. It is not receving any thing if i give i am giving ascii_buffer = "Hello World". But it is sending to dstaddress as 0x0000, if i see in packet sniffer.

    I tried to solve this by myself, but i fails to do so. Desperately i need help. I have posted my sniffer log in prev post. 

  • No Issue with my End device, It is sending Data if i use generic App as coordinator. But My Coordinator Doesn't receiving it. Should i do any registration in Coordinator to receive it. While  Comparing the code of generic App and my Coordinator, i didn't find any changes,only thing is i didn't Process AF_DATA_CONFIRM_CMD. 

  • why i can't able to receive a af_data in my coordinator i am using coordinator as sampleLight. Is any thing i need to do to get the Data. AF_INCOMING_MSG_CMD it self not receving. Please let me know. What are the things need to follow to get a AF_INCOMING_MSG_CMD??

  • why i can't able to receive a af_data in my coordinator i am using coordinator as sampleLight. Is any thing i need to do to get the Data. AF_INCOMING_MSG_CMD it self not receving. Please let me know. What are the things need to follow to get a AF_INCOMING_MSG_CMD??

       I have set a break point  "if ( *msgPtr == AF_INCOMING_MSG_CMD )" in the zcl.c, it's hitting the break point, Then why i can't able to get in my application.

  • Mr.Chen can you reply the prev post

  • As you can see, the AF_INCOMING_MSG_CMD is processed in zcl_event_loop and the bit flag of SYS_EVENT_MSG on event is removed in the end of zcl_event_loop. This is why you can't receive AF_INCOMING_MSG_CMD in zclSampleLight_event_loop. You can try to add a return in the "if ( *msgPtr == AF_INCOMING_MSG_CMD )" as the followings:

    if ( *msgPtr == AF_INCOMING_MSG_CMD )
    {
    rawAFMsg = (afIncomingMSGPacket_t *)msgPtr;
    zclProcessMessageMSG( rawAFMsg );
    rawAFMsg = NULL;

    return event;
    }

    In this way, you should receive AF_INCOMING_MSG_CMD in zclSampleLight_event_loop.

  • If i  add return events, after receiving af_data my coordinator restarts. 

  • Mr.Chen, i know i am disturbing you again. Really i need help of expert. What will the issue. I request to help me to fix this issue

  • I have no idea why your coordinator restarts. Or, you can try to process your proprietary AF_INCOMING_MSG_CMD in the "if…" statement directly.

    if ( *msgPtr == AF_INCOMING_MSG_CMD )
    {
    rawAFMsg = (afIncomingMSGPacket_t *)msgPtr;

    App_MessageMSGCB(rawAFMsg); //Process your proprietary AF_INCOMING_MSG_CMD here.
    zclProcessMessageMSG( rawAFMsg );
    rawAFMsg = NULL;

    //Not return here this time

    }

  • Thanks Chen, i have called my app function there only. But i don't to be there, i need it in my application. Because if i try use with same file then it will show linking error.

  • Why would you have a linking error? You can extern your App_MessageMSGCB in zcl.c and all done.