Hey Everyone.
I am seeking guidance for another AWS issue.
I have had success publishing, subscribing, and updating, but GETting has been a challenge. I am setting breakpoints in my callback function, and they are never being hit.
My understanding is that this function gets called for Success or Failure, but it's not firing. What Exactly are the conditions that call the Callback? I don't see anything in the AWS Plugin Docs.
My thing/shadow/get/accepted Topic IS Publishing. The problem is that I'm unable to capture it into my Microcontroller.
I also can tell you that my AWS Iot Core / Thing policies are not the problem. I have set my permissions as loose as possible. Notice how the statement for GET is identical to UPDATE, which I have confirmed to work.
I have Confirmed that the client IS Subscribing to the /shadow/get/rejected + /accepted topics.
Also, I have noticed that my timeout seconds argument for the GET function doesn't matter. The function seems to hang for 2 seconds regardless of the actual argument value passed, which I believe is the time given to make sure both Subscribe actions are complete.
I have tried:
- Adding aws_iot_shadow_yield() / aws_iot_mqtt_yield() after my GET function
- Different timeouts
- Setting persistent subscribe argument to true and false
- Adjusting permissions then reverting them back to what I showed above (known good)
The Return Code (rcGS) always returns SUCCESS for all my other aws functions within this routine, and during the get function I have confirmed that the client IS Connected to AWS.
My GET Function:
IoT_Error_t rcGS; rcGS = aws_iot_shadow_get(&client, AWS_IOT_MY_THING_NAME, getShadowCallback, NULL, 5, true);
My GET function Callback:
static void getShadowCallback(const char *pThingName, ShadowActions_t action, Shadow_Ack_Status_t status, const char *pReceivedJsonDocument, void *pContextData){ IOT_UNUSED(action); IOT_UNUSED(pContextData); IOT_UNUSED(pReceivedJsonDocument); IOT_UNUSED(pThingName); nop; // breakpoint if (SHADOW_ACK_TIMEOUT == status) { IOT_INFO("GET Timeout--"); } else if (SHADOW_ACK_REJECTED == status) { IOT_INFO("GET RejectedXX"); } else if (SHADOW_ACK_ACCEPTED == status) { IOT_INFO("GET Accepted !!"); GetFromAWS = true; }else{ IOT_INFO("Unknown Update Status"); } }
I have tried to troubleshoot this for several hours before asking for help. I do appreciate any help, and I'm sure others have and will run into this as well. Thank you