<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Classic/Legacy CodeWarriorのトピックRe: Problems while passing a pointer</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165741#M3040</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Mmm, it seems to be a debugger bug. If I print these values with LCD display they are correct. I'll submit a service request.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 21 Nov 2007 21:25:54 GMT</pubDate>
    <dc:creator>CecchiSandrone</dc:creator>
    <dc:date>2007-11-21T21:25:54Z</dc:date>
    <item>
      <title>Problems while passing a pointer</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165738#M3037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm writing a simple app that upon receiving a packet from a zigbee device, sends a response packet containing a value (Link Quality Indicator from incoming data indication, a uint8_t). Here it is the code taken from BeeApp.c:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;void BeeAppDataIndication
&amp;nbsp; (
&amp;nbsp; void
&amp;nbsp; )
{
&amp;nbsp; apsdeToAfMessage_t *pMsg;
&amp;nbsp; zbApsdeDataIndication_t *pIndication;
 
&amp;nbsp; while(MSG_Pending(&amp;amp;gAppDataIndicationQueue))
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Get a message from a queue */
&amp;nbsp;&amp;nbsp;&amp;nbsp; pMsg = MSG_DeQueue( &amp;amp;gAppDataIndicationQueue );

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* ask ZCL to handle the frame */
&amp;nbsp;&amp;nbsp;&amp;nbsp; pIndication = &amp;amp;(pMsg-&amp;gt;msgData.dataIndication);

&amp;nbsp;&amp;nbsp;&amp;nbsp; /*
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Note: if multiple endpoints are supported by this app, insert
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; endpoint filtering here...

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This app assumes only 1 active endpoint. APS layer has already
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; filtered by endpoint and profile.

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Note: all multi-byte over-the-air fields are little endian.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; That is 0x1101 would come in byte order 0x01 0x11.
&amp;nbsp;&amp;nbsp;&amp;nbsp; */

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* handle the command */
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(pIndication-&amp;gt;aClusterId[0] == appDataCluster[0]) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SendLQI(pIndication);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Free memory allocated by data indication */
&amp;nbsp;&amp;nbsp;&amp;nbsp; MSG_Free(pMsg);
&amp;nbsp; }
}

void SendLQI
&amp;nbsp; (
&amp;nbsp; zbApsdeDataIndication_t *indication&amp;nbsp; // Contains requestor info (address)
&amp;nbsp; )
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; afAddrInfo_t addrInfo;
&amp;nbsp; /* set up address information */
&amp;nbsp; addrInfo.dstAddrMode = gZbAddrMode16Bit_c;
&amp;nbsp; Copy2Bytes(addrInfo.dstAddr.aNwkAddr,indication-&amp;gt;aSrcAddr);
&amp;nbsp; addrInfo.dstEndPoint = dstEndPoint;
&amp;nbsp; addrInfo.srcEndPoint = srcEndPoint;
&amp;nbsp; addrInfo.txOptions = gApsTxOptionNone_c;
&amp;nbsp; addrInfo.radiusCounter = afDefaultRadius_c;
&amp;nbsp; /* set up cluster */
&amp;nbsp; Copy2Bytes(addrInfo.aClusterId, appDataCluster);
&amp;nbsp; /* send the data request */
&amp;nbsp; (void)AF_DataRequest(&amp;amp;addrInfo,1,indication-&amp;gt;linkQuality,NULL);

}&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;The problem is that into the function, the values pointed by &lt;I&gt;indication&lt;/I&gt; are wrong. This is due to &lt;I&gt;indication&lt;/I&gt; value variation when the function is invoked. I used debugger and the value of the pointer is different before and after SendLQI() invocation. Why? Maybe isn't the correct modality to pass that pointer?&lt;BR /&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:12:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165738#M3037</guid>
      <dc:creator>CecchiSandrone</dc:creator>
      <dc:date>2020-10-29T09:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Problems while passing a pointer</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165739#M3038</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Do you have the SendLQI-function declared before you call it? Try changing the order of the functions or adding a prototype before using it in BeeAppDataIndication.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Sten&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 14:28:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165739#M3038</guid>
      <dc:creator>Sten</dc:creator>
      <dc:date>2007-11-21T14:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problems while passing a pointer</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165740#M3039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Yes, I declared SendLQI even before BeeAppDataIndication but I have same results &lt;SPAN&gt;&lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 17:57:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165740#M3039</guid>
      <dc:creator>CecchiSandrone</dc:creator>
      <dc:date>2007-11-21T17:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problems while passing a pointer</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165741#M3040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Mmm, it seems to be a debugger bug. If I print these values with LCD display they are correct. I'll submit a service request.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Nov 2007 21:25:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Problems-while-passing-a-pointer/m-p/165741#M3040</guid>
      <dc:creator>CecchiSandrone</dc:creator>
      <dc:date>2007-11-21T21:25:54Z</dc:date>
    </item>
  </channel>
</rss>

